build-environment 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/build/environment/constructor.rb +13 -11
- data/lib/build/environment/version.rb +1 -1
- data/spec/build/environment/constructor_spec.rb +55 -0
- data/spec/spec_helper.rb +0 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 477225cdb8e76a563c7bde99e75e070a652c9a0ce44fc39d4de168174cc3a63b
|
4
|
+
data.tar.gz: 445e04d9e753aa2c48def0d5783060b045c76221aab9b5d015422fb24df3215f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd143a1777f2c706f6a151a677974a7ea968e4fd843c82725de43dbdea5ba5ae0c778573e7580fccc0c7f6488d084c54fd615b61ae6efdca4231ca360ca1076d
|
7
|
+
data.tar.gz: 3c4a6ac1d0bc84ba9ee6ec41366b1e981446572495ce9ff2a5920c54b851ab188a8fd0663602f8fe37a0456073c7df3218bd55251a617747bc2ed269684d1f55
|
@@ -52,18 +52,20 @@ module Build
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def method_missing(name, *args, **options, &block)
|
55
|
-
if
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
55
|
+
if options.empty?
|
56
|
+
if block_given? and args.empty?
|
57
|
+
@environment[name] = block
|
58
|
+
|
59
|
+
return name
|
60
|
+
elsif !block_given? and !args.empty?
|
61
|
+
if args.count == 1
|
62
|
+
@environment[name] = args.first
|
63
|
+
else
|
64
|
+
@environment[name] = args
|
65
|
+
end
|
66
|
+
|
67
|
+
return name
|
64
68
|
end
|
65
|
-
|
66
|
-
return name
|
67
69
|
end
|
68
70
|
|
69
71
|
if @proxy
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Copyright, 2012, 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::Constructor do
|
24
|
+
let(:proxy) {Object.new}
|
25
|
+
let(:environment) {Build::Environment.new(nil)}
|
26
|
+
subject{described_class.new(environment, proxy)}
|
27
|
+
|
28
|
+
it "should set value" do
|
29
|
+
subject.foo :bar
|
30
|
+
|
31
|
+
expect(environment[:foo]).to be == :bar
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should set value with block" do
|
35
|
+
subject.foo {:bar}
|
36
|
+
|
37
|
+
expect(environment[:foo].call).to be == :bar
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should invoke proxy" do
|
41
|
+
expect(proxy).to receive(:build).with(library: 'bar')
|
42
|
+
|
43
|
+
subject.build library: 'bar'
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should invoke proxy with block" do
|
47
|
+
a_block = proc{}
|
48
|
+
|
49
|
+
expect(proxy).to receive(:build).with(library: 'bar') do |&block|
|
50
|
+
expect(block).to be a_block
|
51
|
+
end
|
52
|
+
|
53
|
+
subject.build library: 'bar', &a_block
|
54
|
+
end
|
55
|
+
end
|
data/spec/spec_helper.rb
CHANGED
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
|
+
version: 1.7.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-03-
|
11
|
+
date: 2019-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: covered
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/build/environment/version.rb
|
90
90
|
- spec/build/environment/build_spec.rb
|
91
91
|
- spec/build/environment/checksum_spec.rb
|
92
|
+
- spec/build/environment/constructor_spec.rb
|
92
93
|
- spec/build/environment/environment_spec.rb
|
93
94
|
- spec/build/environment/evaluator_spec.rb
|
94
95
|
- spec/build/environment/freeze_spec.rb
|
@@ -122,6 +123,7 @@ summary: A nested hash data structure for controlling build environments.
|
|
122
123
|
test_files:
|
123
124
|
- spec/build/environment/build_spec.rb
|
124
125
|
- spec/build/environment/checksum_spec.rb
|
126
|
+
- spec/build/environment/constructor_spec.rb
|
125
127
|
- spec/build/environment/environment_spec.rb
|
126
128
|
- spec/build/environment/evaluator_spec.rb
|
127
129
|
- spec/build/environment/freeze_spec.rb
|