build 2.5.1 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a584085143f5ed2e6ea2bc4dd34688402a07e09b86174342d40ecbbf4c3ca75
4
- data.tar.gz: f830204ab793ae014d4c78e28b50a9f0a7d9c890bf61f978e94e33a76ba8362f
3
+ metadata.gz: 1d19cc4bbe6685576a37aaa0abc93c2f264660d0ae4265c8c9eb8cc7eea9a462
4
+ data.tar.gz: c40c1bd3188a406d6c5f836ed02181f7fa4ccb8ea6b4b42367df01586d097e8b
5
5
  SHA512:
6
- metadata.gz: 1ede532310d8e76e5565c35893e68924f3eb30b034d4dda3aececee3848920576f78c7ccaa50aab484e9c4d71fd953680c30ccf3cf88105797f8afc55b7c4e3f
7
- data.tar.gz: c60e8d539f50fdfcaeea102d325e61f0580f57f595d3edc4c0fa243aa591152f2502a4642750ceda2e8daa24f42b4587a6cc8153fb7cdbad0be4182871c29f04
6
+ metadata.gz: 466d9379b0c9c35ac3e2ea9494ea1b870ceec42d74494572e79aa6938e02a28da7185bac37165e8ee62b70d59640c928adb25276b52554b5b0a4fcf2dd952dcf
7
+ data.tar.gz: 6fe800fc5113bbf0831b04a853a3e9fc2340884662feac512f86b92e6595467d4df8049c5852dcef6644b8b45f22b2b9d8a9fb438ae7bc7ef2351f2c12d2f443
checksums.yaml.gz.sig ADDED
Binary file
@@ -25,30 +25,27 @@ require 'console/event/spawn'
25
25
 
26
26
  module Build
27
27
  class BuildNode < Graph::Node
28
- def initialize(environment, dependency, provisions, arguments)
28
+ def initialize(environment, provision, arguments)
29
29
  @environment = environment
30
- @dependency = dependency
31
- @provisions = provisions
30
+ @provision = provision
32
31
  @arguments = arguments
33
32
 
34
33
  super(Files::List::NONE, :inherit)
35
34
  end
36
35
 
37
36
  attr :environment
38
- attr :dependency
39
- attr :provisions
37
+ attr :provision
40
38
  attr :arguments
41
39
 
42
40
  def == other
43
41
  super and
44
42
  @environment == other.environment and
45
- @dependency == other.dependency and
46
- @provisions == other.provisions and
43
+ @provision == other.provision and
47
44
  @arguments == other.arguments
48
45
  end
49
46
 
50
47
  def hash
51
- super ^ @environment.hash ^ @dependency.hash ^ @provisions.hash ^ @arguments.hash
48
+ super ^ @environment.hash ^ @provision.hash ^ @arguments.hash
52
49
  end
53
50
 
54
51
  def task_class(parent_task)
@@ -56,19 +53,17 @@ module Build
56
53
  end
57
54
 
58
55
  def initial_environment
59
- Build::Environment.new(@environment, name: @dependency.name)
56
+ Build::Environment.new(@environment)
60
57
  end
61
58
 
62
59
  def name
63
- @dependency.name
60
+ @environment.name
64
61
  end
65
62
 
66
63
  def apply!(task)
67
64
  output_environment = self.initial_environment
68
65
 
69
- @provisions.each do |provision|
70
- output_environment.construct!(task, *@arguments, &provision.value)
71
- end
66
+ output_environment.construct!(task, *@arguments, &@provision.value)
72
67
 
73
68
  task.output_environment = output_environment
74
69
  end
@@ -104,10 +99,10 @@ module Build
104
99
  @node.dirty?
105
100
  end
106
101
 
107
- def spawn(*arguments)
102
+ def spawn(*arguments, **options)
108
103
  if wet?
109
- @logger&.info(self) {Console::Event::Spawn.for(*arguments)}
110
- status = @group.spawn(*arguments)
104
+ @logger&.info(self) {Console::Event::Spawn.for(*arguments, **options)}
105
+ status = @group.spawn(*arguments, **options)
111
106
 
112
107
  if status != 0
113
108
  raise CommandFailure.new(self, arguments, status)
@@ -119,8 +114,8 @@ module Build
119
114
  @shell_environment ||= environment.flatten.export
120
115
  end
121
116
 
122
- def run!(*arguments)
123
- self.spawn(shell_environment, *arguments)
117
+ def run!(*arguments, **options)
118
+ self.spawn(shell_environment, *arguments, **options)
124
119
  end
125
120
 
126
121
  def touch(path)
@@ -66,9 +66,9 @@ module Build
66
66
  def apply!(task)
67
67
  # Go through all the dependencies in order and apply them to the build graph:
68
68
  @chain.dependencies.each do |dependency|
69
- node = DependencyNode.new(@chain, dependency, @environment, @arguments)
70
-
71
- task.invoke(node)
69
+ task.invoke(
70
+ DependencyNode.new(@chain, dependency, @environment, @arguments)
71
+ )
72
72
  end
73
73
  end
74
74
 
@@ -20,7 +20,7 @@
20
20
 
21
21
  require 'build/graph'
22
22
 
23
- require_relative 'build_node'
23
+ require_relative 'provision_node'
24
24
 
25
25
  module Build
26
26
  class DependencyNode < Graph::Node
@@ -48,7 +48,7 @@ module Build
48
48
  end
49
49
 
50
50
  def hash
51
- super ^ @chain.hash ^ @environment.hash ^ @arguments.hash
51
+ super ^ @chain.hash ^ @dependency.hash ^ @environment.hash ^ @arguments.hash
52
52
  end
53
53
 
54
54
  def task_class(parent_task)
@@ -63,26 +63,18 @@ module Build
63
63
  @chain.resolved[@dependency]
64
64
  end
65
65
 
66
- def alias?
67
- @dependency.alias?
68
- end
69
-
70
66
  def public?
71
67
  @dependency.public?
72
68
  end
73
69
 
74
- # This is the main entry point when invoking the node from `Build::Task`.
75
- def apply!(task)
76
- # Go through all the dependencies in order and apply them to the build graph:
77
- @chain.dependencies.each do |dependency|
78
- node = DependencyNode.new(@chain, dependency, @environment, @arguments)
79
-
80
- task.invoke(node)
81
- end
70
+ def provision_node_for(provision)
71
+ ProvisionNode.new(@chain, provision, @environment, @arguments)
82
72
  end
83
-
84
- def dependency_node_for(dependency)
85
- DependencyNode.new(@chain, dependency, @environment, @arguments)
73
+ end
74
+
75
+ module ProvisionsFailed
76
+ def self.to_s
77
+ "Failed to build all provisions!"
86
78
  end
87
79
  end
88
80
 
@@ -90,15 +82,18 @@ module Build
90
82
  def initialize(*arguments, **options)
91
83
  super
92
84
 
85
+ @provisions = []
86
+
87
+ @environments = nil
93
88
  @environment = nil
94
- @tasks = []
95
89
  end
96
90
 
97
- attr :group
98
- attr :logger
99
-
100
91
  attr :environment
101
92
 
93
+ def dependency
94
+ @node.dependency
95
+ end
96
+
102
97
  def update
103
98
  logger.debug(self) do |buffer|
104
99
  buffer.puts "building #{@node} which #{@node.dependency}"
@@ -109,55 +104,24 @@ module Build
109
104
 
110
105
  # Lookup what things this dependency provides:
111
106
  @node.provisions.each do |provision|
112
- provision.each_dependency do |nested_dependency|
113
- @tasks << invoke(@node.dependency_node_for(nested_dependency))
114
- end
115
- end
116
- end
117
-
118
- def update_outputs
119
- dependency = @node.dependency
120
- environments = [@node.environment]
121
-
122
- public_environments = []
123
- public_alias = @node.alias?
124
-
125
- @tasks.each do |task|
126
- if environment = task.environment
127
- environments << environment
128
-
129
- if public_alias || task.node.public?
130
- public_environments << environment
131
- # else
132
- # logger.debug("Skipping #{nested_dependency} in public environment.")
133
- end
134
- end
135
- end
136
-
137
- unless public_alias
138
- logger.debug(self) {"Building: #{dependency} <- #{@tasks.join}"}
139
-
140
- # environments.each do |environment|
141
- # logger.debug {"Using #{environment}"}
142
- # end
143
-
144
- local_environment = Build::Environment.combine(*environments)&.evaluate || Build::Environment.new
145
-
146
- # logger.debug("Local Environment: #{local_environment}")
147
-
148
- build_task = invoke(
149
- BuildNode.new(local_environment, dependency, @node.provisions, @node.arguments)
107
+ @provisions << invoke(
108
+ @node.provision_node_for(provision)
150
109
  )
151
-
152
- if wait_for_children?
153
- output_environment = build_task.output_environment
154
- public_environments << output_environment.dup(parent: nil, name: dependency.name)
155
- end
156
110
  end
157
111
 
158
- @environment = Build::Environment.combine(*public_environments)
112
+ if wait_for_children?
113
+ update_environments!
114
+ else
115
+ fail!(ProvisionsFailed)
116
+ end
117
+ end
118
+
119
+ private
120
+
121
+ def update_environments!
122
+ @environments = @provisions.flat_map(&:output_environments)
159
123
 
160
- super
124
+ @environment = Build::Environment.combine(*@environments)
161
125
  end
162
126
  end
163
127
  end
@@ -0,0 +1,146 @@
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/graph'
22
+
23
+ require_relative 'build_node'
24
+
25
+ module Build
26
+ class ProvisionNode < Graph::Node
27
+ def initialize(chain, provision, environment, arguments)
28
+ @chain = chain
29
+ @provision = provision
30
+ @environment = environment
31
+ @arguments = arguments
32
+
33
+ # Wait here, for all dependent targets, to be done:
34
+ super(Files::List::NONE, :inherit)
35
+ end
36
+
37
+ attr :chain
38
+ attr :provision
39
+ attr :environment
40
+ attr :arguments
41
+
42
+ def == other
43
+ super and
44
+ @chain == other.chain and
45
+ @provision == other.provision and
46
+ @environment == other.environment and
47
+ @arguments == other.arguments
48
+ end
49
+
50
+ def hash
51
+ super ^ @chain.hash ^ @provision.hash ^ @environment.hash ^ @arguments.hash
52
+ end
53
+
54
+ def task_class(parent_task)
55
+ ProvisionTask
56
+ end
57
+
58
+ def name
59
+ @provision.name
60
+ end
61
+
62
+ def dependency_node_for(dependency)
63
+ DependencyNode.new(@chain, dependency, @environment, @arguments)
64
+ end
65
+ end
66
+
67
+ module DependenciesFailed
68
+ def self.to_s
69
+ "Failed to build all dependencies!"
70
+ end
71
+ end
72
+
73
+ class ProvisionTask < Task
74
+ def initialize(*arguments, **options)
75
+ super
76
+
77
+ @dependencies = []
78
+
79
+ @environments = []
80
+ @public_environments = []
81
+
82
+ @build_task = nil
83
+ end
84
+
85
+ attr :environments
86
+ attr :public_environments
87
+
88
+ attr :build_task
89
+
90
+ def provision
91
+ @node.provision
92
+ end
93
+
94
+ def update
95
+ provision.each_dependency do |dependency|
96
+ @dependencies << invoke(@node.dependency_node_for(dependency))
97
+ end
98
+
99
+ if wait_for_children?
100
+ update_environments!
101
+ else
102
+ fail!(DependenciesFailed)
103
+ end
104
+ end
105
+
106
+ def local_environment
107
+ Build::Environment.combine(@node.environment, *@environments)&.evaluate(name: @node.name).freeze
108
+ end
109
+
110
+ def output_environment
111
+ if @build_task
112
+ @build_task.output_environment.dup(parent: nil)
113
+ end
114
+ end
115
+
116
+ def output_environments
117
+ environments = @public_environments.dup
118
+
119
+ if environment = self.output_environment
120
+ environments << environment
121
+ end
122
+
123
+ return environments
124
+ end
125
+
126
+ private
127
+
128
+ def update_environments!
129
+ @dependencies.each do |task|
130
+ if environment = task.environment
131
+ @environments << environment
132
+
133
+ if task.dependency.public? || @node.provision.alias?
134
+ @public_environments << environment
135
+ end
136
+ end
137
+ end
138
+
139
+ unless @node.provision.alias?
140
+ @build_task = invoke(
141
+ BuildNode.new(local_environment, @node.provision, @node.arguments)
142
+ )
143
+ end
144
+ end
145
+ end
146
+ end
data/lib/build/version.rb CHANGED
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Build
22
- VERSION = "2.5.1"
22
+ VERSION = "2.6.1"
23
23
  end
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,57 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2019-09-30 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
14
+ ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
15
+ MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMMLHNhbXVlbC53aWxs
16
+ aWFtcy9EQz1vcmlvbnRyYW5zZmVyL0RDPWNvL0RDPW56MIIBojANBgkqhkiG9w0B
17
+ AQEFAAOCAY8AMIIBigKCAYEAyXLSS/cw+fXJ5e7hi+U/TeChPWeYdwJojDsFY1xr
18
+ xvtqbTTL8gbLHz5LW3QD2nfwCv3qTlw0qI3Ie7a9VMJMbSvgVEGEfQirqIgJXWMj
19
+ eNMDgKsMJtC7u/43abRKx7TCURW3iWyR19NRngsJJmaR51yGGGm2Kfsr+JtKKLtL
20
+ L188Wm3f13KAx7QJU8qyuBnj1/gWem076hzdA7xi1DbrZrch9GCRz62xymJlrJHn
21
+ 9iZEZ7AxrS7vokhMlzSr/XMUihx/8aFKtk+tMLClqxZSmBWIErWdicCGTULXCBNb
22
+ E/mljo4zEVKhlTWpJklMIhr55ZRrSarKFuW7en0+tpJrfsYiAmXMJNi4XAYJH7uL
23
+ rgJuJwSaa/dMz+VmUoo7VKtSfCoOI+6v5/z0sK3oT6sG6ZwyI47DBq2XqNC6tnAj
24
+ w+XmCywiTQrFzMMAvcA7rPI4F0nU1rZId51rOvvfxaONp+wgTi4P8owZLw0/j0m4
25
+ 8C20DYi6EYx4AHDXiLpElWh3AgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8E
26
+ BAMCBLAwHQYDVR0OBBYEFB6ZaeWKxQjGTI+pmz7cKRmMIywwMC4GA1UdEQQnMCWB
27
+ I3NhbXVlbC53aWxsaWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWB
28
+ I3NhbXVlbC53aWxsaWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEB
29
+ CwUAA4IBgQBVoM+pu3dpdUhZM1w051iw5GfiqclAr1Psypf16Tiod/ho//4oAu6T
30
+ 9fj3DPX/acWV9P/FScvqo4Qgv6g4VWO5ZU7z2JmPoTXZtYMunRAmQPFL/gSUc6aK
31
+ vszMHIyhtyzRc6DnfW2AiVOjMBjaYv8xXZc9bduniRVPrLR4J7ozmGLh4o4uJp7w
32
+ x9KCFaR8Lvn/r0oJWJOqb/DMAYI83YeN2Dlt3jpwrsmsONrtC5S3gOUle5afSGos
33
+ bYt5ocnEpKSomR9ZtnCGljds/aeO1Xgpn2r9HHcjwnH346iNrnHmMlC7BtHUFPDg
34
+ Ts92S47PTOXzwPBDsrFiq3VLbRjHSwf8rpqybQBH9MfzxGGxTaETQYOd6b4e4Ag6
35
+ y92abGna0bmIEb4+Tx9rQ10Uijh1POzvr/VTH4bbIPy9FbKrRsIQ24qDbNJRtOpE
36
+ RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
37
+ HiLJ8VOFx6w=
38
+ -----END CERTIFICATE-----
39
+ date: 2022-05-23 00:00:00.000000000 Z
12
40
  dependencies:
13
41
  - !ruby/object:Gem::Dependency
14
- name: build-graph
42
+ name: build-dependency
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
45
  - - "~>"
18
46
  - !ruby/object:Gem::Version
19
- version: '2.0'
47
+ version: '1.5'
20
48
  type: :runtime
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
52
  - - "~>"
25
53
  - !ruby/object:Gem::Version
26
- version: '2.0'
54
+ version: '1.5'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: build-environment
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
59
  - - "~>"
32
60
  - !ruby/object:Gem::Version
33
- version: '1.3'
61
+ version: '1.12'
34
62
  type: :runtime
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
66
  - - "~>"
39
67
  - !ruby/object:Gem::Version
40
- version: '1.3'
68
+ version: '1.12'
41
69
  - !ruby/object:Gem::Dependency
42
- name: build-dependency
70
+ name: build-graph
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - "~>"
46
74
  - !ruby/object:Gem::Version
47
- version: '1.4'
75
+ version: '2.1'
48
76
  type: :runtime
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
- version: '1.4'
82
+ version: '2.1'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: build-makefile
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +95,7 @@ dependencies:
67
95
  - !ruby/object:Gem::Version
68
96
  version: '1.0'
69
97
  - !ruby/object:Gem::Dependency
70
- name: graphviz
98
+ name: console
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
101
  - - "~>"
@@ -81,7 +109,7 @@ dependencies:
81
109
  - !ruby/object:Gem::Version
82
110
  version: '1.0'
83
111
  - !ruby/object:Gem::Dependency
84
- name: console
112
+ name: graphviz
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - "~>"
@@ -95,7 +123,7 @@ dependencies:
95
123
  - !ruby/object:Gem::Version
96
124
  version: '1.0'
97
125
  - !ruby/object:Gem::Dependency
98
- name: covered
126
+ name: bundler
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
129
  - - ">="
@@ -109,7 +137,7 @@ dependencies:
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
- name: bundler
140
+ name: covered
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
143
  - - ">="
@@ -123,48 +151,39 @@ dependencies:
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0'
125
153
  - !ruby/object:Gem::Dependency
126
- name: rspec
154
+ name: rake
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
- - - "~>"
157
+ - - ">="
130
158
  - !ruby/object:Gem::Version
131
- version: '3.6'
159
+ version: '0'
132
160
  type: :development
133
161
  prerelease: false
134
162
  version_requirements: !ruby/object:Gem::Requirement
135
163
  requirements:
136
- - - "~>"
164
+ - - ">="
137
165
  - !ruby/object:Gem::Version
138
- version: '3.6'
166
+ version: '0'
139
167
  - !ruby/object:Gem::Dependency
140
- name: rake
168
+ name: rspec
141
169
  requirement: !ruby/object:Gem::Requirement
142
170
  requirements:
143
- - - ">="
171
+ - - "~>"
144
172
  - !ruby/object:Gem::Version
145
- version: '0'
173
+ version: '3.6'
146
174
  type: :development
147
175
  prerelease: false
148
176
  version_requirements: !ruby/object:Gem::Requirement
149
177
  requirements:
150
- - - ">="
178
+ - - "~>"
151
179
  - !ruby/object:Gem::Version
152
- version: '0'
153
- description:
180
+ version: '3.6'
181
+ description:
154
182
  email:
155
- - samuel.williams@oriontransfer.co.nz
156
183
  executables: []
157
184
  extensions: []
158
185
  extra_rdoc_files: []
159
186
  files:
160
- - ".gitignore"
161
- - ".rspec"
162
- - ".travis.yml"
163
- - Gemfile
164
- - Gemfile.local
165
- - README.md
166
- - Rakefile
167
- - build.gemspec
168
187
  - lib/build.rb
169
188
  - lib/build/build_node.rb
170
189
  - lib/build/chain_node.rb
@@ -172,22 +191,17 @@ files:
172
191
  - lib/build/dependency_node.rb
173
192
  - lib/build/graphviz.rb
174
193
  - lib/build/name.rb
194
+ - lib/build/provision_node.rb
175
195
  - lib/build/rule.rb
176
196
  - lib/build/rule_node.rb
177
197
  - lib/build/rulebook.rb
178
198
  - lib/build/task.rb
179
199
  - lib/build/version.rb
180
- - spec/build/controller_spec.rb
181
- - spec/build/name_spec.rb
182
- - spec/build/rule_spec.rb
183
- - spec/build/rulebook_spec.rb
184
- - spec/build/target.rb
185
- - spec/spec_helper.rb
186
- homepage: ''
200
+ homepage: https://github.com/kurocha/build
187
201
  licenses:
188
202
  - MIT
189
203
  metadata: {}
190
- post_install_message:
204
+ post_install_message:
191
205
  rdoc_options: []
192
206
  require_paths:
193
207
  - lib
@@ -202,14 +216,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
216
  - !ruby/object:Gem::Version
203
217
  version: '0'
204
218
  requirements: []
205
- rubygems_version: 3.0.4
206
- signing_key:
219
+ rubygems_version: 3.1.6
220
+ signing_key:
207
221
  specification_version: 4
208
- summary: Build is a framework for working with task based build systems.
209
- test_files:
210
- - spec/build/controller_spec.rb
211
- - spec/build/name_spec.rb
212
- - spec/build/rule_spec.rb
213
- - spec/build/rulebook_spec.rb
214
- - spec/build/target.rb
215
- - spec/spec_helper.rb
222
+ summary: Build is a framework for creating task based build systems.
223
+ test_files: []
metadata.gz.sig ADDED
Binary file
data/.gitignore DELETED
@@ -1,23 +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
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
23
- .rspec_status
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --format documentation
2
- --backtrace
3
- --warnings
4
- --require spec_helper
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- language: ruby
2
- dist: xenial
3
- cache: bundler
4
-
5
- matrix:
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 DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in build.gemspec
4
- gemspec
data/Gemfile.local DELETED
@@ -1,24 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in build.gemspec
4
- gemspec
5
-
6
- group :development do
7
- gem 'pry'
8
- gem 'pry-coolline'
9
-
10
- gem 'build-environment', path: '../build-environment'
11
- gem 'build-files', path: '../build-files'
12
- gem 'build-graph', path: '../build-graph'
13
- gem 'build-makefile', path: '../build-makefile'
14
-
15
- gem 'process-daemon', path: '../process-daemon'
16
- gem 'process-group', path: '../process-group'
17
-
18
- gem 'graphviz', path: '../graphviz'
19
- end
20
-
21
- group :test do
22
- gem 'simplecov'
23
- gem 'coveralls', require: false
24
- end
data/README.md DELETED
@@ -1,57 +0,0 @@
1
- # Build
2
-
3
- Build is a ruby gem providing systems for building task driven build systems similar to make.
4
-
5
- [![Build Status](https://secure.travis-ci.org/ioquatix/build.svg)](http://travis-ci.org/ioquatix/build)
6
- [![Code Climate](https://codeclimate.com/github/ioquatix/build.svg)](https://codeclimate.com/github/ioquatix/build)
7
- [![Coverage Status](https://coveralls.io/repos/ioquatix/build/badge.svg)](https://coveralls.io/r/ioquatix/build)
8
-
9
- ## Installation
10
-
11
- Add this line to your application's Gemfile:
12
-
13
- gem 'build'
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install build
22
-
23
- ## Usage
24
-
25
- This gem is a container for `build-files` and `build-graph`.
26
-
27
- ## Contributing
28
-
29
- 1. Fork it
30
- 2. Create your feature branch (`git checkout -b my-new-feature`)
31
- 3. Commit your changes (`git commit -am 'Add some feature'`)
32
- 4. Push to the branch (`git push origin my-new-feature`)
33
- 5. Create new Pull Request
34
-
35
- ## License
36
-
37
- Released under the MIT license.
38
-
39
- Copyright, 2015, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
40
-
41
- Permission is hereby granted, free of charge, to any person obtaining a copy
42
- of this software and associated documentation files (the "Software"), to deal
43
- in the Software without restriction, including without limitation the rights
44
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45
- copies of the Software, and to permit persons to whom the Software is
46
- furnished to do so, subject to the following conditions:
47
-
48
- The above copyright notice and this permission notice shall be included in
49
- all copies or substantial portions of the Software.
50
-
51
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
54
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
56
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
57
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
-
2
- require "bundler/gem_tasks"
3
- require "rspec/core/rake_task"
4
-
5
- # Load all rake tasks:
6
- import(*Dir.glob('tasks/**/*.rake'))
7
-
8
- RSpec::Core::RakeTask.new(:spec)
9
-
10
- task :default => :spec
data/build.gemspec DELETED
@@ -1,32 +0,0 @@
1
-
2
- require_relative 'lib/build/version'
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "build"
6
- spec.version = Build::VERSION
7
- spec.authors = ["Samuel Williams"]
8
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
- spec.summary = %q{Build is a framework for working with task based build systems.}
10
- spec.homepage = ""
11
- spec.license = "MIT"
12
-
13
- spec.files = `git ls-files -z`.split("\x0")
14
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
- spec.require_paths = ["lib"]
17
-
18
- spec.required_ruby_version = '>= 2.0'
19
-
20
- spec.add_dependency "build-graph", "~> 2.0"
21
- spec.add_dependency "build-environment", "~> 1.3"
22
- spec.add_dependency "build-dependency", "~> 1.4"
23
- spec.add_dependency "build-makefile", "~> 1.0"
24
-
25
- spec.add_dependency "graphviz", "~> 1.0"
26
- spec.add_dependency "console", "~> 1.0"
27
-
28
- spec.add_development_dependency "covered"
29
- spec.add_development_dependency "bundler"
30
- spec.add_development_dependency "rspec", "~> 3.6"
31
- spec.add_development_dependency "rake"
32
- end
@@ -1,129 +0,0 @@
1
- #!/usr/bin/env rspec
2
-
3
- # Copyright, 2015, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- require 'build/rulebook'
24
- require 'build/controller'
25
-
26
- require_relative 'target'
27
-
28
- RSpec.describe Build::Controller do
29
- let(:base) {Build::Environment.new(name: "base")}
30
-
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
42
- end
43
- end
44
- end
45
-
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
56
- end
57
-
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
70
- end
71
- end
72
-
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
- run! 'sleep 0.1'
82
- touch parameters[:destination]
83
- end
84
- end
85
-
86
- define Build::Rule, "copy.file" do
87
- input :source
88
- output :destination
89
-
90
- apply do |parameters|
91
- cp parameters[:source], parameters[:destination]
92
- end
93
- end
94
- end
95
- end
96
- end
97
-
98
- let(:build_target) do
99
- Target.new("build") do |target|
100
- target.depends "files"
101
-
102
- target.provides "foo" do
103
- foo_path = Build::Files::Path['foo']
104
- bar_path = Build::Files::Path['bar']
105
-
106
- make destination: foo_path
107
- copy source: foo_path, destination: bar_path
108
- end
109
- end
110
- end
111
-
112
- it "should execute the build graph" do
113
- chain = Build::Dependency::Chain.expand(["foo"], [files_target, build_target])
114
-
115
- controller = Build::Controller.new do |controller|
116
- controller.add_chain(chain, [], base)
117
- end
118
-
119
- expect(controller.nodes.size).to be 1
120
-
121
- controller.update
122
-
123
- expect(File).to be_exist('foo')
124
- expect(File).to be_exist('bar')
125
-
126
- FileUtils.rm ['foo', 'bar']
127
- end
128
- end
129
- end
@@ -1,52 +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 'build/name'
22
-
23
- RSpec.describe Build::Name do
24
- let(:name) {Build::Name.new('Foo Bar')}
25
- it "retains the original text" do
26
- expect(name.text).to be == 'Foo Bar'
27
- end
28
-
29
- it "should generate useful identifiers" do
30
- expect(name.identifier).to be == 'FooBar'
31
- end
32
-
33
- it "should generate useful target names" do
34
- expect(name.target).to be == 'foo-bar'
35
- end
36
-
37
- it "should generate useful key names" do
38
- expect(name.key('executable')).to be == 'foo_bar_executable'
39
- end
40
-
41
- it "should generate useful macro names" do
42
- expect(name.macro).to be == 'FOO_BAR'
43
- end
44
-
45
- it "should generate useful macro names" do
46
- expect(name.macro).to be == 'FOO_BAR'
47
- end
48
-
49
- it "can be constructed from target name" do
50
- expect(Build::Name.from_target(name.target).text).to be == name.text
51
- end
52
- end
@@ -1,53 +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 'build/rule'
22
-
23
- RSpec.describe Build::Rule do
24
- it "should validate input and output parameters" do
25
- rule = Build::Rule.new("compile", "cpp")
26
-
27
- rule.input :source
28
- rule.output :destination
29
-
30
- expect(rule.parameters.size).to be 2
31
-
32
- expect(rule.applicable?(source: 'foo', destination: 'bar')).to be_truthy
33
- expect(rule.applicable?(source: 'foo')).to be_falsey
34
- end
35
-
36
- it "respects false argument" do
37
- rule = Build::Rule.new("compile", "cpp")
38
-
39
- rule.parameter :install, default: true
40
-
41
- expect(
42
- rule.normalize({}, binding)
43
- ).to be == {install: true}
44
-
45
- expect(
46
- rule.normalize({install: true}, binding)
47
- ).to be == {install: true}
48
-
49
- expect(
50
- rule.normalize({install: false}, binding)
51
- ).to be == {install: false}
52
- end
53
- end
@@ -1,52 +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 'build/environment'
22
- require 'build/rulebook'
23
-
24
- RSpec.describe Build::Rulebook do
25
- it "should generate a valid rulebook" do
26
- environment = Build::Environment.new do
27
- define Build::Rule, "copy.file" do
28
- input :source
29
- output :destination
30
-
31
- apply do |parameters|
32
- cp parameters[:source], parameters[:destination]
33
- end
34
- end
35
-
36
- define Build::Rule, "delete.file" do
37
- input :target
38
-
39
- apply do |parameters|
40
- rm parameters[:target]
41
- end
42
- end
43
- end
44
-
45
- rulebook = Build::Rulebook.for(environment.flatten)
46
-
47
- expect(rulebook.rules.size).to be 2
48
-
49
- expect(rulebook.rules).to be_include 'copy.file'
50
- expect(rulebook.rules).to be_include 'delete.file'
51
- end
52
- end
data/spec/build/target.rb DELETED
@@ -1,20 +0,0 @@
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 DELETED
@@ -1,12 +0,0 @@
1
-
2
- require 'covered/rspec'
3
- require 'build'
4
-
5
- RSpec.configure do |config|
6
- # Enable flags like --only-failures and --next-failure
7
- config.example_status_persistence_file_path = ".rspec_status"
8
-
9
- config.expect_with :rspec do |c|
10
- c.syntax = :expect
11
- end
12
- end