fanforce-factory 0.5.2 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/factory +2 -2
- data/bin/factory-supercharge +1 -1
- data/fanforce-factory.gemspec +2 -0
- data/lib/fanforce/factory/_base.rb +10 -0
- data/lib/fanforce/factory/commands.rb +42 -1
- data/lib/fanforce/factory/help.rb +5 -0
- data/lib/fanforce/factory/version.rb +1 -1
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTBhZjc0ZTU1Mzg1MTBhNzkxNDc1NDBkMjYwZGExZDZkNTkxYjhmMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmExNTNhNzYyMjM0OTE0NTk1NTk1Y2FmMDFlNGIxNWFhNTVhN2RiMg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2ZiYzkzYzc0MTJhYzQ4OGVmYTk0OGFjYTk1YzhmYjBmZTRlOTZmZWE4MTdm
|
10
|
+
ZTVjMjNkNDRlN2MzMzY0YTIwYzVhYTZiY2VhNmU3OTRlZmY2YWY0NGI4MWRh
|
11
|
+
NzU1ZWViYTM3MzE3ODg2ZGE0MTJiNTM0NjcyNTA5OWVjZWQ0OGE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjdkNTZkM2I4YjZhZmU1YjE4YTRlN2FkYTY5NzQxOTk2MmEzODY1ODE1YTEz
|
14
|
+
MzBjZWM2MDRmNGJjZDFlMDE5NzlhY2YwNmUxNzNhNGIxMDlkZjUyNmUzMDJl
|
15
|
+
MDkwMzlhZGIzNjJhMTdlMzI3ZDI2ZDEzNTkwNDg2MjI1ZDc4Y2Y=
|
data/bin/factory
CHANGED
@@ -8,11 +8,11 @@ if File.exists?("#{$HomeDir}/config.ru") and File.exists?("#{$HomeDir}/../.facto
|
|
8
8
|
$HomeDir = File.expand_path('..', $HomeDir)
|
9
9
|
factory.start(
|
10
10
|
:runtype => :single,
|
11
|
-
:allowed => [:setup, :update, :restart, :push, :count, :bundle, :git, :iron, :version, :config],
|
11
|
+
:allowed => [:setup, :update, :restart, :push, :count, :bundle, :git, :iron, :version, :config, :cleanorgs],
|
12
12
|
)
|
13
13
|
else
|
14
14
|
factory.start(
|
15
15
|
:runtype => :realtime,
|
16
|
-
:allowed => [:create, :setup, :delete, :update, :restart, :push, :count, :bundle, :git, :iron, :version, :config],
|
16
|
+
:allowed => [:create, :setup, :delete, :update, :restart, :push, :count, :bundle, :git, :iron, :version, :config, :cleanorgs],
|
17
17
|
)
|
18
18
|
end
|
data/bin/factory-supercharge
CHANGED
@@ -3,5 +3,5 @@ require 'fanforce/factory'
|
|
3
3
|
|
4
4
|
Fanforce::Factory.new('factory-supercharge').start(
|
5
5
|
:runtype => :forked,
|
6
|
-
:allowed => [:update, :restart, :push, :bundle, :git, :iron, :version, :config],
|
6
|
+
:allowed => [:update, :restart, :push, :bundle, :git, :iron, :version, :config, :cleanorgs],
|
7
7
|
)
|
data/fanforce-factory.gemspec
CHANGED
@@ -18,11 +18,13 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ['lib']
|
20
20
|
|
21
|
+
gem.add_dependency 'redis'
|
21
22
|
gem.add_dependency 'rest-client'
|
22
23
|
gem.add_dependency 'iron_worker_ng'
|
23
24
|
gem.add_dependency 'activesupport'
|
24
25
|
gem.add_dependency 'heroku-api', '0.3.8'
|
25
26
|
gem.add_dependency 'multi_json'
|
26
27
|
gem.add_dependency 'bitbucket_rest_api'
|
28
|
+
gem.add_dependency 'fanforce-api'
|
27
29
|
|
28
30
|
end
|
@@ -188,6 +188,16 @@ class Fanforce::Factory
|
|
188
188
|
|
189
189
|
#################################################################
|
190
190
|
|
191
|
+
elsif ARGV[0] == 'cleanorgs'
|
192
|
+
ARGV[1] =~ /^(development|staging|production)$/ || error('You supplied an invalid cleanorgs command.', :cleanorgs)
|
193
|
+
environment = $1.to_sym
|
194
|
+
|
195
|
+
supercore_api_key = ARGV[2] || error('You supplied an invalid cleanorgs command.', :cleanorgs)
|
196
|
+
|
197
|
+
run(:cleanorgs, environment, supercore_api_key)
|
198
|
+
|
199
|
+
#################################################################
|
200
|
+
|
191
201
|
elsif ARGV[0] == 'version'
|
192
202
|
puts '---------------------------------------------------------------------------------------------------------------'
|
193
203
|
puts "You are using version #{Fanforce::Factory::VERSION} of Fanforce Factory "
|
@@ -344,7 +344,7 @@ class Fanforce::Factory
|
|
344
344
|
def restart(addon, environment)
|
345
345
|
if environment == :development
|
346
346
|
File.mkdir("#{addon.dir}/tmp") if !File.directory?("#{addon.dir}/tmp")
|
347
|
-
FileUtils.touch("#{addon.dir}/tmp/
|
347
|
+
FileUtils.touch("#{addon.dir}/tmp/restart.txt")
|
348
348
|
elsif [:production, :staging].include?(environment)
|
349
349
|
if $Config[:heroku].blank? or $Config[:heroku][environment].blank?
|
350
350
|
puts "#{'OOPS...'.format(:red,:bold)} #{environment} has not been setup on heroku"
|
@@ -379,6 +379,47 @@ class Fanforce::Factory
|
|
379
379
|
|
380
380
|
######################################################################################################################
|
381
381
|
|
382
|
+
def run_cleanorgs(addon_dir, processed_count, total_count, environment, supercore_api_key)
|
383
|
+
ENV['RACK_ENV'] = environment.to_s
|
384
|
+
addon = Addon.load(addon_dir)
|
385
|
+
puts "\n---------------------------------------------------------------------------------------------------------------"
|
386
|
+
puts "#{addon.type.to_s.upcase.format(:bold)} - #{addon._id.upcase.gsub('-',' ').format(:bold)} (#{processed_count} of #{total_count})... "
|
387
|
+
|
388
|
+
require 'redis'
|
389
|
+
require 'fanforce/api'
|
390
|
+
ff = Fanforce::API.new(supercore_api_key)
|
391
|
+
|
392
|
+
Dir.chdir(addon_dir) do
|
393
|
+
addon = Addon.load(addon_dir)
|
394
|
+
vars = Env.vars_by_addon(environment)[addon.dir_name] || {}
|
395
|
+
redis = Redis.new(url: vars['REDIS_URL'])
|
396
|
+
|
397
|
+
installs = redis.keys("installed:#{addon.dir_name}:*")
|
398
|
+
organizations = {}
|
399
|
+
redis.multi do
|
400
|
+
organizations = installs.inject({}) do |result, key|
|
401
|
+
next result if key !~ /^(installed:#{addon.dir_name}:(.+))$/
|
402
|
+
result.update $2 => redis.get($1)
|
403
|
+
end
|
404
|
+
end
|
405
|
+
puts "#{organizations.size} installs found..."
|
406
|
+
processed_count = 0
|
407
|
+
organizations.each do |organization_id, api_key|
|
408
|
+
print "- checking organization #{processed_count+=1}... "
|
409
|
+
if ff.get("/organizations/#{organization_id}", fields: '_id')
|
410
|
+
puts 'VALID'
|
411
|
+
else
|
412
|
+
print 'INVALID... '
|
413
|
+
redis.del("installed:#{addon.dir_name}:#{organization_id}")
|
414
|
+
puts 'UNINSTALLED'
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
421
|
+
######################################################################################################################
|
422
|
+
|
382
423
|
def preprocess_git_overview
|
383
424
|
puts ''
|
384
425
|
length = Addons.dir_names.inject(0) {|length, dir_name| dir_name.length > length ? dir_name.length : length }
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fanforce-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.2
|
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-
|
11
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: redis
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rest-client
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - ! '>='
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: fanforce-api
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
description: CLI for managing a folder of Fanforce addons
|
98
126
|
email:
|
99
127
|
- cclark@mobilizationlabs.com
|