vagrant_cloud 0.2.3 → 0.3.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 +4 -4
- data/lib/vagrant_cloud/account.rb +10 -5
- data/lib/vagrant_cloud/box.rb +10 -2
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: dcdd9dd3b5ac00bf1add77d8a837f727c61c0041
         | 
| 4 | 
            +
              data.tar.gz: 2bd31b671ba202ca7b2cbba4a06e767949732b95
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 72b0c2dbc26b450f46df0eb47111ea80742e4890a1ff143cb7e9ad03c724e499368c69eb5d4c4378a851261bd948801d2d928f9ccd97633a40e4c04de5ef7d8a
         | 
| 7 | 
            +
              data.tar.gz: 9b11a23883516758c7da2f4f0f851ea270030a9c4b128d62260f7503005835bbcf8b06cbf693b065197331a6d84d9713785da6a4d178e2d7e1bc0f849e1ba6a5
         | 
| @@ -14,24 +14,29 @@ module VagrantCloud | |
| 14 14 | 
             
                  Box.new(self, name, data)
         | 
| 15 15 | 
             
                end
         | 
| 16 16 |  | 
| 17 | 
            -
                def create_box(name, description = nil)
         | 
| 17 | 
            +
                def create_box(name, description = nil, is_private = false)
         | 
| 18 18 | 
             
                  params = {:name => name}
         | 
| 19 19 | 
             
                  params[:description] = description if description
         | 
| 20 20 | 
             
                  params[:short_description] = description if description
         | 
| 21 | 
            +
                  params[:is_private] = is_private ? 1 : 0
         | 
| 21 22 | 
             
                  data = request('post', '/boxes', {:box => params})
         | 
| 22 23 | 
             
                  get_box(name, data)
         | 
| 23 24 | 
             
                end
         | 
| 24 25 |  | 
| 25 | 
            -
                def ensure_box(name, description = nil)
         | 
| 26 | 
            +
                def ensure_box(name, description = nil, is_private = nil)
         | 
| 26 27 | 
             
                  begin
         | 
| 27 28 | 
             
                    box = get_box(name)
         | 
| 28 29 | 
             
                    box.data
         | 
| 29 30 | 
             
                  rescue RestClient::ResourceNotFound => e
         | 
| 30 | 
            -
                    box = create_box(name, description)
         | 
| 31 | 
            +
                    box = create_box(name, description, is_private)
         | 
| 31 32 | 
             
                  end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 33 | 
            +
             | 
| 34 | 
            +
                  updated_description = (!description.nil? && (description != box.description || description != box.description_short))
         | 
| 35 | 
            +
                  updated_private = (!is_private.nil? && (is_private != box.private))
         | 
| 36 | 
            +
                  if updated_description || updated_private
         | 
| 37 | 
            +
                    box.update(description, is_private)
         | 
| 34 38 | 
             
                  end
         | 
| 39 | 
            +
             | 
| 35 40 | 
             
                  box
         | 
| 36 41 | 
             
                end
         | 
| 37 42 |  | 
    
        data/lib/vagrant_cloud/box.rb
    CHANGED
    
    | @@ -20,6 +20,10 @@ module VagrantCloud | |
| 20 20 | 
             
                  data['short_description']
         | 
| 21 21 | 
             
                end
         | 
| 22 22 |  | 
| 23 | 
            +
                def private
         | 
| 24 | 
            +
                  data['private']
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
             | 
| 23 27 | 
             
                def versions
         | 
| 24 28 | 
             
                  version_list = data['versions'].map { |data| Version.new(self, data['number'], data) }
         | 
| 25 29 | 
             
                  version_list.sort_by { |version| Gem::Version.new(version.number) }
         | 
| @@ -29,8 +33,12 @@ module VagrantCloud | |
| 29 33 | 
             
                  @data ||= account.request('get', "/box/#{account.username}/#{name}")
         | 
| 30 34 | 
             
                end
         | 
| 31 35 |  | 
| 32 | 
            -
                def update(description)
         | 
| 33 | 
            -
                  box = { | 
| 36 | 
            +
                def update(description, is_private)
         | 
| 37 | 
            +
                  box = {
         | 
| 38 | 
            +
                    :short_description => description,
         | 
| 39 | 
            +
                    :description => description,
         | 
| 40 | 
            +
                    :is_private => is_private,
         | 
| 41 | 
            +
                  }
         | 
| 34 42 | 
             
                  @data = account.request('put', "/box/#{account.username}/#{name}", {:box => box})
         | 
| 35 43 | 
             
                end
         | 
| 36 44 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: vagrant_cloud
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Cargo Media
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015- | 
| 11 | 
            +
            date: 2015-06-30 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rest-client
         | 
| @@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 71 71 | 
             
                  version: '0'
         | 
| 72 72 | 
             
            requirements: []
         | 
| 73 73 | 
             
            rubyforge_project: 
         | 
| 74 | 
            -
            rubygems_version: 2.4. | 
| 74 | 
            +
            rubygems_version: 2.4.6
         | 
| 75 75 | 
             
            signing_key: 
         | 
| 76 76 | 
             
            specification_version: 4
         | 
| 77 77 | 
             
            summary: Vagrant Cloud API wrapper
         |