Skip to content
Snippets Groups Projects
Commit 5ae6c973 authored by Utkarsh Gupta's avatar Utkarsh Gupta
Browse files

Reduce autopkgtest dependencies by embedding a dummy rails app

parent 3dee06fa
No related branches found
No related tags found
No related merge requests found
......@@ -3,22 +3,73 @@
exec 2>&1
set -ex
smoke() {
# Create a dummy rails app skeleton
cd $AUTOPKGTEST_TMP
rails new foo-$1
cd foo-$1
mkdir foo
cd foo
mkdir -p config
mkdir -p app/assets/javascripts
mkdir -p app/assets/javascripts/
# Include the rails asset we want to test
cat >> app/assets/javascripts/application.js <<EOF
# =require $1
EOF
cat >> Gemfile <<EOF
gem "rake"
gem "railties"
gem "rails-assets-$1", "~> 8.4"
EOF
bundle install --local
# Copied from rails new foo
cat >> Rakefile <<EOF
require_relative 'config/application'
Rails.logger = Logger.new(STDOUT)
Rails.application.load_tasks
EOF
# Copied from rails new foo
cat >> config/application.rb <<EOF
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Foo
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
end
end
EOF
# Copied from rails new foo
cat >> config/boot.rb <<EOF
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
EOF
# Copied from rails new foo
cat >> config/environment.rb <<EOF
# Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
EOF
# Confirm sprockets can find the asset
bundle exec rake assets:precompile
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment