Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#environmentObject



1
2
3
4
5
6
7
8
9
10
11
# File 'lib/helpers.rb', line 1

def environment  
  if exists?(:stage)
    stage
  elsif exists?(:rails_env)
    rails_env  
  elsif(ENV['RAILS_ENV'])
    ENV['RAILS_ENV']
  else
    "production"  
  end
end

#run_rake(task) ⇒ Object



20
21
22
# File 'lib/helpers.rb', line 20

def run_rake(task)
  run "cd #{current_path} && rake #{task} RAILS_ENV=#{environment}"
end

#template_for(name) ⇒ Object



13
14
15
16
17
# File 'lib/helpers.rb', line 13

def template_for(name)
  name<<".erb" unless name.include?(".erb")
  template = File.join(File.dirname(__FILE__),"templates",name)
  ERB.new(File.read(template))
end