fog 0.2.14 → 0.2.15
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.
- data/fog.gemspec +7 -2
- data/lib/fog.rb +1 -1
- data/lib/fog/linode.rb +5 -0
- data/lib/fog/linode/requests/avail_distributions.rb +1 -1
- data/lib/fog/linode/requests/avail_kernels.rb +1 -1
- data/lib/fog/linode/requests/avail_stackscripts.rb +35 -0
- data/lib/fog/linode/requests/linode_create.rb +39 -0
- data/lib/fog/linode/requests/linode_delete.rb +34 -0
- data/lib/fog/linode/requests/linode_list.rb +33 -0
- data/lib/fog/linode/requests/linode_reboot.rb +34 -0
- data/lib/fog/rackspace/files.rb +2 -2
- data/lib/fog/rackspace/models/files/files.rb +1 -1
- data/spec/rackspace/requests/files/get_container_spec.rb +4 -2
- metadata +8 -3
    
        data/fog.gemspec
    CHANGED
    
    | @@ -7,8 +7,8 @@ Gem::Specification.new do |s| | |
| 7 7 | 
             
              ## If your rubyforge_project name is different, then edit it and comment out
         | 
| 8 8 | 
             
              ## the sub! line in the Rakefile
         | 
| 9 9 | 
             
              s.name              = 'fog'
         | 
| 10 | 
            -
              s.version           = '0.2. | 
| 11 | 
            -
              s.date              = '2010-07- | 
| 10 | 
            +
              s.version           = '0.2.15'
         | 
| 11 | 
            +
              s.date              = '2010-07-17'
         | 
| 12 12 | 
             
              s.rubyforge_project = 'fog'
         | 
| 13 13 |  | 
| 14 14 | 
             
              ## Make sure your summary is short. The description may be as long
         | 
| @@ -242,6 +242,11 @@ Gem::Specification.new do |s| | |
| 242 242 | 
             
                lib/fog/linode/requests/avail_distributions.rb
         | 
| 243 243 | 
             
                lib/fog/linode/requests/avail_kernels.rb
         | 
| 244 244 | 
             
                lib/fog/linode/requests/avail_linodeplans.rb
         | 
| 245 | 
            +
                lib/fog/linode/requests/avail_stackscripts.rb
         | 
| 246 | 
            +
                lib/fog/linode/requests/linode_create.rb
         | 
| 247 | 
            +
                lib/fog/linode/requests/linode_delete.rb
         | 
| 248 | 
            +
                lib/fog/linode/requests/linode_list.rb
         | 
| 249 | 
            +
                lib/fog/linode/requests/linode_reboot.rb
         | 
| 245 250 | 
             
                lib/fog/local.rb
         | 
| 246 251 | 
             
                lib/fog/local/bin.rb
         | 
| 247 252 | 
             
                lib/fog/local/models/directories.rb
         | 
    
        data/lib/fog.rb
    CHANGED
    
    
    
        data/lib/fog/linode.rb
    CHANGED
    
    | @@ -11,6 +11,11 @@ module Fog | |
| 11 11 | 
             
                request 'avail_distributions'
         | 
| 12 12 | 
             
                request 'avail_kernels'
         | 
| 13 13 | 
             
                request 'avail_linodeplans'
         | 
| 14 | 
            +
                request 'avail_stackscripts'
         | 
| 15 | 
            +
                request 'linode_create'
         | 
| 16 | 
            +
                request 'linode_delete'
         | 
| 17 | 
            +
                request 'linode_list'
         | 
| 18 | 
            +
                request 'linode_reboot'
         | 
| 14 19 |  | 
| 15 20 | 
             
                class Mock
         | 
| 16 21 | 
             
                  include Collections
         | 
| @@ -0,0 +1,35 @@ | |
| 1 | 
            +
            module Fog
         | 
| 2 | 
            +
              module Linode
         | 
| 3 | 
            +
                class Real
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                  # Get available stack scripts
         | 
| 6 | 
            +
                  #
         | 
| 7 | 
            +
                  # ==== Parameters
         | 
| 8 | 
            +
                  # * options<~Hash>:
         | 
| 9 | 
            +
                  #   * distributionId<~Integer>: Limit the results to Stackscripts that can be applied to this distribution id
         | 
| 10 | 
            +
                  #   * distributionVendor<~String>: Debian, Ubuntu, Fedora, etc.
         | 
| 11 | 
            +
                  #   * keywords<~String>: Search terms
         | 
| 12 | 
            +
                  #
         | 
| 13 | 
            +
                  # ==== Returns
         | 
| 14 | 
            +
                  # * response<~Excon::Response>:
         | 
| 15 | 
            +
                  #   * body<~Array>:
         | 
| 16 | 
            +
                  # TODO: docs
         | 
| 17 | 
            +
                  def avail_stackscripts(options={})
         | 
| 18 | 
            +
                    request(
         | 
| 19 | 
            +
                      :expects  => 200,
         | 
| 20 | 
            +
                      :method   => 'GET',
         | 
| 21 | 
            +
                      :query    => { :api_action => 'avail.stackscripts' }.merge!(options)
         | 
| 22 | 
            +
                    )
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                class Mock
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  def avail_stackscripts(options={})
         | 
| 30 | 
            +
                    Fog::Mock.not_implemented
         | 
| 31 | 
            +
                  end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
            end
         | 
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            module Fog
         | 
| 2 | 
            +
              module Linode
         | 
| 3 | 
            +
                class Real
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                  # Creates a linode and assigns you full privileges
         | 
| 6 | 
            +
                  #
         | 
| 7 | 
            +
                  # ==== Parameters
         | 
| 8 | 
            +
                  # * datacenter_id<~Integer>: id of datacenter to place new linode in
         | 
| 9 | 
            +
                  # * payment_term<~Integer>: Subscription term in months, in [1, 12, 24]
         | 
| 10 | 
            +
                  # * plan_id<~Integer>: id of plan to boot new linode with
         | 
| 11 | 
            +
                  #
         | 
| 12 | 
            +
                  # ==== Returns
         | 
| 13 | 
            +
                  # * response<~Excon::Response>:
         | 
| 14 | 
            +
                  #   * body<~Array>:
         | 
| 15 | 
            +
                  # TODO: docs
         | 
| 16 | 
            +
                  def linode_create(datacenter_id, payment_term, plan_id)
         | 
| 17 | 
            +
                    request(
         | 
| 18 | 
            +
                      :expects  => 200,
         | 
| 19 | 
            +
                      :method   => 'GET',
         | 
| 20 | 
            +
                      :query    => {
         | 
| 21 | 
            +
                        :api_action   => 'linode.create',
         | 
| 22 | 
            +
                        :datacenterId => datacenter_id,
         | 
| 23 | 
            +
                        :paymentTerm  => payment_term,
         | 
| 24 | 
            +
                        :planId       => plan_id
         | 
| 25 | 
            +
                      }
         | 
| 26 | 
            +
                    )
         | 
| 27 | 
            +
                  end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                class Mock
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  def linode_create(datacenter_id, payment_term, plan_id)
         | 
| 34 | 
            +
                    Fog::Mock.not_implemented
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
            end
         | 
| @@ -0,0 +1,34 @@ | |
| 1 | 
            +
            module Fog
         | 
| 2 | 
            +
              module Linode
         | 
| 3 | 
            +
                class Real
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                  # List all linodes user has access or delete to
         | 
| 6 | 
            +
                  #
         | 
| 7 | 
            +
                  # ==== Parameters
         | 
| 8 | 
            +
                  # * linode_id<~Integer>: id of linode to delete
         | 
| 9 | 
            +
                  # * options<~Hash>:
         | 
| 10 | 
            +
                  #   * skipChecks<~Boolean>: skips safety checks and always deletes
         | 
| 11 | 
            +
                  #
         | 
| 12 | 
            +
                  # ==== Returns
         | 
| 13 | 
            +
                  # * response<~Excon::Response>:
         | 
| 14 | 
            +
                  #   * body<~Array>:
         | 
| 15 | 
            +
                  # TODO: docs
         | 
| 16 | 
            +
                  def linode_delete(linode_id, options={})
         | 
| 17 | 
            +
                    request(
         | 
| 18 | 
            +
                      :expects  => 200,
         | 
| 19 | 
            +
                      :method   => 'GET',
         | 
| 20 | 
            +
                      :query    => { :api_action => 'linode.delete', :linodeId => linode_id }.merge!(options)
         | 
| 21 | 
            +
                    )
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                class Mock
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  def linode_delete(linode_id, options={})
         | 
| 29 | 
            +
                    Fog::Mock.not_implemented
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
              end
         | 
| 34 | 
            +
            end
         | 
| @@ -0,0 +1,33 @@ | |
| 1 | 
            +
            module Fog
         | 
| 2 | 
            +
              module Linode
         | 
| 3 | 
            +
                class Real
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                  # List all linodes user has access or delete to
         | 
| 6 | 
            +
                  #
         | 
| 7 | 
            +
                  # ==== Parameters
         | 
| 8 | 
            +
                  # * options<~Hash>:
         | 
| 9 | 
            +
                  #   * linodeId<~Integer>: Limit the list to the specified LinodeID
         | 
| 10 | 
            +
                  #
         | 
| 11 | 
            +
                  # ==== Returns
         | 
| 12 | 
            +
                  # * response<~Excon::Response>:
         | 
| 13 | 
            +
                  #   * body<~Array>:
         | 
| 14 | 
            +
                  # TODO: docs
         | 
| 15 | 
            +
                  def linode_list(options={})
         | 
| 16 | 
            +
                    request(
         | 
| 17 | 
            +
                      :expects  => 200,
         | 
| 18 | 
            +
                      :method   => 'GET',
         | 
| 19 | 
            +
                      :query    => { :api_action => 'linode.list' }.merge!(options)
         | 
| 20 | 
            +
                    )
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                class Mock
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  def linode_list(options={})
         | 
| 28 | 
            +
                    Fog::Mock.not_implemented
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
            end
         | 
| @@ -0,0 +1,34 @@ | |
| 1 | 
            +
            module Fog
         | 
| 2 | 
            +
              module Linode
         | 
| 3 | 
            +
                class Real
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                  # Issues a shutdown, and then a boot job for a given linode
         | 
| 6 | 
            +
                  #
         | 
| 7 | 
            +
                  # ==== Parameters
         | 
| 8 | 
            +
                  # * linode_id<~Integer>: id of linode to reboot
         | 
| 9 | 
            +
                  # * options<~Hash>:
         | 
| 10 | 
            +
                  #   * configId<~Boolean>: id of config to boot server with
         | 
| 11 | 
            +
                  #
         | 
| 12 | 
            +
                  # ==== Returns
         | 
| 13 | 
            +
                  # * response<~Excon::Response>:
         | 
| 14 | 
            +
                  #   * body<~Array>:
         | 
| 15 | 
            +
                  # TODO: docs
         | 
| 16 | 
            +
                  def linode_reboot(linode_id, options={})
         | 
| 17 | 
            +
                    request(
         | 
| 18 | 
            +
                      :expects  => 200,
         | 
| 19 | 
            +
                      :method   => 'GET',
         | 
| 20 | 
            +
                      :query    => { :api_action => 'linode.reboot', :linodeId => linode_id }.merge!(options)
         | 
| 21 | 
            +
                    )
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                class Mock
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  def linode_reboot(linode_id, options={})
         | 
| 29 | 
            +
                    Fog::Mock.not_implemented
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
              end
         | 
| 34 | 
            +
            end
         | 
    
        data/lib/fog/rackspace/files.rb
    CHANGED
    
    | @@ -107,7 +107,7 @@ module Fog | |
| 107 107 | 
             
                        :host     => @cdn_host,
         | 
| 108 108 | 
             
                        :path     => "#{@cdn_path}/#{params[:path]}",
         | 
| 109 109 | 
             
                      }))
         | 
| 110 | 
            -
                       | 
| 110 | 
            +
                      if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
         | 
| 111 111 | 
             
                        response.body = JSON.parse(response.body)
         | 
| 112 112 | 
             
                      end
         | 
| 113 113 | 
             
                      response
         | 
| @@ -122,7 +122,7 @@ module Fog | |
| 122 122 | 
             
                        :host     => @storage_host,
         | 
| 123 123 | 
             
                        :path     => "#{@storage_path}/#{params[:path]}",
         | 
| 124 124 | 
             
                      }), &block)
         | 
| 125 | 
            -
                      if !response.body.empty? && parse_json && response.headers['Content-Type']  | 
| 125 | 
            +
                      if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
         | 
| 126 126 | 
             
                        response.body = JSON.parse(response.body)
         | 
| 127 127 | 
             
                      end
         | 
| 128 128 | 
             
                      response
         | 
| @@ -25,8 +25,10 @@ describe 'Rackspace::Files.get_container' do | |
| 25 25 | 
             
              end
         | 
| 26 26 | 
             
              describe 'failure' do
         | 
| 27 27 |  | 
| 28 | 
            -
                it "should  | 
| 29 | 
            -
                   | 
| 28 | 
            +
                it "should raise a NotFound error if the container does not exist" do
         | 
| 29 | 
            +
                  lambda do
         | 
| 30 | 
            +
                    Rackspace[:files].get_container('container_name')
         | 
| 31 | 
            +
                  end.should raise_error(Excon::Errors::NotFound)
         | 
| 30 32 | 
             
                end
         | 
| 31 33 |  | 
| 32 34 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version | |
| 5 5 | 
             
              segments: 
         | 
| 6 6 | 
             
              - 0
         | 
| 7 7 | 
             
              - 2
         | 
| 8 | 
            -
              -  | 
| 9 | 
            -
              version: 0.2. | 
| 8 | 
            +
              - 15
         | 
| 9 | 
            +
              version: 0.2.15
         | 
| 10 10 | 
             
            platform: ruby
         | 
| 11 11 | 
             
            authors: 
         | 
| 12 12 | 
             
            - geemus (Wesley Beary)
         | 
| @@ -14,7 +14,7 @@ autorequire: | |
| 14 14 | 
             
            bindir: bin
         | 
| 15 15 | 
             
            cert_chain: []
         | 
| 16 16 |  | 
| 17 | 
            -
            date: 2010-07- | 
| 17 | 
            +
            date: 2010-07-17 00:00:00 -05:00
         | 
| 18 18 | 
             
            default_executable: fog
         | 
| 19 19 | 
             
            dependencies: 
         | 
| 20 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -331,6 +331,11 @@ files: | |
| 331 331 | 
             
            - lib/fog/linode/requests/avail_distributions.rb
         | 
| 332 332 | 
             
            - lib/fog/linode/requests/avail_kernels.rb
         | 
| 333 333 | 
             
            - lib/fog/linode/requests/avail_linodeplans.rb
         | 
| 334 | 
            +
            - lib/fog/linode/requests/avail_stackscripts.rb
         | 
| 335 | 
            +
            - lib/fog/linode/requests/linode_create.rb
         | 
| 336 | 
            +
            - lib/fog/linode/requests/linode_delete.rb
         | 
| 337 | 
            +
            - lib/fog/linode/requests/linode_list.rb
         | 
| 338 | 
            +
            - lib/fog/linode/requests/linode_reboot.rb
         | 
| 334 339 | 
             
            - lib/fog/local.rb
         | 
| 335 340 | 
             
            - lib/fog/local/bin.rb
         | 
| 336 341 | 
             
            - lib/fog/local/models/directories.rb
         |