fog-iwd 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +147 -0
  2. data/bin/fog +54 -0
  3. metadata +350 -0
@@ -0,0 +1,147 @@
1
+ http://geemus.s3.amazonaws.com/fog.png
2
+
3
+ fog is the Ruby cloud computing library, top to bottom:
4
+
5
+ * Collections provide a simplified interface, making clouds easier to work with and switch between.
6
+ * Requests allow power users to get the most out of the features of each individual cloud.
7
+ * Mocks make testing and integrating a breeze.
8
+
9
+ == Getting Started
10
+
11
+ sudo gem install fog
12
+
13
+ Now type 'fog' to try stuff, confident that fog will let you know what to do. Here is an example of wading through server creation for Amazon Elastic Compute Cloud:
14
+
15
+ >> server = Compute[:aws].servers.create
16
+ ArgumentError: image_id is required for this operation
17
+
18
+ >> server = Compute[:aws].servers.create(:image_id => 'ami-5ee70037')
19
+ <Fog::AWS::EC2::Server [...]>
20
+
21
+ >> server.destroy # cleanup after yourself or regret it, trust me
22
+ true
23
+
24
+ == Collections
25
+
26
+ A high level interface to each cloud is provided through collections, such as `images` and `servers`.
27
+ You can see a list of available collections by calling `collections` on the connection object. You can try it out using the `fog` command:
28
+
29
+ >> Compute[:aws].collections
30
+ [:addresses, :directories, ..., :volumes, :zones]
31
+
32
+ Some collections are available across multiple providers:
33
+
34
+ * compute providers have +flavors+, +images+ and +servers+
35
+ * dns providers have +zones+ and +records+
36
+ * storage providers have +directories+ and +files+
37
+
38
+ Collections share basic CRUD type operations, such as:
39
+ * +all+ - fetch every object of that type from the provider.
40
+ * +create+ - initialize a new record locally and a remote resource with the provider.
41
+ * +get+ - fetch a single object by it's identity from the provider.
42
+ * +new+ - initialize a new record locally, but do not create a remote resource with the provider.
43
+
44
+ As an example, we'll try initializing and persisting a Rackspace Cloud server:
45
+
46
+ require 'fog'
47
+
48
+ compute = Fog::Compute.new(
49
+ :provider => 'Rackspace',
50
+ :rackspace_api_key => key,
51
+ :rackspace_username => username
52
+ )
53
+
54
+ # boot a gentoo server (flavor 1 = 256, image 3 = gentoo 2008.0)
55
+ server = compute.servers.create(:flavor_id => 1, :image_id => 3, :name => 'my_server')
56
+ server.wait_for { ready? } # give server time to boot
57
+
58
+ # DO STUFF
59
+
60
+ server.destroy # cleanup after yourself or regret it, trust me
61
+
62
+ == Models
63
+
64
+ Many of the collection methods return individual objects, which also provide common methods:
65
+ * +destroy+ - will destroy the persisted object from the provider
66
+ * +save+ - persist the object to the provider
67
+ * +wait_for+ - takes a block and waits for either the block to return true for the object or for a timeout (defaults to 10 minutes)
68
+
69
+ == Mocks
70
+
71
+ As you might imagine, testing code using Fog can be slow and expensive, constantly turning on and and shutting down instances.
72
+ Mocking allows skipping this overhead by providing an in memory representation resources as you make requests.
73
+ Enabling mocking easy to use, before you run other commands, simply run:
74
+
75
+ Fog.mock!
76
+
77
+ Then proceed as usual, if you run into unimplemented mocks fog will raise an error and as always contributions are welcome!
78
+
79
+ == Requests
80
+
81
+ Requests allow you to dive deeper when the models just can't cut it.
82
+ You can see a list of available requests by calling #requests on the connection object.
83
+
84
+ For instance, ec2 provides methods related to reserved instances that don't have any models (yet). Here is how you can lookup your reserved instances:
85
+
86
+ $ fog
87
+ >> Compute[:aws].describe_reserved_instances
88
+ #<Excon::Response [...]>
89
+
90
+ It will return an {excon}[http://github.com/geemus/excon] response, which has `body`, `headers` and `status`. Both return nice hashes.
91
+
92
+ == Go forth and conquer
93
+
94
+ Play around and use the console to explore or check out {fog.io}[http://fog.io] for more details and examples. Once you are ready to start scripting fog, here is a quick hint on how to make connections without the command line thing to help you.
95
+
96
+ # create a compute connection
97
+ compute = Fog::Compute.new(:provider => 'AWS', :aws_access_key_id => ACCESS_KEY_ID, :aws_secret_access_key => SECRET_ACCESS_KEY)
98
+ # compute operations go here
99
+
100
+ # create a storage connection
101
+ storage = Fog::Storage.new(:provider => 'AWS', :aws_access_key_id => ACCESS_KEY_ID, :aws_secret_access_key => SECRET_ACCESS_KEY)
102
+ # storage operations go here
103
+
104
+ geemus says: "That should give you everything you need to get started, but let me know if there is anything I can do to help!"
105
+
106
+ == Contributing
107
+
108
+ * 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]
109
+ * Fork the project and do your work in a topic branch.
110
+ * Add shindo tests to prove your code works and run all the tests using `bundle exec rake`.
111
+ * Rebase your branch against fog/fog to make sure everything is up to date.
112
+ * Commit your changes and send a pull request.
113
+
114
+ == Additional Resources
115
+
116
+ {fog.io}[http://fog.io]
117
+
118
+ == Sponsorship
119
+
120
+ http://www.engineyard.com/images/logo.png
121
+
122
+ All new work on fog is sponsored by {Engine Yard}[http://engineyard.com]
123
+
124
+ == Copyright
125
+
126
+ (The MIT License)
127
+
128
+ Copyright (c) 2010 {geemus (Wesley Beary)}[http://github.com/geemus]
129
+
130
+ Permission is hereby granted, free of charge, to any person obtaining
131
+ a copy of this software and associated documentation files (the
132
+ "Software"), to deal in the Software without restriction, including
133
+ without limitation the rights to use, copy, modify, merge, publish,
134
+ distribute, sublicense, and/or sell copies of the Software, and to
135
+ permit persons to whom the Software is furnished to do so, subject to
136
+ the following conditions:
137
+
138
+ The above copyright notice and this permission notice shall be
139
+ included in all copies or substantial portions of the Software.
140
+
141
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
142
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
143
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
144
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
145
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
146
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
147
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/bin/fog ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'fog'))
3
+ require 'irb'
4
+ require 'yaml'
5
+ Fog.credential = ARGV.first ? ARGV.first.to_sym : nil
6
+ Fog.mock! if ENV['FOG_MOCK']
7
+ if Fog.credentials.empty?
8
+ begin
9
+ Fog::Errors.missing_credentials
10
+ rescue Fog::Errors::LoadError => error
11
+ abort error.message
12
+ end
13
+ end
14
+
15
+ require 'fog/bin'
16
+
17
+ providers = Fog.available_providers
18
+ providers = if providers.length > 1
19
+ providers[0...-1].join(', ') << ' and ' << providers[-1]
20
+ else
21
+ providers.first
22
+ end
23
+
24
+ if ARGV.length > 1
25
+
26
+ require 'multi_json'
27
+
28
+ result = instance_eval(ARGV[1..-1].join(' '))
29
+ puts(MultiJson.encode(result))
30
+
31
+ else
32
+
33
+ ARGV.clear # Avoid passing args to IRB
34
+ IRB.setup(nil)
35
+ @irb = IRB::Irb.new(nil)
36
+ IRB.conf[:MAIN_CONTEXT] = @irb.context
37
+ IRB.conf[:PROMPT][:FOG] = IRB.conf[:PROMPT][:SIMPLE].dup
38
+ IRB.conf[:PROMPT][:FOG][:RETURN] = "%s\n"
39
+ @irb.context.prompt_mode = :FOG
40
+ @irb.context.workspace = IRB::WorkSpace.new(binding)
41
+
42
+ Formatador.display_line('Welcome to fog interactive!')
43
+ Formatador.display_line(":#{Fog.credential} provides #{providers}")
44
+ providers = Fog.providers
45
+
46
+ # FIXME: hacks until we can `include Fog` in bin
47
+ CDN = Fog::CDN
48
+ Compute = Fog::Compute
49
+ DNS = Fog::DNS
50
+ Storage = Fog::Storage
51
+
52
+ catch(:IRB_EXIT) { @irb.eval_input }
53
+
54
+ end
metadata ADDED
@@ -0,0 +1,350 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fog-iwd
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - geemus (Wesley Beary)
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-03-27 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ hash: 3
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ name: builder
31
+ prerelease: false
32
+ type: :runtime
33
+ requirement: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ hash: 43
41
+ segments:
42
+ - 0
43
+ - 13
44
+ - 0
45
+ version: 0.13.0
46
+ name: excon
47
+ prerelease: false
48
+ type: :runtime
49
+ requirement: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ hash: 23
57
+ segments:
58
+ - 0
59
+ - 2
60
+ - 0
61
+ version: 0.2.0
62
+ name: formatador
63
+ prerelease: false
64
+ type: :runtime
65
+ requirement: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ hash: 15
73
+ segments:
74
+ - 1
75
+ - 0
76
+ version: "1.0"
77
+ name: multi_json
78
+ prerelease: false
79
+ type: :runtime
80
+ requirement: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ version_requirements: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ name: mime-types
92
+ prerelease: false
93
+ type: :runtime
94
+ requirement: *id005
95
+ - !ruby/object:Gem::Dependency
96
+ version_requirements: &id006 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ hash: 31
102
+ segments:
103
+ - 1
104
+ - 0
105
+ - 4
106
+ version: 1.0.4
107
+ name: net-scp
108
+ prerelease: false
109
+ type: :runtime
110
+ requirement: *id006
111
+ - !ruby/object:Gem::Dependency
112
+ version_requirements: &id007 !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ hash: 13
118
+ segments:
119
+ - 2
120
+ - 1
121
+ - 3
122
+ version: 2.1.3
123
+ name: net-ssh
124
+ prerelease: false
125
+ type: :runtime
126
+ requirement: *id007
127
+ - !ruby/object:Gem::Dependency
128
+ version_requirements: &id008 !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ hash: 3
134
+ segments:
135
+ - 1
136
+ - 5
137
+ - 0
138
+ version: 1.5.0
139
+ name: nokogiri
140
+ prerelease: false
141
+ type: :runtime
142
+ requirement: *id008
143
+ - !ruby/object:Gem::Dependency
144
+ version_requirements: &id009 !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ hash: 3
150
+ segments:
151
+ - 0
152
+ version: "0"
153
+ name: ruby-hmac
154
+ prerelease: false
155
+ type: :runtime
156
+ requirement: *id009
157
+ - !ruby/object:Gem::Dependency
158
+ version_requirements: &id010 !ruby/object:Gem::Requirement
159
+ none: false
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ hash: 3
164
+ segments:
165
+ - 0
166
+ version: "0"
167
+ name: jekyll
168
+ prerelease: false
169
+ type: :development
170
+ requirement: *id010
171
+ - !ruby/object:Gem::Dependency
172
+ version_requirements: &id011 !ruby/object:Gem::Requirement
173
+ none: false
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ hash: 3
178
+ segments:
179
+ - 0
180
+ version: "0"
181
+ name: rake
182
+ prerelease: false
183
+ type: :development
184
+ requirement: *id011
185
+ - !ruby/object:Gem::Dependency
186
+ version_requirements: &id012 !ruby/object:Gem::Requirement
187
+ none: false
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ hash: 3
192
+ segments:
193
+ - 0
194
+ version: "0"
195
+ name: rbvmomi
196
+ prerelease: false
197
+ type: :development
198
+ requirement: *id012
199
+ - !ruby/object:Gem::Dependency
200
+ version_requirements: &id013 !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ hash: 3
206
+ segments:
207
+ - 0
208
+ version: "0"
209
+ name: rdoc
210
+ prerelease: false
211
+ type: :development
212
+ requirement: *id013
213
+ - !ruby/object:Gem::Dependency
214
+ version_requirements: &id014 !ruby/object:Gem::Requirement
215
+ none: false
216
+ requirements:
217
+ - - ">="
218
+ - !ruby/object:Gem::Version
219
+ hash: 3
220
+ segments:
221
+ - 0
222
+ version: "0"
223
+ name: thor
224
+ prerelease: false
225
+ type: :development
226
+ requirement: *id014
227
+ - !ruby/object:Gem::Dependency
228
+ version_requirements: &id015 !ruby/object:Gem::Requirement
229
+ none: false
230
+ requirements:
231
+ - - ~>
232
+ - !ruby/object:Gem::Version
233
+ hash: 25
234
+ segments:
235
+ - 1
236
+ - 3
237
+ - 1
238
+ version: 1.3.1
239
+ name: rspec
240
+ prerelease: false
241
+ type: :development
242
+ requirement: *id015
243
+ - !ruby/object:Gem::Dependency
244
+ version_requirements: &id016 !ruby/object:Gem::Requirement
245
+ none: false
246
+ requirements:
247
+ - - ">="
248
+ - !ruby/object:Gem::Version
249
+ hash: 13
250
+ segments:
251
+ - 0
252
+ - 0
253
+ - 9
254
+ version: 0.0.9
255
+ name: rbovirt
256
+ prerelease: false
257
+ type: :development
258
+ requirement: *id016
259
+ - !ruby/object:Gem::Dependency
260
+ version_requirements: &id017 !ruby/object:Gem::Requirement
261
+ none: false
262
+ requirements:
263
+ - - ~>
264
+ - !ruby/object:Gem::Version
265
+ hash: 27
266
+ segments:
267
+ - 0
268
+ - 3
269
+ - 4
270
+ version: 0.3.4
271
+ name: shindo
272
+ prerelease: false
273
+ type: :development
274
+ requirement: *id017
275
+ - !ruby/object:Gem::Dependency
276
+ version_requirements: &id018 !ruby/object:Gem::Requirement
277
+ none: false
278
+ requirements:
279
+ - - ~>
280
+ - !ruby/object:Gem::Version
281
+ hash: 57
282
+ segments:
283
+ - 0
284
+ - 9
285
+ - 1
286
+ version: 0.9.1
287
+ name: virtualbox
288
+ prerelease: false
289
+ type: :development
290
+ requirement: *id018
291
+ - !ruby/object:Gem::Dependency
292
+ version_requirements: &id019 !ruby/object:Gem::Requirement
293
+ none: false
294
+ requirements:
295
+ - - ">="
296
+ - !ruby/object:Gem::Version
297
+ hash: 3
298
+ segments:
299
+ - 0
300
+ version: "0"
301
+ name: fission
302
+ prerelease: false
303
+ type: :development
304
+ requirement: *id019
305
+ description: The Ruby cloud services library. Supports all major cloud providers including AWS, Rackspace, Linode, Blue Box, StormOnDemand, and many others. Full support for most AWS services including EC2, S3, CloudWatch, SimpleDB, ELB, and RDS.
306
+ email: geemus@gmail.com
307
+ executables:
308
+ - fog
309
+ extensions: []
310
+
311
+ extra_rdoc_files:
312
+ - README.rdoc
313
+ files:
314
+ - README.rdoc
315
+ - bin/fog
316
+ homepage: http://github.com/fog/fog
317
+ licenses: []
318
+
319
+ post_install_message:
320
+ rdoc_options:
321
+ - --charset=UTF-8
322
+ require_paths:
323
+ - lib
324
+ required_ruby_version: !ruby/object:Gem::Requirement
325
+ none: false
326
+ requirements:
327
+ - - ">="
328
+ - !ruby/object:Gem::Version
329
+ hash: 3
330
+ segments:
331
+ - 0
332
+ version: "0"
333
+ required_rubygems_version: !ruby/object:Gem::Requirement
334
+ none: false
335
+ requirements:
336
+ - - ">="
337
+ - !ruby/object:Gem::Version
338
+ hash: 3
339
+ segments:
340
+ - 0
341
+ version: "0"
342
+ requirements: []
343
+
344
+ rubyforge_project: fog-iwd
345
+ rubygems_version: 1.7.2
346
+ signing_key:
347
+ specification_version: 2
348
+ summary: brings clouds to you
349
+ test_files: []
350
+