knife-google 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/CONTRIB.md +64 -0
- data/Gemfile +11 -0
- data/README.md +287 -0
- data/Rakefile +53 -0
- data/knife-google.gemspec +26 -0
- data/lib/chef/knife/google_base.rb +39 -68
- data/lib/chef/knife/google_disk_create.rb +60 -0
- data/lib/chef/knife/google_disk_delete.rb +60 -0
- data/lib/chef/knife/google_disk_list.rb +75 -0
- data/lib/chef/knife/google_server_create.rb +273 -184
- data/lib/chef/knife/google_server_delete.rb +74 -32
- data/lib/chef/knife/google_server_list.rb +45 -64
- data/lib/chef/knife/google_setup.rb +31 -0
- data/lib/chef/knife/google_zone_list.rb +78 -0
- data/lib/google/compute.rb +46 -0
- data/lib/google/compute/client.rb +188 -0
- data/lib/google/compute/config.rb +23 -0
- data/lib/google/compute/creatable_resource_collection.rb +38 -0
- data/lib/google/compute/deletable_resource_collection.rb +51 -0
- data/lib/google/compute/disk.rb +40 -0
- data/lib/google/compute/exception.rb +28 -0
- data/lib/google/compute/firewall.rb +65 -0
- data/lib/google/compute/global_operation.rb +60 -0
- data/lib/google/compute/image.rb +30 -0
- data/lib/google/compute/kernel.rb +20 -0
- data/lib/google/compute/listable_resource_collection.rb +33 -0
- data/lib/google/compute/machine_type.rb +36 -0
- data/lib/google/compute/mixins/utils.rb +58 -0
- data/lib/google/compute/network.rb +29 -0
- data/lib/google/compute/project.rb +76 -0
- data/lib/google/compute/resource.rb +81 -0
- data/lib/google/compute/resource_collection.rb +78 -0
- data/lib/google/compute/server.rb +87 -0
- data/lib/google/compute/server/attached_disk.rb +39 -0
- data/lib/google/compute/server/network_interface.rb +38 -0
- data/lib/google/compute/server/network_interface/access_config.rb +35 -0
- data/lib/google/compute/server/serial_port_output.rb +31 -0
- data/lib/google/compute/snapshot.rb +30 -0
- data/lib/google/compute/version.rb +19 -0
- data/lib/google/compute/zone.rb +32 -0
- data/lib/google/compute/zone_operation.rb +60 -0
- data/lib/knife-google/version.rb +18 -2
- data/spec/chef/knife/google_base_spec.rb +46 -0
- data/spec/chef/knife/google_disk_create_spec.rb +36 -0
- data/spec/chef/knife/google_disk_delete_spec.rb +65 -0
- data/spec/chef/knife/google_disk_list_spec.rb +36 -0
- data/spec/chef/knife/google_server_create_spec.rb +84 -0
- data/spec/chef/knife/google_server_delete_spec.rb +105 -0
- data/spec/chef/knife/google_server_list_spec.rb +39 -0
- data/spec/chef/knife/google_setup_spec.rb +25 -0
- data/spec/chef/knife/google_zone_list_spec.rb +32 -0
- data/spec/data/client.json +14 -0
- data/spec/data/compute-v1beta14.json +3386 -0
- data/spec/data/disk.json +15 -0
- data/spec/data/firewall.json +13 -0
- data/spec/data/global_operation.json +36 -0
- data/spec/data/image.json +12 -0
- data/spec/data/kernel.json +15 -0
- data/spec/data/machine_type.json +24 -0
- data/spec/data/network.json +10 -0
- data/spec/data/project.json +21 -0
- data/spec/data/serial_port_output.json +5 -0
- data/spec/data/server.json +46 -0
- data/spec/data/snapshot.json +12 -0
- data/spec/data/zone.json +30 -0
- data/spec/data/zone_operation.json +36 -0
- data/spec/google/compute/disk_spec.rb +105 -0
- data/spec/google/compute/firewall_spec.rb +128 -0
- data/spec/google/compute/global_operation_spec.rb +62 -0
- data/spec/google/compute/image_spec.rb +75 -0
- data/spec/google/compute/kernel_spec.rb +49 -0
- data/spec/google/compute/machine_type_spec.rb +53 -0
- data/spec/google/compute/network_spec.rb +68 -0
- data/spec/google/compute/project_spec.rb +71 -0
- data/spec/google/compute/server_spec.rb +125 -0
- data/spec/google/compute/snapshot_spec.rb +69 -0
- data/spec/google/compute/zone_operation_spec.rb +62 -0
- data/spec/google/compute/zone_spec.rb +50 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/support/mocks.rb +62 -0
- data/spec/support/resource_examples.rb +70 -0
- data/spec/support/spec_google_base.rb +56 -0
- metadata +121 -31
- data/README.rdoc +0 -96
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
coverage
|
6
|
+
InstalledFiles
|
7
|
+
lib/bundler/man
|
8
|
+
pkg
|
9
|
+
rdoc
|
10
|
+
spec/reports
|
11
|
+
test/tmp
|
12
|
+
test/version_tmp
|
13
|
+
tmp
|
14
|
+
|
15
|
+
# YARD artifacts
|
16
|
+
.yardoc
|
17
|
+
_yardoc
|
18
|
+
doc/
|
19
|
+
.swp
|
20
|
+
.swo
|
21
|
+
Gemfile.lock
|
22
|
+
.rvmrc
|
data/CONTRIB.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# How to become a contributor and submit your own code
|
2
|
+
|
3
|
+
## Contributor License Agreements
|
4
|
+
|
5
|
+
We'd love to accept your sample apps and patches! Before we can take them, we
|
6
|
+
have to jump a couple of legal hurdles.
|
7
|
+
|
8
|
+
Please fill out either the individual or corporate Contributor License Agreement
|
9
|
+
(CLA).
|
10
|
+
|
11
|
+
* If you are an individual writing original source code and you're sure you
|
12
|
+
own the intellectual property, then you'll need to sign an [individual CLA]
|
13
|
+
(http://code.google.com/legal/individual-cla-v1.0.html).
|
14
|
+
* If you work for a company that wants to allow you to contribute your work,
|
15
|
+
then you'll need to sign a [corporate CLA]
|
16
|
+
(http://code.google.com/legal/corporate-cla-v1.0.html).
|
17
|
+
|
18
|
+
Follow either of the two links above to access the appropriate CLA and
|
19
|
+
instructions for how to sign and return it. Once we receive it, we'll be able to
|
20
|
+
accept your pull requests.
|
21
|
+
|
22
|
+
## Contributing A Patch
|
23
|
+
|
24
|
+
1. Submit an issue describing your proposed change to the repo in question.
|
25
|
+
1. The repo owner will respond to your issue promptly.
|
26
|
+
1. If your proposed change is accepted, and you haven't already done so, sign a
|
27
|
+
Contributor License Agreement (see details above).
|
28
|
+
1. Fork the desired repo, develop and test your code changes.
|
29
|
+
1. Ensure that your code adheres to the existing style in the sample to which
|
30
|
+
you are contributing. Refer to the
|
31
|
+
[Google Cloud Platform Samples Style Guide]
|
32
|
+
(https://github.com/GoogleCloudPlatform/Template/wiki/style.html) for the
|
33
|
+
recommended coding standards for this organization.
|
34
|
+
1. Ensure that your code has an appropriate set of unit tests which all pass.
|
35
|
+
1. Submit a pull request.
|
36
|
+
|
37
|
+
## Contributing A New Sample App
|
38
|
+
|
39
|
+
1. Submit an issue to the GoogleCloudPlatform/Template repo describing your
|
40
|
+
proposed sample app.
|
41
|
+
1. The Template repo owner will respond to your enhancement issue promptly.
|
42
|
+
Instructional value is the top priority when evaluating new app proposals for
|
43
|
+
this collection of repos.
|
44
|
+
1. If your proposal is accepted, and you haven't already done so, sign a
|
45
|
+
Contributor License Agreement (see details above).
|
46
|
+
1. Create your own repo for your app following this naming convention:
|
47
|
+
* {product}-{app-name}-{language}
|
48
|
+
* products: appengine, compute, storage, bigquery, prediction, cloudsql
|
49
|
+
* example: appengine-guestbook-python
|
50
|
+
* For multi-product apps, concatenate the primary products, like this:
|
51
|
+
compute-appengine-demo-suite-python.
|
52
|
+
* For multi-language apps, concatenate the primary languages like this:
|
53
|
+
appengine-sockets-python-java-go.
|
54
|
+
|
55
|
+
1. Clone the README.md, CONTRIB.md and LICENSE files from the
|
56
|
+
GoogleCloudPlatform/Template repo.
|
57
|
+
1. Ensure that your code adheres to the existing style in the sample to which
|
58
|
+
you are contributing. Refer to the
|
59
|
+
[Google Cloud Platform Samples Style Guide]
|
60
|
+
(https://github.com/GoogleCloudPlatform/Template/wiki/style.html) for the
|
61
|
+
recommended coding standards for this organization.
|
62
|
+
1. Ensure that your code has an appropriate set of unit tests which all pass.
|
63
|
+
1. Submit a request to fork your repo in GoogleCloudPlatform organizationt via
|
64
|
+
your proposal issue.
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,287 @@
|
|
1
|
+
# knife-google
|
2
|
+
|
3
|
+
A [knife] (http://wiki.opscode.com/display/chef/Knife) plugin to create,
|
4
|
+
delete and enlist
|
5
|
+
[Google Compute Engine] (https://cloud.google.com/products/compute-engine)
|
6
|
+
resources.
|
7
|
+
|
8
|
+
## Overview
|
9
|
+
|
10
|
+
This plugin adds functionality to Chef through a knife plugin to create,
|
11
|
+
delete, and manage
|
12
|
+
[Google Compute Engine](https://cloud.google.com/products/compute-engine)
|
13
|
+
servers and disks.
|
14
|
+
|
15
|
+
### Nomenclature
|
16
|
+
|
17
|
+
This plugin conforms to the nomenclature used by similar plugins and uses
|
18
|
+
the term "server" when referencing nodes managed by the plugin. But in
|
19
|
+
Google Compute Engine parlance, this is equivalent to an "instance" or
|
20
|
+
"virtual machine instance".
|
21
|
+
|
22
|
+
### Create a Google Cloud Platform project
|
23
|
+
|
24
|
+
Before getting started with this plugin, you must first create a
|
25
|
+
[Google Cloud Platform](https://cloud.google.com/) "project" and add the
|
26
|
+
Google Compute Engine service to your project. Once you have created your
|
27
|
+
project, you will have access to other Google Cloud Platform services such as
|
28
|
+
[App Egnine](https://developers.google.com/appengine/),
|
29
|
+
[Cloud Storage](https://developers.google.com/storage/),
|
30
|
+
[Cloud SQL](https://developers.google.com/cloud-sql/)
|
31
|
+
and others, but this plugin only requires you enable Google Compute Engine in
|
32
|
+
your project. Note that you will need to be logged in with your Google
|
33
|
+
Account before creating the project and adding services.
|
34
|
+
|
35
|
+
### Authorizing Setup
|
36
|
+
|
37
|
+
In order for the knife plugin to programmatically manage your servers, you
|
38
|
+
will first need to authorize its use of the Google Compute Engine API.
|
39
|
+
Authorization to use any of Google's Cloud service API's utilizes the
|
40
|
+
[OAuth 2.0](https://developers.google.com/accounts/docs/OAuth2) standard.
|
41
|
+
Once your project has been created, log in to your Google Account and visit the
|
42
|
+
[API Console](http://code.google.com/apis/console) and follow the "API Access"
|
43
|
+
menu. Create a new "Client ID" and specify the
|
44
|
+
[Installed Application](https://developers.google.com/accounts/docs/OAuth2#installed)
|
45
|
+
Application type with sub-type "Other". These actions will generate a new
|
46
|
+
"Client ID", "Client secret", and "Redirect URI's".
|
47
|
+
|
48
|
+
This knife plugin includes a 'setup' sub-command that requires you to supply
|
49
|
+
the client ID and secret in order to obtain an "authorization token". You
|
50
|
+
will only need to run this command one time and the plugin will record your
|
51
|
+
credential information and tokens for future API calls.
|
52
|
+
|
53
|
+
## Installation
|
54
|
+
|
55
|
+
Be sure you are running Chef version 0.10.0 or higher in order to use knife
|
56
|
+
plugins.
|
57
|
+
|
58
|
+
```sh
|
59
|
+
gem install knife-google
|
60
|
+
```
|
61
|
+
|
62
|
+
or, for Gemfile:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
gem 'knife-google'
|
66
|
+
```
|
67
|
+
|
68
|
+
Depending on your system's configuration, you may need to run this command
|
69
|
+
with root/Administrator privileges.
|
70
|
+
|
71
|
+
## Configuration
|
72
|
+
|
73
|
+
### Setting up the plugin
|
74
|
+
|
75
|
+
For initial setup, you must first have created your Google Cloud Platform
|
76
|
+
project, enabled Google Compute Engine, and set up the Client ID described
|
77
|
+
above. Run the 'setup' sub-command and supply the Project ID (not your
|
78
|
+
project name or number), the Client ID, client secret, and authorization
|
79
|
+
tokens when prompted. It will also prompt you to open a URL in a browser.
|
80
|
+
Make sure sure the you are logged in with the Google account associated
|
81
|
+
with the project and client id/secrete in order to authorize the plugin.
|
82
|
+
|
83
|
+
```sh
|
84
|
+
knife google setup
|
85
|
+
```
|
86
|
+
|
87
|
+
By default, the credential and token information will be stored in
|
88
|
+
`~/.google-compute.json`. You can override this location with
|
89
|
+
`-f <credential_file>` flag with all plugin commands.
|
90
|
+
|
91
|
+
### Bootstrap Preparation and SSH
|
92
|
+
|
93
|
+
In order to bootstrap nodes, you will first need to ensure your SSH
|
94
|
+
keys are set up correctly. In Google Compute Engine, you can store
|
95
|
+
SSH keys in project metadata that will get copied over to new servers
|
96
|
+
and placed in the appropriate user's `~/.ssh/authorized_keys` file.
|
97
|
+
|
98
|
+
If you don't already have SSH keys set up, you can create them with
|
99
|
+
the `ssh-keygen` program. Open up the Metadata page from the
|
100
|
+
GCE section of the cloud console. If it doesn't already exist, create
|
101
|
+
a new `sshKeys` key and paste in your user's `~/.ssh/id_rsa.pub`
|
102
|
+
file; make sure to prefix the entry with the username that corresponds
|
103
|
+
to the username specified with the `-x` (aka `--ssh-user`) argument of the knife
|
104
|
+
command or its default value of `root`. An example entry should look
|
105
|
+
something like this -- notice the prepended username of `myuser`:
|
106
|
+
|
107
|
+
```
|
108
|
+
myuser:ssh-rsa AYAAB3Nwejwejjfjawlwl990sefjsfC5lPulcP4eZB+z1zcMF
|
109
|
+
76gTV4vojT/SWXymTfGpBL2KHTmF4jnGfEKPwjHIiLrZNHM2ISMi/atlKjOoUCVT
|
110
|
+
AvUyjqqp3z2KVXSP9P50Kgf8JYWjjXKApiZHkJOHJZ8GGf7aTnRU9NEGLbQK6Q1k
|
111
|
+
4UHbVG4ps4kSLWsJ7eVcu981GvlwP3ooiJ6YWcOX9PS58d4SNtq41/XaoLibKt/Y
|
112
|
+
Wzd/4tjYwMRVcxJdAy1T2474vkU/Qr7ibFinKeJymgouoQpEGhF64cF2pncCcmR7
|
113
|
+
zRk7CzL3mhcma8Zvwj234-2f3/+234/AR#@R#y1EEFsbzGbxOJfEVSTgJfvY7KYp
|
114
|
+
329df/2348sd3ARTx99 mymail@myhost
|
115
|
+
```
|
116
|
+
|
117
|
+
## Usage
|
118
|
+
|
119
|
+
Some usage examples follow:
|
120
|
+
|
121
|
+
```sh
|
122
|
+
# See a list of all zones, their statuses and maintenance windows
|
123
|
+
$ knife google zone list
|
124
|
+
|
125
|
+
# List all servers (including those that may not be managed by Chef)
|
126
|
+
$ knife google server list -Z us-central2-a
|
127
|
+
|
128
|
+
# Create a server
|
129
|
+
$ knife google server create www1 -m n1-standard-1 -I centos-6-v20130325 -Z us-central2-a -i ~/.ssh/id_rsa -x jdoe
|
130
|
+
|
131
|
+
# Delete a server (along with Chef node and API client via --purge)
|
132
|
+
$ knife google server delete www1 --purge -Z us-central2-a
|
133
|
+
```
|
134
|
+
|
135
|
+
For a full list of commands, run `knife google` without additional arguments:
|
136
|
+
|
137
|
+
```sh
|
138
|
+
$ knife google
|
139
|
+
|
140
|
+
** GOOGLE COMMANDS **
|
141
|
+
knife google disk list --google-compute-zone ZONE (options)
|
142
|
+
knife google zone list (options)
|
143
|
+
knife google server delete SERVER [SERVER] --google-compute-zone ZONE (options)
|
144
|
+
knife google server create NAME --google-compute-zone ZONE (options)
|
145
|
+
knife google disk create NAME --google-disk-size N --google-compute-zone ZONE (options)
|
146
|
+
knife google setup
|
147
|
+
knife google server list --google-compute-zone ZONE (options)
|
148
|
+
knife google disk delete NAME --google-compute-zone ZONE
|
149
|
+
```
|
150
|
+
|
151
|
+
More detailed help can be obtained by specifying sub-commands. For
|
152
|
+
instance,
|
153
|
+
|
154
|
+
```sh
|
155
|
+
$ knife google server list -Z foo --help
|
156
|
+
knife google server list --google-compute-zone ZONE (options)
|
157
|
+
-s, --server-url URL Chef Server URL
|
158
|
+
-k, --key KEY API Client Key
|
159
|
+
--[no-]color Use colored output, defaults to enabled
|
160
|
+
-f CREDENTIAL_FILE, Google Compute credential file (google setup can create this)
|
161
|
+
--google-compute-credential-file
|
162
|
+
-c, --config CONFIG The configuration file to use
|
163
|
+
--defaults Accept default values for all questions
|
164
|
+
-d, --disable-editing Do not open EDITOR, just accept the data as is
|
165
|
+
-e, --editor EDITOR Set the editor to use for interactive commands
|
166
|
+
-E, --environment ENVIRONMENT Set the Chef environment
|
167
|
+
-F, --format FORMAT Which format to use for output
|
168
|
+
-u, --user USER API Client Username
|
169
|
+
--print-after Show the data after a destructive operation
|
170
|
+
-V, --verbose More verbose output. Use twice for max verbosity
|
171
|
+
-v, --version Show chef version
|
172
|
+
-y, --yes Say yes to all prompts for confirmation
|
173
|
+
-Z, --google-compute-zone ZONE The Zone for this server (required)
|
174
|
+
-h, --help Show this message
|
175
|
+
```
|
176
|
+
|
177
|
+
## Sub-commands
|
178
|
+
|
179
|
+
### knife google setup
|
180
|
+
|
181
|
+
Use this command to initially set up authorization (see above for more
|
182
|
+
details). Note that if you override the default credential file with the
|
183
|
+
`-f` parameter, you'll need to use the `-f` switch for *all* sub-commands.
|
184
|
+
When prompted, make sure to specify the "Project ID" (and not the name or
|
185
|
+
number) or you will see 404/not found errors even if the setup command
|
186
|
+
completes successfully.
|
187
|
+
|
188
|
+
### knife google zone list
|
189
|
+
|
190
|
+
Use this command to list out the available Google Compute Engine zones.
|
191
|
+
You can find a zone's current status, number of deployed servers, disks,
|
192
|
+
and upcoming maintenance windows. The output should look similar to:
|
193
|
+
|
194
|
+
```
|
195
|
+
Name Status Servers Disks Maintainance Window
|
196
|
+
europe-west1-a up 0 0 2013-08-03 19:00:00 +0000 to 2013-08-18 19:00:00 +0000
|
197
|
+
europe-west1-b up 0 0 2013-05-11 19:00:00 +0000 to 2013-05-26 19:00:00 +0000
|
198
|
+
us-central1-a up 0 1 2013-08-17 19:00:00 +0000 to 2013-09-01 19:00:00 +0000
|
199
|
+
us-central1-b up 0 0 2013-06-08 19:00:00 +0000 to 2013-06-23 19:00:00 +0000
|
200
|
+
us-central2-a up 10 6 2013-05-25 19:00:00 +0000 to 2013-06-09 19:00:00 +0000
|
201
|
+
```
|
202
|
+
|
203
|
+
### knife google server create
|
204
|
+
|
205
|
+
Use this command to create a new Google Compute Engine server (a.k.a.
|
206
|
+
instance). You must specify a name, the machine type, the zone, and
|
207
|
+
image. Note that if you are bootstrapping the node, make sure to
|
208
|
+
follow the preparation instructions earlier and use the `-x` and
|
209
|
+
`-i` commands to specify the username and the identity file for
|
210
|
+
that user. Make sure to use the private key file (e.g. `~/.ssh/id_rsa`)
|
211
|
+
for the identity file and *not* the public key file.
|
212
|
+
|
213
|
+
See the extended options that also allow bootstrapping the node with
|
214
|
+
`knife google server create --help`.
|
215
|
+
|
216
|
+
### knife google server delete
|
217
|
+
|
218
|
+
This command terminates and deletes a server. Use the `--purge`
|
219
|
+
option to also remove it from Chef. Use `knife google server
|
220
|
+
delete --help` for other options.
|
221
|
+
|
222
|
+
### knife google server list
|
223
|
+
|
224
|
+
Get a list of servers in the specified zone. Note that this may
|
225
|
+
include servers that are *not* managed by Chef. Your output should
|
226
|
+
look something like:
|
227
|
+
|
228
|
+
```
|
229
|
+
Name Type Image Public IP Private IP Disks Zone Status
|
230
|
+
chef-svr n1-standard-1 gcel-12-04-v20130325 103.59.80.113 10.240.45.78 us-central2-a running
|
231
|
+
chef-workstation n1-standard-1 gcel-12-04-v20130325 103.59.85.188 10.240.9.140 us-central2-a running
|
232
|
+
fuse-dev n1-standard-1 gcel-12-04-v20130225 103.59.80.147 10.240.166.18 pd-fuse us-central2-a running
|
233
|
+
magfs-c1 n1-standard-2 gcel-12-04-v20130225 103.59.87.217 10.240.61.92 us-central2-a running
|
234
|
+
magfs-c2 n1-standard-2 gcel-12-04-v20130225 103.59.80.161 10.240.175.240 us-central2-a running
|
235
|
+
magfs-c3 n1-standard-2 gcel-12-04-v20130325 178.255.120.69 10.240.34.197 jay-scratch us-central2-a running
|
236
|
+
magfs-svr n1-standard-4 gcel-12-04-v20130225 103.59.80.178 10.240.81.25 pd28g us-central2-a running
|
237
|
+
```
|
238
|
+
|
239
|
+
### knife google disk create
|
240
|
+
|
241
|
+
Create a new persistent disk. You must provide a name, size in
|
242
|
+
gigabytes, and the desired zone.
|
243
|
+
|
244
|
+
### knife google disk delete
|
245
|
+
|
246
|
+
Delete an existing disk in the specified zone. Note that the
|
247
|
+
disk will *not* be deleted if it is currently attached to a
|
248
|
+
running server.
|
249
|
+
|
250
|
+
### knife google disk list
|
251
|
+
|
252
|
+
See a listing of disks defined for a specific zone. For example,
|
253
|
+
|
254
|
+
```
|
255
|
+
Name Zone Source Snapshot Size (In GB) Status
|
256
|
+
jay-scratch us-central2-a 10 ready
|
257
|
+
pd-fuse us-central2-a 10 ready
|
258
|
+
pd28g us-central2-a 28 ready
|
259
|
+
```
|
260
|
+
|
261
|
+
## Troubleshooting
|
262
|
+
|
263
|
+
* Seeing 404 errors or zone not found?
|
264
|
+
This can result if you mistakenly specified an invalid "Project ID"
|
265
|
+
while going through the `knife google setup` command. Make sure
|
266
|
+
you specified the "Project ID" (not the project name or number).
|
267
|
+
|
268
|
+
## Build and Development
|
269
|
+
|
270
|
+
Standard rake commands for building, installing, testing, and uninstalling the module.
|
271
|
+
|
272
|
+
```
|
273
|
+
# Run spec tests
|
274
|
+
$ rake
|
275
|
+
|
276
|
+
# Build and install the module
|
277
|
+
$ rake install
|
278
|
+
|
279
|
+
# Uninstall
|
280
|
+
$ rake uninstall
|
281
|
+
```
|
282
|
+
## Contributing
|
283
|
+
* See [CONTRIB.md](https://github.com/opscode/knife-google/blob/master/CONTRIB.md)
|
284
|
+
|
285
|
+
## Licensing
|
286
|
+
* See [LICENSE](https://raw.github.com/opscode/knife-google/master/LICENSE)
|
287
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Copyright 2013, Google, Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
#
|
15
|
+
# encoding: utf-8
|
16
|
+
|
17
|
+
require 'rubygems'
|
18
|
+
require 'rake'
|
19
|
+
GEM_NAME = "knife-google"
|
20
|
+
|
21
|
+
spec = eval(File.read(GEM_NAME+".gemspec"))
|
22
|
+
|
23
|
+
require 'rubygems/package_task'
|
24
|
+
|
25
|
+
Gem::PackageTask.new(spec) do |pkg|
|
26
|
+
pkg.gem_spec = spec
|
27
|
+
end
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :spec
|
36
|
+
|
37
|
+
task :install => :package do
|
38
|
+
sh %{gem install pkg/#{GEM_NAME}-#{Knife::Google::VERSION} --no-rdoc --no-ri}
|
39
|
+
end
|
40
|
+
|
41
|
+
task :uninstall do
|
42
|
+
sh %{gem uninstall #{GEM_NAME} -x -v #{Knife::Google::VERSION} }
|
43
|
+
end
|
44
|
+
|
45
|
+
require 'rdoc/task'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "#{GEM_NAME} #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*', 'LICENSE', 'CONTRIB*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require 'knife-google/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'knife-google'
|
7
|
+
s.version = Knife::Google::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Chiraq Jog", "Ranjib Dey", "James Tucker", "Paul Rossman", "Eric Johnson"]
|
10
|
+
s.email = "raggi@google.com"
|
11
|
+
s.has_rdoc = true
|
12
|
+
s.extra_rdoc_files = ["README.md", "LICENSE", "CONTRIB.md" ]
|
13
|
+
s.summary = "Manage Google Compute Engine servers, disks, and zones"
|
14
|
+
s.description = "Google Compute Engine Support for Chef's Knife Command"
|
15
|
+
s.homepage = "http://wiki.opscode.com/display/chef"
|
16
|
+
|
17
|
+
s.add_dependency "chef", ">= 0.10.0"
|
18
|
+
s.add_dependency "google-api-client"
|
19
|
+
s.add_dependency "multi_json"
|
20
|
+
s.add_dependency "mixlib-config"
|
21
|
+
s.files = `git ls-files`.split($/)
|
22
|
+
|
23
|
+
s.add_development_dependency "rspec"
|
24
|
+
s.add_development_dependency "rake"
|
25
|
+
s.add_development_dependency "simplecov"
|
26
|
+
end
|