fog 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +106 -17
- data/bin/fog +1 -1
- data/changelog.txt +17 -0
- data/docs/_layouts/default.html +2 -1
- data/docs/about/contributing.markdown +1 -1
- data/docs/compute/index.markdown +104 -0
- data/docs/index.markdown +1 -0
- data/docs/storage/index.markdown +17 -0
- data/fog.gemspec +3 -2
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/elb.rb +1 -0
- data/lib/fog/aws/iam.rb +1 -0
- data/lib/fog/aws/rds.rb +1 -0
- data/lib/fog/aws/requests/simpledb/batch_put_attributes.rb +5 -5
- data/lib/fog/aws/requests/simpledb/create_domain.rb +1 -1
- data/lib/fog/aws/requests/simpledb/delete_attributes.rb +3 -3
- data/lib/fog/aws/requests/simpledb/delete_domain.rb +1 -1
- data/lib/fog/aws/requests/simpledb/domain_metadata.rb +1 -1
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +5 -5
- data/lib/fog/aws/requests/simpledb/list_domains.rb +2 -2
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +6 -6
- data/lib/fog/aws/ses.rb +1 -0
- data/lib/fog/aws/simpledb.rb +8 -2
- data/lib/fog/bin.rb +2 -2
- data/lib/fog/cdn/aws.rb +8 -2
- data/lib/fog/cdn/rackspace.rb +8 -2
- data/lib/fog/compute/aws.rb +12 -3
- data/lib/fog/compute/bluebox.rb +8 -2
- data/lib/fog/compute/ecloud.rb +9 -4
- data/lib/fog/compute/go_grid.rb +8 -2
- data/lib/fog/compute/linode.rb +38 -6
- data/lib/fog/compute/models/aws/volumes.rb +4 -4
- data/lib/fog/compute/models/bluebox/server.rb +3 -3
- data/lib/fog/compute/models/brightbox/server.rb +9 -9
- data/lib/fog/compute/models/linode/data_center.rb +12 -0
- data/lib/fog/compute/models/linode/data_centers.rb +26 -0
- data/lib/fog/compute/models/linode/disk.rb +62 -0
- data/lib/fog/compute/models/linode/disks.rb +40 -0
- data/lib/fog/compute/models/linode/flavor.rb +23 -0
- data/lib/fog/compute/models/linode/flavors.rb +32 -0
- data/lib/fog/compute/models/linode/image.rb +14 -0
- data/lib/fog/compute/models/linode/images.rb +33 -0
- data/lib/fog/compute/models/linode/ip.rb +30 -0
- data/lib/fog/compute/models/linode/ips.rb +40 -0
- data/lib/fog/compute/models/linode/kernel.rb +12 -0
- data/lib/fog/compute/models/linode/kernels.rb +32 -0
- data/lib/fog/compute/models/linode/server.rb +88 -0
- data/lib/fog/compute/models/linode/servers.rb +32 -0
- data/lib/fog/compute/models/linode/stack_script.rb +13 -0
- data/lib/fog/compute/models/linode/stack_scripts.rb +32 -0
- data/lib/fog/compute/models/rackspace/server.rb +2 -2
- data/lib/fog/compute/models/slicehost/server.rb +2 -2
- data/lib/fog/compute/models/voxel/server.rb +3 -3
- data/lib/fog/compute/new_servers.rb +8 -2
- data/lib/fog/compute/rackspace.rb +8 -2
- data/lib/fog/compute/requests/aws/allocate_address.rb +4 -2
- data/lib/fog/compute/requests/aws/associate_address.rb +4 -2
- data/lib/fog/compute/requests/aws/attach_volume.rb +4 -2
- data/lib/fog/compute/requests/aws/authorize_security_group_ingress.rb +5 -3
- data/lib/fog/compute/requests/aws/create_image.rb +2 -1
- data/lib/fog/compute/requests/aws/create_key_pair.rb +4 -2
- data/lib/fog/compute/requests/aws/create_security_group.rb +5 -3
- data/lib/fog/compute/requests/aws/create_snapshot.rb +6 -4
- data/lib/fog/compute/requests/aws/create_tags.rb +7 -5
- data/lib/fog/compute/requests/aws/create_volume.rb +4 -2
- data/lib/fog/compute/requests/aws/delete_key_pair.rb +3 -1
- data/lib/fog/compute/requests/aws/delete_security_group.rb +4 -2
- data/lib/fog/compute/requests/aws/delete_snapshot.rb +3 -1
- data/lib/fog/compute/requests/aws/delete_tags.rb +5 -3
- data/lib/fog/compute/requests/aws/delete_volume.rb +4 -2
- data/lib/fog/compute/requests/aws/deregister_image.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_addresses.rb +3 -1
- data/lib/fog/compute/requests/aws/describe_availability_zones.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_images.rb +3 -1
- data/lib/fog/compute/requests/aws/describe_instances.rb +12 -10
- data/lib/fog/compute/requests/aws/describe_key_pairs.rb +3 -1
- data/lib/fog/compute/requests/aws/describe_regions.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_reserved_instances.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_reserved_instances_offerings.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_security_groups.rb +3 -1
- data/lib/fog/compute/requests/aws/describe_snapshots.rb +5 -3
- data/lib/fog/compute/requests/aws/describe_tags.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_volumes.rb +9 -7
- data/lib/fog/compute/requests/aws/detach_volume.rb +3 -1
- data/lib/fog/compute/requests/aws/disassociate_address.rb +4 -2
- data/lib/fog/compute/requests/aws/get_console_output.rb +3 -1
- data/lib/fog/compute/requests/aws/get_password_data.rb +15 -1
- data/lib/fog/compute/requests/aws/import_key_pair.rb +4 -2
- data/lib/fog/compute/requests/aws/modify_image_attributes.rb +4 -0
- data/lib/fog/compute/requests/aws/modify_snapshot_attribute.rb +4 -0
- data/lib/fog/compute/requests/aws/monitor_instances.rb +3 -1
- data/lib/fog/compute/requests/aws/reboot_instances.rb +4 -2
- data/lib/fog/compute/requests/aws/register_image.rb +4 -0
- data/lib/fog/compute/requests/aws/release_address.rb +3 -1
- data/lib/fog/compute/requests/aws/revoke_security_group_ingress.rb +3 -1
- data/lib/fog/compute/requests/aws/run_instances.rb +12 -6
- data/lib/fog/compute/requests/aws/start_instances.rb +2 -0
- data/lib/fog/compute/requests/aws/stop_instances.rb +2 -0
- data/lib/fog/compute/requests/aws/terminate_instances.rb +5 -3
- data/lib/fog/compute/requests/aws/unmonitor_instances.rb +3 -1
- data/lib/fog/compute/requests/go_grid/grid_image_get.rb +1 -1
- data/lib/fog/compute/requests/go_grid/grid_image_list.rb +1 -1
- data/lib/fog/compute/requests/linode/avail_datacenters.rb +1 -2
- data/lib/fog/compute/requests/linode/avail_distributions.rb +1 -2
- data/lib/fog/compute/requests/linode/avail_kernels.rb +6 -5
- data/lib/fog/compute/requests/linode/avail_linodeplans.rb +9 -3
- data/lib/fog/compute/requests/linode/avail_stackscripts.rb +3 -15
- data/lib/fog/compute/requests/linode/linode_boot.rb +15 -0
- data/lib/fog/compute/requests/linode/linode_config_create.rb +21 -0
- data/lib/fog/compute/requests/linode/linode_config_list.rb +18 -0
- data/lib/fog/compute/requests/linode/linode_create.rb +3 -4
- data/lib/fog/compute/requests/linode/linode_delete.rb +0 -1
- data/lib/fog/compute/requests/linode/linode_disk_create.rb +21 -0
- data/lib/fog/compute/requests/linode/linode_disk_createfromdistribution.rb +22 -0
- data/lib/fog/compute/requests/linode/linode_disk_createfromstackscript.rb +24 -0
- data/lib/fog/compute/requests/linode/linode_disk_delete.rb +19 -0
- data/lib/fog/compute/requests/linode/linode_disk_list.rb +19 -0
- data/lib/fog/compute/requests/linode/linode_ip_addprivate.rb +15 -0
- data/lib/fog/compute/requests/linode/linode_ip_list.rb +19 -0
- data/lib/fog/compute/requests/linode/linode_list.rb +0 -1
- data/lib/fog/compute/requests/linode/linode_reboot.rb +1 -2
- data/lib/fog/compute/requests/linode/linode_shutdown.rb +15 -0
- data/lib/fog/compute/requests/linode/linode_update.rb +15 -0
- data/lib/fog/compute/requests/linode/stackscript_list.rb +31 -0
- data/lib/fog/compute/requests/rackspace/confirm_resized_server.rb +3 -3
- data/lib/fog/compute/requests/rackspace/create_image.rb +2 -2
- data/lib/fog/compute/requests/rackspace/create_server.rb +2 -2
- data/lib/fog/compute/requests/rackspace/delete_image.rb +2 -2
- data/lib/fog/compute/requests/rackspace/delete_server.rb +2 -2
- data/lib/fog/compute/requests/rackspace/list_images_detail.rb +2 -2
- data/lib/fog/compute/requests/rackspace/list_servers_detail.rb +2 -2
- data/lib/fog/compute/requests/rackspace/resize_server.rb +4 -4
- data/lib/fog/compute/requests/rackspace/revert_resized_server.rb +4 -4
- data/lib/fog/compute/slicehost.rb +8 -2
- data/lib/fog/compute/storm_on_demand.rb +12 -1
- data/lib/fog/compute/voxel.rb +8 -2
- data/lib/fog/core/mock.rb +14 -1
- data/lib/fog/dns/aws.rb +8 -2
- data/lib/fog/dns/bluebox.rb +8 -2
- data/lib/fog/dns/dnsimple.rb +15 -3
- data/lib/fog/dns/linode.rb +8 -2
- data/lib/fog/dns/slicehost.rb +8 -2
- data/lib/fog/dns/zerigo.rb +8 -2
- data/lib/fog/providers/aws.rb +5 -10
- data/lib/fog/providers/linode.rb +0 -3
- data/lib/fog/storage.rb +6 -4
- data/lib/fog/storage/aws.rb +8 -2
- data/lib/fog/storage/google.rb +8 -2
- data/lib/fog/storage/local.rb +8 -2
- data/lib/fog/storage/models/aws/file.rb +0 -1
- data/lib/fog/storage/models/google/file.rb +1 -5
- data/lib/fog/storage/models/local/file.rb +1 -1
- data/lib/fog/storage/models/rackspace/file.rb +1 -5
- data/lib/fog/storage/rackspace.rb +8 -2
- data/lib/fog/storage/requests/aws/copy_object.rb +2 -2
- data/lib/fog/storage/requests/aws/delete_bucket.rb +3 -3
- data/lib/fog/storage/requests/aws/delete_object.rb +1 -1
- data/lib/fog/storage/requests/aws/get_bucket.rb +1 -1
- data/lib/fog/storage/requests/aws/get_bucket_acl.rb +1 -1
- data/lib/fog/storage/requests/aws/get_bucket_location.rb +1 -1
- data/lib/fog/storage/requests/aws/get_object.rb +1 -1
- data/lib/fog/storage/requests/aws/get_object_acl.rb +1 -1
- data/lib/fog/storage/requests/aws/get_request_payment.rb +1 -1
- data/lib/fog/storage/requests/aws/get_service.rb +1 -1
- data/lib/fog/storage/requests/aws/put_bucket.rb +3 -3
- data/lib/fog/storage/requests/aws/put_object.rb +3 -3
- data/lib/fog/storage/requests/aws/put_request_payment.rb +1 -1
- data/lib/fog/storage/requests/google/copy_object.rb +2 -2
- data/lib/fog/storage/requests/google/delete_bucket.rb +3 -3
- data/lib/fog/storage/requests/google/delete_object.rb +1 -1
- data/lib/fog/storage/requests/google/get_bucket.rb +1 -1
- data/lib/fog/storage/requests/google/get_bucket_acl.rb +1 -1
- data/lib/fog/storage/requests/google/get_object.rb +1 -1
- data/lib/fog/storage/requests/google/get_object_acl.rb +1 -1
- data/lib/fog/storage/requests/google/get_service.rb +2 -2
- data/lib/fog/storage/requests/google/put_bucket.rb +3 -3
- data/lib/fog/storage/requests/google/put_object.rb +3 -3
- data/lib/fog/terremark/requests/shared/get_network.rb +1 -1
- data/lib/fog/terremark/requests/shared/get_organization.rb +1 -1
- data/lib/fog/terremark/requests/shared/get_organizations.rb +1 -1
- data/lib/fog/terremark/requests/shared/get_public_ips.rb +1 -1
- data/lib/fog/terremark/requests/shared/get_vdc.rb +1 -1
- data/lib/fog/terremark/shared.rb +4 -0
- data/lib/fog/terremark/vcloud.rb +11 -1
- data/spec/ecloud/bin_spec.rb +8 -2
- data/spec/ecloud/spec_helper.rb +3 -3
- data/tests/compute/helper.rb +1 -3
- data/tests/compute/models/aws/server_tests.rb +3 -2
- data/tests/compute/requests/aws/instance_tests.rb +12 -9
- data/tests/compute/requests/aws/key_pair_tests.rb +1 -1
- data/tests/compute/requests/aws/volume_tests.rb +2 -2
- data/tests/compute/requests/brightbox/helper.rb +3 -0
- data/tests/compute/requests/linode/kernel_tests.rb +27 -0
- data/tests/compute/requests/linode/linode_tests.rb +62 -4
- data/tests/compute/requests/linode/stackscripts_tests.rb +35 -0
- data/tests/compute/requests/rackspace/resize_tests.rb +2 -2
- data/tests/compute/requests/voxel/server_tests.rb +1 -0
- data/tests/core/credential_tests.rb +7 -2
- data/tests/core/parser_tests.rb +1 -1
- data/tests/helper.rb +1 -1
- data/tests/helpers/compute/server_helper.rb +6 -0
- data/tests/helpers/formats_helper.rb +2 -0
- data/tests/helpers/mock_helper.rb +8 -1
- data/tests/helpers/model_helper.rb +1 -3
- data/tests/helpers/responds_to_helper.rb +2 -2
- data/tests/storage/helper.rb +1 -1
- data/tests/storage/models/directories_tests.rb +8 -4
- data/tests/storage/models/directory_test.rb +15 -11
- data/tests/storage/models/file_tests.rb +6 -6
- data/tests/storage/models/files_tests.rb +5 -5
- metadata +105 -55
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bundler/setup'
|
3
3
|
require 'date'
|
4
|
-
require 'fog'
|
4
|
+
require 'lib/fog'
|
5
5
|
|
6
6
|
#############################################################################
|
7
7
|
#
|
@@ -52,11 +52,40 @@ task :examples do
|
|
52
52
|
# sh("export FOG_MOCK=true && bundle exec shindont examples")
|
53
53
|
end
|
54
54
|
|
55
|
-
task :test => :examples do
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
task :test do # => :examples do
|
56
|
+
Rake::Task[:mock_tests].invoke
|
57
|
+
Rake::Task[:real_tests].invoke
|
58
|
+
end
|
59
|
+
|
60
|
+
def tests(mocked)
|
61
|
+
Formatador.display_line
|
62
|
+
sh("export FOG_MOCK=#{mocked} && bundle exec spec spec")
|
63
|
+
Formatador.display_line
|
64
|
+
start = Time.now.to_i
|
65
|
+
threads = []
|
66
|
+
Thread.main[:results] = []
|
67
|
+
Fog.providers.each do |provider|
|
68
|
+
threads << Thread.new do
|
69
|
+
Thread.main[:results] << {
|
70
|
+
:provider => provider,
|
71
|
+
:success => sh("export FOG_MOCK=#{mocked} && bundle exec shindont +#{provider.downcase}")
|
72
|
+
}
|
73
|
+
end
|
74
|
+
end
|
75
|
+
threads.each do |thread|
|
76
|
+
thread.join
|
77
|
+
end
|
78
|
+
Formatador.display_table(Thread.main[:results].sort {|x,y| x[:provider] <=> y[:provider]})
|
79
|
+
Formatador.display_line("[bold]FOG_MOCK=#{mocked}[/] tests completed in [bold]#{Time.now.to_i - start}[/] seconds")
|
80
|
+
Formatador.display_line
|
81
|
+
end
|
82
|
+
|
83
|
+
task :mock_tests do
|
84
|
+
tests(true)
|
85
|
+
end
|
86
|
+
|
87
|
+
task :real_tests do
|
88
|
+
tests(false)
|
60
89
|
end
|
61
90
|
|
62
91
|
desc "Generate RCov test coverage and open in your browser"
|
@@ -67,8 +96,8 @@ task :coverage do
|
|
67
96
|
sh "open coverage/index.html"
|
68
97
|
end
|
69
98
|
|
70
|
-
require '
|
71
|
-
|
99
|
+
require 'rdoc/task'
|
100
|
+
RDoc::Task.new do |rdoc|
|
72
101
|
rdoc.rdoc_dir = 'rdoc'
|
73
102
|
rdoc.title = "#{name} #{version}"
|
74
103
|
rdoc.rdoc_files.include('README*')
|
@@ -98,6 +127,7 @@ task :release => :build do
|
|
98
127
|
sh "git push origin v#{version}"
|
99
128
|
sh "gem push pkg/#{name}-#{version}.gem"
|
100
129
|
Rake::Task[:docs].invoke
|
130
|
+
Rake::Task[:changelog].invoke
|
101
131
|
end
|
102
132
|
|
103
133
|
task :build => :gemspec do
|
@@ -143,11 +173,13 @@ task :changelog do
|
|
143
173
|
last_sha = `cat changelog.txt | head -1`.split(' ').last
|
144
174
|
shortlog = `git shortlog #{last_sha}..HEAD`
|
145
175
|
changes = {}
|
176
|
+
committers = {}
|
146
177
|
for line in shortlog.split("\n")
|
147
178
|
if line =~ /^\S/
|
148
179
|
committer = line.split(' (', 2).first
|
149
|
-
|
150
|
-
|
180
|
+
committers[committer] = 0
|
181
|
+
elsif line =~ /^\s*((Merge.*)|(Release.*))?$/
|
182
|
+
# skip empty lines, Merge and Release commits
|
151
183
|
else
|
152
184
|
unless line[-1..-1] == '.'
|
153
185
|
line << '.'
|
@@ -156,7 +188,17 @@ task :changelog do
|
|
156
188
|
tag = $1 || 'misc'
|
157
189
|
changes[tag] ||= []
|
158
190
|
changes[tag] << (line << ' thanks ' << committer)
|
191
|
+
committers[committer] += 1
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
for committer, commits in committers.to_a.sort {|x,y| y[1] <=> x[1]}
|
196
|
+
if ['Aaron Suggs', 'geemus', 'Wesley Beary'].include?(committer)
|
197
|
+
next
|
159
198
|
end
|
199
|
+
changelog << "MVP! #{committer}"
|
200
|
+
changelog << ''
|
201
|
+
break
|
160
202
|
end
|
161
203
|
|
162
204
|
for tag in changes.keys.sort
|
@@ -167,31 +209,39 @@ task :changelog do
|
|
167
209
|
changelog << ''
|
168
210
|
end
|
169
211
|
|
170
|
-
|
171
|
-
|
172
|
-
end
|
212
|
+
`echo "#{changelog.join("\n")}" | pbcopy`
|
213
|
+
p 'changelog copied to clipboard'
|
173
214
|
end
|
174
215
|
|
175
216
|
task :docs do
|
176
217
|
# build the docs locally
|
177
218
|
sh "jekyll docs docs/_site"
|
178
219
|
|
179
|
-
# connect to storage provider
|
220
|
+
# connect to storage provider
|
180
221
|
Fog.credential = :geemus
|
181
222
|
storage = Fog::Storage.new(:provider => 'AWS')
|
182
223
|
directory = storage.directories.new(:key => 'fog.io')
|
224
|
+
|
225
|
+
# write web page files to versioned 'folder'
|
183
226
|
for file_path in Dir.glob('docs/_site/**/*')
|
184
227
|
next if File.directory?(file_path)
|
185
228
|
file_name = file_path.gsub('docs/_site/', '')
|
186
229
|
key = '' << version << '/' << file_name
|
187
|
-
Formatador.redisplay(' ' *
|
188
|
-
Formatador.redisplay(
|
230
|
+
Formatador.redisplay(' ' * 128)
|
231
|
+
Formatador.redisplay("Uploading [bold]#{key}[/]")
|
189
232
|
if File.extname(file_name) == '.html'
|
190
233
|
# rewrite links with version
|
191
234
|
body = File.read(file_path)
|
235
|
+
body.gsub!(/vX.Y.Z/, 'v' << version)
|
192
236
|
body.gsub!(/='\//, %{='/} << version << '/')
|
193
237
|
body.gsub!(/="\//, %{="/} << version << '/')
|
194
238
|
content_type = 'text/html'
|
239
|
+
directory.files.create(
|
240
|
+
:body => redirecter(key),
|
241
|
+
:content_type => 'text/html',
|
242
|
+
:key => 'latest/' << file_name,
|
243
|
+
:public => true
|
244
|
+
)
|
195
245
|
else
|
196
246
|
body = File.open(file_path)
|
197
247
|
content_type = nil # leave it up to mime-types
|
@@ -203,10 +253,35 @@ task :docs do
|
|
203
253
|
:public => true
|
204
254
|
)
|
205
255
|
end
|
256
|
+
Formatador.redisplay(' ' * 128)
|
257
|
+
Formatador.redisplay('Uploaded docs/_site')
|
258
|
+
|
259
|
+
# write rdoc files to versioned 'folder'
|
260
|
+
Rake::Task[:rdoc].invoke
|
261
|
+
for file_path in Dir.glob('rdoc/**/*')
|
262
|
+
next if File.directory?(file_path)
|
263
|
+
file_name = file_path.gsub('rdoc/', '')
|
264
|
+
key = '' << version << '/rdoc/' << file_name
|
265
|
+
Formatador.redisplay(' ' * 128)
|
266
|
+
Formatador.redisplay("Uploading [bold]#{key}[/]")
|
267
|
+
directory.files.create(
|
268
|
+
:body => File.open(file_path),
|
269
|
+
:key => key,
|
270
|
+
:public => true
|
271
|
+
)
|
272
|
+
end
|
273
|
+
Formatador.redisplay(' ' * 128)
|
274
|
+
directory.files.create(
|
275
|
+
:body => redirecter("#{version}/rdoc/index.html"),
|
276
|
+
:content_type => 'text/html',
|
277
|
+
:key => 'latest/rdoc/index.html',
|
278
|
+
:public => true
|
279
|
+
)
|
280
|
+
Formatador.redisplay('Uploaded rdoc')
|
206
281
|
|
207
282
|
# write base index with redirect to new version
|
208
283
|
directory.files.create(
|
209
|
-
:body =>
|
284
|
+
:body => redirecter(version),
|
210
285
|
:content_type => 'text/html',
|
211
286
|
:key => 'index.html',
|
212
287
|
:public => true
|
@@ -214,3 +289,17 @@ task :docs do
|
|
214
289
|
|
215
290
|
Formatador.display_line
|
216
291
|
end
|
292
|
+
|
293
|
+
def redirecter(path)
|
294
|
+
redirecter = <<-HTML
|
295
|
+
<!doctype html>
|
296
|
+
<head>
|
297
|
+
<title>fog</title>
|
298
|
+
<meta http-equiv="REFRESH" content="0;url=http://fog.io/#{path}">
|
299
|
+
</head>
|
300
|
+
<body>
|
301
|
+
<a href="http://fog.io/#{path}">redirecting to lastest (#{path})</a>
|
302
|
+
</body>
|
303
|
+
</html>
|
304
|
+
HTML
|
305
|
+
end
|
data/bin/fog
CHANGED
data/changelog.txt
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
0.8.1 05/13/2011 3a452347a396f0ad1fea7f5475fb3c349b10f527
|
2
|
+
=========================================================
|
3
|
+
|
4
|
+
[aws|compute]
|
5
|
+
less confusing explanation comment. thanks geemus
|
6
|
+
|
7
|
+
[compute|aws]
|
8
|
+
Fix describe_instances filtering. thanks ktheory
|
9
|
+
Add get_password_data request. thanks ktheory
|
10
|
+
|
11
|
+
[core]
|
12
|
+
Add test for Fog::Parsers::Base. thanks ktheory
|
13
|
+
handle busted ENV['HOME']. thanks pfalcone closes #301. thanks geemus
|
14
|
+
update fog.io in release task. thanks geemus
|
15
|
+
add hash to changelog. thanks geemus
|
16
|
+
work toward automating changelog. thanks geemus
|
17
|
+
|
1
18
|
0.8.0 05/12/2011 27bf76d1f881bec0f900cd11d5c2a10dce4856ca
|
2
19
|
=========================================================
|
3
20
|
|
data/docs/_layouts/default.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<a href="/"><img src="/public/images/fog.png" title="fog" /></a>
|
34
34
|
<h1>{{ page.title }}</h1>
|
35
35
|
<dl>
|
36
|
-
<dt>version</dt><dd>
|
36
|
+
<dt>version</dt><dd>vX.Y.Z</dd>
|
37
37
|
<dt>install</dt><dd><code>gem install fog</code></dd>
|
38
38
|
<dt>source</dt><dd><a href="http://github.com/geemus/fog">geemus/fog</a></dd>
|
39
39
|
</dl>
|
@@ -46,6 +46,7 @@
|
|
46
46
|
<h2>Services</h2>
|
47
47
|
<ul>
|
48
48
|
<li><a href="/cdn">CDN</a></li>
|
49
|
+
<li><a href="/compute">Compute</a></li>
|
49
50
|
<li><a href="/dns">DNS</a></li>
|
50
51
|
<li><a href="/storage">Storage</a></li>
|
51
52
|
{% for post in site.posts %}
|
@@ -201,7 +201,7 @@ For instance:
|
|
201
201
|
class Mock
|
202
202
|
|
203
203
|
def destroy_server(server_identity)
|
204
|
-
if data =
|
204
|
+
if data = self.data[:servers].delete(server_identity)
|
205
205
|
response = Excon::Response.new
|
206
206
|
response.status = 202
|
207
207
|
response.body = data
|
@@ -0,0 +1,104 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: Compute
|
4
|
+
---
|
5
|
+
|
6
|
+
Compute is the lifeblood of the cloud, but with great power comes great complication. Compute opens up huge swaths of potential, but it varies greatly in both capabilities and usage from provider to provider. Thankfully fog helps to abstract these idiosyncrasies to provide a more seamless experience.
|
7
|
+
|
8
|
+
## Installing fog
|
9
|
+
|
10
|
+
fog is distributed as a RubyGem:
|
11
|
+
|
12
|
+
gem install fog
|
13
|
+
|
14
|
+
Or for bundler users, you can add it in your Gemfile:
|
15
|
+
|
16
|
+
gem "fog"
|
17
|
+
|
18
|
+
## Using Amazon EC2 and fog
|
19
|
+
|
20
|
+
Sign up for an account <a href="http://aws-portal.amazon.com/gp/aws/developer/subscription/index.html?productCode=AmazonEC2">here</a> and copy down your secret access key and access key id from <a href="http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key">here</a>. We are about to get into the code samples, so be sure to fill in anything in ALL_CAPS with your own values!
|
21
|
+
|
22
|
+
First, create a connection with your new account:
|
23
|
+
|
24
|
+
require 'rubygems'
|
25
|
+
require 'fog'
|
26
|
+
|
27
|
+
# create a connection
|
28
|
+
connection = Fog::Compute.new(
|
29
|
+
:provider => 'AWS',
|
30
|
+
:aws_secret_access_key => YOUR_SECRET_ACCESS_KEY,
|
31
|
+
:aws_access_key_id => YOUR_SECRET_ACCESS_KEY_ID
|
32
|
+
)
|
33
|
+
|
34
|
+
With that in hand we are ready to start making EC2 calls!
|
35
|
+
|
36
|
+
## Servers the EC2 way
|
37
|
+
|
38
|
+
Creating a server on EC2 is very easy if you are willing to accept the defaults (the smallest server size, using Ubuntu 10.04 LTS).
|
39
|
+
|
40
|
+
server = connection.servers.create
|
41
|
+
|
42
|
+
You can then list your servers to see that it now appears:
|
43
|
+
|
44
|
+
connection.servers
|
45
|
+
|
46
|
+
Rather than worrying about the whole list, we can also just get the latest data for just our server:
|
47
|
+
|
48
|
+
server.reload
|
49
|
+
|
50
|
+
That can get tedious quickly however, especially when servers can take several minutes to boot. Fog has `wait_for` for cases like this and `ready?` for checking to see when a server has completed its start up.
|
51
|
+
|
52
|
+
server.wait_for { ready? }
|
53
|
+
|
54
|
+
Once we are done with that we can shut it down.
|
55
|
+
|
56
|
+
server.destroy
|
57
|
+
|
58
|
+
## Bootstrap: Servers the fog Way
|
59
|
+
|
60
|
+
Cycling servers is great, but in order to actually ssh in we need to setup ssh keys and open ports. But rather than worrying about the nitty gritty, we will utilize `bootstrap`. NOTE: normally we could leave out username and use the default (root), but the default Ubuntu from Canonical uses the ubuntu username instead.
|
61
|
+
|
62
|
+
server = connection.servers.bootstrap(:private_key_path => '~/.ssh/id_rsa', :public_key_path => '~/.ssh/id_rsa.pub', :username => 'ubuntu')
|
63
|
+
|
64
|
+
Bootstrap will create the server, but it will also make sure that port 22 is open for traffic and has ssh keys setup. In order to hook everything up it will need the server to be running, so by the time it finishes it will be ready. You can then make commands to it directly:
|
65
|
+
|
66
|
+
server.ssh('pwd')
|
67
|
+
server.ssh(['pwd', 'whoami'])
|
68
|
+
|
69
|
+
These return an array of results, where each has stdout, stderr and status values so you can check out what your commands accomplished. Now just shut it down to make sure you don't continue getting charged.
|
70
|
+
|
71
|
+
server.destroy
|
72
|
+
|
73
|
+
## Rackspace Cloud Servers
|
74
|
+
|
75
|
+
Rackspace has <a href="http://www.rackspacecloud.com/cloud_hosting_products/servers">Cloud Servers</a> and you can sign up <a href="https://www.rackspacecloud.com/signup">here</a> and get your credentials <a href="https://manage.rackspacecloud.com/APIAccess.do">here</a>.
|
76
|
+
|
77
|
+
# create a connection
|
78
|
+
connection = Fog::Compute.new(
|
79
|
+
:provider => 'Rackspace',
|
80
|
+
:rackspace_username => RACKSPACE_USERNAME,
|
81
|
+
:rackspace_api_key => RACKSPACE_API_KEY
|
82
|
+
)
|
83
|
+
|
84
|
+
We will skip over learning how to do this the 'Rackspace Way' and instead jump right to using bootstrap to get their smallest Ubuntu 10.04 LTS server.
|
85
|
+
|
86
|
+
server = connection.servers.bootstrap
|
87
|
+
|
88
|
+
You can run all the same ssh commands and do what you need to, then once again shutdown to ensure you are not charged once you are done.
|
89
|
+
|
90
|
+
server.destroy
|
91
|
+
|
92
|
+
## Mocking out Compute
|
93
|
+
|
94
|
+
You can also start any of these scripts with `Fog.mock!` or start the fog interactive tool from the command line with `FOG_MOCK=true fog` to run in mock mode. In this mode commands are run as local simulation, so no cloud resources are ever consumed and things operate much faster.
|
95
|
+
|
96
|
+
## Cleaning up
|
97
|
+
|
98
|
+
To cover your tracks its a good idea to check for running servers and shut them down, here is one way you might do that.
|
99
|
+
|
100
|
+
connection.servers.select {|server| server.ready? && server.destroy}
|
101
|
+
|
102
|
+
## Summary
|
103
|
+
|
104
|
+
Compute can be tricky, but the abstractions in fog make it much easier to get started. With your servers up and running you can then focus on the task at hand and get some work done. Congratulations on adding a new tool to your arsenal and let us know what we can do better.
|
data/docs/index.markdown
CHANGED
@@ -61,6 +61,7 @@ Wonder how you can get a lovely fog shirt? Look no further!
|
|
61
61
|
Enjoy, and let me know what I can do to continue improving fog!
|
62
62
|
|
63
63
|
* Work through the [fog tutorial](https://github.com/downloads/geemus/learn_fog/learn_fog.tar.gz)
|
64
|
+
* Read fog's [API documentation](/latest/rdoc)
|
64
65
|
* Stay up to date by following [@fog](http://twitter.com/fog) and/or [@geemus](http://twitter.com/geemus) on Twitter.
|
65
66
|
* Get and give help on the [#ruby-fog](irc://irc.freenode.net/ruby-fog) irc channel on Freenode
|
66
67
|
* Follow release notes and discussions on the [mailing list](http://groups.google.com/group/ruby-fog)
|
data/docs/storage/index.markdown
CHANGED
@@ -170,6 +170,23 @@ Fog takes care of the rest so you can focus on your cover letter. And with the a
|
|
170
170
|
file.destroy
|
171
171
|
directory.destroy
|
172
172
|
|
173
|
+
## Checking if a file already exists
|
174
|
+
|
175
|
+
Sometimes you might want to find out some information about a file without retrieving the whole file. You can do that using 'head'.
|
176
|
+
|
177
|
+
#returns nil if the file doesn't exist
|
178
|
+
unless directory.files.head('resume.html')
|
179
|
+
#do something, like creating the file
|
180
|
+
end
|
181
|
+
|
182
|
+
#returns a hash with the following data:
|
183
|
+
# 'key' - Key for the object
|
184
|
+
# 'Content-Length' - Size of object contents
|
185
|
+
# 'Content-Type' - MIME type of object
|
186
|
+
# 'ETag' - Etag of object
|
187
|
+
# 'Last-Modified' - Last modified timestamp for object
|
188
|
+
puts directory.files.head('resume.html')
|
189
|
+
|
173
190
|
## Summary
|
174
191
|
|
175
192
|
All done. Try out all the different options and let me know if you have any bugs or issues. I also wrote up a more <a href="https://gist.github.com/710869">consolidated example as a script</a> that you can use for reference.
|
data/fog.gemspec
CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
|
|
6
6
|
## If your rubyforge_project name is different, then edit it and comment out
|
7
7
|
## the sub! line in the Rakefile
|
8
8
|
s.name = 'fog'
|
9
|
-
s.version = '0.8.
|
10
|
-
s.date = '2011-05-
|
9
|
+
s.version = '0.8.2'
|
10
|
+
s.date = '2011-05-26'
|
11
11
|
s.rubyforge_project = 'fog'
|
12
12
|
|
13
13
|
## Make sure your summary is short. The description may be as long
|
@@ -49,6 +49,7 @@ Gem::Specification.new do |s|
|
|
49
49
|
## those that are only needed during development
|
50
50
|
s.add_development_dependency('jekyll')
|
51
51
|
s.add_development_dependency('rake')
|
52
|
+
s.add_development_dependency('rdoc')
|
52
53
|
s.add_development_dependency('rspec', '1.3.1')
|
53
54
|
s.add_development_dependency('shindo', '0.3.4')
|
54
55
|
s.add_development_dependency('virtualbox', '0.8.3')
|
data/lib/fog.rb
CHANGED
data/lib/fog/aws/elb.rb
CHANGED