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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0b7457a43d013d7685ac89c049b96c83e54f055f9899fa471c018c22abdcb79
4
- data.tar.gz: 8288a35b0fa3184c91ed00852c055d1dd38819da00050e244416d768793028b8
3
+ metadata.gz: 477225cdb8e76a563c7bde99e75e070a652c9a0ce44fc39d4de168174cc3a63b
4
+ data.tar.gz: 445e04d9e753aa2c48def0d5783060b045c76221aab9b5d015422fb24df3215f
5
5
  SHA512:
6
- metadata.gz: ee2f7c0557ee02fad1cb194504cab735c400561b23b23846acb644985d2eb4253d09657aa00eb10077dba2c663fc5ba8104264dff290f9e09583daaab2105476
7
- data.tar.gz: 5d7c45283557cbd02decf42c4cdf04e78fe0df58edf447b6a026812e1a0368b83be8fa0eade31f9710ad964dbb7f4ccbdf4282e39ed95484243267f94d318880
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 block_given? and args.empty?
56
- @environment[name] = block
57
-
58
- return name
59
- elsif !block_given? and !args.empty?
60
- if args.count == 1
61
- @environment[name] = args.first
62
- else
63
- @environment[name] = args
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
@@ -1,5 +1,5 @@
1
1
  module Build
2
2
  class Environment
3
- VERSION = "1.6.0"
3
+ VERSION = "1.7.0"
4
4
  end
5
5
  end
@@ -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
@@ -1,6 +1,5 @@
1
1
 
2
2
  require 'covered/rspec'
3
- require 'build/environment'
4
3
 
5
4
  RSpec.configure do |config|
6
5
  config.disable_monkey_patching!
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.6.0
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-03 00:00:00.000000000 Z
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