mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Revert "add GitHub Flavored Markdown to README"
This reverts commit 1bdf61a389
.
GFM only works on Gihub so the Yard documentation generated and
available on http://rubydoc.info/gems/fog will be unreadable.
This commit is contained in:
parent
02ff54a3e5
commit
4935fc8703
1 changed files with 26 additions and 36 deletions
56
README.md
56
README.md
|
@ -18,16 +18,14 @@ fog is the Ruby cloud services library, top to bottom:
|
||||||
Now type `fog` to try stuff, confident that fog will let you know what to do.
|
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:
|
Here is an example of wading through server creation for Amazon Elastic Compute Cloud:
|
||||||
|
|
||||||
```ruby
|
>> server = Compute[:aws].servers.create
|
||||||
server = Compute[:aws].servers.create
|
ArgumentError: image_id is required for this operation
|
||||||
# => ArgumentError: image_id is required for this operation
|
|
||||||
|
|
||||||
server = Compute[:aws].servers.create(:image_id => 'ami-5ee70037')
|
>> server = Compute[:aws].servers.create(:image_id => 'ami-5ee70037')
|
||||||
# => <Fog::AWS::EC2::Server [...]>
|
<Fog::AWS::EC2::Server [...]>
|
||||||
|
|
||||||
server.destroy # cleanup after yourself or regret it, trust me
|
>> server.destroy # cleanup after yourself or regret it, trust me
|
||||||
# => true
|
true
|
||||||
```
|
|
||||||
|
|
||||||
## Collections
|
## Collections
|
||||||
|
|
||||||
|
@ -35,10 +33,8 @@ A high level interface to each cloud is provided through collections, such as `i
|
||||||
You can see a list of available collections by calling `collections` on the connection object.
|
You can see a list of available collections by calling `collections` on the connection object.
|
||||||
You can try it out using the `fog` command:
|
You can try it out using the `fog` command:
|
||||||
|
|
||||||
```ruby
|
>> Compute[:aws].collections
|
||||||
Compute[:aws].collections
|
[:addresses, :directories, ..., :volumes, :zones]
|
||||||
# => [:addresses, :directories, ..., :volumes, :zones]
|
|
||||||
```
|
|
||||||
|
|
||||||
Some collections are available across multiple providers:
|
Some collections are available across multiple providers:
|
||||||
|
|
||||||
|
@ -55,23 +51,21 @@ Collections share basic CRUD type operations, such as:
|
||||||
|
|
||||||
As an example, we'll try initializing and persisting a Rackspace Cloud server:
|
As an example, we'll try initializing and persisting a Rackspace Cloud server:
|
||||||
|
|
||||||
```ruby
|
require 'fog'
|
||||||
require 'fog'
|
|
||||||
|
|
||||||
compute = Fog::Compute.new(
|
compute = Fog::Compute.new(
|
||||||
:provider => 'Rackspace',
|
:provider => 'Rackspace',
|
||||||
:rackspace_api_key => key,
|
:rackspace_api_key => key,
|
||||||
:rackspace_username => username
|
:rackspace_username => username
|
||||||
)
|
)
|
||||||
|
|
||||||
# boot a gentoo server (flavor 1 = 256, image 3 = gentoo 2008.0)
|
# boot a gentoo server (flavor 1 = 256, image 3 = gentoo 2008.0)
|
||||||
server = compute.servers.create(:flavor_id => 1, :image_id => 3, :name => 'my_server')
|
server = compute.servers.create(:flavor_id => 1, :image_id => 3, :name => 'my_server')
|
||||||
server.wait_for { ready? } # give server time to boot
|
server.wait_for { ready? } # give server time to boot
|
||||||
|
|
||||||
# DO STUFF
|
# DO STUFF
|
||||||
|
|
||||||
server.destroy # cleanup after yourself or regret it, trust me
|
server.destroy # cleanup after yourself or regret it, trust me
|
||||||
```
|
|
||||||
|
|
||||||
## Models
|
## Models
|
||||||
|
|
||||||
|
@ -87,9 +81,7 @@ As you might imagine, testing code using Fog can be slow and expensive, constant
|
||||||
Mocking allows skipping this overhead by providing an in memory representation resources as you make requests.
|
Mocking allows skipping this overhead by providing an in memory representation resources as you make requests.
|
||||||
Enabling mocking easy to use, before you run other commands, simply run:
|
Enabling mocking easy to use, before you run other commands, simply run:
|
||||||
|
|
||||||
```ruby
|
Fog.mock!
|
||||||
Fog.mock!
|
|
||||||
```
|
|
||||||
|
|
||||||
Then proceed as usual, if you run into unimplemented mocks, fog will raise an error and as always contributions are welcome!
|
Then proceed as usual, if you run into unimplemented mocks, fog will raise an error and as always contributions are welcome!
|
||||||
|
|
||||||
|
@ -111,15 +103,13 @@ It will return an [excon](http://github.com/geemus/excon) response, which has `b
|
||||||
Play around and use the console to explore or check out [fog.io](http://fog.io) for more details and examples.
|
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.
|
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.
|
||||||
|
|
||||||
```ruby
|
# create a compute connection
|
||||||
# create a compute connection
|
compute = Fog::Compute.new(:provider => 'AWS', :aws_access_key_id => ACCESS_KEY_ID, :aws_secret_access_key => SECRET_ACCESS_KEY)
|
||||||
compute = Fog::Compute.new(:provider => 'AWS', :aws_access_key_id => ACCESS_KEY_ID, :aws_secret_access_key => SECRET_ACCESS_KEY)
|
# compute operations go here
|
||||||
# compute operations go here
|
|
||||||
|
|
||||||
# create a storage connection
|
# create a storage connection
|
||||||
storage = Fog::Storage.new(:provider => 'AWS', :aws_access_key_id => ACCESS_KEY_ID, :aws_secret_access_key => SECRET_ACCESS_KEY)
|
storage = Fog::Storage.new(:provider => 'AWS', :aws_access_key_id => ACCESS_KEY_ID, :aws_secret_access_key => SECRET_ACCESS_KEY)
|
||||||
# storage operations go here
|
# storage operations go here
|
||||||
```
|
|
||||||
|
|
||||||
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!"
|
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!"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue