heroku_san 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.6
1
+ 1.0.7
@@ -1,13 +1,20 @@
1
1
  HEROKU_CONFIG_FILE = Rails.root.join('config', 'heroku.yml')
2
2
 
3
- HEROKU_SETTINGS =
3
+ @app_settings =
4
4
  if File.exists?(HEROKU_CONFIG_FILE)
5
5
  YAML.load_file(HEROKU_CONFIG_FILE)
6
6
  else
7
7
  {}
8
8
  end
9
9
 
10
- (HEROKU_SETTINGS['apps'] || []).each do |name, app|
10
+ if @app_settings.has_key? 'apps'
11
+ @app_settings = @app_settings['apps']
12
+ @app_settings.each_pair do |shorthand, app_name|
13
+ @app_settings[shorthand] = {'app' => app_name}
14
+ end
15
+ end
16
+
17
+ (@app_settings.keys || []).each do |name|
11
18
  desc "Select #{name} Heroku app for later commands"
12
19
  task name do
13
20
  @heroku_apps ||= []
@@ -17,7 +24,7 @@ end
17
24
 
18
25
  desc 'Select all Heroku apps for later command'
19
26
  task :all do
20
- @heroku_apps = HEROKU_SETTINGS['apps'].keys
27
+ @heroku_apps = @app_settings.keys
21
28
  end
22
29
 
23
30
  namespace :heroku do
@@ -105,6 +112,15 @@ namespace :heroku do
105
112
  end
106
113
  end
107
114
 
115
+ desc 'Add config:vars to each application.'
116
+ task :config do
117
+ each_heroku_app do |name, app, repo, config|
118
+ (config).each do |var, value|
119
+ sh "heroku config:add --app #{app} #{var}=#{value}"
120
+ end
121
+ end
122
+ end
123
+
108
124
  desc 'Runs a rake task remotely'
109
125
  task :rake, :task do |t, args|
110
126
  each_heroku_app do |name, app, repo|
@@ -226,15 +242,16 @@ namespace :db do
226
242
  end
227
243
 
228
244
  def each_heroku_app
229
- if @heroku_apps.blank? && HEROKU_SETTINGS['apps'].size == 1
230
- app = HEROKU_SETTINGS['apps'].keys.first
245
+ if @heroku_apps.blank? && @app_settings.keys.size == 1
246
+ app = @app_settings.keys.first
231
247
  puts "Defaulting to #{app} app since only one app is defined"
232
248
  @heroku_apps = [app]
233
249
  end
234
250
  if @heroku_apps.present?
235
251
  @heroku_apps.each do |name|
236
- app = HEROKU_SETTINGS['apps'][name]
237
- yield(name, app, "git@heroku.com:#{app}.git")
252
+ app = @app_settings[name]['app']
253
+ config = @app_settings[name]['config'] || []
254
+ yield(name, app, "git@heroku.com:#{app}.git", config)
238
255
  end
239
256
  puts
240
257
  else
@@ -1,5 +1,22 @@
1
- apps:
2
- # shorthand: heroku app
3
- production: awesomeapp
4
- staging: awesomeapp-staging
5
- demo: awesomeapp-demo
1
+ #
2
+ # Format:
3
+ #
4
+ # <heroku_san shorthand name>:
5
+ # app: <Heroku app name>
6
+ # config:
7
+ # - <Heroku config:var name>: <Heroku config:var value>
8
+ #
9
+ production:
10
+ app: awesomeapp
11
+ config:
12
+ - BUNDLE_WITHOUT: "development:test"
13
+ - GOOGLE_ANALYTICS: "UA-12345678-1"
14
+
15
+ staging:
16
+ app: awesomeapp-staging
17
+ config: &default
18
+ - BUNDLE_WITHOUT: "development:test"
19
+
20
+ demo:
21
+ app: awesomeapp-demo
22
+ config: *default
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_san
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 6
10
- version: 1.0.6
9
+ - 7
10
+ version: 1.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Elijah Miller
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-24 00:00:00 -05:00
19
+ date: 2011-01-06 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency