build 1.1.1 → 2.0.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
- SHA1:
3
- metadata.gz: 0061c640201cf6a63ba81925aa552e01428a0b0f
4
- data.tar.gz: bf45a2f7386cb9323e01a5298c6a93334ce97661
2
+ SHA256:
3
+ metadata.gz: 9cc4f25b15c353f405140484002cf0106fa5cdfc115269ff256d92fcc86be47f
4
+ data.tar.gz: d92ce080796f19b6a1a3ff80acbd51b43f97845ac201c7ea295da464e64daf34
5
5
  SHA512:
6
- metadata.gz: bb81f9daffca0da668f216c95e305d3b1630f0c9df42a9fdb9e61c196f19a4261ca458ba1854d6fc380a213fee6dfbdb1f2a700a36d3f9922684370dc88f404c
7
- data.tar.gz: 7c223da32561fa39c61d64864a10eef12e6dece664c028fa6236ca726b62153675cf18089cfd29d1f90cd70c581827b2a02d37c193e8bb3eb5e4c5800af2d597
6
+ metadata.gz: a0924bb939bbb829cd707df95fe25b0ed21965dd1d0a87509f1adeb9bb4f9a16df2e35dedeed89ffc68a31763d3db3a8766b7b60b4338f4996b87c135357f1cf
7
+ data.tar.gz: 58b0a8611fa3549816e8ecc837876fd33be5b3c6eae51fc868ad8063f1e0810fdb948ea4a80864123c73077308f47ccde5f35ea50665a89f0c74d7c0c2c8a805
data/.travis.yml CHANGED
@@ -1,14 +1,12 @@
1
1
  language: ruby
2
- sudo: false
3
- rvm:
4
- - 2.1.8
5
- - 2.2.4
6
- - 2.3.0
7
- - ruby-head
8
- - rbx-2
9
- env: COVERAGE=true
2
+ dist: xenial
3
+ cache: bundler
4
+
10
5
  matrix:
11
- fast_finish: true
12
- allow_failures:
13
- - rvm: ruby-head
14
- - rvm: "rbx-2"
6
+ include:
7
+ - rvm: 2.3
8
+ - rvm: 2.4
9
+ - rvm: 2.5
10
+ - rvm: 2.6
11
+ - rvm: 2.6
12
+ env: COVERAGE=BriefSummary,Coveralls
data/Gemfile CHANGED
@@ -2,8 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in build.gemspec
4
4
  gemspec
5
-
6
- group :test do
7
- gem 'simplecov'
8
- gem 'coveralls', require: false
9
- end
data/Rakefile CHANGED
@@ -1,9 +1,10 @@
1
+
1
2
  require "bundler/gem_tasks"
2
3
  require "rspec/core/rake_task"
3
4
 
4
5
  # Load all rake tasks:
5
6
  import(*Dir.glob('tasks/**/*.rake'))
6
7
 
7
- RSpec::Core::RakeTask.new(:test)
8
+ RSpec::Core::RakeTask.new(:spec)
8
9
 
9
- task :default => :test
10
+ task :default => :spec
data/build.gemspec CHANGED
@@ -18,12 +18,14 @@ Gem::Specification.new do |spec|
18
18
  spec.required_ruby_version = '>= 2.0'
19
19
 
20
20
  spec.add_dependency "build-graph", "~> 1.0"
21
- spec.add_dependency "build-environment", "~> 1.1"
21
+ spec.add_dependency "build-environment", "~> 1.2"
22
+ spec.add_dependency "build-dependency", "~> 1.2"
22
23
  spec.add_dependency "build-makefile", "~> 1.0"
23
24
 
24
25
  spec.add_dependency "graphviz"
25
26
 
26
- spec.add_development_dependency "bundler", "~> 1.3"
27
+ spec.add_development_dependency "covered"
28
+ spec.add_development_dependency "bundler"
27
29
  spec.add_development_dependency "rspec", "~> 3.6"
28
30
  spec.add_development_dependency "rake"
29
31
  end
@@ -0,0 +1,95 @@
1
+ # Copyright, 2018, 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/files'
22
+ require 'build/graph'
23
+
24
+ require_relative 'task'
25
+
26
+ module Build
27
+ class ChainNode < Graph::Node
28
+ def initialize(chain, arguments, environment)
29
+ @chain = chain
30
+ @arguments = arguments
31
+ @environment = environment
32
+
33
+ # Wait here, for all dependent targets, to be done:
34
+ super(Files::List::NONE, :inherit, chain)
35
+ end
36
+
37
+ def task_class
38
+ Task
39
+ end
40
+
41
+ def apply_dependency(scope, dependency)
42
+ # puts "Traversing #{dependency.name}..."
43
+
44
+ # Not sure why need first
45
+ provision = @chain.resolved[dependency].first
46
+
47
+ environments = [@environment]
48
+ public_environments = []
49
+
50
+ provision.each_dependency do |dependency|
51
+ if environment = apply_dependency(scope, dependency)
52
+ environments << environment
53
+
54
+ unless dependency.private?
55
+ public_environments << environment
56
+ end
57
+ end
58
+ end
59
+
60
+ unless dependency.alias?
61
+ # puts "Building #{dependency.name}: #{provision.value}..."
62
+
63
+ local_environment = Build::Environment.combine(*environments)&.evaluate || Build::Environment.new
64
+
65
+ task_class = Rulebook.for(local_environment).with(Task, environment: local_environment)
66
+
67
+ task = task_class.new(scope.walker, self, scope.group, logger: scope.logger)
68
+
69
+ output_environment = nil
70
+
71
+ scope.walker.with(task_class: task_class) do
72
+ task.visit do
73
+ output_environment = Build::Environment.new(local_environment)
74
+
75
+ output_environment.construct!(task, *@arguments, &provision.value)
76
+
77
+ public_environments << output_environment.dup(parent: nil)
78
+ end
79
+ end
80
+ end
81
+
82
+ return Build::Environment.combine(*public_environments)
83
+ end
84
+
85
+ def apply!(scope)
86
+ @chain.dependencies.each do |dependency|
87
+ apply_dependency(scope, dependency)
88
+ end
89
+ end
90
+
91
+ def to_s
92
+ "#<#{self.class}>"
93
+ end
94
+ end
95
+ end
@@ -27,7 +27,7 @@ require_relative 'rulebook'
27
27
  require_relative 'name'
28
28
 
29
29
  require_relative 'rule_node'
30
- require_relative 'target_node'
30
+ require_relative 'chain_node'
31
31
  require_relative 'task'
32
32
 
33
33
  require_relative 'logger'
@@ -72,17 +72,9 @@ module Build
72
72
  @walker.failed?
73
73
  end
74
74
 
75
- # Add a build target to the controller.
76
- def add_target(target, environment, arguments = [])
77
- task_class = Rulebook.for(environment).with(Task, environment: environment, target: target)
78
-
79
- # Not sure if this is a good idea - makes debugging slightly easier.
80
- Object.const_set("TaskClassFor#{Name.from_target(target.name).identifier}_#{task_class.object_id}", task_class)
81
-
82
- # A target node will invoke the build callback on target.
83
- @nodes << TargetNode.new(task_class, target, arguments)
84
-
85
- return @nodes.last
75
+ # Add a build environment to the controller.
76
+ def add_chain(chain, arguments = [], environment)
77
+ @nodes << ChainNode.new(chain, arguments, environment)
86
78
  end
87
79
 
88
80
  def update
data/lib/build/logger.rb CHANGED
@@ -64,11 +64,13 @@ module Build
64
64
 
65
65
  buffer << "\n"
66
66
 
67
- # if environment
68
- # environment.each do |key,value|
69
- # buffer << "\texport #{key}=#{value.dump}\n"
70
- # end
71
- # end
67
+ if @verbose
68
+ if environment
69
+ environment.each do |key, value|
70
+ buffer << "\texport #{key}=#{value.dump}\n"
71
+ end
72
+ end
73
+ end
72
74
  end
73
75
 
74
76
  def format_exception(exception, buffer)
data/lib/build/rule.rb CHANGED
@@ -19,8 +19,16 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Build
22
- # A rule is a function with a specific set of input and output parameters, which can match against a given set of specific inputs and outputs. For example, there might be several rules for compiling, but the specific rules depend on the language being compiled.
22
+ # A rule is a function with a specific set of input and output parameters, which can match against a given set of specific arguments. For example, there might be several rules for compiling, but the specific rules depend on the language being compiled.
23
23
  class Rule
24
+ def self.build(name, &block)
25
+ rule = self.new(*name.split('.', 2))
26
+
27
+ rule.instance_eval(&block)
28
+
29
+ return rule.freeze
30
+ end
31
+
24
32
  class Parameter
25
33
  def initialize(direction, name, options = {}, &block)
26
34
  @direction = direction
@@ -119,6 +127,21 @@ module Build
119
127
 
120
128
  attr :primary_output
121
129
 
130
+ def freeze
131
+ return self if frozen?
132
+
133
+ @name.freeze
134
+ @full_name.freeze
135
+ @process_name.freeze
136
+ @type.freeze
137
+
138
+ @apply.freeze
139
+ @parameters.freeze
140
+ @primary_output.freeze
141
+
142
+ super
143
+ end
144
+
122
145
  def input(name, options = {}, &block)
123
146
  self << Parameter.new(:input, name, options, &block)
124
147
  end
@@ -36,12 +36,12 @@ module Build
36
36
  processes = @processes[rule.process_name] ||= []
37
37
  processes << rule
38
38
  end
39
-
39
+
40
40
  def [] name
41
41
  @rules[name]
42
42
  end
43
43
 
44
- def with(superclass, state = {})
44
+ def with(superclass, **state)
45
45
  task_class = Class.new(superclass)
46
46
 
47
47
  # Define methods for all processes, e.g. task_class#compile
@@ -65,12 +65,18 @@ module Build
65
65
  end
66
66
  end
67
67
 
68
+ # Typically, this defines methods like #environment and #target which can be accessed in the build rule.
68
69
  state.each do |key, value|
69
70
  task_class.send(:define_method, key) do
70
71
  value
71
72
  end
72
73
  end
73
74
 
75
+ rulebook = self
76
+ task_class.send(:define_method, :rulebook) do
77
+ rulebook
78
+ end
79
+
74
80
  return task_class
75
81
  end
76
82
 
@@ -78,13 +84,7 @@ module Build
78
84
  rulebook = self.new
79
85
 
80
86
  environment.defined.each do |name, define|
81
- object = define.klass.new(*name.split('.', 2))
82
-
83
- object.instance_eval(&define.block)
84
-
85
- object.freeze
86
-
87
- rulebook << object
87
+ rulebook << define.klass.build(name, &define.block)
88
88
  end
89
89
 
90
90
  return rulebook
data/lib/build/task.rb CHANGED
@@ -49,18 +49,22 @@ module Build
49
49
  def initialize(walker, node, group, logger: nil)
50
50
  super(walker, node)
51
51
 
52
+ @environment = environment
52
53
  @group = group
53
-
54
- @logger = logger || Logger.new($stderr)
54
+ @logger = logger
55
55
  end
56
56
 
57
+ attr :environment
58
+ attr :group
59
+ attr :logger
60
+
57
61
  def wet?
58
62
  @node.dirty?
59
63
  end
60
64
 
61
65
  def spawn(*arguments)
62
66
  if wet?
63
- @logger.info(:shell) {arguments}
67
+ @logger&.info(:shell) {arguments}
64
68
  status = @group.spawn(*arguments)
65
69
 
66
70
  if status != 0
@@ -80,21 +84,21 @@ module Build
80
84
  def touch(path)
81
85
  return unless wet?
82
86
 
83
- @logger.info(:shell) {['touch', path]}
87
+ @logger&.info(:shell) {['touch', path]}
84
88
  FileUtils.touch(path)
85
89
  end
86
90
 
87
91
  def cp(source_path, destination_path)
88
92
  return unless wet?
89
93
 
90
- @logger.info(:shell) {['cp', source_path, destination_path]}
94
+ @logger&.info(:shell) {['cp', source_path, destination_path]}
91
95
  FileUtils.copy(source_path, destination_path)
92
96
  end
93
97
 
94
98
  def rm(path)
95
99
  return unless wet?
96
100
 
97
- @logger.info(:shell) {['rm -rf', path]}
101
+ @logger&.info(:shell) {['rm -rf', path]}
98
102
  FileUtils.rm_rf(path)
99
103
  end
100
104
 
@@ -102,7 +106,7 @@ module Build
102
106
  return unless wet?
103
107
 
104
108
  unless File.exist?(path)
105
- @logger.info(:shell) {['mkpath', path]}
109
+ @logger&.info(:shell) {['mkpath', path]}
106
110
  FileUtils.mkpath(path)
107
111
  end
108
112
  end
@@ -110,24 +114,19 @@ module Build
110
114
  def install(source_path, destination_path)
111
115
  return unless wet?
112
116
 
113
- @logger.info(:shell) {['install', source_path, destination_path]}
117
+ @logger&.info(:shell) {['install', source_path, destination_path]}
114
118
  FileUtils.install(source_path, destination_path)
115
119
  end
116
120
 
117
121
  def write(path, data, mode = "w")
118
122
  return unless wet?
119
123
 
120
- @logger.info(:shell) {["write", path, "#{data.size}bytes"]}
124
+ @logger&.info(:shell) {["write", path, "#{data.size}bytes"]}
121
125
  File.open(path, mode) do |file|
122
126
  file.write(data)
123
127
  end
124
128
  end
125
129
 
126
- # @deprecated Please use {#self} instead.
127
- def fs
128
- self
129
- end
130
-
131
130
  def update
132
131
  @node.apply!(self)
133
132
  end
@@ -135,12 +134,13 @@ module Build
135
134
  def invoke_rule(rule, arguments, &block)
136
135
  arguments = rule.normalize(arguments, self)
137
136
 
138
- @logger.debug(:invoke) {"-> #{rule}(#{arguments.inspect})"}
137
+ @logger&.debug(:invoke) {"-> #{rule}(#{arguments.inspect})"}
139
138
 
140
- node = RuleNode.new(rule, arguments, &block)
141
- task = invoke(node)
139
+ invoke(
140
+ RuleNode.new(rule, arguments, &block)
141
+ )
142
142
 
143
- @logger.debug(:invoke) {"<- #{rule}(...) -> #{rule.result(arguments)}"}
143
+ @logger&.debug(:invoke) {"<- #{rule}(...) -> #{rule.result(arguments)}"}
144
144
 
145
145
  return rule.result(arguments)
146
146
  end
data/lib/build/version.rb CHANGED
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Build
22
- VERSION = "1.1.1"
22
+ VERSION = "2.0.0"
23
23
  end
@@ -23,92 +23,106 @@
23
23
  require 'build/rulebook'
24
24
  require 'build/controller'
25
25
 
26
+ require_relative 'target'
27
+
26
28
  RSpec.describe Build::Controller do
27
- let(:target_class) do
28
- Class.new do
29
- def initialize(name)
30
- @name = name
31
- end
32
-
33
- attr :name
34
-
35
- def build(&block)
36
- @build = block if block_given?
37
-
38
- return @build
39
- end
40
- end
41
- end
29
+ let(:base) {Build::Environment.new(name: "base")}
42
30
 
43
- it "build graph should fail" do
44
- environment = Build::Environment.new do
45
- define Build::Rule, "make.file" do
46
- output :destination
47
-
48
- apply do |parameters|
49
- run! "exit -1"
31
+ context "failure exit status" do
32
+ let(:make_target) do
33
+ Target.new("make") do |target|
34
+ target.provides "make" do
35
+ define Build::Rule, "make.file" do
36
+ output :destination
37
+
38
+ apply do |parameters|
39
+ run! "exit -1"
40
+ end
41
+ end
50
42
  end
51
43
  end
52
44
  end
53
45
 
54
- target = target_class.new('fail')
55
- target.build do
56
- foo_path = Build::Files::Path['foo']
57
- make destination: foo_path
46
+ let(:build_target) do
47
+ Target.new("foo") do |target|
48
+ target.depends "make"
49
+
50
+ target.provides "foo" do
51
+ foo_path = Build::Files::Path['foo']
52
+
53
+ make destination: foo_path
54
+ end
55
+ end
58
56
  end
59
57
 
60
- controller = Build::Controller.new do |controller|
61
- controller.add_target(target, environment)
58
+ it "build graph should fail" do
59
+ chain = Build::Dependency::Chain.expand(["foo"], [make_target, build_target])
60
+
61
+ controller = Build::Controller.new do |controller|
62
+ controller.add_chain(chain, [], base)
63
+ end
64
+
65
+ controller.logger.level = Logger::DEBUG
66
+
67
+ controller.update
68
+
69
+ expect(controller.failed?).to be_truthy
62
70
  end
63
-
64
- controller.logger.level = Logger::DEBUG
65
-
66
- controller.update
67
-
68
- expect(controller.failed?).to be_truthy
69
71
  end
70
72
 
71
- it "should execute the build graph" do
72
- environment = Build::Environment.new do
73
- define Build::Rule, "make.file" do
74
- output :destination
75
-
76
- apply do |parameters|
77
- touch parameters[:destination]
73
+ context "copying files" do
74
+ let(:files_target) do
75
+ Target.new("files") do |target|
76
+ target.provides "files" do
77
+ define Build::Rule, "make.file" do
78
+ output :destination
79
+
80
+ apply do |parameters|
81
+ touch parameters[:destination]
82
+ end
83
+ end
84
+
85
+ define Build::Rule, "copy.file" do
86
+ input :source
87
+ output :destination
88
+
89
+ apply do |parameters|
90
+ cp parameters[:source], parameters[:destination]
91
+ end
92
+ end
78
93
  end
79
94
  end
80
-
81
- define Build::Rule, "copy.file" do
82
- input :source
83
- output :destination
95
+ end
96
+
97
+ let(:build_target) do
98
+ Target.new("build") do |target|
99
+ target.depends "files"
84
100
 
85
- apply do |parameters|
86
- cp parameters[:source], parameters[:destination]
101
+ target.provides "foo" do
102
+ foo_path = Build::Files::Path['foo']
103
+ bar_path = Build::Files::Path['bar']
104
+
105
+ make destination: foo_path
106
+ copy source: foo_path, destination: bar_path
87
107
  end
88
108
  end
89
109
  end
90
110
 
91
- target = target_class.new('copy')
92
- target.build do
93
- foo_path = Build::Files::Path['foo']
94
- bar_path = Build::Files::Path['bar']
111
+ it "should execute the build graph" do
112
+ chain = Build::Dependency::Chain.expand(["foo"], [files_target, build_target])
95
113
 
96
- make destination: foo_path
114
+ controller = Build::Controller.new do |controller|
115
+ controller.add_chain(chain, [], base)
116
+ end
97
117
 
98
- copy source: foo_path, destination: bar_path
99
- end
100
-
101
- controller = Build::Controller.new do |controller|
102
- controller.add_target(target, environment)
118
+ expect(controller.nodes.size).to be 1
119
+
120
+ controller.update
121
+
122
+ expect(File).to be_exist('foo')
123
+ expect(File).to be_exist('bar')
124
+
125
+ FileUtils.rm ['foo', 'bar']
103
126
  end
104
-
105
- expect(controller.nodes.size).to be 1
106
-
107
- controller.update
108
-
109
- expect(File).to be_exist('foo')
110
- expect(File).to be_exist('bar')
111
-
112
- FileUtils.rm ['foo', 'bar']
113
127
  end
114
128
  end
@@ -42,7 +42,7 @@ RSpec.describe Build::Rulebook do
42
42
  end
43
43
  end
44
44
 
45
- rulebook = Build::Rulebook.for(environment)
45
+ rulebook = Build::Rulebook.for(environment.flatten)
46
46
 
47
47
  expect(rulebook.rules.size).to be 2
48
48
 
@@ -0,0 +1,20 @@
1
+
2
+ require 'build/dependency'
3
+
4
+ class Target
5
+ include Build::Dependency
6
+
7
+ def initialize(name = nil)
8
+ @name = name
9
+
10
+ if block_given?
11
+ yield self
12
+ end
13
+ end
14
+
15
+ attr :name
16
+
17
+ def inspect
18
+ "\#<#{self.class}: #{@name}>"
19
+ end
20
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,23 +1,6 @@
1
1
 
2
- if ENV['COVERAGE'] || ENV['TRAVIS']
3
- begin
4
- require 'simplecov'
5
-
6
- SimpleCov.start do
7
- add_filter "/spec/"
8
- end
9
-
10
- if ENV['TRAVIS']
11
- require 'coveralls'
12
- Coveralls.wear!
13
- end
14
- rescue LoadError
15
- warn "Could not load simplecov: #{$!}"
16
- end
17
- end
18
-
19
- require "bundler/setup"
20
- require "build"
2
+ require 'covered/rspec'
3
+ require 'build'
21
4
 
22
5
  RSpec.configure do |config|
23
6
  # Enable flags like --only-failures and --next-failure
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.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: 2017-07-07 00:00:00.000000000 Z
11
+ date: 2019-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: build-graph
@@ -30,14 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.1'
33
+ version: '1.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.1'
40
+ version: '1.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: build-dependency
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: build-makefile
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,20 +80,34 @@ dependencies:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: covered
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: bundler
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - "~>"
101
+ - - ">="
74
102
  - !ruby/object:Gem::Version
75
- version: '1.3'
103
+ version: '0'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - "~>"
108
+ - - ">="
81
109
  - !ruby/object:Gem::Version
82
- version: '1.3'
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: rspec
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -124,6 +152,7 @@ files:
124
152
  - Rakefile
125
153
  - build.gemspec
126
154
  - lib/build.rb
155
+ - lib/build/chain_node.rb
127
156
  - lib/build/controller.rb
128
157
  - lib/build/graphviz.rb
129
158
  - lib/build/logger.rb
@@ -131,13 +160,13 @@ files:
131
160
  - lib/build/rule.rb
132
161
  - lib/build/rule_node.rb
133
162
  - lib/build/rulebook.rb
134
- - lib/build/target_node.rb
135
163
  - lib/build/task.rb
136
164
  - lib/build/version.rb
137
165
  - spec/build/controller_spec.rb
138
166
  - spec/build/name_spec.rb
139
167
  - spec/build/rule_spec.rb
140
168
  - spec/build/rulebook_spec.rb
169
+ - spec/build/target.rb
141
170
  - spec/spec_helper.rb
142
171
  homepage: ''
143
172
  licenses:
@@ -158,8 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
187
  - !ruby/object:Gem::Version
159
188
  version: '0'
160
189
  requirements: []
161
- rubyforge_project:
162
- rubygems_version: 2.6.12
190
+ rubygems_version: 3.0.2
163
191
  signing_key:
164
192
  specification_version: 4
165
193
  summary: Build is a framework for working with task based build systems.
@@ -168,4 +196,5 @@ test_files:
168
196
  - spec/build/name_spec.rb
169
197
  - spec/build/rule_spec.rb
170
198
  - spec/build/rulebook_spec.rb
199
+ - spec/build/target.rb
171
200
  - spec/spec_helper.rb
@@ -1,53 +0,0 @@
1
- # Copyright, 2016, 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/files'
22
- require 'build/graph'
23
-
24
- module Build
25
- class TargetNode < Graph::Node
26
- def initialize(task_class, target, arguments)
27
- @target = target
28
- @task_class = task_class
29
- @arguments = arguments
30
-
31
- # Wait here, for all dependent targets, to be done:
32
- super(Files::List::NONE, :inherit, target)
33
- end
34
-
35
- attr :task_class
36
-
37
- def name
38
- @task_class.name
39
- end
40
-
41
- def apply!(scope)
42
- scope.instance_exec(*@arguments, &@target.build)
43
- end
44
-
45
- def inspect
46
- @task_class.name.inspect
47
- end
48
-
49
- def to_s
50
- "#<#{self.class} #{@target.name}>"
51
- end
52
- end
53
- end