build-environment 1.4.0 → 1.5.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
  SHA256:
3
- metadata.gz: bb1a640db22cdf5b234170fa80d39fcd85556586e106253fa1ddccfbbf2587ef
4
- data.tar.gz: 522ad2c4f2bcb93aeabd3ae4886129cb8b258483e80538558a7e70c84b146c36
3
+ metadata.gz: dc378a4e1ebc51b575e509352a328e0782d353f726da735d347d0afbdd0b1b96
4
+ data.tar.gz: 6e013d9a197e0b6b78c2c59f7c000734a3949028ca81c23b0defe1fdcf5518f7
5
5
  SHA512:
6
- metadata.gz: ac43aff420aac34dbb0ba55764a3da8fd3d1a61a11d1951bfe08e7e58362582a788e21e90b4ca43774326d00beaa49bc5738f66b4f0c032fb73d3ab0787735c7
7
- data.tar.gz: 379f5ad46b9ed1e7bd5a26228d14d684c8f0da67ea5d3b49e28a053944fffedc6205d2582691a156bcf0f8becb4fc505c3811cb176f9f4df3813e22d398f0f61
6
+ metadata.gz: 65e8b37760528ce3f79b58c12def6db4b09cfbd5ac46623a5db514981a234e7824960585739bcbc64daa8d3ecebd8c940fc6179827b8d26e1ae11a8bc4d1897a
7
+ data.tar.gz: 33750cd643a337a5051a955c7fb76347e430515884777afd0d843603cf615eb70c49bb780078e4279dc62c6d618095d75eb342b6861340daabbf0d32857d76a2
@@ -25,6 +25,10 @@ module Build
25
25
  @environment = environment
26
26
  end
27
27
 
28
+ def respond_to?(name, include_private = false)
29
+ @environment.include?(name) || super
30
+ end
31
+
28
32
  def method_missing(name)
29
33
  object_value(@environment[name])
30
34
  end
@@ -35,6 +35,10 @@ module Build
35
35
  Hash[hash.map{|key, value| [key, evaluator.object_value(value)]}]
36
36
  end
37
37
 
38
+ def evaluator
39
+ Evaluator.new(self)
40
+ end
41
+
38
42
  def evaluate(**options)
39
43
  self.class.new(nil, self.to_h, **options)
40
44
  end
@@ -1,5 +1,5 @@
1
1
  module Build
2
2
  class Environment
3
- VERSION = "1.4.0"
3
+ VERSION = "1.5.0"
4
4
  end
5
5
  end
@@ -0,0 +1,40 @@
1
+ # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'build/environment'
22
+
23
+ RSpec.describe Build::Environment::Evaluator do
24
+ it "can evaluate procs" do
25
+ environment = Build::Environment.new do
26
+ fruit {"apples"}
27
+ end
28
+
29
+ expect(environment.flatten.evaluator.fruit).to be == "apples"
30
+ end
31
+
32
+ it "can evaluate symbols" do
33
+ environment = Build::Environment.new do
34
+ fruit {"apples"}
35
+ dinner :fruit
36
+ end
37
+
38
+ expect(environment.flatten.evaluator.dinner).to be == "apples"
39
+ end
40
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-environment
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-26 00:00:00.000000000 Z
11
+ date: 2019-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: covered
@@ -90,6 +90,7 @@ files:
90
90
  - spec/build/environment/build_spec.rb
91
91
  - spec/build/environment/checksum_spec.rb
92
92
  - spec/build/environment/environment_spec.rb
93
+ - spec/build/environment/evaluator_spec.rb
93
94
  - spec/build/environment/freeze_spec.rb
94
95
  - spec/build/environment/rule.rb
95
96
  - spec/build/environment/system_spec.rb
@@ -122,6 +123,7 @@ test_files:
122
123
  - spec/build/environment/build_spec.rb
123
124
  - spec/build/environment/checksum_spec.rb
124
125
  - spec/build/environment/environment_spec.rb
126
+ - spec/build/environment/evaluator_spec.rb
125
127
  - spec/build/environment/freeze_spec.rb
126
128
  - spec/build/environment/rule.rb
127
129
  - spec/build/environment/system_spec.rb