Sha256: 8bcaad08e11b7ed331fbad029c7a97793bacf3d21b00381aec3e2ade8ba9e2c9

Contents?: true

Size: 1.22 KB

Versions: 20

Compression:

Stored size: 1.22 KB

Contents

#!/usr/bin/env ruby

require File.expand_path('../../spec/support/detect_rails_version', __FILE__)

unless ARGV[0]
  puts <<-EOF
Usage: ./script/#{__FILE__} COMMAND [ARGS]

The command will be run in the context of the local rails
app stored in test-rails-app.

Examples:

./script/local server
./script/local c
./script/local rake db:migrate
  EOF
  exit(1)
end

# Set up some variables
rails_version = detect_rails_version!

test_app_dir = ".test-rails-apps"
test_app_path = "#{test_app_dir}/test-rails-app-#{rails_version}"

# Ensure .test-rails-apps is created
system "mkdir #{test_app_dir}" unless File.exists?(test_app_dir)

# Create the sample rails app if it doesn't already exist
unless File.exists? test_app_path
  system "RAILS='#{rails_version}' bundle exec rails new #{test_app_path} -m spec/support/rails_template_with_data.rb --skip-bundle"
end

# Link this rails app
system "rm test-rails-app"
system "ln -s #{test_app_path} test-rails-app"

# If it's a rails command, auto add the rails script
RAILS_COMMANDS = %w{generate console server dbconsole g c s runner}
args = RAILS_COMMANDS.include?(ARGV[0]) ? ["rails", ARGV].flatten : ARGV

# Run the command
exec "cd test-rails-app && GEMFILE=../Gemfile bundle exec #{args.join(" ")}"

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/script/local
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/script/local
yousty-activeadmin-1.0.17.pre script/local
yousty-activeadmin-1.0.16.pre script/local
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/script/local
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/script/local
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/script/local
yousty-activeadmin-1.0.15.pre script/local
yousty-activeadmin-1.0.14.pre script/local
yousty-activeadmin-1.0.13.pre script/local
yousty-activeadmin-1.0.12.pre script/local
yousty-activeadmin-1.0.11.pre script/local
yousty-activeadmin-1.0.10.pre script/local
yousty-activeadmin-1.0.9.pre script/local
yousty-activeadmin-1.0.8.pre script/local
activeadmin-1.0.0.pre2 script/local
activeadmin-1.0.0.pre1 script/local
yousty-activeadmin-1.0.7.pre script/local
yousty-activeadmin-1.0.6.pre script/local
yousty-activeadmin-1.0.5.pre script/local