Module: HoboSupport

Defined in:
lib/hobo_support.rb,
lib/hobo_support/command.rb,
lib/hobo_support/methodcall.rb,
lib/hobo_support/common_tasks.rb

Defined Under Namespace

Modules: Command Classes: Railtie

Constant Summary collapse

VERSION =
File.read(File.expand_path('../../VERSION', __FILE__)).strip
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.1.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 "[email protected]")
    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
@@root =
Pathname.new File.expand_path('../..', __FILE__)

Class Method Summary collapse

Class Method Details

.hobo_try(this, *args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/hobo_support/methodcall.rb', line 13

def self.hobo_try(this, *args, &block)
  if args.length==0
    # Hobo style try
    CallIfAvailable.new(this)
  else
    # activesupport 2.3 style try
    this.send(:active_support_try, *args, &block)
  end
end

.rootObject



24
# File 'lib/hobo_support.rb', line 24

def self.root; @@root; end