fanforce-cli 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fanforce/cli/_base.rb +14 -24
- data/lib/fanforce/cli/commands.rb +1 -5
- data/lib/fanforce/cli/commands_support.rb +3 -8
- data/lib/fanforce/cli/help.rb +15 -14
- data/lib/fanforce/cli/utils.rb +19 -0
- data/lib/fanforce/cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7755e4c53dc744b5379f207ae89a153d4abb5ffe
|
4
|
+
data.tar.gz: 7774a0e270164adb3eb792a9c7cddc2e01ee6f10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c482e88c8ea7c19da2cde0aa84479dae70d057400714b2a35caaa7e2305569e19841ddc0c528984cf3f9a63ffa7c58719b6f5cf9c57addf65233f52e0d941636
|
7
|
+
data.tar.gz: e622283205243815b7561083be35d92b0442ea8ab0a7ec2d052c410152c7d340fc075db956af513e0fcf150613a2e007581a2be83c2b65f95ff6620a806f91c7
|
data/lib/fanforce/cli/_base.rb
CHANGED
@@ -63,23 +63,14 @@ class Fanforce::CLI
|
|
63
63
|
#################################################################
|
64
64
|
|
65
65
|
elsif ARGV[0] == 'update'
|
66
|
-
if
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
raw_command = ARGV[2]
|
71
|
-
elsif ARGV[1]
|
72
|
-
raw_command = ARGV[1]
|
73
|
-
else
|
74
|
-
error('You supplied an invalid update command.', :update)
|
66
|
+
if !$Filter
|
67
|
+
ARGV[1] =~ /^(all|app-([a-z0-9-]+))$/i || error('You supplied an invalid update command.', :update)
|
68
|
+
app_id = $1
|
69
|
+
ARGV.delete_at(1)
|
75
70
|
end
|
76
71
|
|
77
|
-
|
78
|
-
|
79
|
-
command = $1.to_sym
|
80
|
-
else
|
81
|
-
command = :all
|
82
|
-
end
|
72
|
+
ARGV[1] !~ /^(all|files|bundle|pow|get|env)$/i || error('You supplied an invalid update command.', :update)
|
73
|
+
command = $1.to_sym
|
83
74
|
|
84
75
|
(!app_id or app_id == 'all') ? run(:update, command) : update_app(app_id, command)
|
85
76
|
|
@@ -93,9 +84,11 @@ class Fanforce::CLI
|
|
93
84
|
#################################################################
|
94
85
|
|
95
86
|
elsif ARGV[0] == 'push'
|
96
|
-
ARGV[1] =~ /^(all|development|staging|production)$/ || error('You supplied an invalid push command.', :push)
|
87
|
+
ARGV[1] =~ /^(all|development|staging|production)$/i || error('You supplied an invalid push command.', :push)
|
97
88
|
environment = $1.to_sym
|
98
|
-
|
89
|
+
|
90
|
+
ARGV[2] =~ /^(all|heroku|iron|bitbucket)$/i || error('You supplied an invalid push command.', :push)
|
91
|
+
command = $1.to_sym
|
99
92
|
|
100
93
|
confirm('Are you sure you want to push to all environments, including production?') if environment == :all
|
101
94
|
confirm('Are you sure you want to push to production?') if environment == :production
|
@@ -139,15 +132,12 @@ class Fanforce::CLI
|
|
139
132
|
#################################################################
|
140
133
|
|
141
134
|
elsif ARGV[0] == 'iron'
|
142
|
-
ARGV[1] =~ /^(upload|reset|delete)$/ || error('You supplied an invalid iron command.', :iron)
|
135
|
+
ARGV[1] =~ /^(upload|reset|delete)$/i || error('You supplied an invalid iron command.', :iron)
|
143
136
|
command = $1.to_sym
|
144
137
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
else
|
149
|
-
error('You supplied an invalid iron environment.', :iron)
|
150
|
-
end
|
138
|
+
ARGV[2] =~ /^(all|development|staging|production)$/i || error('You supplied an invalid iron environment.', :iron)
|
139
|
+
environment = $1.to_sym
|
140
|
+
confirm("Are you sure you want to #{command} workers in all environments?") if environment == :all
|
151
141
|
|
152
142
|
if command == :delete
|
153
143
|
delete_all_iron_workers(environment)
|
@@ -203,7 +203,7 @@ class Fanforce::CLI
|
|
203
203
|
environments = (environment==:all) ? [:staging,:production] : [environment]
|
204
204
|
environments.each do |environment|
|
205
205
|
if [:all,:heroku].include?(command)
|
206
|
-
remote_name = "#{environment
|
206
|
+
remote_name = "#{env(environment)}-heroku"
|
207
207
|
setup_heroku(app, environment) if !(`git remote`).split(/\r?\n/).include?(remote_name)
|
208
208
|
|
209
209
|
vars = Env.vars_by_app(environment)[app.dir_name] || {}
|
@@ -469,10 +469,6 @@ class Fanforce::CLI
|
|
469
469
|
end
|
470
470
|
|
471
471
|
######################################################################################################################
|
472
|
-
def get_heroku_app_qa_name(app, environment)
|
473
|
-
heroku_app_name = "#{environment==:production ? 'prd' : 'qa'}-#{app.dir_name}"
|
474
|
-
heroku_app_name.length > 30 ? heroku_app_name.gsub!(/(a|e|i|o|u)/, '') : heroku_app_name
|
475
|
-
end
|
476
472
|
|
477
473
|
def run_upgrade(app_dir, processed_count, total_count)
|
478
474
|
environment = :qa
|
@@ -1,11 +1,6 @@
|
|
1
1
|
class Fanforce::CLI
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
|
-
def get_heroku_app_name(app, environment)
|
5
|
-
heroku_app_name = "#{environment==:production ? 'prd' : 'stg'}-#{app.dir_name}"
|
6
|
-
heroku_app_name.length > 30 ? heroku_app_name.gsub!(/(a|e|i|o|u)/, '') : heroku_app_name
|
7
|
-
end
|
8
|
-
|
9
4
|
def setup_files(app)
|
10
5
|
if File.directory?("#{app.dir}/tmp")
|
11
6
|
puts "#{'Found '.format(:green,:bold)} #{app.dir_name}/tmp/"
|
@@ -145,7 +140,7 @@ class Fanforce::CLI
|
|
145
140
|
heroku.put_config_vars(heroku_app_name, vars) if vars
|
146
141
|
|
147
142
|
# Setup standard app domain
|
148
|
-
domain = "#{app._id}.#{Fanforce.
|
143
|
+
domain = "#{app._id}.#{Fanforce::DomainEnvironments.method(environment).call[:apps_base]}"
|
149
144
|
domain_found = heroku.get_domains(heroku_app_name).body.inject(false) {|result, d| d['domain'] == domain ? (break true) : false }
|
150
145
|
if domain_found
|
151
146
|
puts "#{'Found '.format(:green,:bold)}" + "#{domain} domain on #{environment}"
|
@@ -155,7 +150,7 @@ class Fanforce::CLI
|
|
155
150
|
end
|
156
151
|
|
157
152
|
# Setup default short domain
|
158
|
-
domain = "#{app._id}.#{Fanforce.default_short_domain}"
|
153
|
+
domain = "#{app._id}.#{Fanforce::DomainEnvironments.method(environment).call[:default_short_domain]}"
|
159
154
|
domain_found = heroku.get_domains(heroku_app_name).body.inject(false) {|result, d| d['domain'] == domain ? (break true) : false }
|
160
155
|
if domain_found
|
161
156
|
puts "#{'Found '.format(:green,:bold)}" + "#{domain} domain on #{environment}"
|
@@ -164,7 +159,7 @@ class Fanforce::CLI
|
|
164
159
|
puts "#{'Added '.format(:green,:bold)}" + "#{domain} domain to #{environment}"
|
165
160
|
end
|
166
161
|
|
167
|
-
remote_name = "#{environment
|
162
|
+
remote_name = "#{env(environment)}-heroku"
|
168
163
|
if (`git remote`).split(/\r?\n/).include?(remote_name)
|
169
164
|
puts "#{'Updated '.format(:green,:bold)}" + "git remote for #{remote_name}"
|
170
165
|
`git remote rm #{remote_name}`
|
data/lib/fanforce/cli/help.rb
CHANGED
@@ -17,6 +17,7 @@ module Fanforce::CLI::Help
|
|
17
17
|
|
18
18
|
def for(command, allowed_commands)
|
19
19
|
response = "\n#{command.to_s.upcase} COMMAND...\n-----------------------------------------------------------------------------------------------------------------------\n"
|
20
|
+
response += self.method("#{command}_command").call
|
20
21
|
response += "-----------------------------------------------------------------------------------------------------------------------\n\n"
|
21
22
|
end
|
22
23
|
|
@@ -31,12 +32,12 @@ create app-ID Creates a new app folder and
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def update_command; <<-eos
|
34
|
-
update
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
update app-ID|all all|OR... Similar to the create command, except it updates existing files
|
36
|
+
|files Ensure all files exist and contain correct config
|
37
|
+
|bundle Run bundle install
|
38
|
+
|pow Ensure correct pow domains are configured
|
39
|
+
|git Ensure git is initialized
|
40
|
+
|env Update ENV variables
|
40
41
|
eos
|
41
42
|
end
|
42
43
|
|
@@ -46,11 +47,11 @@ delete app-ID Delete the app folder and al
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def push_command; <<-eos
|
49
|
-
push
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
push RACK_ENV all|OR... Push all changes to the environment specified
|
51
|
+
|env Update environment vars in remote environments
|
52
|
+
|bitbucket Push the latest commit to bitbucket
|
53
|
+
|heroku Push the latest commit to heroku and restart
|
54
|
+
|iron Push changes to workers
|
54
55
|
eos
|
55
56
|
end
|
56
57
|
|
@@ -65,7 +66,7 @@ count Display the number of fanfor
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def bundle_command; <<-eos
|
68
|
-
bundle
|
69
|
+
bundle install|update Run bundle on all apps in current fanforce
|
69
70
|
eos
|
70
71
|
end
|
71
72
|
|
@@ -76,7 +77,7 @@ git status:overview A custom git command that di
|
|
76
77
|
end
|
77
78
|
|
78
79
|
def iron_command; <<-eos
|
79
|
-
iron
|
80
|
+
iron upload|reset|delete RACK_ENV|all Updates env variables and upload one or more workers to iron.io
|
80
81
|
eos
|
81
82
|
end
|
82
83
|
|
@@ -91,7 +92,7 @@ config Display your Fanforce CLI co
|
|
91
92
|
end
|
92
93
|
|
93
94
|
def cleanorgs_command; <<-eos
|
94
|
-
cleanorgs environment
|
95
|
+
cleanorgs environment supercore_api_key Remove installs that are no longer valid in the db
|
95
96
|
eos
|
96
97
|
end
|
97
98
|
|
data/lib/fanforce/cli/utils.rb
CHANGED
@@ -42,6 +42,25 @@ module Fanforce::CLI::Utils
|
|
42
42
|
exit 0 if input.downcase == 'n'
|
43
43
|
end
|
44
44
|
|
45
|
+
def env(environment)
|
46
|
+
return if environment.blank?
|
47
|
+
is_symbol = environment.is_a?(Symbol)
|
48
|
+
env = case environment.to_sym
|
49
|
+
when :development then :dev
|
50
|
+
when :staging then :stg
|
51
|
+
when :production then :prd
|
52
|
+
else raise 'unknown environment'
|
53
|
+
end
|
54
|
+
is_symbol ? env : env.to_s
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_heroku_app_name(app, environment)
|
58
|
+
raise 'unknown environment' if ![:production, :staging].include?(environment)
|
59
|
+
|
60
|
+
heroku_app_name = "#{env(environment)}-#{app.dir_name}"
|
61
|
+
heroku_app_name.length > 30 ? heroku_app_name.gsub!(/(a|e|i|o|u)/, '') : heroku_app_name
|
62
|
+
end
|
63
|
+
|
45
64
|
end
|
46
65
|
|
47
66
|
class String
|
data/lib/fanforce/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fanforce-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.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: 2014-
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|