gce-host 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -222,7 +222,7 @@
222
222
  </div>
223
223
 
224
224
  <div id="footer">
225
- Generated on Wed Nov 23 20:08:30 2016 by
225
+ Generated on Fri Nov 25 20:32:54 2016 by
226
226
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
227
227
  0.8.7.6 (ruby-2.3.2).
228
228
  </div>
@@ -86,7 +86,7 @@ DEALINGS IN THE SOFTWARE.</p>
86
86
  </div></div>
87
87
 
88
88
  <div id="footer">
89
- Generated on Wed Nov 23 20:08:31 2016 by
89
+ Generated on Fri Nov 25 20:32:55 2016 by
90
90
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
91
91
  0.8.7.6 (ruby-2.3.2).
92
92
  </div>
@@ -95,9 +95,12 @@ variables:</p>
95
95
  <code>application_default</code> is available. The default is
96
96
  <code>applilcation_default</code>.</p>
97
97
  </li><li>
98
- <p><strong>GOOGLE_CREDENTIAL_FILE</strong>: Path of credential file. Specify
99
- your service account json file for <code>json_key</code> authentication
100
- method.</p>
98
+ <p><strong>GOOGLE_APPLICATION_CREDENTIALS (optional)</strong>: Path of
99
+ credential file. Specify your service account json file for
100
+ <code>json_key</code> authentication method. Try reading from
101
+ <code>~/.config/gcloud/legacy_credentials/#{service_account}/adc.json</code>
102
+ as default, where the <code>service_account</code> is being read from
103
+ <code>~/.config/gcloud/configurations/config_default</code>.</p>
101
104
  </li></ul>
102
105
 
103
106
  <p>gce-host parameters:</p>
@@ -260,7 +263,7 @@ gcloud account, and instances.</p>
260
263
  <p>Configure .env file as</p>
261
264
 
262
265
  <pre class="code ruby"><code class="ruby"><span class='const'>AUTH_METHOD</span><span class='op'>=</span><span class='id identifier rubyid_json_key'>json_key</span>
263
- <span class='const'>GOOGLE_CREDENTIAL_FILE</span><span class='op'>=</span><span class='id identifier rubyid_service_acount'>service_acount</span><span class='period'>.</span><span class='id identifier rubyid_json'>json</span>
266
+ <span class='const'>GOOGLE_APPLICATION_CREDENTIALS</span><span class='op'>=</span><span class='id identifier rubyid_service_acount'>service_acount</span><span class='period'>.</span><span class='id identifier rubyid_json'>json</span>
264
267
  <span class='const'>GOOGLE_PROJECT</span><span class='op'>=</span><span class='const'>XXXXXXXXXXXXX</span>
265
268
  <span class='const'>OPTIONAL_STRING_KEYS</span><span class='op'>=</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span><span class='id identifier rubyid_status'>status</span>
266
269
  <span class='const'>OPTIONAL_ARRAY_KEYS</span><span class='op'>=</span><span class='id identifier rubyid_tags'>tags</span>
@@ -303,7 +306,7 @@ $ env ($cat .env) terraform apply</code></pre>
303
306
  </div></div>
304
307
 
305
308
  <div id="footer">
306
- Generated on Wed Nov 23 20:08:31 2016 by
309
+ Generated on Fri Nov 25 20:32:55 2016 by
307
310
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
308
311
  0.8.7.6 (ruby-2.3.2).
309
312
  </div>
@@ -95,9 +95,12 @@ variables:</p>
95
95
  <code>application_default</code> is available. The default is
96
96
  <code>applilcation_default</code>.</p>
97
97
  </li><li>
98
- <p><strong>GOOGLE_CREDENTIAL_FILE</strong>: Path of credential file. Specify
99
- your service account json file for <code>json_key</code> authentication
100
- method.</p>
98
+ <p><strong>GOOGLE_APPLICATION_CREDENTIALS (optional)</strong>: Path of
99
+ credential file. Specify your service account json file for
100
+ <code>json_key</code> authentication method. Try reading from
101
+ <code>~/.config/gcloud/legacy_credentials/#{service_account}/adc.json</code>
102
+ as default, where the <code>service_account</code> is being read from
103
+ <code>~/.config/gcloud/configurations/config_default</code>.</p>
101
104
  </li></ul>
102
105
 
103
106
  <p>gce-host parameters:</p>
@@ -260,7 +263,7 @@ gcloud account, and instances.</p>
260
263
  <p>Configure .env file as</p>
261
264
 
262
265
  <pre class="code ruby"><code class="ruby"><span class='const'>AUTH_METHOD</span><span class='op'>=</span><span class='id identifier rubyid_json_key'>json_key</span>
263
- <span class='const'>GOOGLE_CREDENTIAL_FILE</span><span class='op'>=</span><span class='id identifier rubyid_service_acount'>service_acount</span><span class='period'>.</span><span class='id identifier rubyid_json'>json</span>
266
+ <span class='const'>GOOGLE_APPLICATION_CREDENTIALS</span><span class='op'>=</span><span class='id identifier rubyid_service_acount'>service_acount</span><span class='period'>.</span><span class='id identifier rubyid_json'>json</span>
264
267
  <span class='const'>GOOGLE_PROJECT</span><span class='op'>=</span><span class='const'>XXXXXXXXXXXXX</span>
265
268
  <span class='const'>OPTIONAL_STRING_KEYS</span><span class='op'>=</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span><span class='id identifier rubyid_status'>status</span>
266
269
  <span class='const'>OPTIONAL_ARRAY_KEYS</span><span class='op'>=</span><span class='id identifier rubyid_tags'>tags</span>
@@ -303,7 +306,7 @@ $ env ($cat .env) terraform apply</code></pre>
303
306
  </div></div>
304
307
 
305
308
  <div id="footer">
306
- Generated on Wed Nov 23 20:08:31 2016 by
309
+ Generated on Fri Nov 25 20:32:54 2016 by
307
310
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
308
311
  0.8.7.6 (ruby-2.3.2).
309
312
  </div>
@@ -94,23 +94,35 @@
94
94
 
95
95
 
96
96
  <li class="r2 ">
97
- <span class='object_link'><a href="GCE/Host/Config.html#config_file-class_method" title="GCE::Host::Config.config_file (method)">config_file</a></span>
97
+ <span class='object_link'><a href="GCE/Host/Config.html#config_default-class_method" title="GCE::Host::Config.config_default (method)">config_default</a></span>
98
98
  <small>GCE::Host::Config</small>
99
99
  </li>
100
100
 
101
101
 
102
102
  <li class="r1 ">
103
- <span class='object_link'><a href="GCE/Host/Config.html#configure-class_method" title="GCE::Host::Config.configure (method)">configure</a></span>
103
+ <span class='object_link'><a href="GCE/Host/Config.html#config_default_file-class_method" title="GCE::Host::Config.config_default_file (method)">config_default_file</a></span>
104
104
  <small>GCE::Host::Config</small>
105
105
  </li>
106
106
 
107
107
 
108
108
  <li class="r2 ">
109
+ <span class='object_link'><a href="GCE/Host/Config.html#config_file-class_method" title="GCE::Host::Config.config_file (method)">config_file</a></span>
110
+ <small>GCE::Host::Config</small>
111
+ </li>
112
+
113
+
114
+ <li class="r1 ">
109
115
  <span class='object_link'><a href="GCE/Host.html#configure-class_method" title="GCE::Host.configure (method)">configure</a></span>
110
116
  <small>GCE::Host</small>
111
117
  </li>
112
118
 
113
119
 
120
+ <li class="r2 ">
121
+ <span class='object_link'><a href="GCE/Host/Config.html#configure-class_method" title="GCE::Host::Config.configure (method)">configure</a></span>
122
+ <small>GCE::Host::Config</small>
123
+ </li>
124
+
125
+
114
126
  <li class="r1 ">
115
127
  <span class='object_link'><a href="GCE/Host/HostData.html#creation_timestamp-instance_method" title="GCE::Host::HostData#creation_timestamp (method)">#creation_timestamp</a></span>
116
128
  <small>GCE::Host::HostData</small>
@@ -118,11 +130,23 @@
118
130
 
119
131
 
120
132
  <li class="r2 ">
133
+ <span class='object_link'><a href="GCE/Host/Config.html#credential-class_method" title="GCE::Host::Config.credential (method)">credential</a></span>
134
+ <small>GCE::Host::Config</small>
135
+ </li>
136
+
137
+
138
+ <li class="r1 ">
121
139
  <span class='object_link'><a href="GCE/Host/Config.html#credential_file-class_method" title="GCE::Host::Config.credential_file (method)">credential_file</a></span>
122
140
  <small>GCE::Host::Config</small>
123
141
  </li>
124
142
 
125
143
 
144
+ <li class="r2 ">
145
+ <span class='object_link'><a href="GCE/Host/Config.html#credential_file_default-class_method" title="GCE::Host::Config.credential_file_default (method)">credential_file_default</a></span>
146
+ <small>GCE::Host::Config</small>
147
+ </li>
148
+
149
+
126
150
  <li class="r1 ">
127
151
  <span class='object_link'><a href="GCE/Host.html#each-instance_method" title="GCE::Host#each (method)">#each</a></span>
128
152
  <small>GCE::Host</small>
@@ -160,14 +184,14 @@
160
184
 
161
185
 
162
186
  <li class="r1 ">
163
- <span class='object_link'><a href="GCE/Host/RoleData.html#initialize-instance_method" title="GCE::Host::RoleData#initialize (method)">#initialize</a></span>
164
- <small>GCE::Host::RoleData</small>
187
+ <span class='object_link'><a href="GCE/Host/CLI.html#initialize-instance_method" title="GCE::Host::CLI#initialize (method)">#initialize</a></span>
188
+ <small>GCE::Host::CLI</small>
165
189
  </li>
166
190
 
167
191
 
168
192
  <li class="r2 ">
169
- <span class='object_link'><a href="GCE/Host/HostData.html#initialize-instance_method" title="GCE::Host::HostData#initialize (method)">#initialize</a></span>
170
- <small>GCE::Host::HostData</small>
193
+ <span class='object_link'><a href="GCE/Host/RoleData.html#initialize-instance_method" title="GCE::Host::RoleData#initialize (method)">#initialize</a></span>
194
+ <small>GCE::Host::RoleData</small>
171
195
  </li>
172
196
 
173
197
 
@@ -178,20 +202,20 @@
178
202
 
179
203
 
180
204
  <li class="r2 ">
181
- <span class='object_link'><a href="GCE/Host/CLI.html#initialize-instance_method" title="GCE::Host::CLI#initialize (method)">#initialize</a></span>
182
- <small>GCE::Host::CLI</small>
205
+ <span class='object_link'><a href="GCE/Host/HostData.html#initialize-instance_method" title="GCE::Host::HostData#initialize (method)">#initialize</a></span>
206
+ <small>GCE::Host::HostData</small>
183
207
  </li>
184
208
 
185
209
 
186
210
  <li class="r1 ">
187
- <span class='object_link'><a href="GCE/Host/RoleData.html#inspect-instance_method" title="GCE::Host::RoleData#inspect (method)">#inspect</a></span>
188
- <small>GCE::Host::RoleData</small>
211
+ <span class='object_link'><a href="GCE/Host/HostData.html#inspect-instance_method" title="GCE::Host::HostData#inspect (method)">#inspect</a></span>
212
+ <small>GCE::Host::HostData</small>
189
213
  </li>
190
214
 
191
215
 
192
216
  <li class="r2 ">
193
- <span class='object_link'><a href="GCE/Host/HostData.html#inspect-instance_method" title="GCE::Host::HostData#inspect (method)">#inspect</a></span>
194
- <small>GCE::Host::HostData</small>
217
+ <span class='object_link'><a href="GCE/Host/RoleData.html#inspect-instance_method" title="GCE::Host::RoleData#inspect (method)">#inspect</a></span>
218
+ <small>GCE::Host::RoleData</small>
195
219
  </li>
196
220
 
197
221
 
@@ -226,101 +250,113 @@
226
250
 
227
251
 
228
252
  <li class="r2 ">
229
- <span class='object_link'><a href="GCE/Host/HostData.html#match%3F-instance_method" title="GCE::Host::HostData#match? (method)">#match?</a></span>
253
+ <span class='object_link'><a href="GCE/Host/HostData.html#machine_type-instance_method" title="GCE::Host::HostData#machine_type (method)">#machine_type</a></span>
230
254
  <small>GCE::Host::HostData</small>
231
255
  </li>
232
256
 
233
257
 
234
258
  <li class="r1 ">
259
+ <span class='object_link'><a href="GCE/Host/HostData.html#match%3F-instance_method" title="GCE::Host::HostData#match? (method)">#match?</a></span>
260
+ <small>GCE::Host::HostData</small>
261
+ </li>
262
+
263
+
264
+ <li class="r2 ">
235
265
  <span class='object_link'><a href="GCE/Host/RoleData.html#match%3F-instance_method" title="GCE::Host::RoleData#match? (method)">#match?</a></span>
236
266
  <small>GCE::Host::RoleData</small>
237
267
  </li>
238
268
 
239
269
 
240
- <li class="r2 ">
270
+ <li class="r1 ">
241
271
  <span class='object_link'><a href="GCE/Host.html#me-class_method" title="GCE::Host.me (method)">me</a></span>
242
272
  <small>GCE::Host</small>
243
273
  </li>
244
274
 
245
275
 
246
- <li class="r1 ">
276
+ <li class="r2 ">
247
277
  <span class='object_link'><a href="GCE/Host/Config.html#open_timeout_sec-class_method" title="GCE::Host::Config.open_timeout_sec (method)">open_timeout_sec</a></span>
248
278
  <small>GCE::Host::Config</small>
249
279
  </li>
250
280
 
251
281
 
252
- <li class="r2 ">
282
+ <li class="r1 ">
253
283
  <span class='object_link'><a href="GCE/Host/Config.html#optional_array_keys-class_method" title="GCE::Host::Config.optional_array_keys (method)">optional_array_keys</a></span>
254
284
  <small>GCE::Host::Config</small>
255
285
  </li>
256
286
 
257
287
 
258
- <li class="r1 ">
288
+ <li class="r2 ">
259
289
  <span class='object_link'><a href="GCE/Host/Config.html#optional_array_options-class_method" title="GCE::Host::Config.optional_array_options (method)">optional_array_options</a></span>
260
290
  <small>GCE::Host::Config</small>
261
291
  </li>
262
292
 
263
293
 
264
- <li class="r2 ">
294
+ <li class="r1 ">
265
295
  <span class='object_link'><a href="GCE/Host/Config.html#optional_options-class_method" title="GCE::Host::Config.optional_options (method)">optional_options</a></span>
266
296
  <small>GCE::Host::Config</small>
267
297
  </li>
268
298
 
269
299
 
270
- <li class="r1 ">
300
+ <li class="r2 ">
271
301
  <span class='object_link'><a href="GCE/Host/Config.html#optional_string_keys-class_method" title="GCE::Host::Config.optional_string_keys (method)">optional_string_keys</a></span>
272
302
  <small>GCE::Host::Config</small>
273
303
  </li>
274
304
 
275
305
 
276
- <li class="r2 ">
306
+ <li class="r1 ">
277
307
  <span class='object_link'><a href="GCE/Host/Config.html#optional_string_options-class_method" title="GCE::Host::Config.optional_string_options (method)">optional_string_options</a></span>
278
308
  <small>GCE::Host::Config</small>
279
309
  </li>
280
310
 
281
311
 
282
- <li class="r1 ">
312
+ <li class="r2 ">
283
313
  <span class='object_link'><a href="GCE/Host/CLI.html#options-instance_method" title="GCE::Host::CLI#options (method)">#options</a></span>
284
314
  <small>GCE::Host::CLI</small>
285
315
  </li>
286
316
 
287
317
 
288
- <li class="r2 ">
318
+ <li class="r1 ">
289
319
  <span class='object_link'><a href="GCE/Host.html#options-instance_method" title="GCE::Host#options (method)">#options</a></span>
290
320
  <small>GCE::Host</small>
291
321
  </li>
292
322
 
293
323
 
294
- <li class="r1 ">
324
+ <li class="r2 ">
295
325
  <span class='object_link'><a href="GCE/Host/CLI.html#parse_options-instance_method" title="GCE::Host::CLI#parse_options (method)">#parse_options</a></span>
296
326
  <small>GCE::Host::CLI</small>
297
327
  </li>
298
328
 
299
329
 
300
- <li class="r2 ">
330
+ <li class="r1 ">
301
331
  <span class='object_link'><a href="GCE/Host/StringUtil.html#pluralize-class_method" title="GCE::Host::StringUtil.pluralize (method)">pluralize</a></span>
302
332
  <small>GCE::Host::StringUtil</small>
303
333
  </li>
304
334
 
305
335
 
306
- <li class="r1 ">
336
+ <li class="r2 ">
307
337
  <span class='object_link'><a href="GCE/Host/HostData.html#private_ip_address-instance_method" title="GCE::Host::HostData#private_ip_address (method)">#private_ip_address</a></span>
308
338
  <small>GCE::Host::HostData</small>
309
339
  </li>
310
340
 
311
341
 
312
- <li class="r2 ">
342
+ <li class="r1 ">
313
343
  <span class='object_link'><a href="GCE/Host/HostData.html#private_ip_addresses-instance_method" title="GCE::Host::HostData#private_ip_addresses (method)">#private_ip_addresses</a></span>
314
344
  <small>GCE::Host::HostData</small>
315
345
  </li>
316
346
 
317
347
 
318
- <li class="r1 ">
348
+ <li class="r2 ">
319
349
  <span class='object_link'><a href="GCE/Host/Config.html#project-class_method" title="GCE::Host::Config.project (method)">project</a></span>
320
350
  <small>GCE::Host::Config</small>
321
351
  </li>
322
352
 
323
353
 
354
+ <li class="r1 ">
355
+ <span class='object_link'><a href="GCE/Host/Config.html#project_default-class_method" title="GCE::Host::Config.project_default (method)">project_default</a></span>
356
+ <small>GCE::Host::Config</small>
357
+ </li>
358
+
359
+
324
360
  <li class="r2 ">
325
361
  <span class='object_link'><a href="GCE/Host/HostData.html#provisioning%3F-instance_method" title="GCE::Host::HostData#provisioning? (method)">#provisioning?</a></span>
326
362
  <small>GCE::Host::HostData</small>
@@ -399,6 +435,18 @@
399
435
  </li>
400
436
 
401
437
 
438
+ <li class="r1 ">
439
+ <span class='object_link'><a href="GCE/Host/Config.html#service_account-class_method" title="GCE::Host::Config.service_account (method)">service_account</a></span>
440
+ <small>GCE::Host::Config</small>
441
+ </li>
442
+
443
+
444
+ <li class="r2 ">
445
+ <span class='object_link'><a href="GCE/Host/Config.html#service_account_default-class_method" title="GCE::Host::Config.service_account_default (method)">service_account_default</a></span>
446
+ <small>GCE::Host::Config</small>
447
+ </li>
448
+
449
+
402
450
  <li class="r1 ">
403
451
  <span class='object_link'><a href="GCE/Host/StringUtil.html#singularize-class_method" title="GCE::Host::StringUtil.singularize (method)">singularize</a></span>
404
452
  <small>GCE::Host::StringUtil</small>
@@ -471,6 +519,12 @@
471
519
  </li>
472
520
 
473
521
 
522
+ <li class="r1 ">
523
+ <span class='object_link'><a href="GCE/Host/Config.html#zone_default-class_method" title="GCE::Host::Config.zone_default (method)">zone_default</a></span>
524
+ <small>GCE::Host::Config</small>
525
+ </li>
526
+
527
+
474
528
  </ul>
475
529
  </div>
476
530
  </body>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Wed Nov 23 20:08:31 2016 by
106
+ Generated on Fri Nov 25 20:32:55 2016 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.7.6 (ruby-2.3.2).
109
109
  </div>
@@ -1,5 +1,5 @@
1
1
  AUTH_METHOD=json_key
2
- GOOGLE_CREDENTIAL_FILE=~/.config/gcloud/your-project-000.json
2
+ GOOGLE_APPLICATION_CREDENTIALS=~/.config/gcloud/your-project-000.json
3
3
  ROLES_KEY=roles
4
4
  ROLE_VALUE_DELIMITER=:
5
5
  OPTIONAL_STRING_KEYS=service,status
@@ -20,11 +20,8 @@ class GCE
20
20
  end
21
21
 
22
22
  def self.credential_file
23
- @credential_file ||= File.expand_path(
24
- ENV['GOOGLE_CREDENTIAL_FILE'] ||
25
- config.fetch('GOOGLE_CREDENTIAL_FILE', nil) ||
26
- "~/.config/gcloud/legacy_credentials/#{service_account}/adc.json"
27
- )
23
+ # ref. https://developers.google.com/identity/protocols/application-default-credentials
24
+ @credential_file ||= File.expand_path(ENV['GOOGLE_APPLICATION_CREDENTIALS'] || config.fetch('GOOGLE_APPLICATION_CREDENTIALS', nil) || credential_file_default)
28
25
  end
29
26
 
30
27
  def self.credential
@@ -51,6 +48,10 @@ class GCE
51
48
  (config_default['compute'] || {})['zone']
52
49
  end
53
50
 
51
+ def self.credential_file_default
52
+ @credential_file_default ||= File.expand_path("~/.config/gcloud/legacy_credentials/#{service_account}/adc.json")
53
+ end
54
+
54
55
  def self.service_account
55
56
  @service_account ||= ENV['GOOGLE_SERVICE_ACCOUNT'] || config.fetch('GOOGLE_SERVICE_ACCOUNT', nil) || service_account_default
56
57
  end
@@ -1,5 +1,5 @@
1
1
  class GCE
2
2
  class Host
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gce-host
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo