Class: Glitter::Server
- Inherits:
-
Object
- Object
- Glitter::Server
- Defined in:
- lib/glitter/server.rb
Instance Attribute Summary collapse
-
#access_key_id ⇒ Object
readonly
Returns the value of attribute access_key_id.
-
#bucket_name ⇒ Object
readonly
Returns the value of attribute bucket_name.
-
#secret_access_key ⇒ Object
readonly
Returns the value of attribute secret_access_key.
Instance Method Summary collapse
- #bucket ⇒ Object
- #channel(name) ⇒ Object
-
#channel_versions ⇒ Object
Iterate through the objects in S3 and return a hash of channels containing their respective released versions.
-
#initialize(access_key_id = ENV['AWS_ACCESS_KEY_ID'], secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'], bucket_name = ENV['AWS_BUCKET_NAME']) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(access_key_id = ENV['AWS_ACCESS_KEY_ID'], secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'], bucket_name = ENV['AWS_BUCKET_NAME']) ⇒ Server
Returns a new instance of Server.
10 11 12 |
# File 'lib/glitter/server.rb', line 10 def initialize(access_key_id = ENV['AWS_ACCESS_KEY_ID'], secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'], bucket_name = ENV['AWS_BUCKET_NAME']) @access_key_id, @secret_access_key, @bucket_name = access_key_id, secret_access_key, bucket_name end |
Instance Attribute Details
#access_key_id ⇒ Object (readonly)
Returns the value of attribute access_key_id.
8 9 10 |
# File 'lib/glitter/server.rb', line 8 def access_key_id @access_key_id end |
#bucket_name ⇒ Object (readonly)
Returns the value of attribute bucket_name.
8 9 10 |
# File 'lib/glitter/server.rb', line 8 def bucket_name @bucket_name end |
#secret_access_key ⇒ Object (readonly)
Returns the value of attribute secret_access_key.
8 9 10 |
# File 'lib/glitter/server.rb', line 8 def secret_access_key @secret_access_key end |
Instance Method Details
#bucket ⇒ Object
18 19 20 |
# File 'lib/glitter/server.rb', line 18 def bucket @bucket ||= s3.buckets.find bucket_name end |
#channel(name) ⇒ Object
14 15 16 |
# File 'lib/glitter/server.rb', line 14 def channel(name) channels[name] end |
#channel_versions ⇒ Object
Iterate through the objects in S3 and return a hash of channels containing their respective released versions.
24 25 26 27 28 29 30 |
# File 'lib/glitter/server.rb', line 24 def channel_versions bucket.objects.inject Hash.new { |h,k| h[k] = Set.new } do |hash, object| channel, version, _ = Release.object_segments(object.key) hash[channel].add(version) if channel and version hash end end |