teapot 1.0.0.pre.rc4 → 1.0.0.pre.rc5

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: 251ea130da35d001ed422700d3c632af11991a20
4
- data.tar.gz: 17cf1f80e489cb72dfbed9b6e6d8526724746c58
3
+ metadata.gz: bb0a1d45164325d2d77c3d68dc5f459c4c633e4d
4
+ data.tar.gz: aabed3ec2828480b020c852c92e1fbc3821935f8
5
5
  SHA512:
6
- metadata.gz: 3fb8f690ace29ceca0e63c5998452a9b0d429fe8806e73a3fe52fcd82873bbd9e5b7700b50a793981d3c7e49e9d2097448dfa5e26ce29468915f4e2ce8081b3e
7
- data.tar.gz: 600a16ac1435f5045e055a4b0c8cbebc57a9e8dbceedd766b0a2b8645ac4a16a61b40ded62fe7291e4fd73704f31e539b883e5e040c76157297a4dfbb7bd9da3
6
+ metadata.gz: 7f43013b1d0935b6bf97c8caa9e1c72ca0102f5fab5df8e0acfd86e1d1070d209f7b4de3f4dd6184526a6e2448341519e1ab75f794ba2e4a1d90cb8d2e7dd9b4
7
+ data.tar.gz: e33f4fc7502997addd232293da08717c0144ef6ab00738f1add4a18f6a3085f94841d69cd5cb67eca72114a40b907c4959176bdd9d7706ef6e9468bba62b7774
data/lib/teapot/build.rb CHANGED
@@ -111,7 +111,7 @@ module Teapot
111
111
  end
112
112
 
113
113
  def update(rule, arguments, &block)
114
- arguments = rule.normalize(arguments)
114
+ arguments = rule.normalize(arguments, self)
115
115
 
116
116
  # A sub-graph for a particular build is isolated based on the task class used to instantiate it, so we use this as part of the key.
117
117
  child_node = @controller.nodes.fetch([self.class, rule.name, arguments]) do |key|
data/lib/teapot/rule.rb CHANGED
@@ -74,11 +74,11 @@ module Teapot
74
74
  return true
75
75
  end
76
76
 
77
- def compute(arguments)
77
+ def compute(arguments, scope)
78
78
  if implicit?
79
- @dynamic.call(arguments)
79
+ scope.instance_exec(arguments, &@dynamic)
80
80
  elsif dynamic?
81
- @dynamic.call(arguments[@name], arguments)
81
+ scope.instance_exec(arguments[@name], arguments, &@dynamic)
82
82
  else
83
83
  arguments[@name]
84
84
  end
@@ -137,10 +137,11 @@ module Teapot
137
137
  return true
138
138
  end
139
139
 
140
- def normalize(arguments)
140
+ # The scope is the context in which the dynamic rule computation is done, usually an instance of Task.
141
+ def normalize(arguments, scope)
141
142
  Hash[
142
143
  @parameters.collect do |parameter|
143
- [parameter.name, parameter.compute(arguments)]
144
+ [parameter.name, parameter.compute(arguments, scope)]
144
145
  end
145
146
  ]
146
147
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Teapot
22
- VERSION = "1.0.0-rc4"
22
+ VERSION = "1.0.0-rc5"
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teapot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.rc4
4
+ version: 1.0.0.pre.rc5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -215,8 +215,6 @@ files:
215
215
  - lib/teapot/environment/evaluator.rb
216
216
  - lib/teapot/environment/flatten.rb
217
217
  - lib/teapot/environment/system.rb
218
- - lib/teapot/extractors/linker_extractor.rb
219
- - lib/teapot/extractors/preprocessor_extractor.rb
220
218
  - lib/teapot/generator.rb
221
219
  - lib/teapot/loader.rb
222
220
  - lib/teapot/merge.rb
@@ -1,57 +0,0 @@
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 'teapot/graph'
22
-
23
- module Teapot
24
- module Extractors
25
- module LinkerExtractor
26
- # Give back a list of library paths for a specific set of ldflags.
27
- def self.libraries(flags)
28
- roots = []
29
- libraries = []
30
- paths = []
31
-
32
- # Extract include directories:
33
- flags.each do |option|
34
- if option.to_s =~ /^-L(.+)/
35
- roots << Pathname($1)
36
- elsif option.to_s =~ /^-l(.+)/
37
- libraries << Pathname($1)
38
- end
39
- end
40
-
41
- libraries.each do |name|
42
- archive_name = "lib#{name}.a"
43
-
44
- roots.each do |root|
45
- archive_path = root + archive_name
46
-
47
- paths << archive_path
48
-
49
- break
50
- end
51
- end
52
-
53
- return paths
54
- end
55
- end
56
- end
57
- end
@@ -1,62 +0,0 @@
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 'teapot/graph'
22
-
23
- module Teapot
24
- module Extractors
25
- class PreprocessorExtractor < Graph::Extractor
26
- def self.include_directories(flags)
27
- roots = []
28
-
29
- # Extract include directories:
30
- flags.each do |option|
31
- if option.to_s =~ /^-I(.+)/
32
- roots << Pathname($1)
33
- end
34
- end
35
-
36
- return roots
37
- end
38
-
39
- def initialize(patterns, roots = [])
40
- super patterns
41
-
42
- @roots = roots
43
- end
44
-
45
- def extract(path)
46
- local_root = Pathname(path).dirname
47
-
48
- File.open(path).each do |line|
49
- if line =~ /\#(?:include|import) "(.*?)"/
50
- path = local_root + $1
51
-
52
- yield path if path.exist?
53
- elsif line =~ /\#(?:include|import) \<(.*?)\>/
54
- path = @roots.collect{|root| root+$1}.find{|path| path.exist?}
55
-
56
- yield path if path
57
- end
58
- end
59
- end
60
- end
61
- end
62
- end