rscons 1.4.3 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/lib/rscons.rb +75 -5
  2. data/lib/rscons/build_target.rb +36 -0
  3. data/lib/rscons/builder.rb +41 -3
  4. data/lib/rscons/builders/cfile.rb +15 -0
  5. data/lib/rscons/builders/disassemble.rb +15 -0
  6. data/lib/rscons/builders/library.rb +17 -2
  7. data/lib/rscons/builders/object.rb +37 -5
  8. data/lib/rscons/builders/preprocess.rb +15 -0
  9. data/lib/rscons/builders/program.rb +42 -2
  10. data/lib/rscons/cache.rb +26 -6
  11. data/lib/rscons/environment.rb +259 -19
  12. data/lib/rscons/varset.rb +33 -10
  13. data/lib/rscons/version.rb +1 -1
  14. data/rscons.gemspec +8 -10
  15. metadata +38 -103
  16. checksums.yaml +0 -15
  17. data/.gitignore +0 -18
  18. data/.rspec +0 -2
  19. data/Gemfile +0 -4
  20. data/README.md +0 -384
  21. data/Rakefile.rb +0 -26
  22. data/build_tests/build_dir/src/one/one.c +0 -6
  23. data/build_tests/build_dir/src/two/two.c +0 -7
  24. data/build_tests/build_dir/src/two/two.h +0 -6
  25. data/build_tests/clone_env/src/program.c +0 -6
  26. data/build_tests/custom_builder/program.c +0 -7
  27. data/build_tests/d/main.d +0 -6
  28. data/build_tests/header/header.c +0 -7
  29. data/build_tests/header/header.h +0 -6
  30. data/build_tests/library/one.c +0 -8
  31. data/build_tests/library/three.c +0 -0
  32. data/build_tests/library/two.c +0 -0
  33. data/build_tests/simple/simple.c +0 -6
  34. data/build_tests/simple_cc/simple.cc +0 -8
  35. data/build_tests/two_sources/one.c +0 -8
  36. data/build_tests/two_sources/two.c +0 -3
  37. data/spec/build_tests_spec.rb +0 -527
  38. data/spec/rscons/builders/cfile_spec.rb +0 -28
  39. data/spec/rscons/builders/disassemble_spec.rb +0 -17
  40. data/spec/rscons/builders/library_spec.rb +0 -18
  41. data/spec/rscons/builders/object_spec.rb +0 -23
  42. data/spec/rscons/builders/preprocess_spec.rb +0 -18
  43. data/spec/rscons/builders/program_spec.rb +0 -18
  44. data/spec/rscons/cache_spec.rb +0 -271
  45. data/spec/rscons/environment_spec.rb +0 -361
  46. data/spec/rscons/varset_spec.rb +0 -163
  47. data/spec/rscons_spec.rb +0 -26
  48. data/spec/spec_helper.rb +0 -7
@@ -1,9 +1,9 @@
1
1
  module Rscons
2
- # This class represents a collection of variables which can be accessed
3
- # as certain types.
4
- # Only nil, strings, arrays, and hashes should be stored in a VarSet.
2
+ # This class represents a collection of variables which supports efficient
3
+ # deep cloning.
5
4
  class VarSet
6
5
  # Create a VarSet.
6
+ #
7
7
  # @param vars [Hash] Optional initial variables.
8
8
  def initialize(vars = {})
9
9
  @my_vars = {}
@@ -11,8 +11,10 @@ module Rscons
11
11
  append(vars)
12
12
  end
13
13
 
14
- # Access the value of variable as a particular type
14
+ # Access the value of variable.
15
+ #
15
16
  # @param key [String, Symbol] The variable name.
17
+ #
16
18
  # @return [Object] The variable's value.
17
19
  def [](key)
18
20
  if @my_vars.include?(key)
@@ -29,15 +31,19 @@ module Rscons
29
31
  end
30
32
 
31
33
  # Assign a value to a variable.
34
+ #
32
35
  # @param key [String, Symbol] The variable name.
36
+ #
33
37
  # @param val [Object] The value to set.
34
38
  def []=(key, val)
35
39
  @my_vars[key] = val
36
40
  end
37
41
 
38
42
  # Check if the VarSet contains a variable.
43
+ #
39
44
  # @param key [String, Symbol] The variable name.
40
- # @return [true, false] Whether the VarSet contains a variable.
45
+ #
46
+ # @return [Boolean] Whether the VarSet contains the variable.
41
47
  def include?(key)
42
48
  if @my_vars.include?(key)
43
49
  true
@@ -48,8 +54,11 @@ module Rscons
48
54
  end
49
55
  end
50
56
 
51
- # Add or overwrite a set of variables
57
+ # Add or overwrite a set of variables.
58
+ #
52
59
  # @param values [VarSet, Hash] New set of variables.
60
+ #
61
+ # @return [self]
53
62
  def append(values)
54
63
  coa!
55
64
  if values.is_a?(VarSet)
@@ -62,7 +71,10 @@ module Rscons
62
71
  end
63
72
 
64
73
  # Create a new VarSet object based on the first merged with other.
74
+ #
65
75
  # @param other [VarSet, Hash] Other variables to add or overwrite.
76
+ #
77
+ # @return [VarSet] The newly created VarSet.
66
78
  def merge(other = {})
67
79
  coa!
68
80
  varset = self.class.new
@@ -71,9 +83,13 @@ module Rscons
71
83
  end
72
84
  alias_method :clone, :merge
73
85
 
74
- # Replace "$" variable references in varref with the variables values,
75
- # recursively.
86
+ # Replace "$\{var}" variable references in varref with the expanded
87
+ # variables' values, recursively.
88
+ #
76
89
  # @param varref [String, Array] Value containing references to variables.
90
+ #
91
+ # @return [String, Array]
92
+ # Expanded value with "$\{var}" variable references replaced.
77
93
  def expand_varref(varref)
78
94
  if varref.is_a?(Array)
79
95
  varref.map do |ent|
@@ -99,6 +115,8 @@ module Rscons
99
115
  private
100
116
 
101
117
  # Move all VarSet variables into the copy-on-access list.
118
+ #
119
+ # @return [void]
102
120
  def coa!
103
121
  unless @my_vars.empty?
104
122
  @coa_vars.unshift(@my_vars)
@@ -107,8 +125,13 @@ module Rscons
107
125
  end
108
126
 
109
127
  # Create a deep copy of an object.
110
- # @param obj [nil, String, Array, Hash] Object to deep copy.
111
- # @return [nil, String, Array, Hash] Deep copied value.
128
+ #
129
+ # Only objects which are of type String, Array, or Hash are deep copied.
130
+ # Any other object just has its referenced copied.
131
+ #
132
+ # @param obj [Object] Object to deep copy.
133
+ #
134
+ # @return [Object] Deep copied value.
112
135
  def deep_dup(obj)
113
136
  obj_class = obj.class
114
137
  if obj_class == Hash
@@ -1,4 +1,4 @@
1
1
  module Rscons
2
2
  # gem version
3
- VERSION = "1.4.3"
3
+ VERSION = "1.5.0"
4
4
  end
@@ -1,30 +1,28 @@
1
1
  # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'rscons/version'
4
+ require "rscons/version"
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "rscons"
8
8
  gem.version = Rscons::VERSION
9
9
  gem.authors = ["Josh Holtrop"]
10
10
  gem.email = ["jholtrop@gmail.com"]
11
- gem.description = %q{Software construction library inspired by SCons and implemented in Ruby}
11
+ gem.description = %q{Software construction library inspired by SCons and implemented in Ruby.}
12
12
  gem.summary = %q{Software construction library inspired by SCons and implemented in Ruby}
13
13
  gem.homepage = "https://github.com/holtrop/rscons"
14
- gem.license = 'MIT'
14
+ gem.license = "MIT"
15
15
 
16
- gem.files = `git ls-files`.split($/)
16
+ gem.files = Dir["{bin,assets,lib}/**/*", "*.gemspec", "LICENSE.txt"]
17
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
- gem.add_development_dependency "rspec-core"
22
- gem.add_development_dependency "rspec-mocks"
23
- gem.add_development_dependency "rspec-expectations"
21
+ gem.add_dependency "json", "~> 1.0"
22
+
24
23
  gem.add_development_dependency "rspec"
25
24
  gem.add_development_dependency "rake"
26
25
  gem.add_development_dependency "simplecov"
27
- gem.add_development_dependency "json"
28
- gem.add_development_dependency 'rdoc'
29
26
  gem.add_development_dependency "yard"
27
+ gem.add_development_dependency "redcarpet"
30
28
  end
metadata CHANGED
@@ -1,60 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rscons
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.5.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Josh Holtrop
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-05-14 00:00:00.000000000 Z
12
+ date: 2014-06-17 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
- name: rspec-core
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ! '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ! '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rspec-mocks
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ! '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec-expectations
15
+ name: json
43
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
44
18
  requirements:
45
- - - ! '>='
19
+ - - ~>
46
20
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
21
+ version: '1.0'
22
+ type: :runtime
49
23
  prerelease: false
50
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
51
26
  requirements:
52
- - - ! '>='
27
+ - - ~>
53
28
  - !ruby/object:Gem::Version
54
- version: '0'
29
+ version: '1.0'
55
30
  - !ruby/object:Gem::Dependency
56
31
  name: rspec
57
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
58
34
  requirements:
59
35
  - - ! '>='
60
36
  - !ruby/object:Gem::Version
@@ -62,6 +38,7 @@ dependencies:
62
38
  type: :development
63
39
  prerelease: false
64
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
65
42
  requirements:
66
43
  - - ! '>='
67
44
  - !ruby/object:Gem::Version
@@ -69,6 +46,7 @@ dependencies:
69
46
  - !ruby/object:Gem::Dependency
70
47
  name: rake
71
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
72
50
  requirements:
73
51
  - - ! '>='
74
52
  - !ruby/object:Gem::Version
@@ -76,6 +54,7 @@ dependencies:
76
54
  type: :development
77
55
  prerelease: false
78
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
79
58
  requirements:
80
59
  - - ! '>='
81
60
  - !ruby/object:Gem::Version
@@ -83,6 +62,7 @@ dependencies:
83
62
  - !ruby/object:Gem::Dependency
84
63
  name: simplecov
85
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
86
66
  requirements:
87
67
  - - ! '>='
88
68
  - !ruby/object:Gem::Version
@@ -90,27 +70,15 @@ dependencies:
90
70
  type: :development
91
71
  prerelease: false
92
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
93
74
  requirements:
94
75
  - - ! '>='
95
76
  - !ruby/object:Gem::Version
96
77
  version: '0'
97
78
  - !ruby/object:Gem::Dependency
98
- name: json
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ! '>='
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ! '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rdoc
79
+ name: yard
113
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
114
82
  requirements:
115
83
  - - ! '>='
116
84
  - !ruby/object:Gem::Version
@@ -118,13 +86,15 @@ dependencies:
118
86
  type: :development
119
87
  prerelease: false
120
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
121
90
  requirements:
122
91
  - - ! '>='
123
92
  - !ruby/object:Gem::Version
124
93
  version: '0'
125
94
  - !ruby/object:Gem::Dependency
126
- name: yard
95
+ name: redcarpet
127
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
128
98
  requirements:
129
99
  - - ! '>='
130
100
  - !ruby/object:Gem::Version
@@ -132,39 +102,18 @@ dependencies:
132
102
  type: :development
133
103
  prerelease: false
134
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
135
106
  requirements:
136
107
  - - ! '>='
137
108
  - !ruby/object:Gem::Version
138
109
  version: '0'
139
- description: Software construction library inspired by SCons and implemented in Ruby
110
+ description: Software construction library inspired by SCons and implemented in Ruby.
140
111
  email:
141
112
  - jholtrop@gmail.com
142
113
  executables: []
143
114
  extensions: []
144
115
  extra_rdoc_files: []
145
116
  files:
146
- - .gitignore
147
- - .rspec
148
- - Gemfile
149
- - LICENSE.txt
150
- - README.md
151
- - Rakefile.rb
152
- - build_tests/build_dir/src/one/one.c
153
- - build_tests/build_dir/src/two/two.c
154
- - build_tests/build_dir/src/two/two.h
155
- - build_tests/clone_env/src/program.c
156
- - build_tests/custom_builder/program.c
157
- - build_tests/d/main.d
158
- - build_tests/header/header.c
159
- - build_tests/header/header.h
160
- - build_tests/library/one.c
161
- - build_tests/library/three.c
162
- - build_tests/library/two.c
163
- - build_tests/simple/simple.c
164
- - build_tests/simple_cc/simple.cc
165
- - build_tests/two_sources/one.c
166
- - build_tests/two_sources/two.c
167
- - lib/rscons.rb
168
117
  - lib/rscons/builder.rb
169
118
  - lib/rscons/builders/cfile.rb
170
119
  - lib/rscons/builders/disassemble.rb
@@ -172,58 +121,44 @@ files:
172
121
  - lib/rscons/builders/object.rb
173
122
  - lib/rscons/builders/preprocess.rb
174
123
  - lib/rscons/builders/program.rb
124
+ - lib/rscons/build_target.rb
175
125
  - lib/rscons/cache.rb
176
126
  - lib/rscons/environment.rb
177
127
  - lib/rscons/varset.rb
178
128
  - lib/rscons/version.rb
129
+ - lib/rscons.rb
179
130
  - rscons.gemspec
180
- - spec/build_tests_spec.rb
181
- - spec/rscons/builders/cfile_spec.rb
182
- - spec/rscons/builders/disassemble_spec.rb
183
- - spec/rscons/builders/library_spec.rb
184
- - spec/rscons/builders/object_spec.rb
185
- - spec/rscons/builders/preprocess_spec.rb
186
- - spec/rscons/builders/program_spec.rb
187
- - spec/rscons/cache_spec.rb
188
- - spec/rscons/environment_spec.rb
189
- - spec/rscons/varset_spec.rb
190
- - spec/rscons_spec.rb
191
- - spec/spec_helper.rb
131
+ - LICENSE.txt
192
132
  homepage: https://github.com/holtrop/rscons
193
133
  licenses:
194
134
  - MIT
195
- metadata: {}
196
135
  post_install_message:
197
136
  rdoc_options: []
198
137
  require_paths:
199
138
  - lib
200
139
  required_ruby_version: !ruby/object:Gem::Requirement
140
+ none: false
201
141
  requirements:
202
142
  - - ! '>='
203
143
  - !ruby/object:Gem::Version
204
144
  version: '0'
145
+ segments:
146
+ - 0
147
+ hash: -456926221
205
148
  required_rubygems_version: !ruby/object:Gem::Requirement
149
+ none: false
206
150
  requirements:
207
151
  - - ! '>='
208
152
  - !ruby/object:Gem::Version
209
153
  version: '0'
154
+ segments:
155
+ - 0
156
+ hash: -456926221
210
157
  requirements: []
211
158
  rubyforge_project:
212
- rubygems_version: 2.2.1
159
+ rubygems_version: 1.8.23.2
213
160
  signing_key:
214
- specification_version: 4
161
+ specification_version: 3
215
162
  summary: Software construction library inspired by SCons and implemented in Ruby
216
- test_files:
217
- - spec/build_tests_spec.rb
218
- - spec/rscons/builders/cfile_spec.rb
219
- - spec/rscons/builders/disassemble_spec.rb
220
- - spec/rscons/builders/library_spec.rb
221
- - spec/rscons/builders/object_spec.rb
222
- - spec/rscons/builders/preprocess_spec.rb
223
- - spec/rscons/builders/program_spec.rb
224
- - spec/rscons/cache_spec.rb
225
- - spec/rscons/environment_spec.rb
226
- - spec/rscons/varset_spec.rb
227
- - spec/rscons_spec.rb
228
- - spec/spec_helper.rb
163
+ test_files: []
229
164
  has_rdoc:
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NTNkMDYxN2I0NGJlMTJlOTQxYjYwMzA3MDI4ZGYxZTdjNzM3NjM4OA==
5
- data.tar.gz: !binary |-
6
- MTY0ZTBlY2QxMTQwNDE5ZTQ2OWJhYmEwZDZlZjAyYTYzZDliY2Q3MQ==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- MjU3M2FlNzE3M2YyZmFmMjJlMThmYWQzNjVjM2M0MGU1MjM0ZTc0ZTU0YjZh
10
- NjM1ODM2ZDBhYjhmYzdkZTM0MTNiMDNiNzU2Mzc2ODdiOWJiM2Q3NjZiNzBl
11
- YzE4YmQ5ODdmM2RlNTg4YjNmOGJlMTc1YWQ5M2EyNTUxY2I4OGM=
12
- data.tar.gz: !binary |-
13
- MTI1MTgxZmQ5M2I3YTMxYzVmZTM5ZWUzNDRjMmFjMGZkNzZmMGRmMDlmMzA3
14
- ODJlZGQ0YzNlNzIxOGUxNTdlNGY2NmQ0MzVlMmRkZmU5Y2U3MDE0NjQ0Mjg0
15
- NzY3ZjA4ZjdmN2QzZWY4N2ZmY2RjYTQ2YWYwNzkzMzcxM2I2MzU=
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- build_test_run