heirloom 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/heirloom/cli.rb +6 -1
- data/lib/heirloom/version.rb +1 -1
- data/lib/heirloom.rb +10 -2
- metadata +15 -15
data/lib/heirloom/cli.rb
CHANGED
@@ -19,6 +19,7 @@ EOS
|
|
19
19
|
opt :class, "Class of artifact. This should match the SCM repo", :type => :string
|
20
20
|
opt :dir, "Directory which contains git repo", :type => :string
|
21
21
|
opt :prefix, "Bucket prefix", :type => :string
|
22
|
+
opt :open, "Is this artifact open to public read?"
|
22
23
|
opt :sha, "Git Sha", :type => :string
|
23
24
|
end
|
24
25
|
|
@@ -27,10 +28,14 @@ EOS
|
|
27
28
|
case cmd
|
28
29
|
when 'build'
|
29
30
|
raise 'Missing required args' unless @opts[:sha] && @opts[:class]
|
31
|
+
|
32
|
+
accounts = @opts[:accounts].nil? ? [] : @opts[:accounts].split(',')
|
33
|
+
|
30
34
|
h = Heirloom.new :heirloom_type => @opts[:class],
|
31
35
|
:source_dir => @opts[:dir] ||= ".",
|
32
36
|
:prefix => @opts[:prefix],
|
33
|
-
:
|
37
|
+
:open => @opts[:open],
|
38
|
+
:accounts => accounts
|
34
39
|
|
35
40
|
h.build_and_upload_to_s3(:sha => @opts[:sha])
|
36
41
|
when 'list'
|
data/lib/heirloom/version.rb
CHANGED
data/lib/heirloom.rb
CHANGED
@@ -43,6 +43,7 @@ module Heirloom
|
|
43
43
|
def initialize(args)
|
44
44
|
@sdb = self.class.connect_to_sdb
|
45
45
|
@accounts = args[:accounts]
|
46
|
+
@open = args[:open] ||= false
|
46
47
|
|
47
48
|
self.heirloom_type = args[:heirloom_type]
|
48
49
|
self.source_dir = args[:source_dir]
|
@@ -117,14 +118,17 @@ module Heirloom
|
|
117
118
|
# Upload the artifact
|
118
119
|
b.files.create :key => "#{folder}/#{artifact}",
|
119
120
|
:body => File.open(artifact_path),
|
120
|
-
:public =>
|
121
|
+
:public => open?
|
121
122
|
|
122
123
|
# Get the bucket owner name and ID
|
123
124
|
id = connection.get_bucket_acl(bucket).body['Owner']['ID']
|
124
125
|
name = connection.get_bucket_acl(bucket).body['Owner']['Name']
|
125
126
|
|
126
127
|
# Set the objects ACLs
|
127
|
-
|
128
|
+
# Only set them if ACLs exist
|
129
|
+
if @accounts.any?
|
130
|
+
connection.put_object_acl(bucket, "#{folder}/#{artifact}", build_bucket_grants(id, name))
|
131
|
+
end
|
128
132
|
|
129
133
|
# Add the artifact location
|
130
134
|
@sdb.put_attributes domain, sha, { "#{region}-s3-url" => "s3://#{bucket}/#{folder}/#{artifact}" }
|
@@ -203,6 +207,10 @@ module Heirloom
|
|
203
207
|
ENV['USER']
|
204
208
|
end
|
205
209
|
|
210
|
+
def open?
|
211
|
+
@open
|
212
|
+
end
|
213
|
+
|
206
214
|
def hostname
|
207
215
|
Socket.gethostname
|
208
216
|
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.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-06-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70356561112560 !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: *70356561112560
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: fog
|
27
|
-
requirement: &
|
27
|
+
requirement: &70356561112100 !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: *
|
35
|
+
version_requirements: *70356561112100
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: grit
|
38
|
-
requirement: &
|
38
|
+
requirement: &70356561111680 !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: *
|
46
|
+
version_requirements: *70356561111680
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: logger
|
49
|
-
requirement: &
|
49
|
+
requirement: &70356561111260 !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: *
|
57
|
+
version_requirements: *70356561111260
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: minitar
|
60
|
-
requirement: &
|
60
|
+
requirement: &70356561110820 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70356561110820
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: trollop
|
71
|
-
requirement: &
|
71
|
+
requirement: &70356561110380 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70356561110380
|
80
80
|
description: I help build and manage artifacts
|
81
81
|
email:
|
82
82
|
- brett@weav.net
|
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
segments:
|
111
111
|
- 0
|
112
|
-
hash:
|
112
|
+
hash: 2587255120957144358
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
114
|
none: false
|
115
115
|
requirements:
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
segments:
|
120
120
|
- 0
|
121
|
-
hash:
|
121
|
+
hash: 2587255120957144358
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project: heirloom
|
124
124
|
rubygems_version: 1.8.16
|