magellan-cli 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 021a9cbdd704a2f8940fce12a2ac5edae28b29ef
4
- data.tar.gz: 29ef3da35b7db1fa81b611baadf7aa3b530bb987
3
+ metadata.gz: 6c7d893925c8fc3fd547592488118addd0fada70
4
+ data.tar.gz: b3edf628a1b6574d0dcaba6f5f6fe5b4af7bf44a
5
5
  SHA512:
6
- metadata.gz: 2711d186e8a3e95bade11bf6e5188edbbebafeebc3c3cdf546e594ccedb162a2086e85b57d7f12da9724cd160baf6d207f624d057d56ebc269dda05f057cb7cd
7
- data.tar.gz: 154aa76787b259af995b26f126e072ecbb067566c8597a5103ac4c38a81f67a43144191d47b3366a1da8dc54635538de2e409daa276e67e1f487d3f72356e76b
6
+ metadata.gz: 5f35b29d379c475798dd215020796e8eb19ccee2ac429a9417470acc1b9fa97cb32083511c69ff8a23605ee17f35faf41c2b98468c6c12ad2b7bf73627ce9e33
7
+ data.tar.gz: f00de5c3575a1c580aafc50f2b59e6c58ae08e8e4777b330c5af683c1c5f0232895d71188c43320d63bd270f2dbaa70f462a1269a6617bdfac52cffa9910ace6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- magellan-cli (0.8.2)
4
+ magellan-cli (0.8.3)
5
5
  activesupport (~> 4.1.4)
6
6
  groovenauts-thor
7
7
  httpclient (~> 2.5)
@@ -14,7 +14,7 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- activesupport (4.1.10)
17
+ activesupport (4.1.12)
18
18
  i18n (~> 0.6, >= 0.6.9)
19
19
  json (~> 1.7, >= 1.7.7)
20
20
  minitest (~> 5.1)
@@ -40,15 +40,15 @@ GEM
40
40
  groovenauts-thor (0.19.1.1)
41
41
  httpclient (2.6.0.1)
42
42
  i18n (0.7.0)
43
- json (1.8.2)
44
- jwt (1.4.1)
43
+ json (1.8.3)
44
+ jwt (1.5.1)
45
45
  libmagellan (0.2.4)
46
46
  activesupport
47
47
  mqtt (~> 0.3.1)
48
48
  signet (~> 0.5.0)
49
49
  method_source (0.8.2)
50
50
  mini_portile (0.6.2)
51
- minitest (5.6.1)
51
+ minitest (5.8.0)
52
52
  mqtt (0.3.1)
53
53
  multi_json (1.10.1)
54
54
  multipart-post (2.0.0)
@@ -108,3 +108,6 @@ DEPENDENCIES
108
108
  rake (~> 10.0)
109
109
  rspec
110
110
  simplecov
111
+
112
+ BUNDLED WITH
113
+ 1.10.5
@@ -110,6 +110,7 @@ en:
110
110
  reload: "Reload the last selections"
111
111
  cmd_create:
112
112
  type: "-t development|staging|production. specify Stage Type"
113
+ size: "-s micro|standard. specify Stage Size"
113
114
  cmd_release_now:
114
115
  async: "-A async mode. release_now returns soon"
115
116
  interval: "-i polling interval(seconds)"
@@ -107,7 +107,8 @@ ja:
107
107
  set_container_num: "選択された%{image_name}の%{containers_name}の数を設定します"
108
108
  reload: "最後にselectされたものをロードし直します"
109
109
  cmd_create:
110
- type: "-t development|staging|production いづれかのTYPEを指定してください"
110
+ type: "-t development|staging|production いずれかのTYPEを指定してください"
111
+ size: "-s micro|standard. いずれがのSIZEを指定してください"
111
112
  cmd_release_now:
112
113
  async: "-A 非同期モード。リリースの終了を待たずにコマンドを終了します"
113
114
  interval: "-i 状態を取得する間隔を秒で指定します"
@@ -19,17 +19,23 @@ module Magellan
19
19
 
20
20
  desc "create NAME [-t development|staging|production]", I18n.t(:create, scope: [:resources, :stage, :cmd], resource_name: resource_name)
21
21
  option :t, type: :string, default: "development", desc: I18n.t(:type, scope: [:resources, :stage, :cmd_create])
22
+ option :s, type: :string, default: "micro" , desc: I18n.t(:size, scope: [:resources, :stage, :cmd_create])
22
23
  def create(name)
23
24
  type = options["t"]
24
25
  unless %w{ development staging production }.include?(type)
25
26
  raise "Unknown Stage Type #{type}"
26
27
  end
28
+ size = options["s"]
29
+ unless %w{ micro standard }.include?(size)
30
+ raise "Unknown Stage Size #{size}"
31
+ end
27
32
  proj = load_selection!(Project)
28
33
  params = {
29
34
  parameter_name => {
30
35
  "project_id" => proj["id"],
31
36
  "name" => name,
32
37
  "stage_type" => type,
38
+ "stage_size" => size,
33
39
  }
34
40
  }
35
41
  post_json("/admin/#{resource_key}/new.json", params)
@@ -1,5 +1,5 @@
1
1
  module Magellan
2
2
  module Cli
3
- VERSION = "0.8.2"
3
+ VERSION = "0.8.3"
4
4
  end
5
5
  end
@@ -0,0 +1,54 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe Magellan::Cli::Resources::Stage do
5
+
6
+ let(:cmd){ Magellan::Cli::Resources::Stage.new }
7
+
8
+ let(:http_conn){ double(:http_conn, :check_login_auth! => nil) }
9
+ before{ allow(cmd).to receive(:http_conn).and_return(http_conn) }
10
+
11
+ let(:proj1_json) do
12
+ {"id" => 1, "label" => "DefaultProject1"}
13
+ end
14
+ let(:stage1_json) do
15
+ {
16
+ "id" => 1, "project_id" => 1, "nebula_id" => 1, "name" => "DefaultStage1",
17
+ "stage_size" => "1",
18
+ "stage_type" => "1",
19
+ "status" => "1", "authentication" => true,
20
+ "created_at" => "2015-08-13T08:39:21.000Z", "updated_at" => "2015-08-13T08:39:21.000Z",
21
+ "max_worker_count" => 1, "max_container_count" => 5, "container_num" => 0,
22
+ "release_job_status" => nil,
23
+ "last_released_at" => nil, "can_update" => true, "can_delete" => true
24
+ }
25
+ end
26
+
27
+ describe :list do
28
+ before do
29
+ expect(cmd).to receive(:get_json).with("/admin/stage~title.json").and_return([stage1_json])
30
+ expect(cmd).to receive(:get_json).with("/admin/project.json", {"compact"=>true}).and_return([proj1_json])
31
+ expect($stdout).to receive(:puts)
32
+ end
33
+ it do
34
+ cmd.list
35
+ end
36
+ end
37
+
38
+ describe :create do
39
+ let(:stage_name){ "Stage2" }
40
+ let(:organization_list_response) { [ { "id" => 1, "label" => "Stage1" } ] }
41
+ before do
42
+ expect(cmd).to receive(:post_json).
43
+ with("/admin/stage~title/new.json", {"stage_title" => {"project_id"=>1,"name"=>stage_name, "stage_type"=>"development", "stage_size"=>"standard" }})
44
+ allow(cmd).to receive(:get_json).with(any_args).and_return(organization_list_response)
45
+ allow(cmd).to receive(:load_selection!).and_return(proj1_json)
46
+ allow(cmd).to receive(:select).with(stage_name)
47
+ end
48
+ it do
49
+ cmd.options = {"t" => "development", "s" => "standard"}
50
+ cmd.create(stage_name)
51
+ end
52
+ end
53
+
54
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magellan-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - akm2000
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-24 00:00:00.000000000 Z
11
+ date: 2015-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -267,6 +267,7 @@ files:
267
267
  - spec/magellan/cli/resources/magellan-cli_test.yml
268
268
  - spec/magellan/cli/resources/organization_spec.rb
269
269
  - spec/magellan/cli/resources/project_spec.rb
270
+ - spec/magellan/cli/resources/stage_spec.rb
270
271
  - spec/magellan/cli/resources/team_spec.rb
271
272
  - spec/magellan/cli/resources/worker_spec.rb
272
273
  - spec/magellan/cli/script_spec.rb
@@ -316,6 +317,7 @@ test_files:
316
317
  - spec/magellan/cli/resources/magellan-cli_test.yml
317
318
  - spec/magellan/cli/resources/organization_spec.rb
318
319
  - spec/magellan/cli/resources/project_spec.rb
320
+ - spec/magellan/cli/resources/stage_spec.rb
319
321
  - spec/magellan/cli/resources/team_spec.rb
320
322
  - spec/magellan/cli/resources/worker_spec.rb
321
323
  - spec/magellan/cli/script_spec.rb