climate_control 0.0.4 → 0.1.0

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: 115ebcc91a993cd77c6f7d635c98cbcca37e304a
4
- data.tar.gz: 99ea065056db3051e559fc120754bad454f5dbf4
3
+ metadata.gz: 4d6475362f621520ac9b951ad69a1a908e9043a2
4
+ data.tar.gz: 2d05f1c2f110479042944de906ca2e77ed9f3674
5
5
  SHA512:
6
- metadata.gz: af4aa1f76d2c0056d53f407a71df8a0135354d2b5aa126440c791252252cb02d54a4bb7f278bc320f1959e4985967d8c82e7275e9f81cd2f3893f594656fa08c
7
- data.tar.gz: 70320c9af644facb62efbd6710ddf624f41f44ccdcaf92aa1e1156d2f3f7eff5c66c3cf238b6e6194da42225fe4f4995f503d6e6fbffbf009f80c7125566dd15
6
+ metadata.gz: 3e9aeadc9e0a01b5da958d1d2b46144b6972f50dece9d7d71fc32b841a9cdeb5c187574644c5f471110284522f94019f8d0df6ef11db1e6ebce86adef3750cc9
7
+ data.tar.gz: 207eb3f8c9c71fc4c646a85580a2504bb630a581e29cb464dd8b0fbb38e9fde40421f8e017d6aac10559374b854ec0b5484baaf24e0e2f1ffb1d99728a40f712
@@ -1,9 +1,10 @@
1
1
  rvm:
2
- - 1.9.3
3
- - 2.0.0
4
- - 2.1.5
2
+ - 2.2.6
3
+ - 2.3.3
4
+ - 2.4.0
5
5
  before_install:
6
6
  - gem update --system
7
+ - gem update bundler
7
8
  install: "bundle install"
8
9
  branches:
9
10
  only:
data/NEWS CHANGED
@@ -1,3 +1,6 @@
1
+ 0.1.0 (January 7, 2017)
2
+ Remove ActiveSupport dependency
3
+
1
4
  0.0.4 (January 6, 2017)
2
5
  Improved thread safety
3
6
  Handle TypeErrors during assignment
@@ -17,7 +17,6 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency "activesupport", ">= 3.0"
21
20
  gem.add_development_dependency "rspec", "~> 3.1.0"
22
21
  gem.add_development_dependency "rake", "~> 10.3.2"
23
22
  gem.add_development_dependency "simplecov", "~> 0.9.1"
@@ -1,19 +1,19 @@
1
1
  require "thread"
2
- require "active_support/core_ext/module/delegation"
2
+ require "forwardable"
3
3
 
4
4
  module ClimateControl
5
5
  class Environment
6
+ extend Forwardable
7
+
6
8
  def initialize
7
9
  @semaphore = Mutex.new
8
10
  end
9
11
 
10
- delegate :[]=, :to_hash, :[], :delete, to: :env
11
- delegate :synchronize, to: :semaphore
12
+ def_delegators :env, :[]=, :to_hash, :[], :delete
13
+ def_delegator :@semaphore, :synchronize
12
14
 
13
15
  private
14
16
 
15
- attr_reader :semaphore
16
-
17
17
  def env
18
18
  ENV
19
19
  end
@@ -1,9 +1,7 @@
1
- require "active_support/core_ext/hash/keys"
2
-
3
1
  module ClimateControl
4
2
  class Modifier
5
3
  def initialize(env, environment_overrides = {}, &block)
6
- @environment_overrides = environment_overrides.dup.stringify_keys!
4
+ @environment_overrides = stringify_keys(environment_overrides)
7
5
  @block = block
8
6
  @env = env
9
7
  end
@@ -70,6 +68,12 @@ module ClimateControl
70
68
  @env.to_hash
71
69
  end
72
70
 
71
+ def stringify_keys(env)
72
+ env.each_with_object({}) do |(key, value), hash|
73
+ hash[key.to_s] = value
74
+ end
75
+ end
76
+
73
77
  class OverlappingKeysWithChangedValues
74
78
  def initialize(hash_1, hash_2)
75
79
  @hash_1 = hash_1 || {}
@@ -1,3 +1,3 @@
1
1
  module ClimateControl
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -54,7 +54,7 @@ describe "Climate control" do
54
54
  with_modified_env FOO: "bar" do
55
55
  raise "broken"
56
56
  end
57
- }.to raise_error
57
+ }.to raise_error("broken")
58
58
 
59
59
  expect(ENV["FOO"]).to be_nil
60
60
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: climate_control
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Clayton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-06 00:00:00.000000000 Z
11
+ date: 2017-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '3.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '3.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rspec
29
15
  requirement: !ruby/object:Gem::Requirement