heirloom 0.12.1 → 0.12.2
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 +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -0
- data/CHANGELOG.md +6 -0
- data/README.md +12 -6
- data/heirloom.gemspec +3 -5
- data/lib/heirloom/catalog/verify.rb +2 -2
- data/lib/heirloom/cli/authorize.rb +1 -2
- data/lib/heirloom/cli/catalog.rb +62 -19
- data/lib/heirloom/cli/cleanup.rb +1 -2
- data/lib/heirloom/cli/destroy.rb +1 -2
- data/lib/heirloom/cli/download.rb +2 -3
- data/lib/heirloom/cli/formatter/catalog.rb +25 -11
- data/lib/heirloom/cli/list.rb +1 -3
- data/lib/heirloom/cli/rotate.rb +1 -2
- data/lib/heirloom/cli/setup.rb +1 -2
- data/lib/heirloom/cli/shared.rb +3 -0
- data/lib/heirloom/cli/show.rb +1 -3
- data/lib/heirloom/cli/tag.rb +1 -2
- data/lib/heirloom/cli/teardown.rb +1 -2
- data/lib/heirloom/cli/upload.rb +1 -2
- data/lib/heirloom/version.rb +1 -1
- data/spec/acl/s3_spec.rb +11 -11
- data/spec/archive/authorizer_spec.rb +20 -20
- data/spec/archive/builder_spec.rb +13 -13
- data/spec/archive/checker_spec.rb +24 -24
- data/spec/archive/destroyer_spec.rb +20 -20
- data/spec/archive/downloader_spec.rb +30 -30
- data/spec/archive/lister_spec.rb +7 -7
- data/spec/archive/reader_spec.rb +65 -65
- data/spec/archive/setup_spec.rb +27 -27
- data/spec/archive/teardowner_spec.rb +19 -19
- data/spec/archive/updater_spec.rb +10 -10
- data/spec/archive/uploader_spec.rb +26 -26
- data/spec/archive/verifier_spec.rb +25 -25
- data/spec/archive/writer_spec.rb +11 -11
- data/spec/archive_spec.rb +91 -93
- data/spec/aws/s3_spec.rb +102 -102
- data/spec/aws/simpledb_spec.rb +33 -63
- data/spec/catalog/add_spec.rb +12 -12
- data/spec/catalog/delete_spec.rb +14 -14
- data/spec/catalog/list_spec.rb +8 -8
- data/spec/catalog/setup_spec.rb +11 -11
- data/spec/catalog/show_spec.rb +13 -13
- data/spec/catalog/verify_spec.rb +16 -16
- data/spec/catalog_spec.rb +36 -36
- data/spec/cipher/data_spec.rb +19 -19
- data/spec/cipher/file_spec.rb +11 -11
- data/spec/cli/authorize_spec.rb +16 -16
- data/spec/cli/catalog_spec.rb +18 -34
- data/spec/cli/destroy_spec.rb +13 -13
- data/spec/cli/download_spec.rb +31 -31
- data/spec/cli/formatter/catalog_spec.rb +19 -17
- data/spec/cli/list_spec.rb +14 -14
- data/spec/cli/rotate_spec.rb +9 -9
- data/spec/cli/setup_spec.rb +29 -29
- data/spec/cli/shared_spec.rb +119 -119
- data/spec/cli/show_spec.rb +20 -20
- data/spec/cli/tag_spec.rb +18 -18
- data/spec/cli/teardown_spec.rb +28 -28
- data/spec/cli/upload_spec.rb +38 -38
- data/spec/config_spec.rb +21 -21
- data/spec/destroyer/s3_spec.rb +6 -6
- data/spec/directory/directory_spec.rb +19 -19
- data/spec/downloader/s3_spec.rb +18 -18
- data/spec/logger_spec.rb +9 -9
- data/spec/spec_helper.rb +4 -80
- data/spec/uploader/s3_spec.rb +35 -35
- metadata +23 -56
- data/spec/integration/authorize_spec.rb +0 -79
- data/spec/integration/cleanup_spec.rb +0 -77
- data/watchr.rb +0 -101
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'heirloom/cli'
|
3
|
-
require 'heirloom/logger'
|
4
|
-
|
5
|
-
describe "authorize", :integration => true do
|
6
|
-
|
7
|
-
before do
|
8
|
-
@bucket_prefix = ENV['HEIRLOOM_INTEGRATION_BUCKET_PREFIX']
|
9
|
-
@name = @bucket_prefix
|
10
|
-
@domain = "heirloom_#{@name}"
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should require accounts, id, and name" do
|
14
|
-
reset_env
|
15
|
-
|
16
|
-
@output = capture(:stdout) do
|
17
|
-
|
18
|
-
expect {
|
19
|
-
Heirloom::CLI::Authorize.new.authorize
|
20
|
-
}.to raise_error SystemExit
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
@output.should =~ /Option 'accounts' required but not specified./
|
25
|
-
@output.should =~ /Option 'id' required but not specified./
|
26
|
-
@output.should =~ /Option 'name' required but not specified./
|
27
|
-
end
|
28
|
-
|
29
|
-
context "performing authorization of non-existent account" do
|
30
|
-
|
31
|
-
before do
|
32
|
-
@tmp_dir = create_temp_heirloom_content
|
33
|
-
reset_env(
|
34
|
-
:bucket_prefix => @bucket_prefix,
|
35
|
-
:force => true,
|
36
|
-
:metadata_region => 'us-west-1',
|
37
|
-
:name => @name,
|
38
|
-
:region => ['us-west-1']
|
39
|
-
)
|
40
|
-
Heirloom::CLI::Setup.new.setup
|
41
|
-
# give the bucket a chance to propagate
|
42
|
-
wait_for_aws
|
43
|
-
|
44
|
-
reset_env(
|
45
|
-
:name => @name,
|
46
|
-
:id => "v1",
|
47
|
-
:directory => @tmp_dir
|
48
|
-
)
|
49
|
-
Heirloom::CLI::Upload.new.upload
|
50
|
-
end
|
51
|
-
|
52
|
-
after do
|
53
|
-
reset_env(
|
54
|
-
:name => @name,
|
55
|
-
:force => true,
|
56
|
-
:keep_buckets => true
|
57
|
-
)
|
58
|
-
Heirloom::CLI::Teardown.new.teardown
|
59
|
-
FileUtils.remove_entry @tmp_dir
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should try to authorize but fail" do
|
63
|
-
reset_env(
|
64
|
-
:name => @name,
|
65
|
-
:id => "v1",
|
66
|
-
:accounts => ["X" * 64]
|
67
|
-
)
|
68
|
-
expect {
|
69
|
-
Heirloom::CLI::Authorize.new.authorize
|
70
|
-
}.to raise_error(Excon::Errors::BadRequest) { |err|
|
71
|
-
err.response.status.should == 400
|
72
|
-
err.response.body.should =~ /InvalidArgument/
|
73
|
-
err.response.body.should =~ /Invalid id/
|
74
|
-
}
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'heirloom/cli'
|
3
|
-
require 'heirloom/logger'
|
4
|
-
|
5
|
-
describe "cleanup", :integration => true do
|
6
|
-
|
7
|
-
before do
|
8
|
-
@bucket_prefix = ENV['HEIRLOOM_INTEGRATION_BUCKET_PREFIX']
|
9
|
-
@name = @bucket_prefix
|
10
|
-
@domain = "heirloom_#{@name}"
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should require name" do
|
14
|
-
reset_env
|
15
|
-
|
16
|
-
Heirloom.log.should_receive(:error)
|
17
|
-
.with("Option 'name' required but not specified.")
|
18
|
-
|
19
|
-
expect {
|
20
|
-
Heirloom::CLI::Cleanup.new.cleanup
|
21
|
-
}.to raise_error SystemExit
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
context "setting up and tearing down" do
|
26
|
-
|
27
|
-
before do
|
28
|
-
@tmp_dir = create_temp_heirloom_content
|
29
|
-
|
30
|
-
reset_env(
|
31
|
-
:bucket_prefix => @bucket_prefix,
|
32
|
-
:force => true,
|
33
|
-
:metadata_region => 'us-west-1',
|
34
|
-
:name => @name,
|
35
|
-
:region => ['us-west-1']
|
36
|
-
)
|
37
|
-
Heirloom::CLI::Setup.new.setup
|
38
|
-
# give the bucket a chance to propagate
|
39
|
-
wait_for_aws
|
40
|
-
|
41
|
-
@sdb = Heirloom::AWS::SimpleDB.new :config => (Heirloom::Config.new :environment => 'integration')
|
42
|
-
end
|
43
|
-
|
44
|
-
after do
|
45
|
-
reset_env(
|
46
|
-
:name => @name,
|
47
|
-
:force => true,
|
48
|
-
:keep_buckets => true
|
49
|
-
)
|
50
|
-
Heirloom::CLI::Teardown.new.teardown
|
51
|
-
FileUtils.remove_entry @tmp_dir
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should delete some number of archives from an heirloom" do
|
55
|
-
(1..3).each do |i|
|
56
|
-
reset_env(
|
57
|
-
:id => "v#{i}",
|
58
|
-
:name => @name,
|
59
|
-
:directory => @tmp_dir,
|
60
|
-
:metadata_region => 'us-west-1'
|
61
|
-
)
|
62
|
-
Heirloom::CLI::Upload.new.upload
|
63
|
-
end
|
64
|
-
|
65
|
-
reset_env(
|
66
|
-
:name => @name,
|
67
|
-
:keep => 2
|
68
|
-
)
|
69
|
-
Heirloom::CLI::Cleanup.new.cleanup
|
70
|
-
wait_for_aws
|
71
|
-
|
72
|
-
@sdb.count(@domain).should == 2
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
data/watchr.rb
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
# Derived from:
|
2
|
-
# https://gist.github.com/darylf/1175908
|
3
|
-
|
4
|
-
# Combined from:
|
5
|
-
# [1] http://www.rubyinside.com/how-to-rails-3-and-rspec-2-4336.html
|
6
|
-
# [2] https://gist.github.com/600976
|
7
|
-
|
8
|
-
unless defined?(GROWL)
|
9
|
-
$stderr.sync=true
|
10
|
-
$stdout.sync=true
|
11
|
-
ENV["WATCHR"] = "1"
|
12
|
-
GROWL=`which growlnotify`.chomp
|
13
|
-
IMAGE_DIR=File.expand_path("~/.watchr_images/")
|
14
|
-
end
|
15
|
-
|
16
|
-
def growl(message,title=nil,image=nil)
|
17
|
-
return if GROWL.empty?
|
18
|
-
title ||= "Watchr Test Results"
|
19
|
-
message.gsub! /\[[0-9]+?m/, ''
|
20
|
-
image ||= message =~ /^0 failure/ ? "#{IMAGE_DIR}/pass.png" : "#{IMAGE_DIR}/fail.png"
|
21
|
-
options = "-n Watchr --image '#{image}' -m '#{message}' '#{title}'"
|
22
|
-
puts "#{GROWL} #{options}"
|
23
|
-
run "#{GROWL} #{options}"
|
24
|
-
end
|
25
|
-
|
26
|
-
def run(cmd,verbose=true)
|
27
|
-
puts("# #{cmd}")
|
28
|
-
ret=[]
|
29
|
-
IO.popen(cmd) do |output|
|
30
|
-
while line = output.gets do
|
31
|
-
puts line if verbose
|
32
|
-
ret << line
|
33
|
-
end
|
34
|
-
end
|
35
|
-
ret #join("\n")
|
36
|
-
end
|
37
|
-
|
38
|
-
def generate_message(result)
|
39
|
-
message = "Error finding results..."
|
40
|
-
if result.join("\n") =~ /.*(\d+) example(s?), (\d+) failure(s?).*/
|
41
|
-
message = "#{$3} failure"
|
42
|
-
message += "s" unless $3 == "1"
|
43
|
-
end
|
44
|
-
message
|
45
|
-
end
|
46
|
-
|
47
|
-
def run_suite
|
48
|
-
system("clear")
|
49
|
-
results = run "rake spec"
|
50
|
-
growl generate_message(results)
|
51
|
-
puts
|
52
|
-
end
|
53
|
-
|
54
|
-
def run_spec(file)
|
55
|
-
unless File.exist?(file)
|
56
|
-
puts "#{file} does not exist"
|
57
|
-
return
|
58
|
-
end
|
59
|
-
|
60
|
-
puts "Running #{file}"
|
61
|
-
results = run "bundle exec rspec #{file}"
|
62
|
-
growl generate_message(results)
|
63
|
-
puts
|
64
|
-
end
|
65
|
-
|
66
|
-
watch("spec/.*/*_spec.rb") do |match|
|
67
|
-
run_spec match[0]
|
68
|
-
end
|
69
|
-
|
70
|
-
watch("spec/.*/.*/*_spec.rb") do |match|
|
71
|
-
run_spec match[0]
|
72
|
-
end
|
73
|
-
|
74
|
-
watch("lib/(.*).rb") do |match|
|
75
|
-
run_spec %{spec/#{match[1]}_spec.rb}
|
76
|
-
end
|
77
|
-
|
78
|
-
watch("lib/heirloom/(.*).rb") do |match|
|
79
|
-
run_spec %{spec/#{match[1]}_spec.rb}
|
80
|
-
end
|
81
|
-
|
82
|
-
|
83
|
-
# Ctrl-\
|
84
|
-
Signal.trap 'QUIT' do
|
85
|
-
puts " --- Running all tests ---\n\n"
|
86
|
-
run_suite
|
87
|
-
end
|
88
|
-
|
89
|
-
# Ctrl-C
|
90
|
-
Signal.trap 'INT' do
|
91
|
-
if @interrupted then
|
92
|
-
abort("\n")
|
93
|
-
else
|
94
|
-
puts "Interrupt a second time to quit"
|
95
|
-
@interrupted = true
|
96
|
-
Kernel.sleep 1.5
|
97
|
-
# raise Interrupt, nil # let the run loop catch it
|
98
|
-
run_suite
|
99
|
-
@interrupted = false
|
100
|
-
end
|
101
|
-
end
|