Sha256: 1fa2c5bfa3e76c4ff885317b472ece2bc9b586e146b42015c44f6d72ddfea751

Contents?: true

Size: 1.53 KB

Versions: 6

Compression:

Stored size: 1.53 KB

Contents

require 'hobo_support/module'

module HoboSupport
  CommonTasks = classy_module do

namespace :test do

  desc "Prepare a rails application for testing"
  task :prepare_testapp, :force do |t, args|
    if args.force || !File.directory?(TESTAPP_PATH)
      remove_entry_secure( TESTAPP_PATH, true )
      sh %(#{BIN} new #{TESTAPP_PATH} --skip-wizard --skip-bundle)
      chdir TESTAPP_PATH
      if ENV['HOBODEV']
        rvmrc_path = File.join(ENV['HOBODEV'], '.rvmrc')
        if File.exist?(rvmrc_path)
          puts %(Copying .rvmrc file)
          copy_file rvmrc_path, './.rvmrc'
          sh %(rvm reload) do |ok|
            puts 'rvm command skipped' unless ok
          end
        end
      end
      sh %(bundle install)
      sh %(echo "" >> Gemfile)
      sh %(echo "gem 'irt', :group => :development" >> Gemfile) # to make the bundler happy
      sh %(echo "gem 'therubyracer'" >> Gemfile)
      sh %(echo "gem 'protected_attributes'" >> Gemfile)
      sh %(echo "gem 'responders', '~> 2.0'" >> Gemfile)
      sh %(bundle install)
      sh %(echo "" > app/models/.gitignore) # because git reset --hard would rm the dir
      rm %(.gitignore) # we need to reset everything in a testapp
      sh %(git init)
      sh %(git config user.email "someone@example.com")
      sh %(git config user.name "Someone")
      sh %(git add . && git commit -m "initial commit")
      puts %(The testapp has been created in '#{TESTAPP_PATH}')
    else
      chdir TESTAPP_PATH
      sh %(git add .)
      sh %(git reset --hard -q HEAD)
    end
  end
end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hobo_support-2.2.5 lib/hobo_support/common_tasks.rb
hobo_support-2.2.4 lib/hobo_support/common_tasks.rb
hobo_support-2.2.3 lib/hobo_support/common_tasks.rb
hobo_support-2.2.2 lib/hobo_support/common_tasks.rb
hobo_support-2.2.1 lib/hobo_support/common_tasks.rb
hobo_support-2.2.0 lib/hobo_support/common_tasks.rb