heirloom 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,24 @@
1
1
  module Heirloom
2
2
  class Config
3
- def self.load_config_file(config_file = "#{ENV['HOME']}/.heirloom.yml")
4
- YAML::load( File.open( config_file ) )
5
- end
6
3
 
7
- def self.access_key
8
- load_config_file['access_key']
4
+ attr_accessor = :access_key, :secret_key
5
+
6
+ def initiatize(args={})
7
+ if args[:config]
8
+ self.access_key = args[:config][:access_key]
9
+ self.secret_key = args[:config][:secret_key]
10
+ else
11
+ load_config_file
12
+ end
9
13
  end
10
14
 
11
- def self.secret_key
12
- load_config_file['secret_key']
15
+ def load_config_file
16
+ config_file = "#{ENV['HOME']}/.heirloom.yml"
17
+ c = YAML::load( File.open( config_file ) )
18
+
19
+ self.access_key = c['access_key']
20
+ self.secret_key = c['secret_key']
13
21
  end
22
+
14
23
  end
15
24
  end
@@ -1,3 +1,3 @@
1
1
  module Heirloom
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/heirloom.rb CHANGED
@@ -32,7 +32,9 @@ module Heirloom
32
32
  def self.info(args)
33
33
  sdb = self.connect_to_sdb
34
34
 
35
- sdb.select("select * from #{args[:class]} where itemName() = '#{args[:sha]}'")
35
+ s = sdb.select("select * from #{args[:class]} where itemName() = '#{args[:sha]}'")
36
+
37
+ s[args[:sha]]
36
38
  end
37
39
 
38
40
  def self.delete(args)
@@ -45,6 +47,7 @@ module Heirloom
45
47
  @sdb = self.class.connect_to_sdb
46
48
  @accounts = args[:accounts]
47
49
  @open = args[:open] ||= false
50
+ @config = Config.new
48
51
 
49
52
  self.heirloom_type = args[:heirloom_type]
50
53
  self.source_dir = args[:source_dir]
@@ -88,7 +91,6 @@ module Heirloom
88
91
  def create_sdb_record
89
92
  @sdb.put_attributes domain, sha, { 'built_by' => "#{user}@#{hostname}",
90
93
  'built_at' => Time.now.utc.iso8601,
91
- 'tests' => 'pending',
92
94
  'sha' => sha,
93
95
  'abbreviated_sha' => abbreviated_sha,
94
96
  'message' => message,
@@ -109,8 +111,8 @@ module Heirloom
109
111
  region = options['region']
110
112
  endpoint = options['endpoint']
111
113
  connection = Fog::Storage.new :provider => 'AWS',
112
- :aws_access_key_id => Config.access_key,
113
- :aws_secret_access_key => Config.secret_key,
114
+ :aws_access_key_id => @config.access_key,
115
+ :aws_secret_access_key => @config.secret_key,
114
116
  :region => region
115
117
 
116
118
  # Get bucket
@@ -217,8 +219,9 @@ module Heirloom
217
219
  end
218
220
 
219
221
  def self.connect_to_sdb
220
- @access_key = Config.access_key
221
- @secret_key = Config.secret_key
222
+ config = Config.new
223
+ @access_key = config.access_key
224
+ @secret_key = config.secret_key
222
225
 
223
226
  AWS::SimpleDb.new(@access_key, @secret_key)
224
227
  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
4
+ version: 0.0.5
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-06-08 00:00:00.000000000 Z
12
+ date: 2012-06-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70120929125280 !ruby/object:Gem::Requirement
16
+ requirement: &70244686228780 !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: *70120929125280
24
+ version_requirements: *70244686228780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fog
27
- requirement: &70120929124860 !ruby/object:Gem::Requirement
27
+ requirement: &70244686227940 !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: *70120929124860
35
+ version_requirements: *70244686227940
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: grit
38
- requirement: &70120929124420 !ruby/object:Gem::Requirement
38
+ requirement: &70244686227260 !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: *70120929124420
46
+ version_requirements: *70244686227260
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: logger
49
- requirement: &70120929123960 !ruby/object:Gem::Requirement
49
+ requirement: &70244686226560 !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: *70120929123960
57
+ version_requirements: *70244686226560
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: minitar
60
- requirement: &70120929123540 !ruby/object:Gem::Requirement
60
+ requirement: &70244686225920 !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: *70120929123540
68
+ version_requirements: *70244686225920
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: trollop
71
- requirement: &70120929123120 !ruby/object:Gem::Requirement
71
+ requirement: &70244686225420 !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: *70120929123120
79
+ version_requirements: *70244686225420
80
80
  description: I help build and manage artifacts
81
81
  email:
82
82
  - brett@weav.net
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  segments:
112
112
  - 0
113
- hash: -1672995247567950048
113
+ hash: -1505138422404333615
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  none: false
116
116
  requirements:
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  segments:
121
121
  - 0
122
- hash: -1672995247567950048
122
+ hash: -1505138422404333615
123
123
  requirements: []
124
124
  rubyforge_project: heirloom
125
125
  rubygems_version: 1.8.16