heirloom 0.12.1 → 0.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +1 -0
  4. data/CHANGELOG.md +6 -0
  5. data/README.md +12 -6
  6. data/heirloom.gemspec +3 -5
  7. data/lib/heirloom/catalog/verify.rb +2 -2
  8. data/lib/heirloom/cli/authorize.rb +1 -2
  9. data/lib/heirloom/cli/catalog.rb +62 -19
  10. data/lib/heirloom/cli/cleanup.rb +1 -2
  11. data/lib/heirloom/cli/destroy.rb +1 -2
  12. data/lib/heirloom/cli/download.rb +2 -3
  13. data/lib/heirloom/cli/formatter/catalog.rb +25 -11
  14. data/lib/heirloom/cli/list.rb +1 -3
  15. data/lib/heirloom/cli/rotate.rb +1 -2
  16. data/lib/heirloom/cli/setup.rb +1 -2
  17. data/lib/heirloom/cli/shared.rb +3 -0
  18. data/lib/heirloom/cli/show.rb +1 -3
  19. data/lib/heirloom/cli/tag.rb +1 -2
  20. data/lib/heirloom/cli/teardown.rb +1 -2
  21. data/lib/heirloom/cli/upload.rb +1 -2
  22. data/lib/heirloom/version.rb +1 -1
  23. data/spec/acl/s3_spec.rb +11 -11
  24. data/spec/archive/authorizer_spec.rb +20 -20
  25. data/spec/archive/builder_spec.rb +13 -13
  26. data/spec/archive/checker_spec.rb +24 -24
  27. data/spec/archive/destroyer_spec.rb +20 -20
  28. data/spec/archive/downloader_spec.rb +30 -30
  29. data/spec/archive/lister_spec.rb +7 -7
  30. data/spec/archive/reader_spec.rb +65 -65
  31. data/spec/archive/setup_spec.rb +27 -27
  32. data/spec/archive/teardowner_spec.rb +19 -19
  33. data/spec/archive/updater_spec.rb +10 -10
  34. data/spec/archive/uploader_spec.rb +26 -26
  35. data/spec/archive/verifier_spec.rb +25 -25
  36. data/spec/archive/writer_spec.rb +11 -11
  37. data/spec/archive_spec.rb +91 -93
  38. data/spec/aws/s3_spec.rb +102 -102
  39. data/spec/aws/simpledb_spec.rb +33 -63
  40. data/spec/catalog/add_spec.rb +12 -12
  41. data/spec/catalog/delete_spec.rb +14 -14
  42. data/spec/catalog/list_spec.rb +8 -8
  43. data/spec/catalog/setup_spec.rb +11 -11
  44. data/spec/catalog/show_spec.rb +13 -13
  45. data/spec/catalog/verify_spec.rb +16 -16
  46. data/spec/catalog_spec.rb +36 -36
  47. data/spec/cipher/data_spec.rb +19 -19
  48. data/spec/cipher/file_spec.rb +11 -11
  49. data/spec/cli/authorize_spec.rb +16 -16
  50. data/spec/cli/catalog_spec.rb +18 -34
  51. data/spec/cli/destroy_spec.rb +13 -13
  52. data/spec/cli/download_spec.rb +31 -31
  53. data/spec/cli/formatter/catalog_spec.rb +19 -17
  54. data/spec/cli/list_spec.rb +14 -14
  55. data/spec/cli/rotate_spec.rb +9 -9
  56. data/spec/cli/setup_spec.rb +29 -29
  57. data/spec/cli/shared_spec.rb +119 -119
  58. data/spec/cli/show_spec.rb +20 -20
  59. data/spec/cli/tag_spec.rb +18 -18
  60. data/spec/cli/teardown_spec.rb +28 -28
  61. data/spec/cli/upload_spec.rb +38 -38
  62. data/spec/config_spec.rb +21 -21
  63. data/spec/destroyer/s3_spec.rb +6 -6
  64. data/spec/directory/directory_spec.rb +19 -19
  65. data/spec/downloader/s3_spec.rb +18 -18
  66. data/spec/logger_spec.rb +9 -9
  67. data/spec/spec_helper.rb +4 -80
  68. data/spec/uploader/s3_spec.rb +35 -35
  69. metadata +23 -56
  70. data/spec/integration/authorize_spec.rb +0 -79
  71. data/spec/integration/cleanup_spec.rb +0 -77
  72. data/watchr.rb +0 -101
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6d73c91dfef2a41499f55632e29e331c92cdcb3
4
- data.tar.gz: 7e42b9a64be37441bca4a742d63cd34d0ea677f5
3
+ metadata.gz: decae42c86e0f9136bccc91e721bc442e9bb7370
4
+ data.tar.gz: 66989f1a4f9018f4e39383c1fd28c230d69566c2
5
5
  SHA512:
6
- metadata.gz: 85b6bb627ea3cf373d788bde7217d1b774eeb13aa1855a48fcf41d5e7d653ed1cb1f1b90e2df09b22a864fc779f5720525566a7790704d182bfc3059779b89a1
7
- data.tar.gz: 1a07e220a9ed9a3ea9bc78e16bbc39b0f5c033abd6174dff3760246daea2961e5a24245b12d8bc4c87a7ce5cb30f32ac05bd4d8dc822ab77d9a9361efdcd6dff
6
+ metadata.gz: 38a972e23a71f7f797959acac530987d9b3e6199aaf44bf6b56d174a344178ac4e00886e86decaf2f3105855b088ddd02e4a3e7339b2f05f523f4fc4241d8a9e
7
+ data.tar.gz: 499f01de342b1d059156336495f172a302a5d9fe824123643b78d4e4f6216917c98d2af69a1b0455a16e1f0de5f0f7c402d1259911ddfb8e24c9eaf3d787659c
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.1.0
@@ -2,4 +2,5 @@ rvm:
2
2
  - 1.9.2
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.0
5
6
  script: "rake spec"
@@ -1,5 +1,11 @@
1
1
  ## HEAD:
2
2
 
3
+ ## 0.12.2 (03/26/2014):
4
+
5
+ * Upgrade to fog 1.21.0
6
+ * Remove VCR
7
+ * Update specs to use double
8
+
3
9
  ## 0.12.1 (09/04/2013):
4
10
 
5
11
  * Upgraded to fog 1.15.0
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Build Status](https://secure.travis-ci.org/intuit/heirloom.png)](http://travis-ci.org/intuit/heirloom)
2
-
2
+ [![Code Climate](https://codeclimate.com/github/intuit/heirloom.png)](https://codeclimate.com/github/intuit/heirloom)
3
3
  Heirloom
4
4
  ========
5
5
 
@@ -26,18 +26,24 @@ To get started, copy the sample below to ~/.heirloom.yml and update the specifie
26
26
 
27
27
  ```
28
28
  # default environment
29
+
29
30
  default:
30
31
  access_key: UPDATE_ME
31
32
  secret_key: UPDATE_ME
32
33
  metadata_region: us-west-1
33
-
34
+
34
35
  # multiple environments can be defined and
35
36
  # selected via cli with -e or --environment
36
37
 
37
- # prod:
38
- # access_key: UPDATE_ME
39
- # secret_key: UPDATE_ME
40
- # metadata_region: us-west-1
38
+ prod:
39
+ access_key: UPDATE_ME
40
+ secret_key: UPDATE_ME
41
+ metadata_region: us-west-1
42
+
43
+ preprod:
44
+ access_key: UPDATE_ME
45
+ secret_key: UPDATE_ME
46
+ metadata_region: us-west-1
41
47
  ```
42
48
 
43
49
  You can specify an alternate config file by setting "HEIRLOOM_CONFIG_FILE"
@@ -20,13 +20,11 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # specify any dependencies here; for example:
22
22
  s.add_development_dependency "rake"
23
- s.add_development_dependency "rspec", '~> 2.11.0'
23
+ s.add_development_dependency "rspec", '~> 2.14.1'
24
24
  s.add_development_dependency "simplecov"
25
- s.add_development_dependency "vcr", '= 2.4.0'
26
- s.add_development_dependency "watchr"
27
25
 
28
- s.add_runtime_dependency 'fog', '= 1.15.0'
26
+ s.add_runtime_dependency 'fog', '= 1.21.0'
29
27
  s.add_runtime_dependency 'hashie', '= 2.0.5'
30
28
  s.add_runtime_dependency 'trollop', '= 2.0'
31
- s.add_runtime_dependency 'xml-simple', '~> 1.1.2'
29
+ s.add_runtime_dependency 'xml-simple', '~> 1.1.3'
32
30
  end
@@ -10,10 +10,10 @@ module Heirloom
10
10
 
11
11
  def catalog_domain_exists?
12
12
  if sdb.domain_exists? 'heirloom'
13
- @logger.debug "Catalog exists in #{@region}."
13
+ @logger.debug "Catalog of Heirlooms exists in #{@region}."
14
14
  true
15
15
  else
16
- @logger.debug "Catalog does not exist in #{@region}."
16
+ @logger.debug "Catalog of Heirlooms does not exist in #{@region}."
17
17
  false
18
18
  end
19
19
  end
@@ -57,8 +57,7 @@ EOS
57
57
  opt :id, "ID of the Heirloom to authorize.", :type => :string
58
58
  opt :level, "Log level [debug|info|warn|error].", :type => :string,
59
59
  :default => 'info'
60
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
61
- :default => 'us-west-1'
60
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
62
61
  opt :name, "Name of Heirloom.", :type => :string
63
62
  opt :aws_access_key, "AWS Access Key ID", :type => :string,
64
63
  :short => :none
@@ -17,27 +17,71 @@ module Heirloom
17
17
  ensure_valid_options :provided => @opts,
18
18
  :required => [],
19
19
  :config => @config
20
- ensure_valid_region :region => @opts[:metadata_region],
21
- :config => @config
22
- @catalog = Heirloom::Catalog.new :config => @config
23
- ensure_catalog_domain_exists :config => @config,
24
- :catalog => @catalog
25
20
  end
26
21
 
27
22
  def all
28
- if @opts[:json]
29
- jj catalog_with_heirloom_prefix_removed
30
- else
31
- formatter = Heirloom::CLI::Formatter::Catalog.new
32
- puts formatter.format :catalog => catalog_with_heirloom_prefix_removed,
33
- :name => @opts[:name]
23
+ detected_regions.each do |region|
24
+ @config.metadata_region = region
25
+
26
+ ensure_valid_region :region => region,
27
+ :config => @config
28
+
29
+ next unless catalog_domain_exists?
30
+
31
+ @catalog_list = Hash[@catalog.all]
32
+
33
+ unless @opts[:name]
34
+ heirloom_summary region
35
+ @heirloom_found = true
36
+ next
37
+ end
38
+
39
+ if heirloom_exists_in_catalog? @opts[:name]
40
+ @logger.debug "Heirloom \'#{@opts[:name]}\' found in catalog for #{region}."
41
+ heirloom_details region, @opts[:name]
42
+ @heirloom_found = true
43
+ else
44
+ @logger.debug "Heirloom \'#{@opts[:name]}\' not found in catalog for #{region}."
45
+ end
34
46
  end
47
+
48
+ @logger.info "Heirloom \'#{@opts[:name]}\' not found in any regions." unless @heirloom_found
35
49
  end
36
50
 
37
51
  private
38
52
 
39
- def catalog_with_heirloom_prefix_removed
40
- Hash[@catalog.all.sort.map { |k, v| [k.sub(/heirloom_/, ''), v] }]
53
+ def heirloom_summary(region)
54
+ puts formatter.summary_format :region => region
55
+ end
56
+
57
+ def heirloom_details(region,name)
58
+ puts formatter.detailed_format :region => region,
59
+ :name => name
60
+ end
61
+
62
+ def catalog_domain_exists?
63
+ @catalog = Heirloom::Catalog.new :config => @config
64
+ ensure_catalog_domain_exists :config => @config,
65
+ :catalog => @catalog,
66
+ :continue_on_error => true
67
+ end
68
+
69
+
70
+ def default_regions
71
+ %w(us-east-1 us-west-1 us-west-2)
72
+ end
73
+
74
+ def detected_regions
75
+ return default_regions if @opts[:all_regions]
76
+ Array(@opts[:metadata_region] || @config.metadata_region || default_regions)
77
+ end
78
+
79
+ def formatter
80
+ @formatter = Heirloom::CLI::Formatter::Catalog.new :catalog => @catalog_list
81
+ end
82
+
83
+ def heirloom_exists_in_catalog?(name)
84
+ @catalog_list.include? "heirloom_#{name}"
41
85
  end
42
86
 
43
87
  def read_options
@@ -51,17 +95,16 @@ Usage:
51
95
 
52
96
  heirloom catalog
53
97
 
54
- EOS
98
+ EOS
55
99
  opt :help, "Display Help"
56
100
  opt :level, "Log level [debug|info|warn|error].", :type => :string,
57
101
  :default => 'info'
58
- opt :json, "Dump full catalog as raw JSON."
59
102
  opt :name, "Name of Heirloom to show full details.", :type => :string
60
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
61
- :default => 'us-west-1'
62
- opt :aws_access_key, "AWS Access Key ID", :type => :string,
103
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
104
+ opt :all_regions, "Return catalog of all regions."
105
+ opt :aws_access_key, "AWS Access Key ID", :type => :string,
63
106
  :short => :none
64
- opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
107
+ opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
65
108
  :short => :none
66
109
  opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
67
110
  opt :environment, "Environment (defined in ~/.heirloom.yml)", :type => :string
@@ -57,8 +57,7 @@ EOS
57
57
  opt :help, "Display Help"
58
58
  opt :log_level, "Log level [debug|info|warn|error].", :type => :string,
59
59
  :default => 'info'
60
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
61
- :default => 'us-west-1'
60
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
62
61
  opt :name, "Name of Heirloom.", :type => :string
63
62
  opt :keep, "Number of unpreserved heirlooms to keep.", :default => 100
64
63
 
@@ -52,8 +52,7 @@ EOS
52
52
  opt :id, "ID of the Heirloom to display.", :type => :string
53
53
  opt :level, "Log level [debug|info|warn|error].", :type => :string,
54
54
  :default => 'info'
55
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
56
- :default => 'us-west-1'
55
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
57
56
  opt :name, "Name of Heirloom.", :type => :string
58
57
  opt :aws_access_key, "AWS Access Key ID", :type => :string,
59
58
  :short => :none
@@ -77,13 +77,12 @@ EOS
77
77
  opt :id, "ID of the Heirloom to download.", :type => :string
78
78
  opt :level, "Log level [debug|info|warn|error].", :type => :string,
79
79
  :default => 'info'
80
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
81
- :default => 'us-west-1'
80
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
82
81
  opt :name, "Name of Heirloom.", :type => :string
83
82
  opt :output, "Path to output downloaded Heirloom. Must be existing directory.", :type => :string
84
83
  opt :region, "Region to download Heirloom.", :type => :string,
85
84
  :default => 'us-west-1'
86
- opt :secret, "Secret for ecrypted Heirloom.", :type => :string
85
+ opt :secret, "Secret for encrypted Heirloom.", :type => :string
87
86
  opt :secret_file, "Read secret from file.", :type => :string,
88
87
  :short => :none
89
88
  opt :aws_access_key, "AWS Access Key ID", :type => :string,
@@ -2,41 +2,55 @@ module Heirloom
2
2
  module CLI
3
3
  module Formatter
4
4
  class Catalog
5
- def format(args)
6
- @catalog = args[:catalog]
7
- @name = args[:name]
8
5
 
9
- return summary unless @name
6
+ def initialize(args)
7
+ @catalog = args[:catalog]
8
+ end
10
9
 
11
- return "Heirloom #{@name} not found in catalog." unless name_exists?
10
+ def detailed_format(args)
11
+ @name = args[:name]
12
+ @region = args[:region]
12
13
 
13
14
  filter_by_name
14
15
  details
16
+ end
17
+
18
+ def summary_format(args)
19
+ @region = args[:region]
20
+
21
+ summary
15
22
  end
16
23
 
17
24
  private
18
25
 
19
- def name_exists?
20
- @catalog.include? @name
26
+ def remove_heirloom_prefix
27
+ Hash[@catalog.sort.map { |k, v| [k.sub(/heirloom_/, ''), v] }]
28
+ end
29
+
30
+ def add_indent_prefix
31
+ Hash[remove_heirloom_prefix.sort.map { |k, v| [k.sub(/^/, ' '), v] }]
21
32
  end
22
33
 
23
34
  def filter_by_name
24
- @catalog.select! {|k| @name == k }
35
+ @catalog.select! {|k| "heirloom_#{@name}" == k }
25
36
  end
26
37
 
27
38
  def summary
28
- @catalog.keys.join "\n"
39
+ s = @region + "\n"
40
+ s << add_indent_prefix.keys.join("\n")
29
41
  end
30
42
 
31
43
  def details
44
+ @catalog = remove_heirloom_prefix
32
45
  data = @catalog.each_pair.map do |k,v|
33
- urls = v["regions"].map do |region|
46
+ urls = v["regions"].sort.map do |region|
34
47
  bucket_prefix = v["bucket_prefix"].first
35
48
  " #{region}-s3-url : s3://#{bucket_prefix}-#{region}/#{k}"
36
49
  end
37
50
 
38
51
  d = k + "\n"
39
- d << " regions : " + @catalog[k]["regions"].join(", ") + "\n"
52
+ d << " metadata_region : #{@region}\n"
53
+ d << " regions : " + @catalog[k]["regions"].sort.join(", ") + "\n"
40
54
  d << " bucket_prefix : " + @catalog[k]["bucket_prefix"].first + "\n"
41
55
  d << urls.join("\n")
42
56
  end
@@ -52,11 +52,9 @@ EOS
52
52
  opt :count, "Number of IDs to return.", :type => :integer,
53
53
  :default => 10
54
54
  opt :help, "Display Help"
55
- opt :json, "Display output as raw JSON."
56
55
  opt :level, "Log level [debug|info|warn|error].", :type => :string,
57
56
  :default => 'info'
58
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
59
- :default => 'us-west-1'
57
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
60
58
  opt :name, "Name of Heirloom.", :type => :string
61
59
  opt :aws_access_key, "AWS Access Key ID", :type => :string,
62
60
  :short => :none
@@ -66,8 +66,7 @@ EOS
66
66
  opt :id, "ID of the Heirloom to rotate.", :type => :string
67
67
  opt :level, "Log level [debug|info|warn|error].", :type => :string,
68
68
  :default => 'info'
69
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
70
- :default => 'us-west-1'
69
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
71
70
  opt :name, "Name of Heirloom.", :type => :string
72
71
  opt :region, "Region to download Heirloom.", :type => :string,
73
72
  :default => 'us-west-1'
@@ -81,8 +81,7 @@ us-east-1' will create bucket test-us-west-1 in us-west-1 and test-us-east-1 in
81
81
  opt :help, "Display Help"
82
82
  opt :level, "Log level [debug|info|warn|error].", :type => :string,
83
83
  :default => 'info'
84
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
85
- :default => 'us-west-1'
84
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
86
85
  opt :name, "Name of Heirloom.", :type => :string
87
86
  opt :region, "AWS Region(s) to upload Heirloom. \
88
87
  Can be specified multiple times.", :type => :string,
@@ -167,13 +167,16 @@ module Heirloom
167
167
  def ensure_catalog_domain_exists(args)
168
168
  config = args[:config]
169
169
  catalog = args[:catalog]
170
+ continue_on_error = args[:continue_on_error]
170
171
  logger = config.logger
171
172
  region = config.metadata_region
172
173
 
173
174
  unless catalog.catalog_domain_exists?
175
+ return false if continue_on_error
174
176
  logger.error "Catalog does not exist in #{region}."
175
177
  exit 1
176
178
  end
179
+ true
177
180
  end
178
181
 
179
182
  def ensure_entry_exists_in_catalog(args)
@@ -63,11 +63,9 @@ EOS
63
63
  opt :help, "Display Help"
64
64
  opt :all, "Display all attributes (includes internal heirloom settings)."
65
65
  opt :id, "ID of the Heirloom to display.", :type => :string
66
- opt :json, "Display output as raw JSON."
67
66
  opt :level, "Log level [debug|info|warn|error].", :type => :string,
68
67
  :default => 'info'
69
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
70
- :default => 'us-west-1'
68
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
71
69
  opt :name, "Name of Heirloom.", :type => :string
72
70
  opt :aws_access_key, "AWS Access Key ID", :type => :string,
73
71
  :short => :none
@@ -56,8 +56,7 @@ EOS
56
56
  opt :id, "ID of the Heirloom to tag.", :type => :string
57
57
  opt :level, "Log level [debug|info|warn|error].", :type => :string,
58
58
  :default => 'info'
59
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
60
- :default => 'us-west-1'
59
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
61
60
  opt :name, "Name of Heirloom.", :type => :string
62
61
  opt :value, "Value of attribute.", :type => :string,
63
62
  :short => 'u'
@@ -73,8 +73,7 @@ EOS
73
73
  opt :help, "Display Help"
74
74
  opt :level, "Log level [debug|info|warn|error].", :type => :string,
75
75
  :default => 'info'
76
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
77
- :default => 'us-west-1'
76
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
78
77
  opt :name, "Name of Heirloom.", :type => :string
79
78
  opt :force, "Forces recursive deletion of existing archives."
80
79
  opt :keep_buckets, "Do not delete S3 buckets."
@@ -93,8 +93,7 @@ Can be specified multiple times.", :type => :string, :multi => true, :short =>
93
93
  opt :id, "ID for Heirloom.", :type => :string
94
94
  opt :level, "Log level [debug|info|warn|error].", :type => :string,
95
95
  :default => 'info'
96
- opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string,
97
- :default => 'us-west-1'
96
+ opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
98
97
  opt :name, "Name of Heirloom.", :type => :string
99
98
  opt :public, "Set this Heirloom as public readable?"
100
99
  opt :secret, "Encrypt the Heirloom with given secret.", :type => :string
@@ -1,3 +1,3 @@
1
1
  module Heirloom
2
- VERSION = "0.12.1"
2
+ VERSION = "0.12.2"
3
3
  end
@@ -2,11 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  describe Heirloom do
4
4
  before do
5
- @config_mock = double 'config'
6
- @logger_stub = stub 'logger', :info => true, :debug => true
7
- @config_mock.stub :logger => @logger_stub
5
+ @config_double = double 'config'
6
+ @logger_double = double 'logger', :info => true, :debug => true
7
+ @config_double.stub :logger => @logger_double
8
8
 
9
- @s3 = Heirloom::ACL::S3.new :config => @config_mock,
9
+ @s3 = Heirloom::ACL::S3.new :config => @config_double,
10
10
  :region => 'us-west-1'
11
11
  end
12
12
 
@@ -17,17 +17,17 @@ describe Heirloom do
17
17
  'ID' => '123'
18
18
  }
19
19
  }
20
- s3_mock = mock 's3'
20
+ s3_double = double 's3'
21
21
 
22
22
  @s3.should_receive(:s3).exactly(2).times.
23
- and_return(s3_mock)
23
+ and_return(s3_double)
24
24
 
25
- s3_mock.should_receive(:get_object_acl).
26
- with(:bucket => 'bucket', :object_name => 'key-folder/key.tar.gz').
27
- and_return acls
25
+ s3_double.should_receive(:get_object_acl).
26
+ with(:bucket => 'bucket', :object_name => 'key-folder/key.tar.gz').
27
+ and_return acls
28
28
 
29
- s3_mock.should_receive(:put_object_acl).
30
- with("bucket", "key-folder/key.tar.gz", {"Owner"=>{"DisplayName"=>"Brett", "ID"=>"123"}, "AccessControlList"=>[{"Grantee"=>{"EmailAddress"=>"acct1@test.com"}, "Permission"=>"READ"}, {"Grantee"=>{"EmailAddress"=>"acct2@test.com"}, "Permission"=>"READ"}, {"Grantee"=>{"DisplayName"=>"Brett", "ID"=>"123"}, "Permission"=>"FULL_CONTROL"}]})
29
+ s3_double.should_receive(:put_object_acl).
30
+ with("bucket", "key-folder/key.tar.gz", {"Owner"=>{"DisplayName"=>"Brett", "ID"=>"123"}, "AccessControlList"=>[{"Grantee"=>{"EmailAddress"=>"acct1@test.com"}, "Permission"=>"READ"}, {"Grantee"=>{"EmailAddress"=>"acct2@test.com"}, "Permission"=>"READ"}, {"Grantee"=>{"DisplayName"=>"Brett", "ID"=>"123"}, "Permission"=>"FULL_CONTROL"}]})
31
31
 
32
32
  @s3.allow_read_access_from_accounts :bucket => 'bucket',
33
33
  :key_name => 'key.tar.gz',