fanforce-factory 0.4.6 → 0.4.7
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/lib/fanforce/factory/_base.rb +25 -17
- data/lib/fanforce/factory/commands.rb +59 -2
- data/lib/fanforce/factory/help.rb +6 -18
- data/lib/fanforce/factory/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGY5NTY1MTYwMWUyM2ExYzg0OTZlNjQ0NWYyNzM4ZDkwYjViNTVhZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWUwYmYwYTU2NTc3YmMyZWJiMjRmMWFkNDQwOWFjMWRkNTlhNzcyZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2M1OGRmYmY1NzRlYmI5NTZiM2NhZTUxOTllYjMxMTFjYTFmNjE2YzQ2NTk5
|
10
|
+
NzkyZjMzZDY5M2VkNWU5YWU0ZjExNzcwYmEzOTNmMGJkNjkyZTM3YTM0OWFm
|
11
|
+
ZTY0NGM5MDM4NzlmMTBmNGI0NGE0MjQyNmI2YzBhOTUyNjQ0ZmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDY3YWI2NDQ0ZTM0YWFkYzkwYzZjYjU2Mzc1YjJlYjkwZDBhNDhkYWE4OTcy
|
14
|
+
NzVkMTQ3YTlkNWY3NDg4M2ZiOGFhNTIyYTI3ZThmZjE2OTNiMmZmMzk1YWYw
|
15
|
+
MGUyNmQ0ZTE1M2UxMzE1OTk4NTFiNTc0M2MyM2Q5YzM1NGU3NDg=
|
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 => [:update, :restart, :push, :count, :bundle, :git, :iron, :version, :config],
|
11
|
+
:allowed => [:setup, :update, :restart, :push, :count, :bundle, :git, :iron, :version, :config],
|
12
12
|
)
|
13
13
|
else
|
14
14
|
factory.start(
|
15
15
|
:runtype => :realtime,
|
16
|
-
:allowed => [:create, :delete, :update, :restart, :push, :count, :bundle, :git, :iron, :version, :config],
|
16
|
+
:allowed => [:create, :setup, :delete, :update, :restart, :push, :count, :bundle, :git, :iron, :version, :config],
|
17
17
|
)
|
18
18
|
end
|
@@ -46,10 +46,15 @@ class Fanforce::Factory
|
|
46
46
|
#################################################################################
|
47
47
|
|
48
48
|
def parse_command
|
49
|
+
|
50
|
+
#################################################################
|
51
|
+
|
49
52
|
if ARGV.length == 0 or !@allowed_commands.include?(ARGV[0].to_sym)
|
50
53
|
puts Fanforce::Factory::Help.intro(@executable, @runtype)
|
51
54
|
puts Fanforce::Factory::Help.commands(@allowed_commands)
|
52
55
|
|
56
|
+
#################################################################
|
57
|
+
|
53
58
|
elsif ARGV[0] == 'create'
|
54
59
|
ARGV[1] =~ /^(plugin|widget|app)-(.+)$/ || error('You supplied an invalid create command.', :create)
|
55
60
|
|
@@ -70,28 +75,31 @@ class Fanforce::Factory
|
|
70
75
|
|
71
76
|
#################################################################
|
72
77
|
|
73
|
-
elsif ARGV[0] == '
|
74
|
-
ARGV[1] =~ /^(plugin|widget|app)-(.+)$/ || error('You supplied an invalid
|
78
|
+
elsif ARGV[0] == 'setup'
|
79
|
+
ARGV[1] =~ /^(plugin|widget|app)-(.+)$/ || error('You supplied an invalid setup command.', :setup)
|
75
80
|
|
76
|
-
|
77
|
-
|
81
|
+
addon_type = $1
|
82
|
+
addon_id = $2
|
83
|
+
|
84
|
+
if addon_type =~ /app|widget/
|
85
|
+
setup_addon(addon_type, addon_id)
|
86
|
+
else
|
87
|
+
if ARGV[2].nil?
|
88
|
+
error('You failed to supply a valid plugin type for setup.', :setup)
|
89
|
+
elsif ![:data_connector, :data_processor, :broadcaster, :identifier, :behavior].include?(ARGV[2].to_sym)
|
90
|
+
error('You supplied an invalid plugin type.', :setup)
|
91
|
+
else
|
92
|
+
setup_addon(addon_type, addon_id, ARGV[2])
|
93
|
+
end
|
94
|
+
end
|
78
95
|
|
79
96
|
#################################################################
|
80
97
|
|
81
|
-
elsif ARGV[0] == '
|
82
|
-
ARGV[1] =~ /^(
|
98
|
+
elsif ARGV[0] == 'delete'
|
99
|
+
ARGV[1] =~ /^(plugin|widget|app)-(.+)$/ || error('You supplied an invalid delete command.', :delete)
|
83
100
|
|
84
|
-
|
85
|
-
|
86
|
-
command, environment = tmp_str.split(':').map {|d| d.singularize.to_sym }
|
87
|
-
environment = :all if !environment
|
88
|
-
confirm('Are you wanting to setup all environments?') if environment == :all
|
89
|
-
else
|
90
|
-
command = tmp_str.singularize.to_sym
|
91
|
-
environment = command == :all ? :all : nil
|
92
|
-
end
|
93
|
-
confirm('Are you wanting to setup everything in all environments?') if command == :all
|
94
|
-
run(:setup, command, environment)
|
101
|
+
confirm("Are you sure you want to delete all files, repositories, and other items for #{ARGV[1]}?")
|
102
|
+
delete_addon($1, $2)
|
95
103
|
|
96
104
|
#################################################################
|
97
105
|
|
@@ -7,7 +7,61 @@ class Fanforce::Factory
|
|
7
7
|
|
8
8
|
if File.exists?("#{dir}/config.ru")
|
9
9
|
puts '---------------------------------------------------------------------------------------------------------------'
|
10
|
-
puts 'ERROR... '.format(:red,:bold) + "#{addon_type}-#{addon_id} already exists. You should run: ".format(:red) + "factory
|
10
|
+
puts 'ERROR... '.format(:red,:bold) + "#{addon_type}-#{addon_id} already exists. You should run: ".format(:red) + "factory setup #{dir_name}".format(:green)
|
11
|
+
puts '---------------------------------------------------------------------------------------------------------------'
|
12
|
+
return
|
13
|
+
end
|
14
|
+
|
15
|
+
puts "\n---------------------------------------------------------------------------------------------------------------"
|
16
|
+
puts 'CREATING FILES...'
|
17
|
+
Dir.mkdir(dir) if !File.directory?(dir)
|
18
|
+
Dir.chdir(dir)
|
19
|
+
puts "#{'Created'.format(:bold, :green)} #{dir_name}/"
|
20
|
+
addon = Addon.load(dir, plugin_type)
|
21
|
+
setup_files(addon)
|
22
|
+
|
23
|
+
puts "\n---------------------------------------------------------------------------------------------------------------"
|
24
|
+
puts 'RUNNING BUNDLER...'
|
25
|
+
Run.bundle_install(addon.dir)
|
26
|
+
|
27
|
+
puts "\n---------------------------------------------------------------------------------------------------------------"
|
28
|
+
puts 'CREATING POW DOMAINS...'
|
29
|
+
setup_pow(addon)
|
30
|
+
|
31
|
+
puts "\n---------------------------------------------------------------------------------------------------------------"
|
32
|
+
puts 'CREATING LOCAL GIT REPOSITORY...'
|
33
|
+
Run.git_init and puts '- git init'
|
34
|
+
Run.git_add and puts '- git add .'
|
35
|
+
Run.git_first_commit and puts '- git commit -m "initial factory commit"'
|
36
|
+
|
37
|
+
puts "\n---------------------------------------------------------------------------------------------------------------"
|
38
|
+
puts 'CREATING BITBUCKET REPOSITORY...'
|
39
|
+
setup_bitbucket addon
|
40
|
+
|
41
|
+
puts "\n---------------------------------------------------------------------------------------------------------------"
|
42
|
+
puts 'CREATING HEROKU APPS...'
|
43
|
+
setup_heroku addon, :qa
|
44
|
+
setup_heroku addon, :production
|
45
|
+
|
46
|
+
puts "\n---------------------------------------------------------------------------------------------------------------"
|
47
|
+
puts 'CREATING ENV VARIABLES...'
|
48
|
+
setup_envs(addon, :all)
|
49
|
+
|
50
|
+
puts "\n---------------------------------------------------------------------------------------------------------------"
|
51
|
+
puts "#{'DONE!'.format(:bold,:green)} Paste the following JSON into your Developer Configuration for #{addon._id.format(:bold)}:"
|
52
|
+
puts '---------------------------------------------------------------------------------------------------------------'
|
53
|
+
puts DeveloperConfig.method(addon.type).call(addon).format(:magenta)
|
54
|
+
puts '---------------------------------------------------------------------------------------------------------------'
|
55
|
+
puts "\n"
|
56
|
+
end
|
57
|
+
|
58
|
+
def setup_addon(addon_type, addon_id, plugin_type=nil)
|
59
|
+
dir_name = "#{addon_type}-#{addon_id}"
|
60
|
+
dir = "#{$HomeDir}/#{dir_name}"
|
61
|
+
|
62
|
+
if !File.exists?("#{dir}/config.ru")
|
63
|
+
puts '---------------------------------------------------------------------------------------------------------------'
|
64
|
+
puts 'ERROR... '.format(:red,:bold) + "#{addon_type}-#{addon_id} does not exist. You should run: ".format(:red) + "factory create #{dir_name}".format(:green)
|
11
65
|
puts '---------------------------------------------------------------------------------------------------------------'
|
12
66
|
return
|
13
67
|
end
|
@@ -399,7 +453,10 @@ class Fanforce::Factory
|
|
399
453
|
begin
|
400
454
|
iron_worker.codes.create(code, max_concurrency: 5)
|
401
455
|
rescue Exception => e
|
402
|
-
puts "#{'Aborted '.format(:red,:bold)}
|
456
|
+
puts "#{'Aborted '.format(:red,:bold)} upload of #{addon._id}-#{filename.gsub('.worker', '')} to #{environment.to_s.titleize}..."
|
457
|
+
puts e.message
|
458
|
+
puts e.backtrace
|
459
|
+
puts ''
|
403
460
|
end
|
404
461
|
|
405
462
|
end
|
@@ -9,7 +9,6 @@ module Fanforce::Factory::Help
|
|
9
9
|
def commands(allowed_commands)
|
10
10
|
response = "\n\nAVAILABLE COMMANDS...\n-----------------------------------------------------------------------------------------------------------------------\n"
|
11
11
|
commands = allowed_commands.map do |c|
|
12
|
-
c = "standalone_#{c}" if c == :update and !allowed_commands.include?(:setup)
|
13
12
|
self.send(:"#{c}_command")
|
14
13
|
end
|
15
14
|
response += commands.join("-----------------------------------------------------------------------------------------------------------------------\n")
|
@@ -18,7 +17,6 @@ module Fanforce::Factory::Help
|
|
18
17
|
|
19
18
|
def for(command, allowed_commands)
|
20
19
|
response = "\n#{command.to_s.upcase} COMMAND...\n-----------------------------------------------------------------------------------------------------------------------\n"
|
21
|
-
response += self.send(:"#{'standalone_' if command == :update}#{command}_command")
|
22
20
|
response += "-----------------------------------------------------------------------------------------------------------------------\n\n"
|
23
21
|
end
|
24
22
|
|
@@ -27,33 +25,23 @@ create (plugin|widget|app)-ID [PLUGIN_TYPE] Create new addon folder and
|
|
27
25
|
eos
|
28
26
|
end
|
29
27
|
|
30
|
-
def delete_command; <<-eos
|
31
|
-
delete (plugin|widget|app)-ID Delete the addon folder and all related services
|
32
|
-
eos
|
33
|
-
end
|
34
|
-
|
35
28
|
def setup_command; <<-eos
|
36
|
-
setup (
|
37
|
-
|files Create or update needed files
|
38
|
-
|env:[*all|RACK_ENV] Update environment vars for a specific environment
|
39
|
-
|pow Ensure pow domains are setup for development environment
|
40
|
-
|bitbucket Create new repositories in bitbucket and push latest commit
|
41
|
-
|heroku:[*all|RACK_ENV] Create new app in heroku account and push latest commit
|
29
|
+
setup (plugin|widget|app)-ID [PLUGIN_TYPE] Similar to the create command, except it uses existing files
|
42
30
|
eos
|
43
31
|
end
|
44
32
|
|
45
|
-
def
|
46
|
-
|
33
|
+
def delete_command; <<-eos
|
34
|
+
delete (plugin|widget|app)-ID Delete the addon folder and all related services
|
47
35
|
eos
|
48
36
|
end
|
49
37
|
|
50
|
-
def
|
38
|
+
def update_command; <<-eos
|
51
39
|
update (all|OR...) Update all items
|
52
40
|
|files Create or update needed files
|
53
41
|
|env:[*all|RACK_ENV] Update environment vars for a specific environment
|
54
42
|
|pow Ensure pow domains are setup for development environment
|
55
|
-
|bitbucket
|
56
|
-
|heroku:[*all|RACK_ENV]
|
43
|
+
|bitbucket Create new repositories in bitbucket and push latest commit
|
44
|
+
|heroku:[*all|RACK_ENV] Create new app in heroku account and push latest commit
|
57
45
|
eos
|
58
46
|
end
|
59
47
|
|
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.
|
4
|
+
version: 0.4.7
|
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-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|