pipely 0.4.0 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b9b109c0262cd83b9db819b8464e1ed39a6bef6
4
- data.tar.gz: 633b3e1c8bb00323199629919714dec0cce1523f
3
+ metadata.gz: 75e016f5669df8829da06dc708ada8736c04c395
4
+ data.tar.gz: d6fd727143baff289e2f2a0b90ee872d3ad538c8
5
5
  SHA512:
6
- metadata.gz: 9576d0aeb1273ebf96021d60cd1f6fb98f9f800cdae3bcd14a1ea6ca5919864ba3896ff99668c340ef0f25b15fe1280997ca7f997ccabe78ddbb4709762c216a
7
- data.tar.gz: ef09a07d9ecdb00ea13633455b88f262336756e3e8d51889dd989be384b0ce01192ccbc7c9d474b21d436a2a055c67c1d134bf9ed83786af47add4571b5a2a12
6
+ metadata.gz: 8cc24e0b697252d8f1be5c6e8e52016050807c15e0420b9210f124b5525d2c747e49d5421bd110482115d8844bde32125877f3c58ab3f885a83d0a1447932f3d
7
+ data.tar.gz: b01b4816f6630041a8246218741d28d08e53da886c692695ba84c8be07937ea3889c6869eee313049ee92c01a9185123019df9952393dc5571ce86d2f4d3f1f8
@@ -25,13 +25,20 @@ module Pipely
25
25
  ids = []
26
26
 
27
27
  begin
28
- result = Fog::AWS[:data_pipeline].list_pipelines
28
+ result = data_pipeline.list_pipelines
29
29
  ids += result['pipelineIdList']
30
30
  end while (result['hasMoreResults'] && result['marker'])
31
31
 
32
32
  ids
33
33
  end
34
34
 
35
+ def data_pipeline
36
+ Fog::AWS::DataPipeline.new
37
+ rescue ArgumentError
38
+ $stderr.puts "#{self.class.name}: Falling back to IAM profile"
39
+ Fog::AWS::DataPipeline.new(use_iam_profile: true)
40
+ end
41
+
35
42
  end
36
43
 
37
44
  end
@@ -6,7 +6,7 @@ module Pipely
6
6
  class FogClient < Struct.new(:pipeline_id)
7
7
 
8
8
  def definition
9
- objects = Fog::AWS[:data_pipeline].get_pipeline_definition(pipeline_id)
9
+ objects = data_pipeline.get_pipeline_definition(pipeline_id)
10
10
 
11
11
  flattened_objects = []
12
12
 
@@ -61,7 +61,7 @@ module Pipely
61
61
  private
62
62
 
63
63
  def all_instances
64
- c = Fog::AWS[:data_pipeline]
64
+ c = data_pipeline
65
65
 
66
66
  result = {}
67
67
  pipeline_objects = []
@@ -85,5 +85,12 @@ module Pipely
85
85
  pipeline_objects
86
86
  end
87
87
 
88
+ def data_pipeline
89
+ Fog::AWS::DataPipeline.new
90
+ rescue ArgumentError
91
+ $stderr.puts "#{self.class.name}: Falling back to IAM profile"
92
+ Fog::AWS::DataPipeline.new(use_iam_profile: true)
93
+ end
94
+
88
95
  end
89
96
  end
@@ -12,7 +12,6 @@ module Pipely
12
12
  end
13
13
 
14
14
  def directory
15
- storage = Fog::Storage.new({ provider: 'AWS' })
16
15
  directory = storage.directories.detect{ |d| d.key == @host }
17
16
 
18
17
  directory or raise("Couldn't find S3 bucket '#{@host}'")
@@ -28,6 +27,15 @@ module Pipely
28
27
  remote_file.public_url
29
28
  end
30
29
 
30
+ private
31
+
32
+ def storage
33
+ Fog::Storage.new({ provider: 'AWS' })
34
+ rescue ArgumentError
35
+ $stderr.puts "#{self.class.name}: Falling back to IAM profile"
36
+ Fog::Storage.new({ provider: 'AWS', use_iam_profile: true })
37
+ end
38
+
31
39
  end
32
40
 
33
41
  end
@@ -1,3 +1,3 @@
1
1
  module Pipely
2
- VERSION = "0.4.0" unless defined?(::DataPipelineGraphviz::VERSION)
2
+ VERSION = "0.4.1" unless defined?(::DataPipelineGraphviz::VERSION)
3
3
  end
@@ -2,7 +2,7 @@ require 'pipely/graph_builder'
2
2
 
3
3
  describe Pipely::GraphBuilder do
4
4
 
5
- let(:graph) { stub(:graph) }
5
+ let(:graph) { double(:graph) }
6
6
 
7
7
  let(:node1) {
8
8
  Pipely::Component.new(
@@ -1,18 +1,20 @@
1
1
  require 'pipely'
2
2
 
3
3
  describe Pipely do
4
- let(:definition_json) { stub }
4
+ let(:definition_json) { double }
5
5
  let(:filename) { 'path/to/graph.png' }
6
- let(:definition) { stub }
6
+ let(:definition) { double }
7
7
 
8
8
  before do
9
9
  Pipely::Definition.stub(:parse).with(definition_json) { definition }
10
10
  end
11
11
 
12
12
  describe '.draw' do
13
- let(:components) { stub }
14
- let(:definition) { stub(:definition, :components_for_graph => components) }
15
- let(:graph) { stub(:graph, :output => nil) }
13
+ let(:components) { double }
14
+ let(:definition) {
15
+ double(:definition, :components_for_graph => components)
16
+ }
17
+ let(:graph) { double(:graph, :output => nil) }
16
18
 
17
19
  before do
18
20
  Pipely::GraphBuilder.any_instance.stub(:build).with(components) { graph }
@@ -25,7 +27,7 @@ describe Pipely do
25
27
  end
26
28
 
27
29
  context 'with component_attributes' do
28
- let(:component_attributes) { stub }
30
+ let(:component_attributes) { double }
29
31
 
30
32
  it 'applies the component_attributes to the definition' do
31
33
  definition.should_receive(:apply_component_attributes).
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Gillooly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-20 00:00:00.000000000 Z
11
+ date: 2014-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-graphviz