heirloom 0.7.0rc1 → 0.7.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.
- data/CHANGELOG +1 -1
- data/lib/heirloom/catalog/add.rb +1 -1
- data/lib/heirloom/catalog/verify.rb +2 -2
- data/lib/heirloom/catalog.rb +13 -0
- data/lib/heirloom/cli/catalog.rb +4 -2
- data/lib/heirloom/cli/shared.rb +25 -0
- data/lib/heirloom/cli/teardown.rb +5 -0
- data/lib/heirloom/cli/upload.rb +7 -3
- data/lib/heirloom/cli.rb +1 -1
- data/lib/heirloom/version.rb +1 -1
- data/spec/acl/s3_spec.rb +1 -1
- data/spec/archive/destroyer_spec.rb +1 -1
- data/spec/aws/simpledb_spec.rb +37 -35
- data/spec/catalog/add_spec.rb +1 -2
- data/spec/catalog/delete_spec.rb +4 -6
- data/spec/catalog/setup_spec.rb +2 -4
- data/spec/catalog_spec.rb +47 -10
- data/spec/cli/catalog_spec.rb +2 -1
- data/spec/cli/shared_spec.rb +42 -30
- data/spec/cli/teardown_spec.rb +4 -1
- data/spec/cli/upload_spec.rb +8 -3
- metadata +16 -13
data/CHANGELOG
CHANGED
data/lib/heirloom/catalog/add.rb
CHANGED
@@ -20,10 +20,10 @@ module Heirloom
|
|
20
20
|
|
21
21
|
def entry_exists_in_catalog?(entry)
|
22
22
|
if sdb.item_count('heirloom', "heirloom_#{entry}").zero?
|
23
|
-
@logger.debug "#{entry} does not exist in catalog."
|
23
|
+
@logger.debug "#{entry} does not exist in catalog in #{@region}."
|
24
24
|
false
|
25
25
|
else
|
26
|
-
@logger.debug "#{entry} exists in catalog."
|
26
|
+
@logger.debug "#{entry} exists in catalog in #{@region}."
|
27
27
|
true
|
28
28
|
end
|
29
29
|
end
|
data/lib/heirloom/catalog.rb
CHANGED
@@ -17,6 +17,14 @@ module Heirloom
|
|
17
17
|
setup.create_catalog_domain
|
18
18
|
end
|
19
19
|
|
20
|
+
def catalog_domain_exists?
|
21
|
+
verify.catalog_domain_exists?
|
22
|
+
end
|
23
|
+
|
24
|
+
def entry_exists_in_catalog?(entry)
|
25
|
+
verify.entry_exists_in_catalog? entry
|
26
|
+
end
|
27
|
+
|
20
28
|
def delete_from_catalog
|
21
29
|
delete.delete_from_catalog
|
22
30
|
end
|
@@ -61,5 +69,10 @@ module Heirloom
|
|
61
69
|
@show ||= Catalog::Show.new :config => @config,
|
62
70
|
:name => @name
|
63
71
|
end
|
72
|
+
|
73
|
+
def verify
|
74
|
+
@verify ||= Catalog::Verify.new :config => @config
|
75
|
+
end
|
76
|
+
|
64
77
|
end
|
65
78
|
end
|
data/lib/heirloom/cli/catalog.rb
CHANGED
@@ -16,9 +16,11 @@ module Heirloom
|
|
16
16
|
ensure_valid_region :region => @opts[:metadata_region],
|
17
17
|
:config => @config
|
18
18
|
@catalog = Heirloom::Catalog.new :config => @config
|
19
|
+
ensure_catalog_domain_exists :config => @config,
|
20
|
+
:catalog => @catalog
|
19
21
|
end
|
20
22
|
|
21
|
-
def
|
23
|
+
def all
|
22
24
|
if @opts[:details]
|
23
25
|
jj catalog_with_heirloom_prefix_removed
|
24
26
|
else
|
@@ -29,7 +31,7 @@ module Heirloom
|
|
29
31
|
private
|
30
32
|
|
31
33
|
def catalog_with_heirloom_prefix_removed
|
32
|
-
Hash[@catalog.all.map { |k, v| [k.sub(/heirloom_/, ''), v] }]
|
34
|
+
Hash[@catalog.all.sort.map { |k, v| [k.sub(/heirloom_/, ''), v] }]
|
33
35
|
end
|
34
36
|
|
35
37
|
def read_options
|
data/lib/heirloom/cli/shared.rb
CHANGED
@@ -145,6 +145,31 @@ module Heirloom
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
+
def ensure_catalog_domain_exists(args)
|
149
|
+
config = args[:config]
|
150
|
+
catalog = args[:catalog]
|
151
|
+
logger = config.logger
|
152
|
+
region = config.metadata_region
|
153
|
+
|
154
|
+
unless catalog.catalog_domain_exists?
|
155
|
+
logger.error "Catalog does not exist in #{region}."
|
156
|
+
exit 1
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def ensure_entry_exists_in_catalog(args)
|
161
|
+
config = args[:config]
|
162
|
+
catalog = args[:catalog]
|
163
|
+
entry = args[:entry]
|
164
|
+
logger = config.logger
|
165
|
+
region = config.metadata_region
|
166
|
+
|
167
|
+
unless catalog.entry_exists_in_catalog? entry
|
168
|
+
logger.error "Entry for #{entry} does not exist in #{region} catalog."
|
169
|
+
exit 1
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
148
173
|
end
|
149
174
|
end
|
150
175
|
end
|
@@ -19,6 +19,11 @@ module Heirloom
|
|
19
19
|
@archive = Archive.new :name => @opts[:name],
|
20
20
|
:config => @config
|
21
21
|
|
22
|
+
ensure_catalog_domain_exists :config => @config,
|
23
|
+
:catalog => @catalog
|
24
|
+
ensure_entry_exists_in_catalog :config => @config,
|
25
|
+
:catalog => @catalog,
|
26
|
+
:entry => @opts[:name]
|
22
27
|
end
|
23
28
|
|
24
29
|
def teardown
|
data/lib/heirloom/cli/upload.rb
CHANGED
@@ -9,12 +9,16 @@ module Heirloom
|
|
9
9
|
@logger = HeirloomLogger.new :log_level => @opts[:level]
|
10
10
|
@config = load_config :logger => @logger,
|
11
11
|
:opts => @opts
|
12
|
-
|
12
|
+
@catalog = Heirloom::Catalog.new :name => @opts[:name],
|
13
|
+
:config => @config
|
13
14
|
ensure_valid_options :provided => @opts,
|
14
15
|
:required => [:name, :id, :directory],
|
15
16
|
:config => @config
|
16
|
-
|
17
|
-
|
17
|
+
ensure_catalog_domain_exists :config => @config,
|
18
|
+
:catalog => @catalog
|
19
|
+
ensure_entry_exists_in_catalog :config => @config,
|
20
|
+
:catalog => @catalog,
|
21
|
+
:entry => @opts[:name]
|
18
22
|
@archive = Archive.new :name => @opts[:name],
|
19
23
|
:id => @opts[:id],
|
20
24
|
:config => @config
|
data/lib/heirloom/cli.rb
CHANGED
data/lib/heirloom/version.rb
CHANGED
data/spec/acl/s3_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe Heirloom do
|
|
4
4
|
before do
|
5
5
|
@config_mock = double 'config'
|
6
6
|
@logger_stub = stub 'logger', :info => true, :debug => true
|
7
|
-
@config_mock.
|
7
|
+
@config_mock.stub :logger => @logger_stub
|
8
8
|
|
9
9
|
@s3 = Heirloom::ACL::S3.new :config => @config_mock,
|
10
10
|
:region => 'us-west-1'
|
@@ -5,7 +5,7 @@ describe Heirloom do
|
|
5
5
|
before do
|
6
6
|
@config_mock = double 'config'
|
7
7
|
@logger_stub = stub 'logger', :info => true, :debug => true
|
8
|
-
@config_mock.
|
8
|
+
@config_mock.stub :logger => @logger_stub
|
9
9
|
@destroyer = Heirloom::Destroyer.new :config => @config_mock,
|
10
10
|
:name => 'tim',
|
11
11
|
:id => '123'
|
data/spec/aws/simpledb_spec.rb
CHANGED
@@ -52,44 +52,46 @@ describe Heirloom do
|
|
52
52
|
@sdb.delete('domain', 'key')
|
53
53
|
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
with('SELECT count(*) FROM `heirloom_domain`').
|
60
|
-
and_return body_mock
|
61
|
-
body_mock.should_receive(:body).and_return data
|
62
|
-
@sdb.count('heirloom_domain').should == 1
|
63
|
-
end
|
55
|
+
context "testing counts" do
|
56
|
+
before do
|
57
|
+
@body_stub = stub 'body'
|
58
|
+
end
|
64
59
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
60
|
+
it "should count the number of entries in the domain" do
|
61
|
+
data = { 'Items' => { 'Domain' => { 'Count' => ['1'] } } }
|
62
|
+
@fog_mock.should_receive(:select).
|
63
|
+
with('SELECT count(*) FROM `heirloom_domain`').
|
64
|
+
and_return @body_stub
|
65
|
+
@body_stub.stub :body => data
|
66
|
+
@sdb.count('heirloom_domain').should == 1
|
67
|
+
end
|
74
68
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
69
|
+
it "should return true if no entries for the domain" do
|
70
|
+
data = { 'Items' => { 'Domain' => { 'Count' => ['0'] } } }
|
71
|
+
@fog_mock.should_receive(:select).
|
72
|
+
with('SELECT count(*) FROM `heirloom_domain`').
|
73
|
+
and_return @body_stub
|
74
|
+
@body_stub.stub :body => data
|
75
|
+
@sdb.domain_empty?('heirloom_domain').should be_true
|
76
|
+
end
|
84
77
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
78
|
+
it "should return false if entries exist for the domain" do
|
79
|
+
data = { 'Items' => { 'Domain' => { 'Count' => ['50'] } } }
|
80
|
+
@fog_mock.should_receive(:select).
|
81
|
+
with('SELECT count(*) FROM `heirloom_domain`').
|
82
|
+
and_return @body_stub
|
83
|
+
@body_stub.stub :body => data
|
84
|
+
@sdb.domain_empty?('heirloom_domain').should be_false
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should return the count for a specific itemName within a domain" do
|
88
|
+
data = { 'Items' => { 'Domain' => { 'Count' => ['1'] } } }
|
89
|
+
@fog_mock.should_receive(:select).
|
90
|
+
with("SELECT count(*) FROM `heirloom` WHERE itemName() = 'archive'").
|
91
|
+
and_return @body_stub
|
92
|
+
@body_stub.stub :body => data
|
93
|
+
@sdb.item_count('heirloom', 'archive').should == 1
|
94
|
+
end
|
93
95
|
end
|
94
96
|
|
95
97
|
end
|
data/spec/catalog/add_spec.rb
CHANGED
@@ -19,8 +19,7 @@ describe Heirloom::Catalog::Add do
|
|
19
19
|
@sdb_mock.should_receive(:put_attributes).
|
20
20
|
with 'heirloom',
|
21
21
|
'heirloom_new_archive',
|
22
|
-
|
23
|
-
"base" => @base }
|
22
|
+
"regions" => @regions, "base" => @base
|
24
23
|
@add.add_to_catalog :regions => @regions,
|
25
24
|
:base => @base
|
26
25
|
end
|
data/spec/catalog/delete_spec.rb
CHANGED
@@ -5,17 +5,16 @@ describe Heirloom::Catalog::Delete do
|
|
5
5
|
before do
|
6
6
|
@logger_stub = stub 'logger', :info => true
|
7
7
|
@config_stub = stub 'config', :logger => @logger_stub
|
8
|
-
@
|
8
|
+
@verify_stub = stub 'verify'
|
9
9
|
Heirloom::Catalog::Verify.should_receive(:new).
|
10
10
|
with(:config => @config_stub).
|
11
|
-
and_return @
|
11
|
+
and_return @verify_stub
|
12
12
|
@delete = Heirloom::Catalog::Delete.new :config => @config_stub,
|
13
13
|
:name => 'old_archive'
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should delete the entry from the catalog" do
|
17
|
-
@
|
18
|
-
and_return true
|
17
|
+
@verify_stub.stub :catalog_domain_exists? => true
|
19
18
|
@sdb_mock = mock 'sdb'
|
20
19
|
Heirloom::AWS::SimpleDB.should_receive(:new).
|
21
20
|
with(:config => @config_stub).
|
@@ -27,8 +26,7 @@ describe Heirloom::Catalog::Delete do
|
|
27
26
|
end
|
28
27
|
|
29
28
|
it "should return false if an entry does not exist in catalog" do
|
30
|
-
@
|
31
|
-
and_return false
|
29
|
+
@verify_stub.stub :catalog_domain_exists? => false
|
32
30
|
@delete.delete_from_catalog.should be_false
|
33
31
|
end
|
34
32
|
|
data/spec/catalog/setup_spec.rb
CHANGED
@@ -6,17 +6,15 @@ describe Heirloom::Catalog::Setup do
|
|
6
6
|
@logger_stub = stub 'logger', :info => true
|
7
7
|
@config_stub = stub 'config', :logger => @logger_stub,
|
8
8
|
:metadata_region => 'us-west-1'
|
9
|
-
@
|
9
|
+
@verify_stub = stub 'verify', :catalog_domain_exists? => false
|
10
10
|
Heirloom::Catalog::Verify.should_receive(:new).
|
11
11
|
with(:config => @config_stub).
|
12
|
-
and_return @
|
12
|
+
and_return @verify_stub
|
13
13
|
@setup = Heirloom::Catalog::Setup.new :config => @config_stub,
|
14
14
|
:name => 'new_archive'
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should call sdb to create the catalog domain" do
|
18
|
-
@verify_mock.should_receive(:catalog_domain_exists?).
|
19
|
-
and_return false
|
20
18
|
@sdb_mock = mock 'sdb'
|
21
19
|
Heirloom::AWS::SimpleDB.should_receive(:new).
|
22
20
|
with(:config => @config_stub).
|
data/spec/catalog_spec.rb
CHANGED
@@ -12,12 +12,11 @@ describe Heirloom::Catalog do
|
|
12
12
|
|
13
13
|
context "testing add" do
|
14
14
|
it "should call setup to create catalog_domain" do
|
15
|
-
@
|
15
|
+
@catalog_setup_stub = stub 'setup'
|
16
|
+
@catalog_setup_stub.stub :create_catalog_domain => true
|
16
17
|
Heirloom::Catalog::Setup.should_receive(:new).
|
17
18
|
with(:config => @config_mock).
|
18
|
-
and_return @
|
19
|
-
@catalog_setup_mock.should_receive(:create_catalog_domain).
|
20
|
-
and_return true
|
19
|
+
and_return @catalog_setup_stub
|
21
20
|
@catalog.create_catalog_domain.should be_true
|
22
21
|
end
|
23
22
|
end
|
@@ -41,23 +40,61 @@ describe Heirloom::Catalog do
|
|
41
40
|
|
42
41
|
context "testing show" do
|
43
42
|
before do
|
44
|
-
@
|
43
|
+
@catalog_show_stub = stub 'show', :regions => @regions,
|
44
|
+
:base => @base
|
45
45
|
Heirloom::Catalog::Show.should_receive(:new).
|
46
46
|
with(:config => @config_mock,
|
47
47
|
:name => 'new_archive').
|
48
|
-
and_return @
|
48
|
+
and_return @catalog_show_stub
|
49
49
|
end
|
50
|
+
|
50
51
|
it "should call regions from show object" do
|
51
|
-
@catalog_show_mock.should_receive(:regions).
|
52
|
-
and_return @regions
|
53
52
|
@catalog.regions.should == @regions
|
54
53
|
end
|
55
54
|
|
56
55
|
it "should call base from the show object" do
|
57
|
-
@catalog_show_mock.should_receive(:base).
|
58
|
-
and_return @base
|
59
56
|
@catalog.base.should == @base
|
60
57
|
end
|
61
58
|
end
|
62
59
|
|
60
|
+
context "testing catalog_domain_exists?" do
|
61
|
+
before do
|
62
|
+
@catalog_verify_stub = stub 'show'
|
63
|
+
Heirloom::Catalog::Verify.should_receive(:new).
|
64
|
+
with(:config => @config_mock).
|
65
|
+
and_return @catalog_verify_stub
|
66
|
+
end
|
67
|
+
it "should return true if the catalog domain exists" do
|
68
|
+
@catalog_verify_stub.stub :catalog_domain_exists? => true
|
69
|
+
@catalog.catalog_domain_exists?.should be_true
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should return false if the catalog domain does not exist" do
|
73
|
+
@catalog_verify_stub.stub :catalog_domain_exists? => false
|
74
|
+
@catalog.catalog_domain_exists?.should be_false
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context "testing entry_exists_in_catalog?" do
|
79
|
+
before do
|
80
|
+
@catalog_verify_mock = mock 'show'
|
81
|
+
Heirloom::Catalog::Verify.should_receive(:new).
|
82
|
+
with(:config => @config_mock).
|
83
|
+
and_return @catalog_verify_mock
|
84
|
+
end
|
85
|
+
it "should return true if the entry exists in the catalog" do
|
86
|
+
@catalog_verify_mock.should_receive(:entry_exists_in_catalog?).
|
87
|
+
with('entry').
|
88
|
+
and_return true
|
89
|
+
@catalog.entry_exists_in_catalog?('entry').should be_true
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should return false if the entry does not exists in the catalog" do
|
93
|
+
@catalog_verify_mock.should_receive(:entry_exists_in_catalog?).
|
94
|
+
with('entry').
|
95
|
+
and_return false
|
96
|
+
@catalog.entry_exists_in_catalog?('entry').should be_false
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
63
100
|
end
|
data/spec/cli/catalog_spec.rb
CHANGED
@@ -13,6 +13,7 @@ describe Heirloom do
|
|
13
13
|
@logger_stub = stub :debug => true
|
14
14
|
@config_mock = mock 'config'
|
15
15
|
@catalog_mock = mock 'catalog'
|
16
|
+
@catalog_mock.stub :catalog_domain_exists? => true
|
16
17
|
@config_mock.stub :logger => @logger_mock,
|
17
18
|
:access_key => 'key',
|
18
19
|
:secret_key => 'secret',
|
@@ -36,7 +37,7 @@ describe Heirloom do
|
|
36
37
|
{ 'regions' => ['us-west-1'],
|
37
38
|
'base' => ['base'] } }
|
38
39
|
@cli_catalog.should_receive(:jj).with formated_result
|
39
|
-
@cli_catalog.
|
40
|
+
@cli_catalog.all
|
40
41
|
end
|
41
42
|
|
42
43
|
end
|
data/spec/cli/shared_spec.rb
CHANGED
@@ -141,12 +141,6 @@ describe Heirloom do
|
|
141
141
|
and_return @archive_mock
|
142
142
|
end
|
143
143
|
|
144
|
-
it "should ensure the domain for a given archive exists" do
|
145
|
-
@archive_mock.stub :domain_exists? => true
|
146
|
-
@object.ensure_domain_exists :config => @config_stub,
|
147
|
-
:name => 'test'
|
148
|
-
end
|
149
|
-
|
150
144
|
it "should exit if the domain does not exist" do
|
151
145
|
@archive_mock.stub :domain_exists? => false
|
152
146
|
lambda { @object.ensure_domain_exists :config => @config_stub,
|
@@ -165,11 +159,6 @@ describe Heirloom do
|
|
165
159
|
@object.extend Heirloom::CLI::Shared
|
166
160
|
end
|
167
161
|
|
168
|
-
it "should ensure the metadata domain is included in the upload domains" do
|
169
|
-
options = { :config => @config_stub, :regions => ['us-west-1', 'us-east-1'] }
|
170
|
-
@object.ensure_metadata_in_upload_region options
|
171
|
-
end
|
172
|
-
|
173
162
|
it "should exit if the metadata region is not in an upload region" do
|
174
163
|
options = { :config => @config_stub, :regions => ['us-west-2', 'us-east-1'] }
|
175
164
|
lambda { @object.ensure_metadata_in_upload_region options }.
|
@@ -186,11 +175,6 @@ describe Heirloom do
|
|
186
175
|
@object.extend Heirloom::CLI::Shared
|
187
176
|
end
|
188
177
|
|
189
|
-
it "should ensure the metadata domain is included in the upload domains" do
|
190
|
-
options = { :config => @config_stub, :regions => ['us-west-2', 'us-east-1'] }
|
191
|
-
@object.ensure_valid_regions options
|
192
|
-
end
|
193
|
-
|
194
178
|
it "should exit if the region is not valid" do
|
195
179
|
options = { :config => @config_stub, :regions => ['us-west-2', 'us-bad-1'] }
|
196
180
|
lambda { @object.ensure_valid_regions options }.
|
@@ -209,12 +193,6 @@ describe Heirloom do
|
|
209
193
|
@object.extend Heirloom::CLI::Shared
|
210
194
|
end
|
211
195
|
|
212
|
-
it "should ensure the archive exists" do
|
213
|
-
@archive_mock.should_receive(:exists?).and_return true
|
214
|
-
options = { :config => @config_stub, :archive => @archive_mock }
|
215
|
-
@object.ensure_archive_exists options
|
216
|
-
end
|
217
|
-
|
218
196
|
it "should exit if the archive does not exist" do
|
219
197
|
@archive_mock.should_receive(:exists?).and_return false
|
220
198
|
options = { :config => @config_stub, :archive => @archive_mock }
|
@@ -225,26 +203,60 @@ describe Heirloom do
|
|
225
203
|
|
226
204
|
context "testing ensure archive domain empty" do
|
227
205
|
before do
|
228
|
-
@
|
206
|
+
@archive_stub = stub 'archive'
|
229
207
|
@logger_stub = stub 'logger', :error => true
|
230
208
|
@config_stub = stub 'config', :logger => @logger_stub,
|
231
209
|
:metadata_region => 'us-west-1'
|
232
|
-
@options = { :config => @config_stub, :archive => @
|
210
|
+
@options = { :config => @config_stub, :archive => @archive_stub }
|
233
211
|
@object = Object.new
|
234
212
|
@object.extend Heirloom::CLI::Shared
|
235
213
|
end
|
236
214
|
|
237
|
-
it "should ensure the domain is empty" do
|
238
|
-
@archive_mock.should_receive(:count).and_return 0
|
239
|
-
@object.ensure_archive_domain_empty @options
|
240
|
-
end
|
241
|
-
|
242
215
|
it "should exit if the domain is not empty" do
|
243
|
-
@
|
216
|
+
@archive_stub.stub :count => 200
|
244
217
|
lambda { @object.ensure_archive_domain_empty @options }.
|
245
218
|
should raise_error SystemExit
|
246
219
|
end
|
247
220
|
end
|
248
221
|
|
222
|
+
context "testing ensure catalog domain exists" do
|
223
|
+
before do
|
224
|
+
@catalog_mock = mock 'catalog'
|
225
|
+
@logger_stub = stub 'logger', :error => true
|
226
|
+
@config_stub = stub 'config', :logger => @logger_stub,
|
227
|
+
:metadata_region => 'us-west-1'
|
228
|
+
@options = { :config => @config_stub, :catalog => @catalog_mock }
|
229
|
+
@object = Object.new
|
230
|
+
@object.extend Heirloom::CLI::Shared
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should exit if the catlog domain does not exist" do
|
234
|
+
@catalog_mock.stub :catalog_domain_exists? => false
|
235
|
+
lambda { @object.ensure_catalog_domain_exists @options }.
|
236
|
+
should raise_error SystemExit
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
context "testing ensure entry exists in catalog" do
|
241
|
+
before do
|
242
|
+
@catalog_mock = mock 'catalog'
|
243
|
+
@logger_stub = stub 'logger', :error => true
|
244
|
+
@config_stub = stub 'config', :logger => @logger_stub,
|
245
|
+
:metadata_region => 'us-west-1'
|
246
|
+
@options = { :config => @config_stub,
|
247
|
+
:catalog => @catalog_mock,
|
248
|
+
:entry => 'entry' }
|
249
|
+
@object = Object.new
|
250
|
+
@object.extend Heirloom::CLI::Shared
|
251
|
+
end
|
252
|
+
|
253
|
+
it "should exit if the entry does not exist in catalog" do
|
254
|
+
@catalog_mock.should_receive(:entry_exists_in_catalog?).
|
255
|
+
with('entry').
|
256
|
+
and_return false
|
257
|
+
lambda { @object.ensure_entry_exists_in_catalog @options }.
|
258
|
+
should raise_error SystemExit
|
259
|
+
end
|
260
|
+
end
|
249
261
|
|
250
262
|
end
|
data/spec/cli/teardown_spec.rb
CHANGED
@@ -17,7 +17,10 @@ describe Heirloom do
|
|
17
17
|
@archive_mock = mock 'archive'
|
18
18
|
@catalog_mock = mock 'catalog'
|
19
19
|
@catalog_mock.stub :regions => ['us-west-1', 'us-west-2']
|
20
|
-
@catalog_mock.stub :base => 'base'
|
20
|
+
@catalog_mock.stub :base => 'base', :catalog_domain_exists? => true
|
21
|
+
@catalog_mock.should_receive(:entry_exists_in_catalog?).
|
22
|
+
with('archive_name').
|
23
|
+
and_return true
|
21
24
|
Trollop.stub(:options).and_return options
|
22
25
|
Heirloom::HeirloomLogger.should_receive(:new).with(:log_level => 'info').
|
23
26
|
and_return @logger_stub
|
data/spec/cli/upload_spec.rb
CHANGED
@@ -22,8 +22,10 @@ describe Heirloom do
|
|
22
22
|
:secret_key => 'secret',
|
23
23
|
:metadata_region => 'us-west-1'
|
24
24
|
@archive_mock = mock 'archive'
|
25
|
-
@
|
26
|
-
|
25
|
+
@catalog_mock = mock 'catalog'
|
26
|
+
@catalog_mock.stub :regions => @regions,
|
27
|
+
:base => 'base',
|
28
|
+
:catalog_domain_exists? => true
|
27
29
|
Trollop.stub(:options).and_return options
|
28
30
|
Heirloom::HeirloomLogger.should_receive(:new).with(:log_level => 'info').
|
29
31
|
and_return @logger_stub
|
@@ -39,7 +41,10 @@ describe Heirloom do
|
|
39
41
|
Heirloom::Catalog.should_receive(:new).
|
40
42
|
with(:name => 'archive_name',
|
41
43
|
:config => @config_mock).
|
42
|
-
and_return @
|
44
|
+
and_return @catalog_mock
|
45
|
+
@catalog_mock.should_receive(:entry_exists_in_catalog?).
|
46
|
+
with('archive_name').
|
47
|
+
and_return true
|
43
48
|
@upload = Heirloom::CLI::Upload.new
|
44
49
|
end
|
45
50
|
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heirloom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
5
|
-
prerelease:
|
4
|
+
version: 0.7.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Brett Weaver
|
@@ -13,7 +13,7 @@ date: 2012-09-04 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70204824406120 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70204824406120
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: fog
|
27
|
-
requirement: &
|
27
|
+
requirement: &70204824368560 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.5.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70204824368560
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: grit
|
38
|
-
requirement: &
|
38
|
+
requirement: &70204824367580 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.5.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70204824367580
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: trollop
|
49
|
-
requirement: &
|
49
|
+
requirement: &70204824366820 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - =
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '2.0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70204824366820
|
58
58
|
description: I help build and manage building tar.gz files and deploying them into
|
59
59
|
the cloud
|
60
60
|
email:
|
@@ -184,13 +184,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
184
|
version: '0'
|
185
185
|
segments:
|
186
186
|
- 0
|
187
|
-
hash:
|
187
|
+
hash: 223379144740037259
|
188
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
189
|
none: false
|
190
190
|
requirements:
|
191
|
-
- - ! '
|
191
|
+
- - ! '>='
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version:
|
193
|
+
version: '0'
|
194
|
+
segments:
|
195
|
+
- 0
|
196
|
+
hash: 223379144740037259
|
194
197
|
requirements: []
|
195
198
|
rubyforge_project: heirloom
|
196
199
|
rubygems_version: 1.8.16
|