heirloom 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/README.md +1 -1
- data/Rakefile +6 -0
- data/lib/heirloom/archive/builder.rb +29 -29
- data/lib/heirloom/archive/destroyer.rb +27 -18
- data/lib/heirloom/archive/downloader.rb +12 -14
- data/lib/heirloom/archive/lister.rb +2 -1
- data/lib/heirloom/archive/reader.rb +22 -15
- data/lib/heirloom/archive/updater.rb +2 -1
- data/lib/heirloom/archive.rb +5 -2
- data/lib/heirloom/aws/simpledb.rb +15 -2
- data/lib/heirloom/cli/authorize.rb +12 -7
- data/lib/heirloom/cli/build.rb +29 -20
- data/lib/heirloom/cli/destroy.rb +11 -4
- data/lib/heirloom/cli/download.rb +11 -4
- data/lib/heirloom/cli/list.rb +15 -6
- data/lib/heirloom/cli/shared.rb +10 -1
- data/lib/heirloom/cli/show.rb +14 -5
- data/lib/heirloom/cli/update.rb +14 -6
- data/lib/heirloom/cli.rb +1 -2
- data/lib/heirloom/directory/directory.rb +16 -18
- data/lib/heirloom/directory/git_directory.rb +1 -1
- data/lib/heirloom/uploader/s3.rb +4 -3
- data/lib/heirloom/version.rb +1 -1
- data/spec/archive/builder_spec.rb +60 -58
- data/spec/archive/destroyer_spec.rb +9 -10
- data/spec/archive/downloader_spec.rb +2 -2
- data/spec/archive/lister_spec.rb +1 -1
- data/spec/archive/reader_spec.rb +92 -81
- data/spec/archive/updater_spec.rb +1 -1
- data/spec/archive_spec.rb +15 -6
- data/spec/aws/simpledb_spec.rb +35 -0
- data/spec/cli/authorize_spec.rb +34 -0
- data/spec/cli/build_spec.rb +57 -0
- data/spec/cli/destroy_spec.rb +33 -0
- data/spec/cli/download_spec.rb +37 -0
- data/spec/cli/list_spec.rb +34 -0
- data/spec/cli/shared_spec.rb +68 -34
- data/spec/cli/show_spec.rb +34 -0
- data/spec/cli/update_spec.rb +37 -0
- data/spec/directory/directory_spec.rb +13 -20
- data/spec/directory/git_directory_spec.rb +23 -22
- metadata +28 -14
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Heirloom
|
2
2
|
========
|
3
3
|
|
4
|
-
Heirloom
|
4
|
+
Heirloom packages and distributes files to cloud storage services for deployment. Heirloom tracks metadata about those deployments, both about the file locations, as well as arbitrary metadata which can be set by an engineer or build process.
|
5
5
|
|
6
6
|
Installation
|
7
7
|
------------
|
data/Rakefile
CHANGED
@@ -5,77 +5,77 @@ module Heirloom
|
|
5
5
|
|
6
6
|
class Builder
|
7
7
|
|
8
|
-
|
8
|
+
attr_writer :local_build
|
9
9
|
|
10
10
|
def initialize(args)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
@config = args[:config]
|
12
|
+
@name = args[:name]
|
13
|
+
@domain = "heirloom_#{@name}"
|
14
|
+
@id = args[:id]
|
15
|
+
@logger = @config.logger
|
16
|
+
sdb.create_domain @domain
|
16
17
|
end
|
17
18
|
|
18
19
|
def build(args)
|
19
|
-
|
20
|
+
@source = args[:directory] ||= '.'
|
20
21
|
|
21
|
-
directory = Directory.new :path => source,
|
22
|
+
directory = Directory.new :path => @source,
|
22
23
|
:exclude => args[:exclude],
|
23
|
-
:config => config
|
24
|
+
:config => @config
|
24
25
|
|
25
26
|
return false unless directory.build_artifact_from_directory
|
26
27
|
|
27
|
-
|
28
|
+
@local_build = directory.local_build
|
28
29
|
|
29
30
|
create_artifact_record
|
30
31
|
|
31
32
|
add_git_commit if args[:git]
|
32
33
|
|
33
|
-
logger.info "Build complete."
|
34
|
+
@logger.info "Build complete."
|
34
35
|
|
35
|
-
local_build
|
36
|
+
@local_build
|
36
37
|
end
|
37
38
|
|
38
39
|
def cleanup
|
39
|
-
logger.info "Cleaning up local build #{local_build}."
|
40
|
-
File.delete local_build
|
40
|
+
@logger.info "Cleaning up local build #{@local_build}."
|
41
|
+
File.delete @local_build
|
41
42
|
end
|
42
43
|
|
43
44
|
private
|
44
45
|
|
45
46
|
def add_git_commit
|
46
|
-
git = GitDirectory.new(:path => source)
|
47
|
-
commit = git.commit id
|
47
|
+
git = GitDirectory.new(:path => @source)
|
48
|
+
commit = git.commit @id
|
48
49
|
if commit
|
49
50
|
add_git_commit_to_artifact_record commit
|
50
51
|
else
|
51
|
-
logger.warn "Could not find Git sha: #{id}."
|
52
|
+
@logger.warn "Could not find Git sha: #{@id}."
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
55
56
|
def add_git_commit_to_artifact_record(commit)
|
56
|
-
attributes = { 'sha' => id,
|
57
|
+
attributes = { 'sha' => @id,
|
57
58
|
'abbreviated_sha' => commit.id_abbrev,
|
58
59
|
'message' => commit.message,
|
59
60
|
'author' => commit.author.name }
|
60
61
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
logger.info "Git author: #{commit.author.name}"
|
62
|
+
attributes.each_pair do |k, v|
|
63
|
+
@logger.info "Git #{k}: #{v}"
|
64
|
+
end
|
65
65
|
|
66
|
-
sdb.put_attributes
|
66
|
+
sdb.put_attributes @domain, @id, attributes
|
67
67
|
end
|
68
68
|
|
69
69
|
def create_artifact_record
|
70
|
-
attributes = { 'built_by'
|
71
|
-
'built_at'
|
72
|
-
'id'
|
73
|
-
logger.info "Create artifact record #{id}."
|
74
|
-
sdb.put_attributes
|
70
|
+
attributes = { 'built_by' => "#{user}@#{hostname}",
|
71
|
+
'built_at' => Time.now.utc.iso8601,
|
72
|
+
'id' => @id }
|
73
|
+
@logger.info "Create artifact record #{@id}."
|
74
|
+
sdb.put_attributes @domain, @id, attributes
|
75
75
|
end
|
76
76
|
|
77
77
|
def sdb
|
78
|
-
@sdb ||= AWS::SimpleDB.new :config => config
|
78
|
+
@sdb ||= AWS::SimpleDB.new :config => @config
|
79
79
|
end
|
80
80
|
|
81
81
|
def user
|
@@ -2,38 +2,47 @@ module Heirloom
|
|
2
2
|
|
3
3
|
class Destroyer
|
4
4
|
|
5
|
-
attr_accessor :config, :id, :logger, :name
|
6
|
-
|
7
5
|
def initialize(args)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
@config = args[:config]
|
7
|
+
@name = args[:name]
|
8
|
+
@domain = "heirloom_#{@name}"
|
9
|
+
@id = args[:id]
|
10
|
+
@logger = @config.logger
|
12
11
|
end
|
13
12
|
|
14
13
|
def destroy(args)
|
15
14
|
regions = args[:regions]
|
16
15
|
|
17
|
-
logger.info "Destroying #{@name} - #{@id}"
|
16
|
+
@logger.info "Destroying #{@name} - #{@id}"
|
18
17
|
|
19
18
|
regions.each do |region|
|
20
19
|
bucket = reader.get_bucket :region => region
|
21
20
|
|
22
|
-
key = "#{id}.tar.gz"
|
21
|
+
key = "#{@id}.tar.gz"
|
23
22
|
|
24
23
|
if bucket
|
25
|
-
logger.info "Destroying 's3://#{bucket}/#{name}/#{key}'."
|
24
|
+
@logger.info "Destroying 's3://#{bucket}/#{@name}/#{key}'."
|
26
25
|
|
27
|
-
s3_destroyer = Destroyer::S3.new :config => config,
|
26
|
+
s3_destroyer = Destroyer::S3.new :config => @config,
|
28
27
|
:region => region
|
29
28
|
|
30
|
-
s3_destroyer.destroy_file :key_name
|
31
|
-
:
|
32
|
-
:
|
29
|
+
s3_destroyer.destroy_file :key_name => key,
|
30
|
+
:bucket => bucket,
|
31
|
+
:key_folder => @name
|
33
32
|
end
|
34
33
|
end
|
35
|
-
|
36
|
-
|
34
|
+
|
35
|
+
sdb.delete @domain, @id
|
36
|
+
|
37
|
+
# Simple DB is eventually consisten
|
38
|
+
# Sleep for 3 sec for changes to reflect
|
39
|
+
Kernel.sleep 3
|
40
|
+
|
41
|
+
if sdb.domain_empty? @domain
|
42
|
+
@logger.info "Domain #{@domain} empty. Destroying."
|
43
|
+
sdb.delete_domain @domain
|
44
|
+
end
|
45
|
+
@logger.info "Destroy complete."
|
37
46
|
end
|
38
47
|
|
39
48
|
private
|
@@ -43,9 +52,9 @@ module Heirloom
|
|
43
52
|
end
|
44
53
|
|
45
54
|
def reader
|
46
|
-
@reader ||= Reader.new :config => config,
|
47
|
-
:name => name,
|
48
|
-
:id => id
|
55
|
+
@reader ||= Reader.new :config => @config,
|
56
|
+
:name => @name,
|
57
|
+
:id => @id
|
49
58
|
end
|
50
59
|
|
51
60
|
end
|
@@ -2,47 +2,45 @@ module Heirloom
|
|
2
2
|
|
3
3
|
class Downloader
|
4
4
|
|
5
|
-
attr_accessor :config, :id, :name, :logger
|
6
|
-
|
7
5
|
def initialize(args)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
@config = args[:config]
|
7
|
+
@name = args[:name]
|
8
|
+
@id = args[:id]
|
9
|
+
@logger = @config.logger
|
12
10
|
end
|
13
11
|
|
14
12
|
def download(args)
|
15
13
|
region = args[:region]
|
16
14
|
|
17
|
-
s3_downloader = Downloader::S3.new :config => config,
|
18
|
-
:logger => logger,
|
15
|
+
s3_downloader = Downloader::S3.new :config => @config,
|
16
|
+
:logger => @logger,
|
19
17
|
:region => region
|
20
18
|
|
21
19
|
bucket = reader.get_bucket :region => region
|
22
20
|
key = reader.get_key :region => region
|
23
21
|
|
24
|
-
logger.info "Downloading s3://#{bucket}/#{key} from #{region}."
|
22
|
+
@logger.info "Downloading s3://#{bucket}/#{key} from #{region}."
|
25
23
|
|
26
24
|
file = s3_downloader.download_file :bucket => bucket,
|
27
25
|
:key => key
|
28
26
|
|
29
27
|
output = args[:output] ||= "./#{key.split('/').last}"
|
30
28
|
|
31
|
-
logger.info "Writing file to #{output}."
|
29
|
+
@logger.info "Writing file to #{output}."
|
32
30
|
|
33
31
|
File.open(output, 'w') do |local_file|
|
34
32
|
local_file.write file
|
35
33
|
end
|
36
34
|
|
37
|
-
logger.info "Download complete."
|
35
|
+
@logger.info "Download complete."
|
38
36
|
end
|
39
37
|
|
40
38
|
private
|
41
39
|
|
42
40
|
def reader
|
43
|
-
@reader ||= Reader.new :config => config,
|
44
|
-
:name => name,
|
45
|
-
:id => id
|
41
|
+
@reader ||= Reader.new :config => @config,
|
42
|
+
:name => @name,
|
43
|
+
:id => @id
|
46
44
|
end
|
47
45
|
|
48
46
|
end
|
@@ -5,10 +5,11 @@ module Heirloom
|
|
5
5
|
def initialize(args)
|
6
6
|
@config = args[:config]
|
7
7
|
@name = args[:name]
|
8
|
+
@domain = "heirloom_#{@name}"
|
8
9
|
end
|
9
10
|
|
10
11
|
def list(limit=10)
|
11
|
-
sdb.select("select * from #{@
|
12
|
+
sdb.select("select * from #{@domain} where built_at > '2000-01-01T00:00:00.000Z'\
|
12
13
|
order by built_at desc limit #{limit}").keys
|
13
14
|
end
|
14
15
|
|
@@ -2,21 +2,20 @@ module Heirloom
|
|
2
2
|
|
3
3
|
class Reader
|
4
4
|
|
5
|
-
attr_accessor :config, :id, :name
|
6
|
-
|
7
5
|
def initialize(args)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
@
|
6
|
+
@config = args[:config]
|
7
|
+
@name = args[:name]
|
8
|
+
@domain = "heirloom_#{@name}"
|
9
|
+
@id = args[:id]
|
10
|
+
@logger = @config.logger
|
12
11
|
end
|
13
12
|
|
14
13
|
def exists?
|
15
|
-
if show.any?
|
16
|
-
@logger.debug "Found entry for #{id} in SimpleDB."
|
14
|
+
if domain_exists? && show.any?
|
15
|
+
@logger.debug "Found entry for #{@id} in SimpleDB."
|
17
16
|
true
|
18
17
|
else
|
19
|
-
@logger.debug "Entry for #{id} not found in SimpleDB."
|
18
|
+
@logger.debug "Entry for #{@id} not found in SimpleDB."
|
20
19
|
false
|
21
20
|
end
|
22
21
|
end
|
@@ -29,7 +28,7 @@ module Heirloom
|
|
29
28
|
end
|
30
29
|
|
31
30
|
def get_bucket(args)
|
32
|
-
@logger.debug "Looking for bucket in #{args[:region]} for #{id}"
|
31
|
+
@logger.debug "Looking for bucket in #{args[:region]} for #{@id}"
|
33
32
|
url = get_url(args)
|
34
33
|
if url
|
35
34
|
bucket = url.gsub('s3://', '').split('/').first
|
@@ -53,9 +52,13 @@ module Heirloom
|
|
53
52
|
end
|
54
53
|
end
|
55
54
|
|
55
|
+
def count
|
56
|
+
sdb.count @domain
|
57
|
+
end
|
58
|
+
|
56
59
|
def show
|
57
|
-
query = sdb.select "select * from #{
|
58
|
-
items = query[id] ? query[id] : {}
|
60
|
+
query = sdb.select "select * from #{@domain} where itemName() = '#{@id}'"
|
61
|
+
items = query[@id] ? query[@id] : {}
|
59
62
|
Hash.new.tap do |hash|
|
60
63
|
items.each_pair.map do |key,value|
|
61
64
|
hash[key] = value.first
|
@@ -65,15 +68,19 @@ module Heirloom
|
|
65
68
|
|
66
69
|
private
|
67
70
|
|
71
|
+
def domain_exists?
|
72
|
+
sdb.domain_exists? @domain
|
73
|
+
end
|
74
|
+
|
68
75
|
def get_url(args)
|
69
76
|
return nil unless exists?
|
70
|
-
@logger.debug "Looking for #{args[:region]} endpoint for #{id}"
|
77
|
+
@logger.debug "Looking for #{args[:region]} endpoint for #{@id}"
|
71
78
|
url = "#{args[:region]}-s3-url"
|
72
79
|
if show[url]
|
73
|
-
@logger.debug "Found #{url} for #{id}."
|
80
|
+
@logger.debug "Found #{url} for #{@id}."
|
74
81
|
show[url]
|
75
82
|
else
|
76
|
-
@logger.debug "#{args[:region]} endpoint for #{id} not found."
|
83
|
+
@logger.debug "#{args[:region]} endpoint for #{@id} not found."
|
77
84
|
nil
|
78
85
|
end
|
79
86
|
end
|
@@ -7,6 +7,7 @@ module Heirloom
|
|
7
7
|
@name = args[:name]
|
8
8
|
@id = args[:id]
|
9
9
|
|
10
|
+
@domain = "heirloom_#{@name}"
|
10
11
|
@logger = @config.logger
|
11
12
|
end
|
12
13
|
|
@@ -14,7 +15,7 @@ module Heirloom
|
|
14
15
|
attribute = args[:attribute]
|
15
16
|
value = args[:value]
|
16
17
|
|
17
|
-
sdb.put_attributes @
|
18
|
+
sdb.put_attributes @domain, @id, { attribute => value }, { :replace => attribute }
|
18
19
|
@logger.info "Updated #{@name} (#{@id}): #{attribute} = #{value}."
|
19
20
|
end
|
20
21
|
|
data/lib/heirloom/archive.rb
CHANGED
@@ -13,8 +13,7 @@ module Heirloom
|
|
13
13
|
class Archive
|
14
14
|
|
15
15
|
def initialize(args)
|
16
|
-
@config =
|
17
|
-
:logger => args[:logger]
|
16
|
+
@config = args[:config]
|
18
17
|
@name = args[:name]
|
19
18
|
@id = args[:id]
|
20
19
|
end
|
@@ -28,6 +27,10 @@ module Heirloom
|
|
28
27
|
builder.build args
|
29
28
|
end
|
30
29
|
|
30
|
+
def count
|
31
|
+
reader.count
|
32
|
+
end
|
33
|
+
|
31
34
|
def download(args)
|
32
35
|
downloader.download args
|
33
36
|
end
|
@@ -6,9 +6,9 @@ module Heirloom
|
|
6
6
|
|
7
7
|
def initialize(args)
|
8
8
|
@config = args[:config]
|
9
|
-
@sdb = Fog::AWS::SimpleDB.new :aws_access_key_id
|
9
|
+
@sdb = Fog::AWS::SimpleDB.new :aws_access_key_id => @config.access_key,
|
10
10
|
:aws_secret_access_key => @config.secret_key,
|
11
|
-
:region
|
11
|
+
:region => @config.primary_region
|
12
12
|
end
|
13
13
|
|
14
14
|
def domains
|
@@ -23,6 +23,14 @@ module Heirloom
|
|
23
23
|
@sdb.create_domain(domain) unless domain_exists?(domain)
|
24
24
|
end
|
25
25
|
|
26
|
+
def delete_domain(domain)
|
27
|
+
@sdb.delete_domain(domain)
|
28
|
+
end
|
29
|
+
|
30
|
+
def domain_empty?(domain)
|
31
|
+
count(domain).zero?
|
32
|
+
end
|
33
|
+
|
26
34
|
def put_attributes(domain, key, attributes, options = {})
|
27
35
|
@sdb.put_attributes domain, key, attributes, options
|
28
36
|
end
|
@@ -35,6 +43,11 @@ module Heirloom
|
|
35
43
|
@sdb.delete_attributes domain, key
|
36
44
|
end
|
37
45
|
|
46
|
+
def count(domain)
|
47
|
+
body = @sdb.select("SELECT count(*) FROM #{domain}").body
|
48
|
+
body['Items']['Domain']['Count'].first.to_i
|
49
|
+
end
|
50
|
+
|
38
51
|
end
|
39
52
|
end
|
40
53
|
|
@@ -4,17 +4,20 @@ module Heirloom
|
|
4
4
|
module CLI
|
5
5
|
class Authorize
|
6
6
|
|
7
|
+
include Heirloom::CLI::Shared
|
8
|
+
|
7
9
|
def initialize
|
8
10
|
@opts = read_options
|
9
11
|
@logger = HeirloomLogger.new :log_level => @opts[:level]
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
@config = load_config :logger => @logger,
|
13
|
+
:opts => @opts
|
14
|
+
exit 1 unless valid_options? :provided => @opts,
|
15
|
+
:required => [:accounts,
|
16
|
+
:name, :id],
|
17
|
+
:logger => @logger
|
15
18
|
@archive = Archive.new :name => @opts[:name],
|
16
19
|
:id => @opts[:id],
|
17
|
-
:
|
20
|
+
:config => @config
|
18
21
|
end
|
19
22
|
|
20
23
|
def authorize
|
@@ -32,7 +35,7 @@ Authorize access from another AWS account to an archive.
|
|
32
35
|
|
33
36
|
Usage:
|
34
37
|
|
35
|
-
heirloom authorize -n NAME -i ID -a AWS_ACCOUNT1-a AWS_ACCOUNT2
|
38
|
+
heirloom authorize -n NAME -i ID -a AWS_ACCOUNT1 -a AWS_ACCOUNT2
|
36
39
|
|
37
40
|
Note: This will replace all current authorizations with those specified and make the archive private.
|
38
41
|
|
@@ -41,8 +44,10 @@ EOS
|
|
41
44
|
:multi => true
|
42
45
|
opt :help, "Display Help"
|
43
46
|
opt :id, "id of the archive to authorize.", :type => :string
|
47
|
+
opt :key, "AWS Access Key", :type => :string
|
44
48
|
opt :level, "Log level [debug|info|warn|error].", :type => :string,
|
45
49
|
:default => 'info'
|
50
|
+
opt :secret, "AWS Secret Access Key", :type => :string
|
46
51
|
opt :name, "Name of archive.", :type => :string
|
47
52
|
end
|
48
53
|
end
|
data/lib/heirloom/cli/build.rb
CHANGED
@@ -4,36 +4,42 @@ module Heirloom
|
|
4
4
|
module CLI
|
5
5
|
class Build
|
6
6
|
|
7
|
+
include Heirloom::CLI::Shared
|
8
|
+
|
7
9
|
def initialize
|
8
10
|
@opts = read_options
|
9
11
|
@logger = HeirloomLogger.new :log_level => @opts[:level]
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
@config = load_config :logger => @logger,
|
13
|
+
:opts => @opts
|
14
|
+
|
15
|
+
exit 1 unless valid_options? :provided => @opts,
|
16
|
+
:required => [:name, :id, :region,
|
17
|
+
:base_prefix,
|
18
|
+
:directory],
|
19
|
+
:logger => @logger
|
20
|
+
|
15
21
|
@archive = Archive.new :name => @opts[:name],
|
16
22
|
:id => @opts[:id],
|
17
|
-
:
|
23
|
+
:config => @config
|
18
24
|
end
|
19
25
|
|
20
26
|
def build
|
21
|
-
unless @archive.buckets_exist? :bucket_prefix => @opts[:
|
22
|
-
:regions => @opts[:
|
27
|
+
unless @archive.buckets_exist? :bucket_prefix => @opts[:base_prefix],
|
28
|
+
:regions => @opts[:region]
|
23
29
|
@logger.error "Buckets do no exist in required regions."
|
24
30
|
exit 1
|
25
31
|
end
|
26
32
|
|
27
33
|
@archive.destroy if @archive.exists?
|
28
34
|
|
29
|
-
build = @archive.build :bucket_prefix
|
30
|
-
:directory
|
31
|
-
:exclude
|
32
|
-
:git
|
35
|
+
build = @archive.build :bucket_prefix => @opts[:base_prefix],
|
36
|
+
:directory => @opts[:directory],
|
37
|
+
:exclude => @opts[:exclude],
|
38
|
+
:git => @opts[:git]
|
33
39
|
|
34
40
|
if build
|
35
|
-
@archive.upload :bucket_prefix => @opts[:
|
36
|
-
:regions => @opts[:
|
41
|
+
@archive.upload :bucket_prefix => @opts[:base_prefix],
|
42
|
+
:regions => @opts[:region],
|
37
43
|
:public_readable => @opts[:public],
|
38
44
|
:file => build
|
39
45
|
@archive.cleanup
|
@@ -54,15 +60,17 @@ Build and upload a new archive.
|
|
54
60
|
|
55
61
|
Usage:
|
56
62
|
|
57
|
-
heirloom build -n NAME -i ID -b
|
63
|
+
heirloom build -n NAME -i ID -b BASE_PREFIX -r REGION1 -r REGION2 [-d DIRECTORY_TO_BUILD] [-p] [-g] [-e DIRECTORY_TO_EXCLUDE] [-l LOG_LEVEL]
|
58
64
|
|
59
65
|
EOS
|
60
|
-
opt :
|
66
|
+
opt :base_prefix, "Base bucket prefix which will be combined with region. \
|
61
67
|
For example: -b 'test' -r 'us-west-1' will expect bucket 'test-us-west-1' to be present", :type => :string
|
62
68
|
opt :directory, "Source directory of build.", :type => :string,
|
63
69
|
:default => '.'
|
64
|
-
opt :exclude, "
|
65
|
-
|
70
|
+
opt :exclude, "File(s) or directorie(s) to exclude. \
|
71
|
+
Can be specified multiple times.", :type => :string,
|
72
|
+
:multi => true
|
73
|
+
opt :key, "AWS Access Key ID", :type => :string
|
66
74
|
opt :git, "Read git commit information from directory and set as archive attributes."
|
67
75
|
opt :help, "Display Help"
|
68
76
|
opt :id, "id for archive (when -g specified, assumed to be GIT sha).", :type => :string
|
@@ -70,8 +78,9 @@ For example: -b 'test' -r 'us-west-1' will expect bucket 'test-us-west-1' to be
|
|
70
78
|
:default => 'info'
|
71
79
|
opt :name, "Name of archive.", :type => :string
|
72
80
|
opt :public, "Set this archive as public readable?"
|
73
|
-
opt :
|
74
|
-
|
81
|
+
opt :region, "Region(s) to upload archive. Can be specified multiple times.", :type => :string,
|
82
|
+
:multi => true
|
83
|
+
opt :secret, "AWS Secret Access Key", :type => :string
|
75
84
|
end
|
76
85
|
end
|
77
86
|
|
data/lib/heirloom/cli/destroy.rb
CHANGED
@@ -2,17 +2,22 @@ module Heirloom
|
|
2
2
|
module CLI
|
3
3
|
class Destroy
|
4
4
|
|
5
|
+
include Heirloom::CLI::Shared
|
6
|
+
|
5
7
|
def initialize
|
6
8
|
@opts = read_options
|
7
9
|
@logger = HeirloomLogger.new :log_level => @opts[:level]
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
@config = load_config :logger => @logger,
|
11
|
+
:opts => @opts
|
12
|
+
|
13
|
+
exit 1 unless valid_options? :provided => @opts,
|
14
|
+
:required => [:name, :id],
|
15
|
+
:logger => @logger
|
11
16
|
@name = @opts[:name]
|
12
17
|
@id = @opts[:id]
|
13
18
|
@archive = Archive.new :name => @name,
|
14
19
|
:id => @id,
|
15
|
-
:
|
20
|
+
:config => @config
|
16
21
|
end
|
17
22
|
|
18
23
|
def destroy
|
@@ -35,9 +40,11 @@ heirloom destroy -n NAME -i ID [-l LOG_LEVEL]
|
|
35
40
|
EOS
|
36
41
|
opt :help, "Display Help"
|
37
42
|
opt :id, "ID of the archive to display.", :type => :string
|
43
|
+
opt :key, "AWS Access Key ID", :type => :string
|
38
44
|
opt :level, "Log level [debug|info|warn|error].", :type => :string,
|
39
45
|
:default => 'info'
|
40
46
|
opt :name, "Name of archive.", :type => :string
|
47
|
+
opt :secret, "AWS Secret Access Key", :type => :string
|
41
48
|
end
|
42
49
|
end
|
43
50
|
end
|
@@ -2,16 +2,21 @@ module Heirloom
|
|
2
2
|
module CLI
|
3
3
|
class Download
|
4
4
|
|
5
|
+
include Heirloom::CLI::Shared
|
6
|
+
|
5
7
|
def initialize
|
6
8
|
@opts = read_options
|
7
9
|
@logger = HeirloomLogger.new :log_level => @opts[:level]
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
@config = load_config :logger => @logger,
|
11
|
+
:opts => @opts
|
12
|
+
|
13
|
+
exit 1 unless valid_options? :provided => @opts,
|
14
|
+
:required => [:name, :id, :output],
|
15
|
+
:logger => @logger
|
11
16
|
|
12
17
|
@archive = Archive.new :name => @opts[:name],
|
13
18
|
:id => @opts[:id],
|
14
|
-
:
|
19
|
+
:config => @config
|
15
20
|
end
|
16
21
|
|
17
22
|
def download
|
@@ -35,12 +40,14 @@ heirloom download -n NAME -i ID -r REGION -o OUTPUT_FILE
|
|
35
40
|
EOS
|
36
41
|
opt :help, "Display Help"
|
37
42
|
opt :id, "id of the archive to download.", :type => :string
|
43
|
+
opt :key, "AWS Access Key ID", :type => :string
|
38
44
|
opt :name, "Name of archive.", :type => :string
|
39
45
|
opt :level, "Log level [debug|info|warn|error].", :type => :string,
|
40
46
|
:default => 'info'
|
41
47
|
opt :output, "Location to download archive.", :type => :string
|
42
48
|
opt :region, "Region to download archive.", :type => :string,
|
43
49
|
:default => 'us-west-1'
|
50
|
+
opt :secret, "AWS Secret Access Key", :type => :string
|
44
51
|
end
|
45
52
|
end
|
46
53
|
end
|