branchable_cdn_assets 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d4b5ae8228cc5c14fb3ed1ed06abf2efd1056b4
4
- data.tar.gz: 1a3676d5d335a8a329d2196a98ea518bbeb79348
3
+ metadata.gz: 644f8e575d2fbc7650f897c402e2614fe61a0d51
4
+ data.tar.gz: 23e3608e0f7aff7e39f22716b8332bc960e65bba
5
5
  SHA512:
6
- metadata.gz: 9dca1c4d503f5f9f3c442118cdf17685f02e74d1eedfb7000fff59d107624240edd3fed79545b300a865c4f64a687bbfbf9d93e46e8ae78450ee5d361bdfd050
7
- data.tar.gz: 7c94bfdadfc58cc6d8b3c9648c2dce11dec0aaa1eb28d0a68afc19d219b3af5aade65dc9a2ace355c504fe03cb38a4b9a9e0faf8cfe9d361ec06249a3c5a4a99
6
+ metadata.gz: 8721d9341ceecc5c3067d32cb6944a1b4fc710acb6026281ecd1b630786755a0382638da9ec753723ec591966db119cd7e7ddd2ae9748d5f1fae7a333c61ad20
7
+ data.tar.gz: 04dcf0e047124ef84689627cbf46b0e4b493278ec5fb412f18c1aaee6b26bf9da2447bcd70f4464bf79e43b1e4d039ec0e0244d806912c4abcdb4f6dcdcf38ff
@@ -12,7 +12,11 @@ module BranchableCDNAssets
12
12
  def env_attr_reader *keys
13
13
  keys.each do |key|
14
14
  define_method key do
15
- env_attr(key) || raise( ArgumentError, "No key '#{key.to_s}' exists for '#{env}'" )
15
+ if env_attr(key).nil?
16
+ raise( ArgumentError, "No key '#{key.to_s}' exists for '#{env}'" )
17
+ else
18
+ env_attr(key)
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -1,3 +1,3 @@
1
1
  module BranchableCDNAssets
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe BranchableCDNAssets::Config::EnvironmentAttributeReader do
4
+
5
+ before :each do
6
+ @subject_class = Class.new do
7
+ attr_reader :environments, :env
8
+
9
+ def initialize environments={}, env=:default
10
+ @environments = environments
11
+ @env = env
12
+ end
13
+ end
14
+
15
+ @subject_class.send :include, BranchableCDNAssets::Config::EnvironmentAttributeReader
16
+ @subject_class.send :extend, BranchableCDNAssets::Config::EnvironmentAttributeReader::ClassMethods
17
+ end
18
+
19
+ it "raises key missing when trying to access missing key" do
20
+ @subject_class.send :env_attr_reader, :foo
21
+
22
+ expect{
23
+ @subject_class.new.foo
24
+ }.to raise_error ArgumentError
25
+ end
26
+
27
+ it "returns value of key for environment" do
28
+ @subject_class.send :env_attr_reader, :is_true
29
+ @subject_class.send :env_attr_reader, :is_false
30
+
31
+ subject = @subject_class.new default: { is_true: true, is_false: false }
32
+ expect( subject.is_true ).to eq true
33
+ expect( subject.is_false ).to eq false
34
+ end
35
+
36
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: branchable_cdn_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Sloan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-23 00:00:00.000000000 Z
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -99,6 +99,7 @@ files:
99
99
  - lib/branchable_cdn_assets/shell.rb
100
100
  - lib/branchable_cdn_assets/version.rb
101
101
  - spec/lib/branchable_cdn_assets/check_before_spec.rb
102
+ - spec/lib/branchable_cdn_assets/config/environment_attribute_reader_spec.rb
102
103
  - spec/lib/branchable_cdn_assets/config_spec.rb
103
104
  - spec/lib/branchable_cdn_assets/file_manager/find_spec.rb
104
105
  - spec/lib/branchable_cdn_assets/file_manager_spec.rb
@@ -135,6 +136,7 @@ specification_version: 4
135
136
  summary: Helpers for syncing and finding assets accross multiple remotes
136
137
  test_files:
137
138
  - spec/lib/branchable_cdn_assets/check_before_spec.rb
139
+ - spec/lib/branchable_cdn_assets/config/environment_attribute_reader_spec.rb
138
140
  - spec/lib/branchable_cdn_assets/config_spec.rb
139
141
  - spec/lib/branchable_cdn_assets/file_manager/find_spec.rb
140
142
  - spec/lib/branchable_cdn_assets/file_manager_spec.rb