Module: GithubHerokuDeployer

Defined in:
lib/github_heroku_deployer.rb,
lib/github_heroku_deployer/git.rb,
lib/github_heroku_deployer/heroku.rb,
lib/github_heroku_deployer/version.rb,
lib/github_heroku_deployer/exceptions.rb,
lib/github_heroku_deployer/configuration.rb

Defined Under Namespace

Classes: CommandException, Configuration, ConfigurationException, Git, Heroku

Constant Summary collapse

VERSION =
"0.3.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

The configuration object.

See Also:



19
20
21
# File 'lib/github_heroku_deployer.rb', line 19

def configuration
  @configuration ||= Configuration.new
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Call this method to modify defaults in your initializers.

Examples:

GithubHerokuDeployer.configure do |config|
  config.github_repo     = ENV["GITHUB_REPO"]
  config.heroku_api_key  = ENV["HEROKU_API_KEY"]
  config.heroku_app_name = ENV["HEROKU_APP_NAME"]
  config.heroku_repo     = ENV["HEROKU_REPO"]
  config.heroku_username = ENV["HEROKU_USERNAME"]
  config.id_rsa          = ENV["ID_RSA"]
  config.logger          = Logger.new(STDOUT)
end

Yields:



35
36
37
# File 'lib/github_heroku_deployer.rb', line 35

def configure
  yield(configuration)
end

.deploy(options = {}, &block) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/github_heroku_deployer.rb', line 39

def deploy(options={}, &block)
  options = configuration.merge(options)
  validate_options(options)
  heroku_find_or_create_app(options)
  git_push_app_to_heroku(options, &block)
  true
end

.git_push_app_to_heroku(options, &block) ⇒ Object



91
92
93
94
# File 'lib/github_heroku_deployer.rb', line 91

def git_push_app_to_heroku(options, &block)
  repo = Git.new(options)
  repo.push_app_to_heroku(&block)
end

.heroku_addon_add(addon, options = {}) ⇒ Object



71
72
73
74
75
# File 'lib/github_heroku_deployer.rb', line 71

def heroku_addon_add(addon, options={})
  options = configuration.merge(options)
  validate_options(options)
  Heroku.new(options).addon_add(addon)
end

.heroku_config_set(values, options = {}) ⇒ Object



65
66
67
68
69
# File 'lib/github_heroku_deployer.rb', line 65

def heroku_config_set(values, options={})
  options = configuration.merge(options)
  validate_options(options)
  Heroku.new(options).config_set(values)
end

.heroku_destroy(options = {}) ⇒ Object



53
54
55
56
57
# File 'lib/github_heroku_deployer.rb', line 53

def heroku_destroy(options={})
  options = configuration.merge(options)
  validate_options(options)
  Heroku.new(options).destroy_app
end

.heroku_find_or_create_app(options) ⇒ Object



87
88
89
# File 'lib/github_heroku_deployer.rb', line 87

def heroku_find_or_create_app(options)
  Heroku.new(options).find_or_create_app
end

.heroku_post_ps_scale(process, quantity, options = {}) ⇒ Object



77
78
79
80
81
# File 'lib/github_heroku_deployer.rb', line 77

def heroku_post_ps_scale(process, quantity, options={})
  options = configuration.merge(options)
  validate_options(options)
  Heroku.new(options).post_ps_scale(process, quantity)
end

.heroku_restart(options = {}) ⇒ Object



47
48
49
50
51
# File 'lib/github_heroku_deployer.rb', line 47

def heroku_restart(options={})
  options = configuration.merge(options)
  validate_options(options)
  Heroku.new(options).restart_app
end

.heroku_run(command, options = {}) ⇒ Object



59
60
61
62
63
# File 'lib/github_heroku_deployer.rb', line 59

def heroku_run(command, options={})
  options = configuration.merge(options)
  validate_options(options)
  Heroku.new(options).run(command)
end

.validate_options(options) ⇒ Object



83
84
85
# File 'lib/github_heroku_deployer.rb', line 83

def validate_options(options)
  configuration.validate_presence(options)
end