gcloud-cli 0.0.1 → 0.1.0
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.
- checksums.yaml +8 -8
- data/lib/gcloud/cli.rb +8 -1
- data/lib/gcloud/cli/config.rb +11 -0
- data/lib/gcloud/cli/config_repository.rb +2 -2
- data/lib/gcloud/cli/version.rb +1 -1
- data/spec/cli_spec.rb +11 -2
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                ODljODE0N2FlODNkZmZiN2Y0OTAwNDAyZmQzZjNlM2Y3MGRkNDhhYQ==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                MjcyOGRjNmUyMDk5ZDg5MTM0YTRmNDNlM2JmYjBmMDIxNGVkYzViMg==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                N2E4MzQ2NDEwMGYwYzliMGEyYjIyYWIwZWE3MDY5OGZmNDVhZjczY2Y1MWYx
         | 
| 10 | 
            +
                NzgzZmJkYTk1MDBjNjUzY2Y1MWRmNTRkYjMxZWY4YTkzNzYwYjA2NDAyMTE5
         | 
| 11 | 
            +
                YzU5NjllMGVmNjE0MjI4NDc5MWMxYjIzOWRmYzMyZDY5YjJiMzQ=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                NjJmM2EwNmM1MDEwMjNkZmYzNDdmMDM1MTYxN2QxMjhmYWIzM2VmYzU1NTQy
         | 
| 14 | 
            +
                ZWMxOGUyZTZiMzU5OGRhODBkNGVjNTk1N2VmODJhNTNkMDE1NmE3NjVhMzAx
         | 
| 15 | 
            +
                YjhjM2MxNDY3ZGNkMTYzN2Y1MTczM2I3OTQwNmVlZTc1Nzk2YTI=
         | 
    
        data/lib/gcloud/cli.rb
    CHANGED
    
    | @@ -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. | 
| 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
         | 
| @@ -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 | 
| 10 | 
            +
                DEFAULT_URL = 'http://localhost:3000'
         | 
| 11 11 | 
             
                CONFIG_FILE = ENV['HOME'] + '/.gcloud'
         | 
| 12 12 |  | 
| 13 13 | 
             
                def find_or_create
         | 
    
        data/lib/gcloud/cli/version.rb
    CHANGED
    
    
    
        data/spec/cli_spec.rb
    CHANGED
    
    | @@ -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 | 
| 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 | 
| 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
         |