gcloud-cli 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWU0MTc5NjY1ZmRkOWQzZDFlZmVjNjg0ODk1ZDNiZjIyYTYzZmU0Yw==
4
+ ODljODE0N2FlODNkZmZiN2Y0OTAwNDAyZmQzZjNlM2Y3MGRkNDhhYQ==
5
5
  data.tar.gz: !binary |-
6
- NjUyNDY4NGZhZTRjNTNkNjBlNGE1MzgxM2ZmMzg4NmFiYWNmZTI5MQ==
6
+ MjcyOGRjNmUyMDk5ZDg5MTM0YTRmNDNlM2JmYjBmMDIxNGVkYzViMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MTA5MTMzZTJkNTlmNDNkYjFkODg5ZjM0YmNjZDMwZTgxMGRkMDE2MjA4YzAw
10
- ZTE1MDE5NDk2NGM4ZjQ4NzE5ODI4ZTFmNWYyOWJjNzFjZjg2OTdlOGUyNmRi
11
- YWZmMTk5YTUyZWU3Njk2MGI0Yjc2ZTU1OWRlMTZmYzI1ODc4ZjY=
9
+ N2E4MzQ2NDEwMGYwYzliMGEyYjIyYWIwZWE3MDY5OGZmNDVhZjczY2Y1MWYx
10
+ NzgzZmJkYTk1MDBjNjUzY2Y1MWRmNTRkYjMxZWY4YTkzNzYwYjA2NDAyMTE5
11
+ YzU5NjllMGVmNjE0MjI4NDc5MWMxYjIzOWRmYzMyZDY5YjJiMzQ=
12
12
  data.tar.gz: !binary |-
13
- MTVhYjJkMWRiNDA0YTMxMDE2ZmYyOTk3NzdhZWUyY2Y0MmQxNTg2YTQ3NDZk
14
- ODg0MzE3Zjg0ZjFmODE1NGNjNTQ5OTNlYzUzYTUyMDQ1ODJmZjA2NDZjN2Mx
15
- YTNkMGE1M2Q5OGRiNzdlYzk5Nzc0NzM5OTY3NDQ3N2RlOGM0ZWE=
13
+ NjJmM2EwNmM1MDEwMjNkZmYzNDdmMDM1MTYxN2QxMjhmYWIzM2VmYzU1NTQy
14
+ ZWMxOGUyZTZiMzU5OGRhODBkNGVjNTk1N2VmODJhNTNkMDE1NmE3NjVhMzAx
15
+ YjhjM2MxNDY3ZGNkMTYzN2Y1MTczM2I3OTQwNmVlZTc1Nzk2YTI=
@@ -8,7 +8,14 @@ module Gcloud
8
8
 
9
9
  def create_gorgon_cluster
10
10
  config = ConfigRepository.find_or_create
11
- RestClient.post(config.url, api_key: config.api_key)
11
+ result = JSON[RestClient.post(config.create_cluster_url, api_key: config.api_key)]
12
+
13
+ { cluster_id: result['cluster_id'] }
14
+ end
15
+
16
+ def release_gorgon_cluster(cluster_id)
17
+ config = ConfigRepository.find_or_create
18
+ RestClient.post(config.release_cluster_url(cluster_id), api_key: config.api_key)
12
19
  end
13
20
  end
14
21
  end
@@ -0,0 +1,11 @@
1
+ module Gcloud::Cli
2
+ Config = Struct.new(:url, :api_key) do
3
+ def create_cluster_url
4
+ "#{url}/clusters"
5
+ end
6
+
7
+ def release_cluster_url(cluster_id)
8
+ "#{url}/clusters/#{cluster_id}/release"
9
+ end
10
+ end
11
+ end
@@ -1,13 +1,13 @@
1
1
  require 'yaml'
2
2
  require 'highline/import'
3
+ require 'gcloud/cli/config'
3
4
 
4
5
  module Gcloud::Cli
5
- Config = Struct.new(:url, :api_key)
6
6
  module ConfigRepository
7
7
  extend self
8
8
 
9
9
  # MY_NOTE: change this when we get gcloud url
10
- DEFAULT_URL = 'http://localhost:3000/clusters'
10
+ DEFAULT_URL = 'http://localhost:3000'
11
11
  CONFIG_FILE = ENV['HOME'] + '/.gcloud'
12
12
 
13
13
  def find_or_create
@@ -1,5 +1,5 @@
1
1
  module Gcloud
2
2
  module Cli
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -8,9 +8,18 @@ module Gcloud::Cli
8
8
  it "loads config and posts request" do
9
9
  allow(ConfigRepository).to receive(:load).and_return(Config.new(url, api_key))
10
10
 
11
- expect(RestClient).to receive(:post).with(url, api_key: api_key)
11
+ expect(RestClient).to receive(:post).with("#{url}/clusters", api_key: api_key).
12
+ and_return(JSON[cluster_id: 'a-cluster-id'])
12
13
 
13
- Gcloud::Cli.create_gorgon_cluster
14
+ expect(Gcloud::Cli.create_gorgon_cluster).to eq({cluster_id: 'a-cluster-id'})
15
+ end
16
+
17
+ it "posts relases cluster request" do
18
+ allow(ConfigRepository).to receive(:load).and_return(Config.new(url, api_key))
19
+
20
+ expect(RestClient).to receive(:post).with("#{url}/clusters/cluster_1/release", api_key: api_key)
21
+
22
+ Gcloud::Cli.release_gorgon_cluster("cluster_1")
14
23
  end
15
24
  end
16
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gcloud-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arturo Pie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-23 00:00:00.000000000 Z
11
+ date: 2015-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -109,6 +109,7 @@ files:
109
109
  - Rakefile
110
110
  - gcloud-cli.gemspec
111
111
  - lib/gcloud/cli.rb
112
+ - lib/gcloud/cli/config.rb
112
113
  - lib/gcloud/cli/config_repository.rb
113
114
  - lib/gcloud/cli/version.rb
114
115
  - spec/cli_spec.rb