Skip to content

Commit

Permalink
merged with upstream master
Browse files Browse the repository at this point in the history
  • Loading branch information
pastorius committed Nov 16, 2012
2 parents b65167e + 4aa1441 commit 44c5c6e
Show file tree
Hide file tree
Showing 170 changed files with 2,707 additions and 882 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Expand Up @@ -6,17 +6,17 @@
.bundle
.DS_Store
.idea
.yardoc
/tests/.fog
bin/*
!bin/fog
!bin/rdoc
.fog
coverage
doc/*
docs/_site/*
docs/about/supported_services.markdown
Gemfile.lock
rdoc
yardoc
pkg
spec/credentials.yml
vendor/*
17 changes: 8 additions & 9 deletions README.md
Expand Up @@ -7,6 +7,7 @@ fog is the Ruby cloud computing library, top to bottom:
* Mocks make testing and integrating a breeze.

[![Build Status](https://secure.travis-ci.org/fog/fog.png?branch=master)](http://travis-ci.org/fog/fog)
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/fog/fog)

## Getting Started

Expand Down Expand Up @@ -112,23 +113,21 @@ geemus says: "That should give you everything you need to get started, but let m

## Contributing

* Find something you would like to work on. For suggestions look for the `easy`, `medium` and `hard` tags in the [issues](https://github.com/fog/fog/issues)
* Find something you would like to work on.
* Look for anything you can help with in the [issue tracker](https://github.com/fog/fog/issues).
* Look at the [code quality metrics](https://codeclimate.com/github/fog/fog) for anything you can help clean up.
* Or anything else!
* Fork the project and do your work in a topic branch.
* Add a config at `~/.fog` for the component you want to test.
* Make sure your changes will work on both Ruby 1.8.7 and Ruby 1.9
* Add a config at `tests/.fog` for the component you want to test.
* Add shindo tests to prove your code works and run all the tests using `bundle exec rake`.
* Rebase your branch against fog/fog to make sure everything is up to date.
* Rebase your branch against `fog/fog` to make sure everything is up to date.
* Commit your changes and send a pull request.

## Additional Resources

[fog.io](http://fog.io)

## Sponsorship

![Engine Yard](http://www.engineyard.com/images/logo.png)

All new work on fog is sponsored by [Engine Yard](http://engineyard.com)

## Copyright

(The MIT License)
Expand Down
37 changes: 18 additions & 19 deletions Rakefile
@@ -1,8 +1,8 @@
require 'bundler/setup'
require 'date'
require 'rubygems'
require 'rdoc/task'
require 'rubygems/package_task'
require 'yard'
require File.dirname(__FILE__) + '/lib/fog'

#############################################################################
Expand Down Expand Up @@ -116,14 +116,6 @@ task :nuke do
end
end

require 'rdoc/task'
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "#{name} #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end

desc "Open an irb session preloaded with this library"
task :console do
sh "irb -rubygems -r ./lib/#{name}.rb"
Expand Down Expand Up @@ -182,6 +174,13 @@ task :validate do
end
end

# Include Yard tasks for rake yard
YARDOC_LOCATION = "doc"
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb', "README"]
t.options = ["--output-dir", YARDOC_LOCATION, "--title", "#{name} #{version}"]
end

task :changelog do
timestamp = Time.now.utc.strftime('%m/%d/%Y')
sha = `git log | head -1`.split(' ').last
Expand Down Expand Up @@ -271,7 +270,7 @@ end
task :docs do
Rake::Task[:supported_services_docs].invoke
Rake::Task[:upload_fog_io].invoke
Rake::Task[:upload_rdoc].invoke
Rake::Task[:upload_yardoc].invoke

# connect to storage provider
Fog.credential = :geemus
Expand Down Expand Up @@ -397,18 +396,18 @@ task :upload_fog_io do
Formatador.redisplay("Uploaded docs/_site\n")
end

task :upload_rdoc do
task :upload_yardoc do
# connect to storage provider
Fog.credential = :geemus
storage = Fog::Storage.new(:provider => 'AWS')
directory = storage.directories.new(:key => 'fog.io')

# write rdoc files to versioned 'folder'
Rake::Task[:rdoc].invoke
for file_path in Dir.glob('rdoc/**/*')
# write doc files to versioned 'folder'
Rake::Task[:yard].invoke
for file_path in Dir.glob("#{YARDOC_LOCATION}/**/*")
next if File.directory?(file_path)
file_name = file_path.gsub('rdoc/', '')
key = '' << version << '/rdoc/' << file_name
file_name = file_path.gsub("#{YARDOC_LOCATION}/", '')
key = '' << version << "/#{YARDOC_LOCATION}/" << file_name
Formatador.redisplay(' ' * 128)
Formatador.redisplay("Uploading [bold]#{key}[/]")
directory.files.create(
Expand All @@ -419,12 +418,12 @@ task :upload_rdoc do
end
Formatador.redisplay(' ' * 128)
directory.files.create(
:body => redirecter("#{version}/rdoc/index.html"),
:body => redirecter("#{version}/#{YARDOC_LOCATION}/index.html"),
:content_type => 'text/html',
:key => 'latest/rdoc/index.html',
:key => "latest/#{YARDOC_LOCATION}/index.html",
:public => true
)
Formatador.redisplay("Uploaded rdoc\n")
Formatador.redisplay("Uploaded yardoc\n")
end

def redirecter(path)
Expand Down
2 changes: 1 addition & 1 deletion docs/dns/index.markdown
Expand Up @@ -76,4 +76,4 @@ If you already have an account with another service you can just as easily use t

## Go Forth and Resolve

You can see an example of reusing code like this in the <a href="https://github.com/fog/fog/blob/master/examples/dns_tests.rb">examples folder</a>. Using this makes it easier to give yourself shortcuts to your cloud servers and manage how clients and users access them as well. It is great to have this flexibility so that you can modify your cloud infrastructure as needed while keeping everything ship shape. It also provides a nice way to create custom subdomains for users and just generally round out your cloud solution.
Using this makes it easier to give yourself shortcuts to your cloud servers and manage how clients and users access them as well. It is great to have this flexibility so that you can modify your cloud infrastructure as needed while keeping everything ship shape. It also provides a nice way to create custom subdomains for users and just generally round out your cloud solution.
11 changes: 8 additions & 3 deletions docs/index.markdown
Expand Up @@ -42,18 +42,23 @@ geemus says: "That should give you everything you need to get started, but let m

## Contributing

* Find something you would like to work on. For suggestions look for the `easy`, `medium` and `hard` tags in the [issues](http://github.com/fog/fog/issues)
* Find something you would like to work on.
* Look for anything you can help with in the [issue tracker](https://github.com/fog/fog/issues).
* Look at the [code quality metrics](https://codeclimate.com/github/fog/fog) for anything you can help clean up.
* Or anything else!
* Fork the project and do your work in a topic branch.
* Make sure your changes will work on both Ruby 1.8.7 and Ruby 1.9.
* Add a config at `tests/.fog` for the component you want to test.
* Add shindo tests to prove your code works and run all the tests using `bundle exec rake`.
* Rebase your branch against fog/fog to make sure everything is up to date.
* Rebase your branch against `fog/fog` to make sure everything is up to date.
* Commit your changes and send a pull request.

## Resources

Enjoy, and let me know what I can do to continue improving fog!

* Work through the [fog tutorial](https://github.com/downloads/geemus/learn_fog/learn_fog.tar.gz)
* Read fog's [API documentation](/rdoc)
* Read fog's [API documentation](/doc)
* Stay up to date by following [@fog](http://twitter.com/fog) and/or [@geemus](http://twitter.com/geemus) on Twitter.
* Get and give help on the [#ruby-fog](irc://irc.freenode.net/ruby-fog) irc channel on Freenode
* Follow release notes and discussions on the [mailing list](http://groups.google.com/group/ruby-fog)
Expand Down
2 changes: 1 addition & 1 deletion fog.gemspec
Expand Up @@ -56,7 +56,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('jekyll')
s.add_development_dependency('rake')
s.add_development_dependency('rbvmomi')
s.add_development_dependency('rdoc')
s.add_development_dependency('yard')
s.add_development_dependency('thor')
s.add_development_dependency('rspec', '~>1.3.1')
s.add_development_dependency('rbovirt', '>=0.0.11')
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/auto_scaling.rb
Expand Up @@ -258,7 +258,7 @@ def initialize(options={})
setup_credentials(options)
@region = options[:region] || 'us-east-1'

unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}"
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/cloud_watch.rb
Expand Up @@ -55,7 +55,7 @@ def initialize(options={})

@region = options[:region] || 'us-east-1'

unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}"
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/fog/aws/compute.rb
Expand Up @@ -113,6 +113,7 @@ class AWS < Fog::Service
request :modify_instance_attribute
request :modify_network_interface_attribute
request :modify_snapshot_attribute
request :modify_volume_attribute
request :purchase_reserved_instances_offering
request :reboot_instances
request :release_address
Expand Down Expand Up @@ -220,7 +221,7 @@ def initialize(options={})
setup_credentials(options)
@region = options[:region] || 'us-east-1'

unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}"
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/elb.rb
Expand Up @@ -81,7 +81,7 @@ def initialize(options={})

@region = options[:region] || 'us-east-1'

unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}"
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/fog/aws/models/compute/server.rb
Expand Up @@ -60,6 +60,8 @@ def initialize(attributes={})
'ami-5e0fa45f'
when 'ap-southeast-1'
'ami-f092eca2'
when 'ap-southeast-2'
'ami-fb8611c1' # Ubuntu 12.04 LTS 64bit (EBS)
when 'eu-west-1'
'ami-3d1f2b49'
when 'sa-east-1'
Expand Down
1 change: 0 additions & 1 deletion lib/fog/aws/models/compute/volume.rb
Expand Up @@ -125,7 +125,6 @@ def detach(force = false)
end

end

end
end
end
4 changes: 3 additions & 1 deletion lib/fog/aws/parsers/compute/describe_instances.rb
Expand Up @@ -41,7 +41,9 @@ def end_element(name)
when *@contexts
@context.pop
when 'code'
@instance[@context.last][name] = value.to_i
@instance[@context.last][name] = @context.last == 'stateReason' ? value : value.to_i
when 'message'
@instance[@context.last][name] = value
when 'deleteOnTermination'
@block_device_mapping[name] = (value == 'true')
when 'deviceName', 'status', 'volumeId'
Expand Down
Expand Up @@ -12,7 +12,7 @@ def reset

def end_element(name)
case name
when 'availabilityZone', 'currencyCode', 'instanceType', 'instanceTenancy', 'productDescription', 'reservedInstancesOfferingId'
when 'availabilityZone', 'currencyCode', 'instanceType', 'offeringType', 'instanceTenancy', 'productDescription', 'reservedInstancesOfferingId'
@reserved_instances_offering[name] = value
when 'duration'
@reserved_instances_offering[name] = value.to_i
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aws/rds.rb
Expand Up @@ -101,7 +101,7 @@ def initialize(options={})
@use_iam_profile = options[:use_iam_profile]
@region = options[:region] || 'us-east-1'

unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}"
end

Expand Down Expand Up @@ -158,7 +158,7 @@ def initialize(options={})
end

def owner_id
@owner_id ||= Fog::AWS[:rds].security_groups.get('default').owner_id
@owner_id ||= security_groups.get('default').owner_id
end

def reload
Expand Down
3 changes: 3 additions & 0 deletions lib/fog/aws/requests/compute/describe_availability_zones.rb
Expand Up @@ -71,6 +71,9 @@ def describe_availability_zones(filters = {})

{"messageSet" => [], "regionName" => "ap-southeast-1", "zoneName" => "ap-southeast-1a", "zoneState" => "available"},
{"messageSet" => [], "regionName" => "ap-southeast-1", "zoneName" => "ap-southeast-1b", "zoneState" => "available"},

{"messageSet" => [], "regionName" => "ap-southeast-2", "zoneName" => "ap-southeast-2a", "zoneState" => "available"},
{"messageSet" => [], "regionName" => "ap-southeast-2", "zoneName" => "ap-southeast-2b", "zoneState" => "available"},
]

availability_zone_info = all_zones.select { |zoneinfo| zoneinfo["regionName"] == @region }
Expand Down
Expand Up @@ -18,7 +18,9 @@ class Real
# * 'availabilityZone'<~String> - availability zone of offering
# * 'duration'<~Integer> - duration, in seconds, of offering
# * 'fixedPrice'<~Float> - purchase price of offering
# * 'includeMarketplace'<~Boolean> - whether or not to include marketplace offerings
# * 'instanceType'<~String> - instance type of offering
# * 'offeringType'<~String> - type of offering, in ['Heavy Utilization', 'Medium Utilization', 'Light Utilization']
# * 'productDescription'<~String> - description of offering
# * 'reservedInstancesOfferingId'<~String> - id of offering
# * 'usagePrice'<~Float> - usage price of offering, per hour
Expand All @@ -41,14 +43,15 @@ def describe_reserved_instances_offerings(filters = {})

self.data[:reserved_instances_offerings] ||= [{
'reservedInstancesOfferingId' => Fog::AWS::Mock.reserved_instances_offering_id,
'instanceType' => 'm1.small',
'availabilityZone' => 'us-east-1d',
'duration' => 31536000,
'fixedPrice' => 350.0,
'usagePrice' => 0.03,
'productDescription' => 'Linux/UNIX',
'instanceTenancy' => 'default',
'currencyCode' => 'USD'
'instanceType' => 'm1.small',
'availabilityZone' => 'us-east-1d',
'duration' => 31536000,
'fixedPrice' => 350.0,
'offeringType' => 'Medium Utilization',
'usagePrice' => 0.03,
'productDescription' => 'Linux/UNIX',
'instanceTenancy' => 'default',
'currencyCode' => 'USD'
}]

response.body = {
Expand Down
51 changes: 51 additions & 0 deletions lib/fog/aws/requests/compute/modify_volume_attribute.rb
@@ -0,0 +1,51 @@
module Fog
module Compute
class AWS
class Real

require 'fog/aws/parsers/compute/basic'

# Modifies a volume attribute.
#
# ==== Parameters
# * volume_id<~String> - The ID of the volume.
# * auto_enable_io_value<~Boolean> - This attribute exists to auto-enable the I/O operations to the volume.
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'requestId'<~String> - Id of request
# * 'return'<~Boolean> - success?
#
# {Amazon API Reference}[http://http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyVolumeAttribute.html]
def modify_volume_attribute(volume_id=nil, auto_enable_io_value=false)
request(
'Action' => 'ModifyVolumeAttribute',
'VolumeId' => volume_id,
'AutoEnableIO.Value' => auto_enable_io_value,
:idempotent => true,
:parser => Fog::Parsers::Compute::AWS::Basic.new
)
end

end

class Mock

def modify_volume_attribute(volume_id=nil, auto_enable_io_value=false)
response = Excon::Response.new
if volume = self.data[:volumes][volume_id]
response.status = 200
response.body = {
'requestId' => Fog::AWS::Mock.request_id,
'return' => true
}
response
else
raise Fog::Compute::AWS::NotFound.new("The volume '#{volume_id}' does not exist.")
end
end
end
end
end
end
1 change: 1 addition & 0 deletions lib/fog/aws/requests/dns/change_resource_record_sets.rb
Expand Up @@ -198,6 +198,7 @@ def self.elb_hosted_zone_mapping
@elb_hosted_zone_mapping ||= {
"ap-northeast-1" => "Z2YN17T5R711GT",
"ap-southeast-1" => "Z1WI8VXHPB1R38",
"ap-southeast-2" => "Z2999QAZ9SRTIC",
"eu-west-1" => "Z3NF1Z3NOM5OY2",
"sa-east-1" => "Z2ES78Y61JGQKS",
"us-east-1" => "Z3DZXE0Q79N41H",
Expand Down

0 comments on commit 44c5c6e

Please sign in to comment.