Class: DeployTool::Target::Heroku

Inherits:
DeployTool::Target show all
Defined in:
lib/deploytool/target/heroku.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DeployTool::Target

find, from_config, get_json_resource

Constructor Details

#initialize(options) ⇒ Heroku

Returns a new instance of Heroku.



14
15
16
# File 'lib/deploytool/target/heroku.rb', line 14

def initialize(options)
  @app_name = options['app_name']
end

Class Method Details

.create(target_name) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/deploytool/target/heroku.rb', line 18

def self.create(target_name)
  app_name = target_name.gsub('.heroku.com', '')
  # TODO: Require current directory to be a git repository
  # TODO: Ask for app name if app name is nil or www
  puts `heroku create #{app_name}`
  Heroku.new('app_name' => app_name)
end

.matches?(target_spec) ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/deploytool/target/heroku.rb', line 2

def self.matches?(target_spec)
  target_spec[/(^|\.)heroku\.com$/]
end

Instance Method Details

#push(opts) ⇒ Object



26
27
28
29
# File 'lib/deploytool/target/heroku.rb', line 26

def push(opts)
  puts `git push -f [email protected]:#{@app_name}.git master`
  $?.exitstatus
end

#to_hObject



6
7
8
# File 'lib/deploytool/target/heroku.rb', line 6

def to_h
  {:type => "Heroku", :app_name => @app_name}
end

#to_sObject



10
11
12
# File 'lib/deploytool/target/heroku.rb', line 10

def to_s
  "%s.heroku.com (Heroku)" % [@app_name]
end