Sha256: 6b975b7002ab21af696588a7c9cc0df15e115d2cf5af909d90d1a444d382bd68

Contents?: true

Size: 778 Bytes

Versions: 2

Compression:

Stored size: 778 Bytes

Contents

desc 'Runs a command agains the local sample application'
task :local do
  Rake::Task['setup'].invoke(false,
                             '.test-rails-apps',
                             'rails_template_with_data')

  app_folder = ".test-rails-apps/rails-#{Rails::VERSION::STRING}"

  # Discard the "local" argument (name of the task)
  argv = ARGV[1..-1]

  # If it's a rails command, or we're using Rails 5, auto add the rails script
  rails_commands = %w(generate console server db dbconsole g c s runner)

  if rails_commands.include?(argv[0])
    argv.unshift('rails')
  end

  command = ['bundle', 'exec', *argv].join(' ')
  env = { 'BUNDLE_GEMFILE' => ENV['BUNDLE_GEMFILE'] }

  Dir.chdir(app_folder) do
    Bundler.with_clean_env { Kernel.exec(env, command) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activeadmin-rb-1.5.2 tasks/local.rake
activeadmin-rb-1.5.1 tasks/local.rake