bbc-cosmos-config 0.0.4 → 0.0.5
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/README.md +12 -4
- data/bbc-cosmos-config.gemspec +1 -1
- data/lib/bbc/cosmos/config.rb +1 -1
- data/lib/bbc/cosmos/config/aws.rb +14 -1
- data/lib/bbc/cosmos/config/cosmos.rb +1 -1
- data/lib/bbc/cosmos/config/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b47f0a25aa77447781e9ab8e3fd92bf05dbb196a
|
4
|
+
data.tar.gz: de2a7788432ed15f1dbac720067e0a78d264c6a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6405bb3f1d94bb1ac2e4737fc0c499e446633d6fff01d7298dfb9ba5700a4ca8f5a08383c7b008efd2ff6321539bed76d30ccc307cedcde1d18aeb9abc4ede7d
|
7
|
+
data.tar.gz: 8f28b67717086d440d742afa00a743436ff45a929591f52ed205370012ff39bc0087d1ed10b12caba0cac2835290a71f1b128d7ac04397af81092b381bdbe588
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# BBC::Cosmos::Config
|
2
2
|
|
3
|
-
|
3
|
+
Abstracts logic (required by multiple other BBC specific gems) surrounding configuration data loading and access.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,11 +18,19 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
```
|
22
|
+
require "bbc/cosmos/config"
|
23
|
+
|
24
|
+
BBC::Cosmos.production? # => true/false depending on ENV["APP_ENV"]
|
25
|
+
|
26
|
+
BBC::Cosmos::Config.aws # => returns object that provides methods for accessing AWS information
|
27
|
+
BBC::Cosmos::Config.cosmos # => returns object that provides methods for accessing Cosmos information
|
28
|
+
BBC::Cosmos::Config.app # => returns object that provides methods for specific json configuration key values
|
29
|
+
```
|
22
30
|
|
23
31
|
## Contributing
|
24
32
|
|
25
|
-
1. Fork it ( http://github.com
|
33
|
+
1. Fork it ( http://github.com/BBC-News/bbc-cosmos-config/fork )
|
26
34
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
35
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
36
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/bbc-cosmos-config.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["kenoir@gmail.com"]
|
11
11
|
spec.summary = "Config wrapper gem for Ruby apps running on Cosmos"
|
12
12
|
spec.description = "Does what is says in the summary"
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/BBC-News/bbc-cosmos-config"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/lib/bbc/cosmos/config.rb
CHANGED
@@ -2,8 +2,9 @@ module BBC
|
|
2
2
|
module Cosmos
|
3
3
|
module Config
|
4
4
|
class AWS
|
5
|
-
def initialize(ec2)
|
5
|
+
def initialize(ec2, s3)
|
6
6
|
@ec2 = ec2
|
7
|
+
@s3 = s3
|
7
8
|
end
|
8
9
|
|
9
10
|
def tags
|
@@ -18,8 +19,20 @@ module BBC
|
|
18
19
|
BBC::Cosmos.production? ? aws_instance_id : "instance_id"
|
19
20
|
end
|
20
21
|
|
22
|
+
def config(config, path)
|
23
|
+
BBC::Cosmos.production? ? s3_config(config[:component_resources_bucket], path, config[:configuration][:commit]) : config[:configuration]
|
24
|
+
end
|
25
|
+
|
21
26
|
private
|
22
27
|
|
28
|
+
def s3_config_location
|
29
|
+
tags['Renderer']
|
30
|
+
end
|
31
|
+
|
32
|
+
def s3_config(bucket, path, version)
|
33
|
+
JSON.parse(@s3.buckets[bucket].objects["#{path}/config/#{version}/#{s3_config_location}.json"], :symbolize_names => true)
|
34
|
+
end
|
35
|
+
|
23
36
|
def instance
|
24
37
|
BBC::Cosmos.production? ? aws_instance : dummy_instance
|
25
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbc-cosmos-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Kenny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -186,7 +186,7 @@ files:
|
|
186
186
|
- spec/config_spec.rb
|
187
187
|
- spec/fixtures/app_config.json
|
188
188
|
- spec/spec_helper.rb
|
189
|
-
homepage:
|
189
|
+
homepage: https://github.com/BBC-News/bbc-cosmos-config
|
190
190
|
licenses:
|
191
191
|
- MIT
|
192
192
|
metadata: {}
|