opsicle 2.10.1 → 2.11.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e28df963a182535bfaf92964eeb32df3950e884
4
- data.tar.gz: 7ba69cac271a9c2269afe46fe28e120a7405d92b
3
+ metadata.gz: b1ad1bea72c477d7da8b1f4a433b43c2e9b2a046
4
+ data.tar.gz: bcfa61ba70e1041e5a7b4284dd6f4a8199b679c1
5
5
  SHA512:
6
- metadata.gz: 0197fea7b2f46f0ea103c8c8df2549040acf4f00a87ff220827feb237e21d2edce2cad5587f35f25fe6c21b38e6fa3b35ca8da45f244ac2ee11b42567b3df06d
7
- data.tar.gz: 46270627f6c99cb98f4e362aeb93dfac47796c982572b7bea7de5be94062c4f98aec94c49036ffe8525532292f9ce8118a24e1356ef0d6a67c4baf44778a05f7
6
+ metadata.gz: 6693a08f3cdecbbba71746f248a623e9611cbfaeaf6b3b79d011b5a1cef44981293fb3a484fea8d6155663e482f54e556dd014f9e67c07bfdc6c3f2876df2bcd
7
+ data.tar.gz: 0a0ec60a2747b605b22dd49150c3bf204b247c23a83177ba2f72e575eb6fed11da9f192d75dbea163f7b9051e23ae2b4d3340bb4fc428b95091f77ed095886c4
@@ -1,5 +1,6 @@
1
1
  require 'gli'
2
2
  require "opsicle/user_profile"
3
+ require "opsicle/opsworks_adapter"
3
4
  require "opsicle/manageable_layer"
4
5
  require "opsicle/manageable_instance"
5
6
  require "opsicle/manageable_stack"
@@ -9,10 +10,9 @@ module Opsicle
9
10
 
10
11
  def initialize(environment)
11
12
  @client = Client.new(environment)
12
- @opsworks = @client.opsworks
13
- @ec2 = @client.ec2
13
+ @opsworks_adapater = OpsworksAdapter.new(@client)
14
14
  stack_id = @client.config.opsworks_config[:stack_id]
15
- @stack = ManageableStack.new(@client.config.opsworks_config[:stack_id], @opsworks)
15
+ @stack = ManageableStack.new(stack_id, @opsworks_adapater.client)
16
16
  @cli = HighLine.new
17
17
  end
18
18
 
@@ -36,11 +36,11 @@ module Opsicle
36
36
 
37
37
  def select_layer
38
38
  puts "\nLayers:\n"
39
- ops_layers = @opsworks.describe_layers({ :stack_id => @stack.id }).layers
39
+ ops_layers = @opsworks_adapater.get_layers(@stack.id)
40
40
 
41
41
  layers = []
42
42
  ops_layers.each do |layer|
43
- layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks, @ec2, @cli)
43
+ layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapater.client, @client.ec2, @cli)
44
44
  end
45
45
 
46
46
  layers.each_with_index { |layer, index| puts "#{index.to_i + 1}) #{layer.name}" }
@@ -0,0 +1,15 @@
1
+ class Opsicle::OpsworksAdapter
2
+ attr_reader :client
3
+
4
+ def initialize(client)
5
+ @client = client.opsworks
6
+ end
7
+
8
+ def get_layers(stack_id)
9
+ client.describe_layers(stack_id: stack_id).layers
10
+ end
11
+
12
+ def start_instance(instance_id)
13
+ client.start_instance(instance_id: instance_id)
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Opsicle
2
- VERSION = "2.10.1"
2
+ VERSION = "2.11.0"
3
3
  end
@@ -0,0 +1,32 @@
1
+ describe Opsicle::OpsworksAdapter do
2
+ let(:aws_opsworks_client) do
3
+ double(
4
+ :aws_opsworks_client,
5
+ describe_layers: double(:layers, layers: []),
6
+ start_instance: true
7
+ )
8
+ end
9
+ let(:client) { double(:client, opsworks: aws_opsworks_client) }
10
+
11
+ subject { described_class.new(client) }
12
+
13
+ describe "#get_layers" do
14
+ let(:get_layers) { subject.get_layers(:stack_id) }
15
+
16
+ it "should gather an array of layers for this opsworks client" do
17
+ expect(get_layers).to be_empty
18
+ end
19
+
20
+ it "should call describe_layers on the opsworks client" do
21
+ expect(aws_opsworks_client).to receive(:describe_layers).with(stack_id: :stack_id)
22
+ get_layers
23
+ end
24
+ end
25
+
26
+ describe "#start_instance" do
27
+ it "should call start_instance on the opsworks client" do
28
+ expect(aws_opsworks_client).to receive(:start_instance).with(instance_id: :instance_id)
29
+ subject.start_instance(:instance_id)
30
+ end
31
+ end
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opsicle
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.1
4
+ version: 2.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Fleener
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-02-05 00:00:00.000000000 Z
12
+ date: 2018-02-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -190,7 +190,6 @@ files:
190
190
  - LICENSE
191
191
  - bin/opsicle
192
192
  - lib/opsicle.rb
193
- - lib/opsicle/aws_instance_manager_helper.rb
194
193
  - lib/opsicle/client.rb
195
194
  - lib/opsicle/commands.rb
196
195
  - lib/opsicle/commands/add_tags.rb
@@ -236,6 +235,7 @@ files:
236
235
  - lib/opsicle/monitor/spy/instances.rb
237
236
  - lib/opsicle/monitor/subpanel.rb
238
237
  - lib/opsicle/monitor/translatable.rb
238
+ - lib/opsicle/opsworks_adapter.rb
239
239
  - lib/opsicle/output.rb
240
240
  - lib/opsicle/s3_bucket.rb
241
241
  - lib/opsicle/stack.rb
@@ -266,6 +266,7 @@ files:
266
266
  - spec/opsicle/monitor/screen_spec.rb
267
267
  - spec/opsicle/monitor/spy/deployments_spec.rb
268
268
  - spec/opsicle/monitor/subpanel_spec.rb
269
+ - spec/opsicle/opsworks_adapter_spec.rb
269
270
  - spec/opsicle/output_spec.rb
270
271
  - spec/opsicle/s3_bucket_spec.rb
271
272
  - spec/opsicle/user_profile_spec.rb
@@ -290,37 +291,38 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
291
  version: '0'
291
292
  requirements: []
292
293
  rubyforge_project:
293
- rubygems_version: 2.6.13
294
+ rubygems_version: 2.6.14
294
295
  signing_key:
295
296
  specification_version: 4
296
297
  summary: An opsworks specific abstraction on top of the aws sdk
297
298
  test_files:
299
+ - spec/spec_helper.rb
300
+ - spec/opsicle/output_spec.rb
301
+ - spec/opsicle/config_spec.rb
298
302
  - spec/opsicle/client_spec.rb
299
- - spec/opsicle/commands/chef_update_spec.rb
300
- - spec/opsicle/commands/clone_instance_spec.rb
301
- - spec/opsicle/commands/delete_instance_spec.rb
303
+ - spec/opsicle/monitor/spy/deployments_spec.rb
304
+ - spec/opsicle/monitor/screen_spec.rb
305
+ - spec/opsicle/monitor/panel_spec.rb
306
+ - spec/opsicle/monitor/subpanel_spec.rb
307
+ - spec/opsicle/monitor/app_spec.rb
308
+ - spec/opsicle/layer_spec.rb
309
+ - spec/opsicle/manageable_stack_spec.rb
310
+ - spec/opsicle/s3_bucket_spec.rb
311
+ - spec/opsicle/manageable_layer_spec.rb
312
+ - spec/opsicle/opsworks_adapter_spec.rb
302
313
  - spec/opsicle/commands/deploy_spec.rb
303
- - spec/opsicle/commands/execute_recipes_spec.rb
304
- - spec/opsicle/commands/failure_log_spec.rb
305
- - spec/opsicle/commands/list_instances_spec.rb
314
+ - spec/opsicle/commands/clone_instance_spec.rb
315
+ - spec/opsicle/commands/chef_update_spec.rb
306
316
  - spec/opsicle/commands/list_spec.rb
307
317
  - spec/opsicle/commands/ssh_key_spec.rb
308
- - spec/opsicle/commands/ssh_spec.rb
309
318
  - spec/opsicle/commands/update_spec.rb
319
+ - spec/opsicle/commands/failure_log_spec.rb
320
+ - spec/opsicle/commands/delete_instance_spec.rb
321
+ - spec/opsicle/commands/list_instances_spec.rb
322
+ - spec/opsicle/commands/execute_recipes_spec.rb
323
+ - spec/opsicle/commands/ssh_spec.rb
310
324
  - spec/opsicle/commands/user_profile_info_spec.rb
311
- - spec/opsicle/config_spec.rb
312
- - spec/opsicle/errors_spec.rb
313
325
  - spec/opsicle/instances_spec.rb
314
- - spec/opsicle/layer_spec.rb
315
- - spec/opsicle/manageable_instance_spec.rb
316
- - spec/opsicle/manageable_layer_spec.rb
317
- - spec/opsicle/manageable_stack_spec.rb
318
- - spec/opsicle/monitor/app_spec.rb
319
- - spec/opsicle/monitor/panel_spec.rb
320
- - spec/opsicle/monitor/screen_spec.rb
321
- - spec/opsicle/monitor/spy/deployments_spec.rb
322
- - spec/opsicle/monitor/subpanel_spec.rb
323
- - spec/opsicle/output_spec.rb
324
- - spec/opsicle/s3_bucket_spec.rb
326
+ - spec/opsicle/errors_spec.rb
325
327
  - spec/opsicle/user_profile_spec.rb
326
- - spec/spec_helper.rb
328
+ - spec/opsicle/manageable_instance_spec.rb
@@ -1,3 +0,0 @@
1
- module AwsInstanceManagerHelper
2
-
3
- end