heirloom 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGELOG +7 -0
  2. data/README.md +1 -1
  3. data/Rakefile +6 -0
  4. data/lib/heirloom/archive/builder.rb +29 -29
  5. data/lib/heirloom/archive/destroyer.rb +27 -18
  6. data/lib/heirloom/archive/downloader.rb +12 -14
  7. data/lib/heirloom/archive/lister.rb +2 -1
  8. data/lib/heirloom/archive/reader.rb +22 -15
  9. data/lib/heirloom/archive/updater.rb +2 -1
  10. data/lib/heirloom/archive.rb +5 -2
  11. data/lib/heirloom/aws/simpledb.rb +15 -2
  12. data/lib/heirloom/cli/authorize.rb +12 -7
  13. data/lib/heirloom/cli/build.rb +29 -20
  14. data/lib/heirloom/cli/destroy.rb +11 -4
  15. data/lib/heirloom/cli/download.rb +11 -4
  16. data/lib/heirloom/cli/list.rb +15 -6
  17. data/lib/heirloom/cli/shared.rb +10 -1
  18. data/lib/heirloom/cli/show.rb +14 -5
  19. data/lib/heirloom/cli/update.rb +14 -6
  20. data/lib/heirloom/cli.rb +1 -2
  21. data/lib/heirloom/directory/directory.rb +16 -18
  22. data/lib/heirloom/directory/git_directory.rb +1 -1
  23. data/lib/heirloom/uploader/s3.rb +4 -3
  24. data/lib/heirloom/version.rb +1 -1
  25. data/spec/archive/builder_spec.rb +60 -58
  26. data/spec/archive/destroyer_spec.rb +9 -10
  27. data/spec/archive/downloader_spec.rb +2 -2
  28. data/spec/archive/lister_spec.rb +1 -1
  29. data/spec/archive/reader_spec.rb +92 -81
  30. data/spec/archive/updater_spec.rb +1 -1
  31. data/spec/archive_spec.rb +15 -6
  32. data/spec/aws/simpledb_spec.rb +35 -0
  33. data/spec/cli/authorize_spec.rb +34 -0
  34. data/spec/cli/build_spec.rb +57 -0
  35. data/spec/cli/destroy_spec.rb +33 -0
  36. data/spec/cli/download_spec.rb +37 -0
  37. data/spec/cli/list_spec.rb +34 -0
  38. data/spec/cli/shared_spec.rb +68 -34
  39. data/spec/cli/show_spec.rb +34 -0
  40. data/spec/cli/update_spec.rb +37 -0
  41. data/spec/directory/directory_spec.rb +13 -20
  42. data/spec/directory/git_directory_spec.rb +23 -22
  43. metadata +28 -14
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+ require 'heirloom/cli'
3
+
4
+ describe Heirloom do
5
+
6
+ before do
7
+ options = { :name => 'archive_name',
8
+ :id => '1.0.0',
9
+ :level => 'info',
10
+ :attribute => 'att',
11
+ :updated_value => 'val' }
12
+ @logger_stub = stub :debug => true
13
+ @config_mock = mock 'config'
14
+ @archive_mock = mock 'archive'
15
+ Trollop.stub(:options).and_return options
16
+ Heirloom::HeirloomLogger.should_receive(:new).with(:log_level => 'info').
17
+ and_return @logger_stub
18
+ Heirloom::CLI::Update.any_instance.should_receive(:load_config).
19
+ with(:logger => @logger_stub,
20
+ :opts => options).
21
+ and_return @config_mock
22
+ Heirloom::Archive.should_receive(:new).
23
+ with(:name => 'archive_name',
24
+ :id => '1.0.0',
25
+ :config => @config_mock).
26
+ and_return @archive_mock
27
+ @cli_update = Heirloom::CLI::Update.new
28
+ end
29
+
30
+ it "should update an attribute for a given id" do
31
+ @archive_mock.should_receive(:update).
32
+ with(:attribute => 'att',
33
+ :value => 'val')
34
+ @cli_update.update
35
+ end
36
+
37
+ end
@@ -1,19 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Heirloom do
3
+ describe Heirloom::Directory do
4
4
 
5
+ describe 'build_artifact_from_directory' do
5
6
  before do
6
7
  @config_mock = double 'config'
7
8
  @logger_stub = stub :debug => 'true', :info => 'true', :warn => 'true'
8
- @config_mock.should_receive(:logger).and_return(@logger_stub)
9
+ @config_mock.stub(:logger).and_return(@logger_stub)
9
10
  @directory = Heirloom::Directory.new :config => @config_mock,
10
11
  :exclude => ['.', '..', 'dont_pack_me'],
11
12
  :path => '/target/dir'
12
- end
13
-
14
- it "should build an archive from the latest commit in path" do
15
- file_mock = double 'file'
16
- output_mock = double 'output mock'
13
+ output_mock = double 'output mock'
17
14
  Dir.stub :tmpdir => '/tmp/dir'
18
15
  Kernel.stub :rand => 0
19
16
  Dir.should_receive(:entries).with('/target/dir').
@@ -22,23 +19,19 @@ describe Heirloom do
22
19
  Heirloom::Directory.any_instance.should_receive(:`).
23
20
  with("tar czf /tmp/dir/AAAAAAAA.tar.gz pack_me .hidden").
24
21
  and_return output_mock
22
+ end
23
+
24
+ it "should build an archive from the latest commit in path" do
25
25
  $?.should_receive(:success?).and_return true
26
26
  @directory.build_artifact_from_directory.should be_true
27
27
  end
28
28
 
29
- it "should return false if the shell is not succesful" do
30
- file_mock = double 'file'
31
- output_mock = double 'output mock'
32
- Dir.stub :tmpdir => '/tmp/dir'
33
- Kernel.stub :rand => 0
34
- Dir.should_receive(:entries).with('/target/dir').
35
- exactly(2).times.
36
- and_return(['pack_me', '.hidden', 'dont_pack_me'])
37
- Heirloom::Directory.any_instance.should_receive(:`).
38
- with("tar czf /tmp/dir/AAAAAAAA.tar.gz pack_me .hidden").
39
- and_return output_mock
40
- $?.should_receive(:success?).and_return false
41
- @directory.build_artifact_from_directory.should be_false
29
+ context 'when unable to create the tar' do
30
+ before { $?.stub(:success?).and_return(false) }
31
+
32
+ it { @directory.build_artifact_from_directory.should be_false }
42
33
  end
43
34
 
35
+ end
36
+
44
37
  end
@@ -2,31 +2,32 @@ require 'spec_helper'
2
2
 
3
3
  describe Heirloom do
4
4
 
5
- before do
6
- @repo_mock = double 'repo mock'
7
- @git_directory = Heirloom::GitDirectory.new :path => '/target/dir'
8
- Repo.should_receive(:new).with('/target/dir').and_return(@repo_mock)
9
- @commits_mock = double 'commits mock'
10
- end
5
+ describe 'commit' do
6
+ before do
7
+ @repo_mock = double 'repo mock'
8
+ @git_directory = Heirloom::GitDirectory.new :path => '/target/dir'
9
+ Repo.should_receive(:new).with('/target/dir').and_return(@repo_mock)
10
+ end
11
11
 
12
- it "should read commit from the given path" do
13
- @repo_mock.should_receive(:commits).and_return(@commits_mock)
14
- @commits_mock.should_receive(:first).and_return('git_sha')
15
- @git_directory.commit.should == 'git_sha'
16
- end
12
+ it "should return the first commit from the given repo" do
13
+ @repo_mock.stub(:commits).and_return(['git_sha', 'other_sha'])
14
+ @git_directory.commit.should == 'git_sha'
15
+ end
17
16
 
18
- it "should read commit from the given path" do
19
- @repo_mock.should_receive(:commits).with('sha_i_want').
20
- and_return(@commits_mock)
21
- @commits_mock.should_receive(:first).and_return('git_sha')
22
- @git_directory.commit('sha_i_want').should == 'git_sha'
23
- end
17
+ it "should read commit from the given path" do
18
+ @repo_mock.should_receive(:commits).
19
+ with('sha_i_want').
20
+ and_return(['sha_i_want', 'other_sha'])
21
+ @git_directory.commit('sha_i_want').should == 'sha_i_want'
22
+ end
23
+
24
+ it "should return false if the commit given does not exist" do
25
+ @repo_mock.should_receive(:commits).
26
+ with('sha_that_dont_exist').
27
+ and_return(nil)
28
+ @git_directory.commit('sha_that_dont_exist').should be_false
29
+ end
24
30
 
25
- it "should return false if the commit given does not exist" do
26
- @repo_mock.should_receive(:commits).with('sha_that_dont_exist').
27
- and_return(@commits_mock)
28
- @commits_mock.should_receive(:first).and_return nil
29
- @git_directory.commit('sha_that_dont_exist').should be_false
30
31
  end
31
32
 
32
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heirloom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-31 00:00:00.000000000 Z
12
+ date: 2012-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70227657292060 !ruby/object:Gem::Requirement
16
+ requirement: &70212754890460 !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: *70227657292060
24
+ version_requirements: *70212754890460
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fog
27
- requirement: &70227657291640 !ruby/object:Gem::Requirement
27
+ requirement: &70212754889240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70227657291640
35
+ version_requirements: *70212754889240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: grit
38
- requirement: &70227657290960 !ruby/object:Gem::Requirement
38
+ requirement: &70212754888480 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70227657290960
46
+ version_requirements: *70212754888480
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: logger
49
- requirement: &70227657290280 !ruby/object:Gem::Requirement
49
+ requirement: &70212754887860 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70227657290280
57
+ version_requirements: *70212754887860
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: trollop
60
- requirement: &70227657289580 !ruby/object:Gem::Requirement
60
+ requirement: &70212754886740 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70227657289580
68
+ version_requirements: *70212754886740
69
69
  description: I help build and manage building tar.gz files and deploying them into
70
70
  the cloud
71
71
  email:
@@ -135,7 +135,14 @@ files:
135
135
  - spec/archive_spec.rb
136
136
  - spec/aws/s3_spec.rb
137
137
  - spec/aws/simpledb_spec.rb
138
+ - spec/cli/authorize_spec.rb
139
+ - spec/cli/build_spec.rb
140
+ - spec/cli/destroy_spec.rb
141
+ - spec/cli/download_spec.rb
142
+ - spec/cli/list_spec.rb
138
143
  - spec/cli/shared_spec.rb
144
+ - spec/cli/show_spec.rb
145
+ - spec/cli/update_spec.rb
139
146
  - spec/config_spec.rb
140
147
  - spec/destroyer/s3_spec.rb
141
148
  - spec/directory/directory_spec.rb
@@ -157,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
164
  version: '0'
158
165
  segments:
159
166
  - 0
160
- hash: -4029449288318118169
167
+ hash: 1382939958455203904
161
168
  required_rubygems_version: !ruby/object:Gem::Requirement
162
169
  none: false
163
170
  requirements:
@@ -166,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
173
  version: '0'
167
174
  segments:
168
175
  - 0
169
- hash: -4029449288318118169
176
+ hash: 1382939958455203904
170
177
  requirements: []
171
178
  rubyforge_project: heirloom
172
179
  rubygems_version: 1.8.16
@@ -187,7 +194,14 @@ test_files:
187
194
  - spec/archive_spec.rb
188
195
  - spec/aws/s3_spec.rb
189
196
  - spec/aws/simpledb_spec.rb
197
+ - spec/cli/authorize_spec.rb
198
+ - spec/cli/build_spec.rb
199
+ - spec/cli/destroy_spec.rb
200
+ - spec/cli/download_spec.rb
201
+ - spec/cli/list_spec.rb
190
202
  - spec/cli/shared_spec.rb
203
+ - spec/cli/show_spec.rb
204
+ - spec/cli/update_spec.rb
191
205
  - spec/config_spec.rb
192
206
  - spec/destroyer/s3_spec.rb
193
207
  - spec/directory/directory_spec.rb