magellan-cli 0.4.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +17 -1
- data/README.md +14 -80
- data/Rakefile +9 -0
- data/lib/magellan/cli/base.rb +3 -3
- data/lib/magellan/cli/command.rb +8 -2
- data/lib/magellan/cli/locales/en.yml +74 -46
- data/lib/magellan/cli/locales/ja.yml +74 -46
- data/lib/magellan/cli/messaging/base.rb +75 -0
- data/lib/magellan/cli/messaging/http.rb +49 -0
- data/lib/magellan/cli/messaging/mqtt.rb +21 -0
- data/lib/magellan/cli/messaging.rb +18 -0
- data/lib/magellan/cli/reference_generator.rb +23 -6
- data/lib/magellan/cli/resources/base.rb +11 -10
- data/lib/magellan/cli/resources/client_version.rb +3 -2
- data/lib/magellan/cli/resources/cloudsql.rb +4 -4
- data/lib/magellan/cli/resources/deletable.rb +1 -1
- data/lib/magellan/cli/resources/organization.rb +1 -1
- data/lib/magellan/cli/resources/project.rb +2 -2
- data/lib/magellan/cli/resources/stage.rb +16 -16
- data/lib/magellan/cli/resources/team.rb +2 -2
- data/lib/magellan/cli/resources/transaction_router.rb +1 -1
- data/lib/magellan/cli/resources/worker.rb +5 -4
- data/lib/magellan/cli/version.rb +1 -1
- data/lib/magellan/cli.rb +2 -0
- data/magellan-cli.gemspec +1 -0
- data/reference/en/client_version.md +83 -0
- data/reference/en/cloudsql.md +93 -0
- data/reference/en/container.md +65 -0
- data/reference/en/image.md +65 -0
- data/reference/en/index.md +63 -0
- data/reference/en/organization.md +83 -0
- data/reference/en/project.md +92 -0
- data/reference/en/stage.md +181 -0
- data/reference/en/team.md +74 -0
- data/reference/en/worker.md +107 -0
- data/reference/ja/client_version.md +83 -0
- data/reference/ja/cloudsql.md +93 -0
- data/reference/ja/container.md +65 -0
- data/reference/ja/image.md +65 -0
- data/reference/ja/index.md +63 -0
- data/reference/ja/organization.md +83 -0
- data/reference/ja/project.md +92 -0
- data/reference/ja/stage.md +181 -0
- data/reference/ja/team.md +74 -0
- data/reference/ja/worker.md +107 -0
- data/spec/magellan/cli/messaging/http_headers.json +5 -0
- data/spec/magellan/cli/messaging/http_headers.yml +3 -0
- data/spec/magellan/cli/messaging/http_spec.rb +43 -0
- metadata +45 -1
@@ -0,0 +1,18 @@
|
|
1
|
+
require "magellan/cli"
|
2
|
+
|
3
|
+
module Magellan
|
4
|
+
module Cli
|
5
|
+
module Messaging
|
6
|
+
|
7
|
+
autoload :Base, "magellan/cli/messaging/base"
|
8
|
+
autoload :Http, "magellan/cli/messaging/http"
|
9
|
+
# autoload :Spdy, "magellan/cli/messaging/spdy"
|
10
|
+
autoload :Mqtt, "magellan/cli/messaging/mqtt"
|
11
|
+
|
12
|
+
MAPPING = {
|
13
|
+
"Http" => "http",
|
14
|
+
"Mqtt" => "mqtt",
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -16,9 +16,13 @@ module Magellan
|
|
16
16
|
@shell = Thor::Shell::Basic.new
|
17
17
|
change_global_var_temporarily(["$PROGRAM_NAME", "magellan-cli"]) do
|
18
18
|
process(Magellan::Cli::Command, "index.md")
|
19
|
-
Magellan::Cli::Resources::MAPPING.each do |class_name,
|
19
|
+
Magellan::Cli::Resources::MAPPING.each do |class_name, name|
|
20
20
|
klass = Magellan::Cli::Resources.const_get(class_name)
|
21
|
-
process(klass, "
|
21
|
+
process(klass, "resources/#{name}.md", name)
|
22
|
+
end
|
23
|
+
Magellan::Cli::Messaging::MAPPING.each do |class_name, name|
|
24
|
+
klass = Magellan::Cli::Messaging.const_get(class_name)
|
25
|
+
process(klass, "messaging/#{name}.md", name)
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
@@ -38,25 +42,37 @@ module Magellan
|
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
41
|
-
def process(klass, filename,
|
45
|
+
def process(klass, filename, name = nil)
|
42
46
|
if cmd = klass.all_commands["help"]
|
43
47
|
cmd.description = I18n.t(:help, scope: [:base, :cmd])
|
44
48
|
end
|
45
49
|
|
46
|
-
|
50
|
+
rel_path = File.join(@subdir, filename)
|
51
|
+
path = File.expand_path(rel_path, @dest)
|
47
52
|
FileUtils.mkdir_p(File.dirname(path))
|
48
53
|
instance = klass.new
|
49
54
|
open(path, "w") do |f|
|
50
55
|
f.puts "---"
|
51
56
|
f.puts "layout: index"
|
52
|
-
|
57
|
+
version = Magellan::Cli::VERSION.split(/\./)[0,2].join(".")
|
58
|
+
f.puts "title: " << [name, "magellan-cli-#{version} (#{I18n.locale})", "Reference"].compact.join(" | ")
|
59
|
+
lang_links = I18n.available_locales.map do |locale|
|
60
|
+
(locale == I18n.locale) ? locale.to_s :
|
61
|
+
begin
|
62
|
+
path = rel_path.sub(/\/#{I18n.locale}\//, "/#{locale}/").sub(/\.md\z/, ".html")
|
63
|
+
%!<a href="/#{path}">#{locale}</a>!
|
64
|
+
end
|
65
|
+
end
|
66
|
+
f.puts %!breadcrumb: <a href="/">Top</a> / <a href="/reference">Reference</a> / <a href="/reference/magellan-cli/#{I18n.locale}">magellan-cli-#{version}</a> / #{name} #{lang_links.join(' ')}!
|
53
67
|
f.puts "---"
|
54
68
|
f.puts
|
55
69
|
|
56
70
|
f.puts "## "<< I18n.t(:commands, scope: :reference)
|
57
71
|
f.puts
|
58
72
|
klass.sorted_commands.each do |cmd|
|
59
|
-
rel_path =
|
73
|
+
rel_path =
|
74
|
+
Magellan::Cli::Resources::MAPPING.values.include?(cmd.name) ? "./resources/#{cmd.name}.html" :
|
75
|
+
Magellan::Cli::Messaging::MAPPING.values.include?(cmd.name) ? "./messaging/#{cmd.name}.html" : "##{cmd.name}"
|
60
76
|
f.puts "- [%s](%s)" % [Thor.send(:banner, cmd, false, false), rel_path]
|
61
77
|
end
|
62
78
|
f.puts
|
@@ -74,6 +90,7 @@ module Magellan
|
|
74
90
|
f.puts "## " << I18n.t(:details, scope: :reference)
|
75
91
|
klass.sorted_commands.each do |cmd|
|
76
92
|
next if Magellan::Cli::Resources::MAPPING.values.include?(cmd.name)
|
93
|
+
next if Magellan::Cli::Messaging::MAPPING.values.include?(cmd.name)
|
77
94
|
f.puts "### <a name=\"#{cmd.name}\"></a>#{cmd.name}"
|
78
95
|
f.puts
|
79
96
|
f.puts "```text"
|
@@ -46,7 +46,7 @@ module Magellan
|
|
46
46
|
q = {}
|
47
47
|
(self.class.resource_dependency || {}).each do |f, res|
|
48
48
|
r = sel[res]
|
49
|
-
raise NotSelected, I18n.t(:not_selected, scope: [:
|
49
|
+
raise NotSelected, I18n.t(:not_selected, scope: [:resources, :base, :default_query], label: f) unless r
|
50
50
|
q[f] = r["id"]
|
51
51
|
end
|
52
52
|
build_query(q)
|
@@ -55,13 +55,12 @@ module Magellan
|
|
55
55
|
|
56
56
|
def get_first_result!(name, path, query)
|
57
57
|
results = get_json(path, query)
|
58
|
-
raise NotFound, I18n.t(:not_found, scope: [:
|
58
|
+
raise NotFound, I18n.t(:not_found, scope: [:resources, :base, :get_first_result], name: name, query: query.inspect) if results.blank? || results.first.blank?
|
59
59
|
results.first
|
60
60
|
end
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
def update_first_result(name, path, query, fields = DEFAULT_SELECTION_FIELDS)
|
62
|
+
def update_first_result(name, path, query, fields = nil)
|
63
|
+
fields ||= ["id", self.class.caption_attr].compact
|
65
64
|
r = get_first_result!(name, path, query)
|
66
65
|
obj = fields.each_with_object({}) do |f, d|
|
67
66
|
d[f] = r[f]
|
@@ -168,7 +167,7 @@ module Magellan
|
|
168
167
|
end
|
169
168
|
|
170
169
|
def select(name)
|
171
|
-
q = build_query(
|
170
|
+
q = build_query(self.class.caption_attr => name).update(default_query)
|
172
171
|
update_first_result(self.class.parameter_name, "/admin/#{self.class.resource_key}.json", q)
|
173
172
|
end
|
174
173
|
|
@@ -204,6 +203,8 @@ module Magellan
|
|
204
203
|
cattr_accessor :resource_dependency
|
205
204
|
cattr_accessor :field_associations
|
206
205
|
cattr_accessor :hidden_fields, :multiline_fields
|
206
|
+
cattr_accessor :caption_attr
|
207
|
+
self.caption_attr = "name"
|
207
208
|
|
208
209
|
def self.parameter_name
|
209
210
|
resource_key.gsub(/~/, "_")
|
@@ -213,22 +214,22 @@ module Magellan
|
|
213
214
|
end
|
214
215
|
end
|
215
216
|
|
216
|
-
desc "list", "#{I18n.t(:list, scope: [:
|
217
|
+
desc "list", "#{I18n.t(:list, scope: [:resources, :common, :cmd], res_names: res_name.pluralize)}"
|
217
218
|
def list
|
218
219
|
super
|
219
220
|
end
|
220
221
|
|
221
|
-
desc "show [ID]", "#{I18n.t(:show, scope: [:
|
222
|
+
desc "show [ID]", "#{I18n.t(:show, scope: [:resources, :common, :cmd], res_name: res_name)}"
|
222
223
|
def show(id = nil)
|
223
224
|
super(id)
|
224
225
|
end
|
225
226
|
|
226
|
-
desc "select NAME", "#{I18n.t(:select, scope: [:
|
227
|
+
desc "select NAME", "#{I18n.t(:select, scope: [:resources, :common, :cmd], res_name: res_name)}"
|
227
228
|
def select(name)
|
228
229
|
super
|
229
230
|
end
|
230
231
|
|
231
|
-
desc "deselect", "#{I18n.t(:deselect, scope: [:
|
232
|
+
desc "deselect", "#{I18n.t(:deselect, scope: [:resources, :common, :cmd], res_name: res_name)}"
|
232
233
|
def deselect
|
233
234
|
super
|
234
235
|
end
|
@@ -13,8 +13,9 @@ module Magellan
|
|
13
13
|
self.field_associations = {
|
14
14
|
"stage_title_id" => {name: "stage", class: "Stage"},
|
15
15
|
}
|
16
|
+
self.caption_attr = "version"
|
16
17
|
|
17
|
-
desc "create VERSION", I18n.t(:create, scope: [:client_version, :cmd], resource_name: resource_name)
|
18
|
+
desc "create VERSION", I18n.t(:create, scope: [:resources, :client_version, :cmd], resource_name: resource_name)
|
18
19
|
def create(version)
|
19
20
|
stage = load_selection!(Stage)
|
20
21
|
params = {
|
@@ -28,7 +29,7 @@ module Magellan
|
|
28
29
|
# select(version)
|
29
30
|
end
|
30
31
|
|
31
|
-
desc "delete VERSION", I18n.t(:delete, scope: [:client_version, :cmd], resource_name: resource_name)
|
32
|
+
desc "delete VERSION", I18n.t(:delete, scope: [:resources, :client_version, :cmd], resource_name: resource_name)
|
32
33
|
def delete(version)
|
33
34
|
q = build_query("version" => version).update(default_query)
|
34
35
|
r = get_first_result!(self.class.resource_name, "/admin/#{resource_key}.json", q)
|
@@ -12,10 +12,10 @@ module Magellan
|
|
12
12
|
self.resource_dependency = {"stage" => Stage.parameter_name}
|
13
13
|
self.hidden_fields = %w[cloudsql_instance_id].map(&:freeze).freeze
|
14
14
|
|
15
|
-
desc "create NAME", I18n.t(:create, scope: [:
|
16
|
-
option :A, type: :boolean, default: false, desc: I18n.t(:async, scope: [:cloudsql, :cmd_create])
|
17
|
-
option :i, type: :numeric, default: 10, desc: I18n.t(:interval, scope: [:cloudsql, :cmd_create])
|
18
|
-
option :t, type: :numeric, default: 600, desc: I18n.t(:timeout, scope: [:cloudsql, :cmd_create])
|
15
|
+
desc "create NAME", I18n.t(:create, scope: [:resources, :common, :cmd], resource_name: "#{resource_name} database")
|
16
|
+
option :A, type: :boolean, default: false, desc: I18n.t(:async, scope: [:resources, :cloudsql, :cmd_create])
|
17
|
+
option :i, type: :numeric, default: 10, desc: I18n.t(:interval, scope: [:resources, :cloudsql, :cmd_create])
|
18
|
+
option :t, type: :numeric, default: 600, desc: I18n.t(:timeout, scope: [:resources, :cloudsql, :cmd_create])
|
19
19
|
def create(name)
|
20
20
|
o = load_selection!(Stage)
|
21
21
|
params = {
|
@@ -10,7 +10,7 @@ module Magellan
|
|
10
10
|
def self.included(klass)
|
11
11
|
klass.module_eval do
|
12
12
|
|
13
|
-
desc "delete NAME", I18n.t(:delete, scope: [:
|
13
|
+
desc "delete NAME", I18n.t(:delete, scope: [:resources, :common, :cmd], resource_name: resource_name)
|
14
14
|
def delete(name)
|
15
15
|
q = build_query("name" => name).update(default_query)
|
16
16
|
r = get_first_result!(self.class.resource_name, "/admin/#{resource_key}.json", q)
|
@@ -11,7 +11,7 @@ module Magellan
|
|
11
11
|
self.resource_key = "magellan~auth~organization"
|
12
12
|
# self.field_associations = {"creator_id" => {name: "creator", class: "User"} }
|
13
13
|
|
14
|
-
desc "create NAME", I18n.t(:create, scope: [:
|
14
|
+
desc "create NAME", I18n.t(:create, scope: [:resources, :common, :cmd], resource_name: resource_name)
|
15
15
|
def create(name)
|
16
16
|
params = {
|
17
17
|
parameter_name => {
|
@@ -13,14 +13,14 @@ module Magellan
|
|
13
13
|
self.hidden_fields = %w[default_nebula_id created_at updated_at].map(&:freeze).freeze
|
14
14
|
self.field_associations = {"organization_id" => {name: "organization", class: "Organization"} }
|
15
15
|
|
16
|
-
desc "update ATTRIBUTES", I18n.t(:update, scope: [:
|
16
|
+
desc "update ATTRIBUTES", I18n.t(:update, scope: [:resources, :common, :cmd], resource_name: resource_name)
|
17
17
|
def update(attrs)
|
18
18
|
s = load_selection!(self.class)
|
19
19
|
attrs = JSON.parse(File.readable?(attrs) ? File.read(attrs) : attrs)
|
20
20
|
put_json("/admin/project/#{s['id']}/edit", {"project" => attrs})
|
21
21
|
end
|
22
22
|
|
23
|
-
desc "create NAME", I18n.t(:create, scope: [:
|
23
|
+
desc "create NAME", I18n.t(:create, scope: [:resources, :common, :cmd], resource_name: resource_name)
|
24
24
|
def create(name)
|
25
25
|
o = load_selection!(Organization)
|
26
26
|
params = {
|
@@ -17,8 +17,8 @@ module Magellan
|
|
17
17
|
VERSION_RESOURCE_KEY = "stage~version".freeze
|
18
18
|
VERSION_PARAMETER_NAME = "stage_version".freeze
|
19
19
|
|
20
|
-
desc "create NAME [-t development|staging|production|other]",
|
21
|
-
option :t, type: :string, default: "development", desc:
|
20
|
+
desc "create NAME [-t development|staging|production|other]", I18n.t(:create, scope: [:resources, :stage, :cmd], resource_name: resource_name)
|
21
|
+
option :t, type: :string, default: "development", desc: I18n.t(:type, scope: [:resources, :stage, :cmd_create])
|
22
22
|
def create(name)
|
23
23
|
type = options["t"]
|
24
24
|
unless %w{ development staging production other }.include?(type)
|
@@ -36,7 +36,7 @@ module Magellan
|
|
36
36
|
select(name)
|
37
37
|
end
|
38
38
|
|
39
|
-
desc "select NAME", I18n.t(:select, scope: [:
|
39
|
+
desc "select NAME", I18n.t(:select, scope: [:resources, :common, :cmd], res_name: resource_name)
|
40
40
|
def select(name)
|
41
41
|
if selected = load_selections[parameter_name]
|
42
42
|
deselect unless selected["name"] == name
|
@@ -54,7 +54,7 @@ module Magellan
|
|
54
54
|
update_first_result(VERSION_PARAMETER_NAME, "/admin/stage~version.json", q, %w[id])
|
55
55
|
end
|
56
56
|
|
57
|
-
desc "deselect", I18n.t(:deselect, scope: [:
|
57
|
+
desc "deselect", I18n.t(:deselect, scope: [:resources, :common, :cmd], res_name: resource_name)
|
58
58
|
def deselect
|
59
59
|
update_selections! do |s|
|
60
60
|
s.delete(parameter_name)
|
@@ -63,12 +63,12 @@ module Magellan
|
|
63
63
|
deselect_dependants
|
64
64
|
end
|
65
65
|
|
66
|
-
desc "planning", I18n.t(:planning, scope: [:stage, :cmd])
|
66
|
+
desc "planning", I18n.t(:planning, scope: [:resources, :stage, :cmd])
|
67
67
|
def planning
|
68
68
|
switch_version(1)
|
69
69
|
end
|
70
70
|
|
71
|
-
desc "current", I18n.t(:current, scope: [:stage, :cmd])
|
71
|
+
desc "current", I18n.t(:current, scope: [:resources, :stage, :cmd])
|
72
72
|
def current
|
73
73
|
switch_version(2)
|
74
74
|
end
|
@@ -81,7 +81,7 @@ module Magellan
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
desc "prepare", I18n.t(:prepare, scope: [:stage, :cmd], containers_name: Container.resource_name.pluralize)
|
84
|
+
desc "prepare", I18n.t(:prepare, scope: [:resources, :stage, :cmd], containers_name: Container.resource_name.pluralize)
|
85
85
|
def prepare
|
86
86
|
s = load_selection!(self.class)
|
87
87
|
id = s["id"]
|
@@ -89,7 +89,7 @@ module Magellan
|
|
89
89
|
Container.new.show_list(r["result"])
|
90
90
|
end
|
91
91
|
|
92
|
-
desc "repair", I18n.t(:repair, scope: [:stage, :cmd], resource_name: resource_name)
|
92
|
+
desc "repair", I18n.t(:repair, scope: [:resources, :stage, :cmd], resource_name: resource_name)
|
93
93
|
def repair
|
94
94
|
r = call_repair
|
95
95
|
puts r["success"] ? "\e[32msucceeded to repair stage\e[0m" : "\e[31mfailed to repair stage\e[0m"
|
@@ -103,17 +103,17 @@ module Magellan
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
desc "update ATTRIBUTES", I18n.t(:update, scope: [:
|
106
|
+
desc "update ATTRIBUTES", I18n.t(:update, scope: [:resources, :common, :cmd], resource_name: resource_name)
|
107
107
|
def update(attrs)
|
108
108
|
s = load_selection!(self.class)
|
109
109
|
attrs = JSON.parse(File.readable?(attrs) ? File.read(attrs) : attrs)
|
110
110
|
put_json("/admin/stage~title/#{s['id']}/edit", {"stage_title" => attrs})
|
111
111
|
end
|
112
112
|
|
113
|
-
desc "release_now", I18n.t(:release_now, scope: [:stage, :cmd])
|
114
|
-
option :A, type: :boolean, default: false, desc: I18n.t(:async, scope: [:stage, :cmd_release_now])
|
115
|
-
option :i, type: :numeric, default: 10, desc: I18n.t(:interval, scope: [:stage, :cmd_release_now])
|
116
|
-
option :t, type: :numeric, default: 600, desc: I18n.t(:timeout, scope: [:stage, :cmd_release_now])
|
113
|
+
desc "release_now", I18n.t(:release_now, scope: [:resources, :stage, :cmd])
|
114
|
+
option :A, type: :boolean, default: false, desc: I18n.t(:async, scope: [:resources, :stage, :cmd_release_now])
|
115
|
+
option :i, type: :numeric, default: 10, desc: I18n.t(:interval, scope: [:resources, :stage, :cmd_release_now])
|
116
|
+
option :t, type: :numeric, default: 600, desc: I18n.t(:timeout, scope: [:resources, :stage, :cmd_release_now])
|
117
117
|
def release_now
|
118
118
|
spacer = "\r" << (" " * 20)
|
119
119
|
stage = load_selection!(self.class)
|
@@ -166,7 +166,7 @@ module Magellan
|
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
-
desc "logs", I18n.t(:logs, scope: [:stage, :cmd], workers_name: Worker.resource_name.pluralize)
|
169
|
+
desc "logs", I18n.t(:logs, scope: [:resources, :stage, :cmd], workers_name: Worker.resource_name.pluralize)
|
170
170
|
def logs
|
171
171
|
s = load_selection!(self.class)
|
172
172
|
id = s["id"]
|
@@ -178,7 +178,7 @@ module Magellan
|
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
181
|
-
desc "set_container_num NUM", I18n.t(:set_container_num, scope: [:stage, :cmd], containers_name: Container.resource_name.pluralize, image_name: Image.resource_name)
|
181
|
+
desc "set_container_num NUM", I18n.t(:set_container_num, scope: [:resources, :stage, :cmd], containers_name: Container.resource_name.pluralize, image_name: Image.resource_name)
|
182
182
|
def set_container_num(num)
|
183
183
|
s = load_selection!(self.class)
|
184
184
|
v = load_selection!(VERSION_PARAMETER_NAME)
|
@@ -186,7 +186,7 @@ module Magellan
|
|
186
186
|
post_json("/admin/stage~version/#{v["id"]}/set_container_num.json", { container_num: num, container_image_id: i["id"] })
|
187
187
|
end
|
188
188
|
|
189
|
-
desc "reload", I18n.t(:reload, scope: [:stage, :cmd])
|
189
|
+
desc "reload", I18n.t(:reload, scope: [:resources, :stage, :cmd])
|
190
190
|
def reload
|
191
191
|
s = load_selection!(self.class)
|
192
192
|
select(s["name"])
|
@@ -10,7 +10,7 @@ module Magellan
|
|
10
10
|
self.resource_dependency = { "organization" => Organization.parameter_name }
|
11
11
|
self.field_associations = {"organization_id" => {name: "organization", class: "Organization"} }
|
12
12
|
|
13
|
-
desc "create NAME ROLE", I18n.t(:create, scope: [:team, :cmd], resource_name: resource_name)
|
13
|
+
desc "create NAME ROLE", I18n.t(:create, scope: [:resources, :team, :cmd], resource_name: resource_name)
|
14
14
|
def create(name, role)
|
15
15
|
unless %w{ reader admin }.include?(role)
|
16
16
|
raise "ROLE should be 'reader' or 'admin'"
|
@@ -28,7 +28,7 @@ module Magellan
|
|
28
28
|
end
|
29
29
|
|
30
30
|
=begin
|
31
|
-
desc "invite EMAIL", I18n.t(:invite, scope: [:team, :cmd], resource_name: resource_name)
|
31
|
+
desc "invite EMAIL", I18n.t(:invite, scope: [:resources, :team, :cmd], resource_name: resource_name)
|
32
32
|
def invite(email)
|
33
33
|
o = load_selection!(self.class)
|
34
34
|
params = {
|
@@ -9,7 +9,7 @@ module Magellan
|
|
9
9
|
self.resource_key = "functions~transaction_router"
|
10
10
|
self.resource_dependency = {"stage" => Stage.parameter_name}
|
11
11
|
|
12
|
-
desc "create NAME", I18n.t(:create, scope: [:
|
12
|
+
desc "create NAME", I18n.t(:create, scope: [:resources, :common, :cmd], resource_name: resource_name)
|
13
13
|
def create(name)
|
14
14
|
s = load_selection!(Stage::VERSION_PARAMETER_NAME)
|
15
15
|
params = {
|
@@ -14,8 +14,9 @@ module Magellan
|
|
14
14
|
self.multiline_fields = %w[migration_command_1 migration_command_2 run_command environment_vars_yaml].map(&:freeze).freeze
|
15
15
|
self.field_associations = {"stage_version_id" => {name: "stage", resource: "stage~version"} }
|
16
16
|
|
17
|
-
desc "create NAME IMAGE", I18n.t(:create, scope: [:worker, :cmd], resource_name: resource_name)
|
18
|
-
method_option :attributes_yaml, aliases: "-A", desc:
|
17
|
+
desc "create NAME IMAGE", I18n.t(:create, scope: [:resources, :worker, :cmd], resource_name: resource_name)
|
18
|
+
method_option :attributes_yaml, aliases: "-A", desc: I18n.t(:attributes_yaml, scope: [:resources, :worker, :cmd_create])
|
19
|
+
"path to YAML file which defines attributes"
|
19
20
|
def create(name, image_name)
|
20
21
|
s = load_selection!(Stage::VERSION_PARAMETER_NAME)
|
21
22
|
attrs =
|
@@ -36,7 +37,7 @@ module Magellan
|
|
36
37
|
select(name)
|
37
38
|
end
|
38
39
|
|
39
|
-
desc "update ATTRIBUTES", I18n.t(:update, scope: [:worker, :cmd], resource_name: resource_name)
|
40
|
+
desc "update ATTRIBUTES", I18n.t(:update, scope: [:resources, :worker, :cmd], resource_name: resource_name)
|
40
41
|
def update(attrs)
|
41
42
|
if File.readable?(attrs)
|
42
43
|
attrs = YAML.load_file(attrs)
|
@@ -52,7 +53,7 @@ module Magellan
|
|
52
53
|
put_json("/admin/#{resource_key}/#{w["id"]}/edit.js", params)
|
53
54
|
end
|
54
55
|
|
55
|
-
desc "prepare_images", I18n.t(:prepare_images, scope: [:worker, :cmd], images_name: Image.resource_name.pluralize, worker_name: Worker.resource_name)
|
56
|
+
desc "prepare_images", I18n.t(:prepare_images, scope: [:resources, :worker, :cmd], images_name: Image.resource_name.pluralize, worker_name: Worker.resource_name)
|
56
57
|
def prepare_images
|
57
58
|
s = load_selection!(Worker)
|
58
59
|
id = s["id"]
|
data/lib/magellan/cli/version.rb
CHANGED
data/lib/magellan/cli.rb
CHANGED
data/magellan-cli.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_runtime_dependency "text-table", "~> 1.2.3"
|
26
26
|
spec.add_runtime_dependency "i18n"
|
27
27
|
spec.add_runtime_dependency "psych", ">= 2.0.0", "<= 2.0.8"
|
28
|
+
spec.add_runtime_dependency "libmagellan", "~> 0.2.2"
|
28
29
|
|
29
30
|
spec.add_development_dependency "bundler", "~> 1.6"
|
30
31
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -0,0 +1,83 @@
|
|
1
|
+
---
|
2
|
+
layout: index
|
3
|
+
breadcrumb: <a href="/">Top</a> / <a href="/reference">Reference</a> / <a href="/reference/magellan-cli">magellan-cli</a> / client_version
|
4
|
+
---
|
5
|
+
|
6
|
+
## Commands
|
7
|
+
|
8
|
+
- [magellan-cli list](#list)
|
9
|
+
- [magellan-cli show [ID]](#show)
|
10
|
+
- [magellan-cli select NAME](#select)
|
11
|
+
- [magellan-cli deselect](#deselect)
|
12
|
+
- [magellan-cli create VERSION](#create)
|
13
|
+
- [magellan-cli delete VERSION](#delete)
|
14
|
+
- [magellan-cli help [COMMAND]](#help)
|
15
|
+
|
16
|
+
## Global Options
|
17
|
+
|
18
|
+
```text
|
19
|
+
Options:
|
20
|
+
-V, [--verbose]
|
21
|
+
-D, [--dryrun]
|
22
|
+
-v, [--version]
|
23
|
+
|
24
|
+
```
|
25
|
+
|
26
|
+
|
27
|
+
## Details
|
28
|
+
### <a name="list"></a>list
|
29
|
+
|
30
|
+
```text
|
31
|
+
magellan-cli list
|
32
|
+
```
|
33
|
+
|
34
|
+
Show a list of the client_versions
|
35
|
+
|
36
|
+
### <a name="show"></a>show
|
37
|
+
|
38
|
+
```text
|
39
|
+
magellan-cli show [ID]
|
40
|
+
```
|
41
|
+
|
42
|
+
Show the detail of the client_version specified by ID
|
43
|
+
|
44
|
+
### <a name="select"></a>select
|
45
|
+
|
46
|
+
```text
|
47
|
+
magellan-cli select NAME
|
48
|
+
```
|
49
|
+
|
50
|
+
Select the client_version by NAME
|
51
|
+
|
52
|
+
### <a name="deselect"></a>deselect
|
53
|
+
|
54
|
+
```text
|
55
|
+
magellan-cli deselect
|
56
|
+
```
|
57
|
+
|
58
|
+
Deselect the client_version
|
59
|
+
|
60
|
+
### <a name="create"></a>create
|
61
|
+
|
62
|
+
```text
|
63
|
+
magellan-cli create VERSION
|
64
|
+
```
|
65
|
+
|
66
|
+
Create a new client_version with VERSION
|
67
|
+
|
68
|
+
### <a name="delete"></a>delete
|
69
|
+
|
70
|
+
```text
|
71
|
+
magellan-cli delete VERSION
|
72
|
+
```
|
73
|
+
|
74
|
+
Delete the client_version specified by VERSION
|
75
|
+
|
76
|
+
### <a name="help"></a>help
|
77
|
+
|
78
|
+
```text
|
79
|
+
magellan-cli help [COMMAND]
|
80
|
+
```
|
81
|
+
|
82
|
+
Describe available commands or one specific command
|
83
|
+
|
@@ -0,0 +1,93 @@
|
|
1
|
+
---
|
2
|
+
layout: index
|
3
|
+
breadcrumb: <a href="/">Top</a> / <a href="/reference">Reference</a> / <a href="/reference/magellan-cli">magellan-cli</a> / cloudsql
|
4
|
+
---
|
5
|
+
|
6
|
+
## Commands
|
7
|
+
|
8
|
+
- [magellan-cli list](#list)
|
9
|
+
- [magellan-cli show [ID]](#show)
|
10
|
+
- [magellan-cli select NAME](#select)
|
11
|
+
- [magellan-cli deselect](#deselect)
|
12
|
+
- [magellan-cli delete NAME](#delete)
|
13
|
+
- [magellan-cli create NAME](#create)
|
14
|
+
- [magellan-cli help [COMMAND]](#help)
|
15
|
+
|
16
|
+
## Global Options
|
17
|
+
|
18
|
+
```text
|
19
|
+
Options:
|
20
|
+
-V, [--verbose]
|
21
|
+
-D, [--dryrun]
|
22
|
+
-v, [--version]
|
23
|
+
|
24
|
+
```
|
25
|
+
|
26
|
+
|
27
|
+
## Details
|
28
|
+
### <a name="list"></a>list
|
29
|
+
|
30
|
+
```text
|
31
|
+
magellan-cli list
|
32
|
+
```
|
33
|
+
|
34
|
+
Show a list of the cloudsqls
|
35
|
+
|
36
|
+
### <a name="show"></a>show
|
37
|
+
|
38
|
+
```text
|
39
|
+
magellan-cli show [ID]
|
40
|
+
```
|
41
|
+
|
42
|
+
Show the detail of the cloudsql specified by ID
|
43
|
+
|
44
|
+
### <a name="select"></a>select
|
45
|
+
|
46
|
+
```text
|
47
|
+
magellan-cli select NAME
|
48
|
+
```
|
49
|
+
|
50
|
+
Select the cloudsql by NAME
|
51
|
+
|
52
|
+
### <a name="deselect"></a>deselect
|
53
|
+
|
54
|
+
```text
|
55
|
+
magellan-cli deselect
|
56
|
+
```
|
57
|
+
|
58
|
+
Deselect the cloudsql
|
59
|
+
|
60
|
+
### <a name="delete"></a>delete
|
61
|
+
|
62
|
+
```text
|
63
|
+
magellan-cli delete NAME
|
64
|
+
```
|
65
|
+
|
66
|
+
Delete the cloudsql specified by NAME
|
67
|
+
|
68
|
+
### <a name="create"></a>create
|
69
|
+
|
70
|
+
```text
|
71
|
+
magellan-cli create NAME
|
72
|
+
```
|
73
|
+
|
74
|
+
```text
|
75
|
+
Options:
|
76
|
+
[-A] # -A async mode. release_now returns soon
|
77
|
+
[-i=N] # -i polling interval(seconds)
|
78
|
+
# Default: 10
|
79
|
+
[-t=N] # -t timeout(seconds)
|
80
|
+
# Default: 600
|
81
|
+
|
82
|
+
```
|
83
|
+
|
84
|
+
Create a new cloudsql database with NAME
|
85
|
+
|
86
|
+
### <a name="help"></a>help
|
87
|
+
|
88
|
+
```text
|
89
|
+
magellan-cli help [COMMAND]
|
90
|
+
```
|
91
|
+
|
92
|
+
Describe available commands or one specific command
|
93
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
---
|
2
|
+
layout: index
|
3
|
+
breadcrumb: <a href="/">Top</a> / <a href="/reference">Reference</a> / <a href="/reference/magellan-cli">magellan-cli</a> / container
|
4
|
+
---
|
5
|
+
|
6
|
+
## Commands
|
7
|
+
|
8
|
+
- [magellan-cli list](#list)
|
9
|
+
- [magellan-cli show [ID]](#show)
|
10
|
+
- [magellan-cli select NAME](#select)
|
11
|
+
- [magellan-cli deselect](#deselect)
|
12
|
+
- [magellan-cli help [COMMAND]](#help)
|
13
|
+
|
14
|
+
## Global Options
|
15
|
+
|
16
|
+
```text
|
17
|
+
Options:
|
18
|
+
-V, [--verbose]
|
19
|
+
-D, [--dryrun]
|
20
|
+
-v, [--version]
|
21
|
+
|
22
|
+
```
|
23
|
+
|
24
|
+
|
25
|
+
## Details
|
26
|
+
### <a name="list"></a>list
|
27
|
+
|
28
|
+
```text
|
29
|
+
magellan-cli list
|
30
|
+
```
|
31
|
+
|
32
|
+
Show a list of the containers
|
33
|
+
|
34
|
+
### <a name="show"></a>show
|
35
|
+
|
36
|
+
```text
|
37
|
+
magellan-cli show [ID]
|
38
|
+
```
|
39
|
+
|
40
|
+
Show the detail of the container specified by ID
|
41
|
+
|
42
|
+
### <a name="select"></a>select
|
43
|
+
|
44
|
+
```text
|
45
|
+
magellan-cli select NAME
|
46
|
+
```
|
47
|
+
|
48
|
+
Select the container by NAME
|
49
|
+
|
50
|
+
### <a name="deselect"></a>deselect
|
51
|
+
|
52
|
+
```text
|
53
|
+
magellan-cli deselect
|
54
|
+
```
|
55
|
+
|
56
|
+
Deselect the container
|
57
|
+
|
58
|
+
### <a name="help"></a>help
|
59
|
+
|
60
|
+
```text
|
61
|
+
magellan-cli help [COMMAND]
|
62
|
+
```
|
63
|
+
|
64
|
+
Describe available commands or one specific command
|
65
|
+
|