capricorn 0.2.22 → 0.2.23
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/lib/capricorn/apps/engines.rb +6 -6
- data/lib/capricorn/apps/satellite.rb +18 -11
- data/lib/capricorn/job_queue.rb +3 -0
- data/lib/capricorn/satellite/actions.rb +2 -0
- data/lib/capricorn/server.rb +14 -14
- data/lib/capricorn/system.rb +14 -14
- metadata +1 -1
@@ -5,27 +5,27 @@ module Capricorn
|
|
5
5
|
|
6
6
|
class Engines < Thor
|
7
7
|
desc 'install DOMAIN NAME', 'install an engine'
|
8
|
-
method_options :version => :required, :lib => :optional, :source => :optional, :token => :optional
|
8
|
+
method_options :version => :required, :lib => :optional, :source => :optional, :token => :optional, :immediate => :boolean
|
9
9
|
def install(domain, name)
|
10
10
|
desc = { :version => options[:version] }
|
11
11
|
desc[:lib] = options[:lib] if options[:lib]
|
12
12
|
desc[:source] = options[:source] if options[:source]
|
13
|
-
Capricorn.client(options[:token]).install_engine(domain, name, desc)
|
13
|
+
Capricorn.client(options[:token]).install_engine(domain, name, desc, options[:immediate])
|
14
14
|
end
|
15
15
|
|
16
16
|
desc 'update DOMAIN NAME', 'update an engine'
|
17
|
-
method_options :version => :required, :lib => :optional, :source => :optional, :token => :optional
|
17
|
+
method_options :version => :required, :lib => :optional, :source => :optional, :token => :optional, :immediate => :boolean
|
18
18
|
def update(domain, name)
|
19
19
|
desc = { :version => options[:version] }
|
20
20
|
desc[:lib] = options[:lib] if options[:lib]
|
21
21
|
desc[:source] = options[:source] if options[:source]
|
22
|
-
Capricorn.client(options[:token]).update_engine(domain, name, desc)
|
22
|
+
Capricorn.client(options[:token]).update_engine(domain, name, desc, options[:immediate])
|
23
23
|
end
|
24
24
|
|
25
25
|
desc 'uninstall DOMAIN NAME', 'uninstall an engine'
|
26
|
-
method_options :token => :optional
|
26
|
+
method_options :token => :optional, :immediate => :boolean
|
27
27
|
def uninstall(domain, name)
|
28
|
-
Capricorn.client(options[:token]).uninstall_engine(domain, name)
|
28
|
+
Capricorn.client(options[:token]).uninstall_engine(domain, name, options[:immediate])
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -8,10 +8,17 @@ module Capricorn
|
|
8
8
|
method_options :token => :optional
|
9
9
|
def list(domain=nil)
|
10
10
|
satellites = Capricorn.client(options[:token]).satellites.dup
|
11
|
-
|
11
|
+
|
12
|
+
names_by_index = []
|
12
13
|
satellites.size.times do |i|
|
13
14
|
sat = satellites[i]
|
14
|
-
|
15
|
+
names_by_index.push([sat.domain, i])
|
16
|
+
end
|
17
|
+
names_by_index.sort! { |a,b| a.first <=> b.first }
|
18
|
+
|
19
|
+
names_by_index.each do |(domain, i)|
|
20
|
+
sat = satellites[i]
|
21
|
+
if domain.nil? or sat.domain.include?(domain)
|
15
22
|
puts [
|
16
23
|
sat.domain,
|
17
24
|
(sat.development ? ['development:', sat.module_name] : [])
|
@@ -27,31 +34,31 @@ module Capricorn
|
|
27
34
|
end
|
28
35
|
|
29
36
|
desc 'install DOMAIN', 'install a satellite'
|
30
|
-
method_options :token => :optional
|
37
|
+
method_options :token => :optional, :immediate => :boolean
|
31
38
|
def install(domain)
|
32
|
-
Capricorn.client(options[:token]).install_satellite(domain)
|
39
|
+
Capricorn.client(options[:token]).install_satellite(domain, options[:immediate])
|
33
40
|
end
|
34
41
|
|
35
42
|
desc 'uninstall DOMAIN', 'uninstall a satellite'
|
36
|
-
method_options :token => :optional
|
43
|
+
method_options :token => :optional, :immediate => :boolean
|
37
44
|
def uninstall(domain)
|
38
|
-
Capricorn.client(options[:token]).uninstall_satellite(domain)
|
45
|
+
Capricorn.client(options[:token]).uninstall_satellite(domain, options[:immediate])
|
39
46
|
end
|
40
47
|
|
41
48
|
desc 'relink DOMAIN', 'relink a satellite'
|
42
|
-
method_options :token => :optional
|
49
|
+
method_options :token => :optional, :immediate => :boolean
|
43
50
|
def relink(domain)
|
44
|
-
Capricorn.client(options[:token]).relink_satellite(domain)
|
51
|
+
Capricorn.client(options[:token]).relink_satellite(domain, options[:immediate])
|
45
52
|
end
|
46
53
|
|
47
54
|
desc 'update DOMAIN', 'update the installed engines of a satellite'
|
48
|
-
method_options :token => :optional
|
55
|
+
method_options :token => :optional, :immediate => :boolean
|
49
56
|
def update(domain)
|
50
|
-
Capricorn.client(options[:token]).update_satellite(domain)
|
57
|
+
Capricorn.client(options[:token]).update_satellite(domain, options[:immediate])
|
51
58
|
end
|
52
59
|
|
53
60
|
# desc 'upgrade DOMAIN', 'upgrade/rebuild the rails app of a satellite'
|
54
|
-
# method_options :token => :optional
|
61
|
+
# method_options :token => :optional, :immediate => :boolean
|
55
62
|
# def upgrade(domain)
|
56
63
|
# Capricorn.client(options[:token]).upgrade_satellite(domain)
|
57
64
|
# end
|
data/lib/capricorn/job_queue.rb
CHANGED
@@ -14,6 +14,8 @@ module Capricorn
|
|
14
14
|
|
15
15
|
def update_all_engines
|
16
16
|
@engines.each do |gem_name,options|
|
17
|
+
Capricorn.system.gem_update(gem_name)
|
18
|
+
|
17
19
|
dep = Gem::Dependency.new(gem_name.to_s, Gem::Requirement.default)
|
18
20
|
specs = Gem::SourceIndex.from_installed_gems.search(dep)
|
19
21
|
|
data/lib/capricorn/server.rb
CHANGED
@@ -52,32 +52,32 @@ module Capricorn
|
|
52
52
|
Capricorn.system.gem_update(:all)
|
53
53
|
end
|
54
54
|
|
55
|
-
def install_satellite(domain)
|
56
|
-
Capricorn.system.install_satellite(domain)
|
55
|
+
def install_satellite(domain, immediate)
|
56
|
+
Capricorn.system.install_satellite(domain, immediate)
|
57
57
|
end
|
58
58
|
|
59
|
-
def relink_satellite(domain)
|
59
|
+
def relink_satellite(domain, immediate)
|
60
60
|
satellite = Capricorn.system.find_satellite(domain)
|
61
61
|
if satellite
|
62
|
-
Capricorn.system.relink_satellite(satellite)
|
62
|
+
Capricorn.system.relink_satellite(satellite, immediate)
|
63
63
|
else
|
64
64
|
Capricorn.log "Satellite not found (#{domain})"
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
def update_satellite(domain)
|
68
|
+
def update_satellite(domain, immediate)
|
69
69
|
satellite = Capricorn.system.find_satellite(domain)
|
70
70
|
if satellite
|
71
|
-
Capricorn.system.update_satellite(satellite)
|
71
|
+
Capricorn.system.update_satellite(satellite, immediate)
|
72
72
|
else
|
73
73
|
Capricorn.log "Satellite not found (#{domain})"
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
def uninstall_satellite(domain)
|
77
|
+
def uninstall_satellite(domain, immediate)
|
78
78
|
satellite = Capricorn.system.find_satellite(domain)
|
79
79
|
if satellite
|
80
|
-
Capricorn.system.uninstall_satellite(satellite)
|
80
|
+
Capricorn.system.uninstall_satellite(satellite, immediate)
|
81
81
|
else
|
82
82
|
Capricorn.log "Satellite not found (#{domain})"
|
83
83
|
end
|
@@ -92,28 +92,28 @@ module Capricorn
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
def install_engine(domain, name, options
|
95
|
+
def install_engine(domain, name, options, immediate)
|
96
96
|
satellite = Capricorn.system.find_satellite(domain)
|
97
97
|
if satellite
|
98
|
-
Capricorn.system.install_engine(satellite, name, options)
|
98
|
+
Capricorn.system.install_engine(satellite, name, options, immediate)
|
99
99
|
else
|
100
100
|
Capricorn.log "Satellite not found (#{domain})"
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
-
def update_engine(domain, name, options
|
104
|
+
def update_engine(domain, name, options, immediate)
|
105
105
|
satellite = Capricorn.system.find_satellite(domain)
|
106
106
|
if satellite
|
107
|
-
Capricorn.system.update_engine(satellite, name, options)
|
107
|
+
Capricorn.system.update_engine(satellite, name, options, immediate)
|
108
108
|
else
|
109
109
|
Capricorn.log "Satellite not found (#{domain})"
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
def uninstall_engine(domain, name)
|
113
|
+
def uninstall_engine(domain, name, immediate)
|
114
114
|
satellite = Capricorn.system.find_satellite(domain)
|
115
115
|
if satellite
|
116
|
-
Capricorn.system.uninstall_engine(satellite, name)
|
116
|
+
Capricorn.system.uninstall_engine(satellite, name, immediate)
|
117
117
|
else
|
118
118
|
Capricorn.log "Satellite not found (#{domain})"
|
119
119
|
end
|
data/lib/capricorn/system.rb
CHANGED
@@ -67,8 +67,8 @@ module Capricorn
|
|
67
67
|
File.join(@root, *args)
|
68
68
|
end
|
69
69
|
|
70
|
-
def install_satellite(domain)
|
71
|
-
self.queue.enqueue("install new satellite #{domain}", :domain => domain) do |options|
|
70
|
+
def install_satellite(domain, immediate)
|
71
|
+
self.queue.enqueue("install new satellite #{domain}", :domain => domain, :immediate => immediate) do |options|
|
72
72
|
satellite = Capricorn::Satellite.new(options[:domain])
|
73
73
|
|
74
74
|
run_action_on :install_satellite, satellite
|
@@ -77,8 +77,8 @@ module Capricorn
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
def relink_satellite(satellite)
|
81
|
-
self.queue.enqueue("relink #{satellite.domain}", :satellite => satellite) do |options|
|
80
|
+
def relink_satellite(satellite, immediate)
|
81
|
+
self.queue.enqueue("relink #{satellite.domain}", :satellite => satellite, :immediate => immediate) do |options|
|
82
82
|
satellite = options[:satellite]
|
83
83
|
|
84
84
|
if satellite
|
@@ -88,9 +88,9 @@ module Capricorn
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
def update_satellite(satellite)
|
91
|
+
def update_satellite(satellite, immediate)
|
92
92
|
if satellite
|
93
|
-
self.queue.enqueue("update #{satellite.domain}", :satellite => satellite) do |options|
|
93
|
+
self.queue.enqueue("update #{satellite.domain}", :satellite => satellite, :immediate => immediate) do |options|
|
94
94
|
|
95
95
|
satellite = options[:satellite]
|
96
96
|
if satellite.update_all_engines
|
@@ -105,9 +105,9 @@ module Capricorn
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
def uninstall_satellite(satellite)
|
108
|
+
def uninstall_satellite(satellite, immediate)
|
109
109
|
if satellite
|
110
|
-
self.queue.enqueue("uninstall #{satellite.domain}", :satellite => satellite) do |options|
|
110
|
+
self.queue.enqueue("uninstall #{satellite.domain}", :satellite => satellite, :immediate => immediate) do |options|
|
111
111
|
run_action_on :uninstall_satellite, options[:satellite]
|
112
112
|
destroy_satellite! options[:satellite]
|
113
113
|
end
|
@@ -147,10 +147,10 @@ module Capricorn
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
-
def install_engine(satellite, name, options
|
150
|
+
def install_engine(satellite, name, options, immediate)
|
151
151
|
if satellite
|
152
152
|
self.queue.enqueue("install #{satellite.domain}: #{name} #{options.inspect}",
|
153
|
-
:satellite => satellite, :name => name, :options => options) do |options|
|
153
|
+
:satellite => satellite, :name => name, :options => options, :immediate => immediate) do |options|
|
154
154
|
|
155
155
|
satellite, name, options = options[:satellite], options[:name], options[:options]
|
156
156
|
resolve_options_with(satellite) { ensure_presence_of_gem(name, options) }
|
@@ -166,10 +166,10 @@ module Capricorn
|
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
-
def update_engine(satellite, name, options
|
169
|
+
def update_engine(satellite, name, options, immediate)
|
170
170
|
if satellite
|
171
171
|
self.queue.enqueue("update #{satellite.domain}: #{name} #{options.inspect}",
|
172
|
-
:satellite => satellite, :name => name, :options => options) do |options|
|
172
|
+
:satellite => satellite, :name => name, :options => options, :immediate => immediate) do |options|
|
173
173
|
|
174
174
|
satellite, name, options = options[:satellite], options[:name], options[:options]
|
175
175
|
resolve_options_with(satellite) { ensure_presence_of_gem(name, options) }
|
@@ -185,10 +185,10 @@ module Capricorn
|
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
188
|
-
def uninstall_engine(satellite, name)
|
188
|
+
def uninstall_engine(satellite, name, immediate)
|
189
189
|
if satellite
|
190
190
|
self.queue.enqueue("uninstall #{satellite.domain}: #{name}",
|
191
|
-
:satellite => satellite, :name => name) do |options|
|
191
|
+
:satellite => satellite, :name => name, :immediate => immediate) do |options|
|
192
192
|
|
193
193
|
satellite, name = options[:satellite], options[:name]
|
194
194
|
if satellite.remove_engine(name)
|