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.4.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

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



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

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

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



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

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

.git_push_app_to_heroku(options, &block) ⇒ Object



96
97
98
99
# File 'lib/github_heroku_deployer.rb', line 96

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

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



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

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

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



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

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

.heroku_destroy(options = {}) ⇒ Object



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

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

.heroku_find_or_create_app(options) ⇒ Object



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

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

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



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

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



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

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

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



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

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

.validate_options(options) ⇒ Object



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

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