Sha256: fcf9902592ee6df7e6b85fceeaff2c3908f4b3f76d033e4db71c65bf0d6b922d
Contents?: true
Size: 1.63 KB
Versions: 6
Compression:
Stored size: 1.63 KB
Contents
namespace :signonotron do desc "Start signonotron (for integration tests)" task :start => :stop do @app_to_launch = ENV['SIGNONOTRON_VERSION'] == "1" ? "sign-on-o-tron" : "signonotron2" puts "ENV version: #{ENV['SIGNONOTRON_VERSION']}" puts "Launching: #{@app_to_launch}" gem_root = Pathname.new(File.dirname(__FILE__)) + '..' + '..' FileUtils.mkdir_p(gem_root + 'tmp') Dir.chdir gem_root + 'tmp' do if File.exist? @app_to_launch Dir.chdir @app_to_launch do puts `git clean -fdx` puts `git fetch origin` puts `git reset --hard origin/master` end else puts `git clone git@github.com:alphagov/#{@app_to_launch}` end end Dir.chdir gem_root + 'tmp' + @app_to_launch do env_stuff = '/usr/bin/env -u BUNDLE_GEMFILE -u BUNDLE_BIN_PATH -u RUBYOPT -u GEM_HOME -u GEM_PATH RAILS_ENV=test' puts `#{env_stuff} bundle install --path=#{gem_root + 'tmp' + "#{@app_to_launch}_bundle"}` FileUtils.cp gem_root.join('spec', 'fixtures', 'integration', "#{@app_to_launch}_database.yml"), File.join('config', 'database.yml') puts `#{env_stuff} bundle exec rake db:drop db:create db:schema:load` puts "Starting signonotron instance in the background" fork do Process.daemon(true) exec "#{env_stuff} bundle exec rails s -p 4567" end end end desc "Stop running signonotron (for integration tests)" task :stop do pid_output = `lsof -Fp -i :4567`.chomp if pid_output =~ /\Ap(\d+)\z/ puts "Stopping running instance of Signonotron (pid #{$1})" Process.kill(:INT, $1.to_i) end end end
Version data entries
6 entries across 6 versions & 1 rubygems