fanforce-factory 0.4.7 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGY5NTY1MTYwMWUyM2ExYzg0OTZlNjQ0NWYyNzM4ZDkwYjViNTVhZg==
4
+ OGFhMjg0MTU4YzQ2NDVkNzk4YWE3MzViMDFhZDgzZWJhMzg4MWNkYg==
5
5
  data.tar.gz: !binary |-
6
- OWUwYmYwYTU2NTc3YmMyZWJiMjRmMWFkNDQwOWFjMWRkNTlhNzcyZQ==
6
+ NzgyMGE2NDg5NDNhZTg0ZDMzNTBkNjc3YzE1M2Y5NDIyNjM0ZTY0MA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Y2M1OGRmYmY1NzRlYmI5NTZiM2NhZTUxOTllYjMxMTFjYTFmNjE2YzQ2NTk5
10
- NzkyZjMzZDY5M2VkNWU5YWU0ZjExNzcwYmEzOTNmMGJkNjkyZTM3YTM0OWFm
11
- ZTY0NGM5MDM4NzlmMTBmNGI0NGE0MjQyNmI2YzBhOTUyNjQ0ZmE=
9
+ NDI2YWM0MTliMGVmOTk3OWExMjg1MzRlOWRkYmMyYzdmNjMzODc3ZWY5MzM5
10
+ ZDhlNzk4YjcwYTZjZWY4NmY4ZmJlYWVmZGNkOWQyNTNlOWQ3OTc0OGM1YTEw
11
+ N2M0MDNlM2VkOWVlYWMyMDgyMDMxN2ZiZmQyY2NhYTI4ZTg2NmI=
12
12
  data.tar.gz: !binary |-
13
- MDY3YWI2NDQ0ZTM0YWFkYzkwYzZjYjU2Mzc1YjJlYjkwZDBhNDhkYWE4OTcy
14
- NzVkMTQ3YTlkNWY3NDg4M2ZiOGFhNTIyYTI3ZThmZjE2OTNiMmZmMzk1YWYw
15
- MGUyNmQ0ZTE1M2UxMzE1OTk4NTFiNTc0M2MyM2Q5YzM1NGU3NDg=
13
+ NDg1NDQyNGFiMTIwNzA0ZmM4NDkzZWRlMTI3NTkzZTQwZTQ2ZTU0MGNmOGIx
14
+ Y2RiNDUxMWQ4YWM4MGQ3ZDU4YTg4ZDRiMmFjMTBhZmQ4M2EzY2Y3MmE1ODIx
15
+ Y2UxZmQzNzIwZDAyNzM3ODVmZTQ2YTgzMjViOGVkYTA5YTE2NzE=
data/README.md CHANGED
@@ -86,7 +86,7 @@ bitbucket:
86
86
 
87
87
  ## Heroku Apps: Creating and Updating
88
88
  A heroku app will be automatically setup for each new addon if a heroku object is defined in your .factoryconfig file. You'll need
89
- one for each environment (qa|production) you want apps setup for.
89
+ one for each environment (staging|production) you want apps setup for.
90
90
 
91
91
  ```yaml
92
92
  heroku:
@@ -144,7 +144,7 @@ development:
144
144
  api_key: 175620799120142
145
145
  api_secret: b4e86cbf9db2ch5777609396b1d0a52f
146
146
 
147
- qa:
147
+ staging:
148
148
  api_key: 362017347478160
149
149
  api_secret: cf3605c0cnda02c95ddd1bb983a59e7a
150
150
  ```
@@ -21,10 +21,10 @@ class Fanforce::Factory
21
21
  @allowed_commands = options[:allowed]
22
22
  @runtype = options[:runtype]
23
23
  setup_config
24
- init_counter if @runtype == :forked
24
+ init_counter(Process.pid) if @runtype == :forked
25
25
  parse_addons_filter
26
26
  parse_command
27
- destroy_counter if @runtype == :forked
27
+ destroy_counter(Process.pid) if @runtype == :forked
28
28
  end
29
29
 
30
30
  def setup_config
@@ -104,7 +104,7 @@ class Fanforce::Factory
104
104
  #################################################################
105
105
 
106
106
  elsif ARGV[0] == 'update'
107
- ARGV[1] =~ /^(all|files?|envs?(:all|:development|:qa|:production)?|pows?|bitbuckets?|herokus?(:all|:qa|:production)?)$/ || error('You supplied an invalid update command.', :update)
107
+ ARGV[1] =~ /^(all|files?|envs?(:all|:development|:staging|:production)?|pows?|bitbuckets?|herokus?(:all|:staging|:production)?)$/ || error('You supplied an invalid update command.', :update)
108
108
 
109
109
  tmp_str = $1
110
110
  if tmp_str =~ /^envs?|herokus?/
@@ -123,7 +123,7 @@ class Fanforce::Factory
123
123
 
124
124
  elsif ARGV[0] == 'restart'
125
125
  if ARGV[1].present?
126
- ARGV[1] =~ /^(development|qa|production|all)?$/ || error('You supplied an invalid restart command.', :restart)
126
+ ARGV[1] =~ /^(development|staging|production|all)?$/ || error('You supplied an invalid restart command.', :restart)
127
127
  environment = $1.to_sym
128
128
  else
129
129
  environment = :development
@@ -135,7 +135,7 @@ class Fanforce::Factory
135
135
  #################################################################
136
136
 
137
137
  elsif ARGV[0] == 'push'
138
- ARGV[1] =~ /^(development|qa|production)(:all|:heroku|:irons?(:upload|:nuclear)?|bitbuckets?)?$/ || error('You supplied an invalid push command.', :push)
138
+ ARGV[1] =~ /^(development|staging|production)(:all|:heroku|:irons?(:upload|:nuclear)?|bitbuckets?)?$/ || error('You supplied an invalid push command.', :push)
139
139
 
140
140
  environment = $1.to_sym
141
141
  tmp_str = $2 || 'all'
@@ -174,7 +174,7 @@ class Fanforce::Factory
174
174
  #################################################################
175
175
 
176
176
  elsif ARGV[0] == 'iron'
177
- ARGV[1] =~ /^(upload|reset|delete)(:all|:development|:qa|:production)?$/ || error('You supplied an invalid iron command.', :iron)
177
+ ARGV[1] =~ /^(upload|reset|delete)(:all|:development|:staging|:production)?$/ || error('You supplied an invalid iron command.', :iron)
178
178
 
179
179
  command = $1.to_sym
180
180
  environment = ($2.present?) ? $2.gsub(':','').to_sym : :all
@@ -239,6 +239,7 @@ class Fanforce::Factory
239
239
  end
240
240
 
241
241
  def run_forked(method, *args)
242
+ counter_id = Process.pid
242
243
  processes = []
243
244
  dirs = Addons.dirs
244
245
  puts "\n---------------------------------------------------------------------------------------------------------------"
@@ -250,7 +251,7 @@ class Fanforce::Factory
250
251
  response = capture_stdout do
251
252
  self.method(:"run_#{method}").call(addon_dir, 'PROCESSED_ADDONS_COUNT', dirs.size, *args)
252
253
  end
253
- puts response.gsub('PROCESSED_ADDONS_COUNT', incr_counter.to_s)
254
+ puts response.gsub('PROCESSED_ADDONS_COUNT', incr_counter(counter_id).to_s)
254
255
  end
255
256
  sleep(0.25)
256
257
  end
@@ -276,13 +277,13 @@ class Fanforce::Factory
276
277
  $stderr = previous_stderr
277
278
  end
278
279
 
279
- def init_counter
280
- File.open("#{$HomeDir}/.forked-counter", 'w') {|f| f.write('0') }
280
+ def init_counter(counter_id)
281
+ File.open("#{$HomeDir}/.forked-counter-#{counter_id}", 'w') {|f| f.write('0') }
281
282
  end
282
283
 
283
- def incr_counter
284
+ def incr_counter(counter_id)
284
285
  new_count = nil
285
- File.open("#{$HomeDir}/.forked-counter", File::RDWR|File::CREAT, 0644) do |f|
286
+ File.open("#{$HomeDir}/.forked-counter-#{counter_id}", File::RDWR|File::CREAT, 0644) do |f|
286
287
  f.flock(File::LOCK_EX)
287
288
  new_count = f.read.to_i + 1
288
289
  f.rewind
@@ -293,8 +294,8 @@ class Fanforce::Factory
293
294
  new_count
294
295
  end
295
296
 
296
- def destroy_counter
297
- File.delete("#{$HomeDir}/.forked-counter")
297
+ def destroy_counter(counter_id)
298
+ File.delete("#{$HomeDir}/.forked-counter-#{counter_id}")
298
299
  end
299
300
 
300
301
  end
@@ -40,7 +40,7 @@ class Fanforce::Factory
40
40
 
41
41
  puts "\n---------------------------------------------------------------------------------------------------------------"
42
42
  puts 'CREATING HEROKU APPS...'
43
- setup_heroku addon, :qa
43
+ setup_heroku addon, :staging
44
44
  setup_heroku addon, :production
45
45
 
46
46
  puts "\n---------------------------------------------------------------------------------------------------------------"
@@ -94,7 +94,7 @@ class Fanforce::Factory
94
94
 
95
95
  puts "\n---------------------------------------------------------------------------------------------------------------"
96
96
  puts 'CREATING HEROKU APPS...'
97
- setup_heroku addon, :qa
97
+ setup_heroku addon, :staging
98
98
  setup_heroku addon, :production
99
99
 
100
100
  puts "\n---------------------------------------------------------------------------------------------------------------"
@@ -126,7 +126,7 @@ class Fanforce::Factory
126
126
 
127
127
  puts "\n---------------------------------------------------------------------------------------------------------------"
128
128
  puts 'DELETING HEROKU APPS...'
129
- [:qa,:production].each do |environment|
129
+ [:staging,:production].each do |environment|
130
130
  next if $Config[:heroku].blank? or $Config[:heroku][environment].blank?
131
131
  heroku = auth_heroku(environment)
132
132
  heroku_app_name = get_heroku_app_name(addon, environment)
@@ -214,7 +214,7 @@ class Fanforce::Factory
214
214
  if [:all, :heroku].include?(scope)
215
215
  puts ''
216
216
  puts 'SETTING UP HEROKU APPS...'
217
- setup_heroku addon, :qa if [:all,:qa].include?(environment)
217
+ setup_heroku addon, :staging if [:all,:staging].include?(environment)
218
218
  setup_heroku addon, :production if [:all,:production].include?(environment)
219
219
  end
220
220
 
@@ -270,7 +270,7 @@ class Fanforce::Factory
270
270
  if [:all, :heroku].include?(scope)
271
271
  puts ''
272
272
  puts 'UPDATING HEROKU APPS...'
273
- setup_heroku addon, :qa if [:all,:qa].include?(environment)
273
+ setup_heroku addon, :staging if [:all,:staging].include?(environment)
274
274
  setup_heroku addon, :production if [:all,:production].include?(environment)
275
275
  end
276
276
 
@@ -301,7 +301,7 @@ class Fanforce::Factory
301
301
  puts "\n#{"Updating Env Vars".format(:green,:bold)} on Heroku #{environment.to_s.titleize} (#{vars.size} variables)..."
302
302
  push_env_to(environment, addon, vars)
303
303
 
304
- remote_name = "#{environment==:qa ? 'qa' : 'prd'}-heroku"
304
+ remote_name = "#{environment==:staging ? 'stg' : 'prd'}-heroku"
305
305
  puts "\n#{'Pushing '.format(:green,:bold)}" + "latest commit to Heroku #{environment.to_s.titleize} (#{remote_name})..."
306
306
  Run.command("git push #{remote_name} master")
307
307
  end
@@ -332,8 +332,8 @@ class Fanforce::Factory
332
332
  if [:all, :development].include?(environment)
333
333
  puts "#{'DEVELOPMENT '.format(:bold)}#{addon.dir_name.format(:green)} restarted" if restart(addon, :development)
334
334
  end
335
- if [:all, :qa].include?(environment)
336
- puts "#{'QA '.format(:bold)}#{addon.dir_name.format(:green)} restarted" if restart(addon, :qa)
335
+ if [:all, :staging].include?(environment)
336
+ puts "#{'STAGING '.format(:bold)}#{addon.dir_name.format(:green)} restarted" if restart(addon, :staging)
337
337
  end
338
338
  if [:all, :production].include?(environment)
339
339
  puts "#{'PRODUCTION '.format(:bold)}#{addon.dir_name.format(:green)} restarted" if restart(addon, :production)
@@ -344,7 +344,7 @@ class Fanforce::Factory
344
344
  def restart(addon, environment)
345
345
  if environment == :development
346
346
  `touch tmp/restart.txt`
347
- elsif [:production, :qa].include?(environment)
347
+ elsif [:production, :staging].include?(environment)
348
348
  if $Config[:heroku].blank? or $Config[:heroku][environment].blank?
349
349
  puts "#{'OOPS...'.format(:red,:bold)} #{environment} has not been setup on heroku"
350
350
  return false
@@ -416,7 +416,7 @@ class Fanforce::Factory
416
416
  ######################################################################################################################
417
417
 
418
418
  def run_iron(addon_dir, processed_count, total_count, command, environment)
419
- environments = environment == :all ? [:development, :qa, :production] : [environment]
419
+ environments = environment == :all ? [:development, :staging, :production] : [environment]
420
420
  addon = Addon.load(addon_dir)
421
421
  puts "\n---------------------------------------------------------------------------------------------------------------"
422
422
  puts "#{addon.type.to_s.upcase.format(:bold)} - #{addon._id.upcase.gsub('-',' ').format(:bold)} (#{processed_count} of #{total_count})... "
@@ -477,7 +477,7 @@ class Fanforce::Factory
477
477
 
478
478
  def delete_all_iron_workers(environment)
479
479
  puts ''
480
- environments = environment == :all ? [:development, :qa, :production] : [environment]
480
+ environments = environment == :all ? [:development, :staging, :production] : [environment]
481
481
 
482
482
  iron_auths = {}
483
483
  Addons.each do |addon, cur_count, total|
@@ -1,7 +1,7 @@
1
1
  class Fanforce::Factory
2
2
 
3
3
  def get_heroku_app_name(addon, environment)
4
- heroku_app_name = "#{environment==:production ? 'prd' : 'qa'}-#{addon.dir_name}"
4
+ heroku_app_name = "#{environment==:production ? 'prd' : 'stg'}-#{addon.dir_name}"
5
5
  heroku_app_name.length > 30 ? heroku_app_name.gsub!(/(a|e|i|o|u)/, '') : heroku_app_name
6
6
  end
7
7
 
@@ -49,7 +49,7 @@ class Fanforce::Factory
49
49
  end
50
50
 
51
51
  def setup_envs(addon, environment)
52
- environments = environment == :all ? [:development, :qa, :production] : [environment]
52
+ environments = environment == :all ? [:development, :staging, :production] : [environment]
53
53
 
54
54
  if !File.exists?("#{$HomeDir}/.env/_bind.yml")
55
55
  return puts "#{'Oops'.format(:bold)}... you must setup .env/_bind.yml before trying to update env variables."
@@ -138,7 +138,7 @@ class Fanforce::Factory
138
138
  end
139
139
  end
140
140
 
141
- remote_name = "#{environment==:qa ? 'qa' : 'prd'}-heroku"
141
+ remote_name = "#{environment==:staging ? 'stg' : 'prd'}-heroku"
142
142
  if (`git remote`).split(/\r?\n/).include?(remote_name)
143
143
  puts "#{'Updated '.format(:green,:bold)}" + "git remote for #{remote_name}"
144
144
  `git remote rm #{remote_name}`
@@ -34,8 +34,8 @@ elsif ENV['RACK_ENV'] == 'test'
34
34
  $PUSHER_KEY = '7bcc87b3c55301f687b9'
35
35
  $PUSHER_SECRET = '61c760c05430e68d7e8d'
36
36
 
37
- elsif ENV['RACK_ENV'] == 'qa'
38
- $BASE_DOMAIN = 'fanforce-qa.com'
37
+ elsif ENV['RACK_ENV'] == 'staging'
38
+ $BASE_DOMAIN = 'fanforce-staging.com'
39
39
  $APP_DOMAIN = 'app.' + $BASE_DOMAIN
40
40
  $API_DOMAIN = 'api.' + $BASE_DOMAIN
41
41
  $I_DOMAIN = 'i.' + $BASE_DOMAIN
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  class Factory
3
- VERSION = '0.4.7'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-08 00:00:00.000000000 Z
11
+ date: 2013-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client