Class: Eastrails::Components::Heroku

Inherits:
Base
  • Object
show all
Defined in:
lib/eastrails/components/heroku.rb

Instance Method Summary collapse

Methods inherited from Base

#component_installed?, #dir_html_to_haml, #do_if_installed, #file_html_to_haml, #gems, #html_to_haml, #parse_gemfile

Methods inherited from Generator

#initialize

Constructor Details

This class inherits a constructor from Eastrails::Generator

Instance Method Details

#addObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/eastrails/components/heroku.rb', line 4

def add
  insert_into_file 'Gemfile', "ruby '1.9.3'\n", :before => /^gem\s+["']rails["']/
  puts "============================"

  result = `heroku version`
  if result.index("heroku-toolbelt")
    system "heroku login"
    system "heroku create"
    if gems.index "pg"
      puts "* Probably you haven't use pg for production"
    else
      gem 'pg', :group => :production
    end
    puts "Run `git push heroku master` to deploy your code"
  else
    puts "You should do followings manually:"
    puts "- Go to http://heroku.com, sign up (if any) and download Heroku Toolbelt for your OS"
    puts "- Then add this component again"
  end

  puts "For more information, see at https://devcenter.heroku.com/articles/rails3"
end