teapot 2.2.1 → 2.3.0

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: c7dd6530fa6205da0fb6e8ac664cf5afaeaefee7c8b2953b4db59143efe5bc3a
4
- data.tar.gz: 71fc02fb6d3bbd8b5bcd4d52322c38ed4c3436284840d8b7a42204b259328665
3
+ metadata.gz: 0dd1292b87cd5db2fadc2379f270574504222ca5865d020c1463c072ddb14e79
4
+ data.tar.gz: 9c7a12f5887482e46b896d5a3e77147a28d3563cdf2ec194f489ab064f75d9ef
5
5
  SHA512:
6
- metadata.gz: dba16c3116e3d58b669847fc070115dccb6aa191fa563dea6a924d3e7aaa5c990516e374defc9db4d582cecc0197786e9e597771cea09d1af18fc902f82139c3
7
- data.tar.gz: f3c1235934ea56215e55730c78d0e96b72ddc4aea27c053db3e808216a1e76a7675a7391eb08a87bfdc984f3ef7203677c60fcf5a8c0046397e96ff63e79ac1a
6
+ metadata.gz: 4dfac1b253ce27cd86644dfae4f9b1ee3b8cc43a1436b11022a33a18b17e0ba53bd79deb420b236b9dd7b1d48f5859a5f1d2cfafc223cbc3689801eefc1f20cc
7
+ data.tar.gz: 797f3d03946859f2e8c8fefc4a610a3f7bb14d6dad90fdc8063989b7cf1a66524b5608ebeeb7c984455603c8d9a6096be5c0bef74385a4711d326c4bd0af3c13
data/.travis.yml CHANGED
@@ -2,9 +2,7 @@ language: ruby
2
2
  dist: xenial
3
3
  cache: bundler
4
4
 
5
- before_install:
6
- - gem update --system
7
- - gem install bundler
5
+ before_script:
8
6
  # For testing purposes:
9
7
  - git config --global user.email "samuel@oriontransfer.net"
10
8
  - git config --global user.name "Samuel Williams"
@@ -15,16 +13,12 @@ matrix:
15
13
  - rvm: 2.4
16
14
  - rvm: 2.5
17
15
  - rvm: 2.6
18
- - rvm: truffleruby
19
- - rvm: jruby-head
20
- env: JRUBY_OPTS="--debug -X+O"
21
- - rvm: ruby-head
22
- - rvm: rbx-3
23
- allow_failures:
24
- - rvm: ruby-head
25
- - rvm: truffleruby
26
- - rvm: jruby-head
27
- - rvm: rbx-3
16
+ - rvm: 2.6
17
+ os: osx
18
+ before_install: brew install pkgconfig zlib curl openssl libssh2 libgit2
19
+ env: RUGGED_USE_SYSTEM_LIBRARIES=y
20
+ - rvm: 2.6
21
+ env: COVERAGE=BriefSummary,Coveralls
28
22
 
29
23
  addons:
30
24
  apt:
data/Gemfile CHANGED
@@ -5,11 +5,8 @@ gemspec
5
5
 
6
6
  group :development do
7
7
  gem 'pry'
8
- gem 'pry-coolline'
9
- gem 'pry-byebug', platform: :mri
10
8
  end
11
9
 
12
- group :test do
13
- gem 'simplecov'
14
- gem 'coveralls', require: false
15
- end
10
+ # group :test do
11
+ # gem 'rugged', git: 'git://github.com/libgit2/rugged.git', submodules: true
12
+ # end
data/README.md CHANGED
@@ -10,6 +10,7 @@ Teapot is a decentralised build tool for managing complex cross-platform project
10
10
  [![Build Status](https://secure.travis-ci.org/kurocha/teapot.svg)](http://travis-ci.org/kurocha/teapot)
11
11
  [![Code Climate](https://codeclimate.com/github/kurocha/teapot.svg)](https://codeclimate.com/github/kurocha/teapot)
12
12
  [![Coverage Status](https://coveralls.io/repos/kurocha/teapot/badge.svg)](https://coveralls.io/r/kurocha/teapot)
13
+ [![Gitter Chat](https://badges.gitter.im/kurocha/community.svg)](https://gitter.im/kurocha/community)
13
14
 
14
15
  ## Installation
15
16
 
@@ -50,7 +50,7 @@ module Teapot
50
50
  end
51
51
 
52
52
  def freeze
53
- return if frozen?
53
+ return self if frozen?
54
54
 
55
55
  @options.freeze
56
56
  @packages.freeze
@@ -128,11 +128,13 @@ module Teapot
128
128
  context.root + "teapot/packages/#{name}"
129
129
  end
130
130
 
131
- # The path where built products will be installed.
132
- def platforms_path
133
- context.root + "teapot/platforms/#{name}"
131
+ # The path where built products will be placed.
132
+ def build_path
133
+ context.root + "teapot/build/#{name}"
134
134
  end
135
135
 
136
+ alias platforms_path build_path
137
+
136
138
  def lock_path
137
139
  context.root + "#{@name}-lock.yml"
138
140
  end
@@ -18,135 +18,9 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- require_relative 'loader'
22
- require_relative 'package'
23
-
24
- require 'build/rulebook'
25
- require 'build/text/substitutions'
26
- require 'build/text/merge'
21
+ require_relative 'select'
27
22
 
28
23
  module Teapot
29
- class AlreadyDefinedError < StandardError
30
- def initialize(definition, previous)
31
- super "Definition #{definition.name} in #{definition.path} has already been defined in #{previous.path}!"
32
- end
33
-
34
- def self.check(definition, definitions)
35
- previous = definitions[definition.name]
36
-
37
- raise self.new(definition, previous) if previous
38
- end
39
- end
40
-
41
- # A selection is a specific view of the data exposed by the context at a specific point in time.
42
- class Select
43
- def initialize(context, configuration, names = [])
44
- @context = context
45
- @configuration = Configuration.new(context, configuration.package, configuration.name, [], configuration.options)
46
-
47
- @targets = {}
48
- @configurations = {}
49
- @projects = {}
50
- @rules = Build::Rulebook.new
51
-
52
- @dependencies = []
53
- @selection = Set.new
54
- @unresolved = Set.new
55
-
56
- load!(configuration, names)
57
-
58
- @chain = nil
59
- end
60
-
61
- attr :context
62
- attr :configuration
63
-
64
- attr :targets
65
- attr :projects
66
-
67
- # Alises as defined by Configuration#targets
68
- attr :aliases
69
-
70
- # All public configurations.
71
- attr :configurations
72
-
73
- attr :rules
74
-
75
- attr :dependencies
76
- attr :selection
77
- attr :unresolved
78
-
79
- def chain
80
- @chain ||= Build::Dependency::Chain.expand(@dependencies, @targets.values, @selection)
81
- end
82
-
83
- def direct_targets(ordered)
84
- @dependencies.collect do |dependency|
85
- ordered.find{|(package, _)| package.provides? dependency}
86
- end.compact
87
- end
88
-
89
- private
90
-
91
- # Add a definition to the current context.
92
- def append definition
93
- case definition
94
- when Target
95
- AlreadyDefinedError.check(definition, @targets)
96
- @targets[definition.name] = definition
97
- when Configuration
98
- # We define configurations in two cases, if they are public, or if they are part of the root package of this context.
99
- if definition.public? or definition.package == @context.root_package
100
- AlreadyDefinedError.check(definition, @configurations)
101
- @configurations[definition.name] = definition
102
- end
103
- when Project
104
- AlreadyDefinedError.check(definition, @projects)
105
- @projects[definition.name] = definition
106
- when Rule
107
- AlreadyDefinedError.check(definition, @rules)
108
- @rules << definition
109
- end
110
- end
111
-
112
- def load_package!(package)
113
- begin
114
- script = @context.load(package)
115
-
116
- # Load the definitions into the current selection:
117
- script.defined.each do |definition|
118
- append(definition)
119
- end
120
- rescue NonexistantTeapotError, IncompatibleTeapotError
121
- # If the package doesn't exist or the teapot version is too old, it failed:
122
- @unresolved << package
123
- end
124
- end
125
-
126
- def load!(configuration, names)
127
- # Load the root package which makes all the named configurations and targets available.
128
- load_package!(@context.root_package)
129
-
130
- # Load all packages defined by this configuration.
131
- configuration.traverse(@configurations) do |configuration|
132
- @configuration.merge(configuration) do |package|
133
- # puts "Load package: #{package} from #{configuration}"
134
- load_package!(package)
135
- end
136
- end
137
-
138
- @configuration.freeze
139
-
140
- names.each do |name|
141
- if @targets.key? name
142
- @selection << name
143
- else
144
- @dependencies << name
145
- end
146
- end
147
- end
148
- end
149
-
150
24
  # A context represents a specific root package instance with a given configuration and all related definitions. A context is stateful in the sense that package selection is specialized based on #select and #dependency_chain. These parameters are usually set up initially as part of the context setup.
151
25
  class Context
152
26
  def initialize(root, **options)
data/lib/teapot/loader.rb CHANGED
@@ -30,7 +30,8 @@ module Teapot
30
30
  # Cannot load packages newer than this.
31
31
  # Version 1.3: Added support for build-dependency library which allows options for `#depends`. The primary use case is private dependencies.
32
32
  # Version 2.0: Generators removed and refactored into build.
33
- LOADER_VERSION = "2.0"
33
+ # Version 2.3: Rework install_prefix -> build_prefix.
34
+ LOADER_VERSION = "2.3"
34
35
 
35
36
  # Cannot load packages older than this.
36
37
  MINIMUM_LOADER_VERSION = "1.0"
@@ -103,9 +104,9 @@ module Teapot
103
104
 
104
105
  def define_target(*args)
105
106
  target = Target.new(@context, @package, *args)
106
-
107
+
107
108
  yield target
108
-
109
+
109
110
  @defined << target
110
111
  end
111
112
 
@@ -0,0 +1,149 @@
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_relative 'loader'
22
+ require_relative 'package'
23
+
24
+ require 'build/rulebook'
25
+ require 'build/text/substitutions'
26
+ require 'build/text/merge'
27
+
28
+ module Teapot
29
+ class AlreadyDefinedError < StandardError
30
+ def initialize(definition, previous)
31
+ super "Definition #{definition.name} in #{definition.path} has already been defined in #{previous.path}!"
32
+ end
33
+
34
+ def self.check(definition, definitions)
35
+ previous = definitions[definition.name]
36
+
37
+ raise self.new(definition, previous) if previous
38
+ end
39
+ end
40
+
41
+ # A selection is a specific view of the data exposed by the context at a specific point in time.
42
+ class Select
43
+ def initialize(context, configuration, names = [])
44
+ @context = context
45
+ @configuration = Configuration.new(context, configuration.package, configuration.name, [], configuration.options)
46
+
47
+ @targets = {}
48
+ @configurations = {}
49
+ @projects = {}
50
+ @rules = Build::Rulebook.new
51
+
52
+ @dependencies = []
53
+ @selection = Set.new
54
+ @unresolved = Set.new
55
+
56
+ load!(configuration, names)
57
+
58
+ @chain = nil
59
+ end
60
+
61
+ attr :context
62
+ attr :configuration
63
+
64
+ attr :targets
65
+ attr :projects
66
+
67
+ # Alises as defined by Configuration#targets
68
+ attr :aliases
69
+
70
+ # All public configurations.
71
+ attr :configurations
72
+
73
+ attr :rules
74
+
75
+ attr :dependencies
76
+ attr :selection
77
+ attr :unresolved
78
+
79
+ def chain
80
+ @chain ||= Build::Dependency::Chain.expand(@dependencies, @targets.values, @selection)
81
+ end
82
+
83
+ def direct_targets(ordered)
84
+ @dependencies.collect do |dependency|
85
+ ordered.find{|(package, _)| package.provides? dependency}
86
+ end.compact
87
+ end
88
+
89
+ private
90
+
91
+ # Add a definition to the current context.
92
+ def append definition
93
+ case definition
94
+ when Target
95
+ AlreadyDefinedError.check(definition, @targets)
96
+ @targets[definition.name] = definition
97
+ when Configuration
98
+ # We define configurations in two cases, if they are public, or if they are part of the root package of this context.
99
+ if definition.public? or definition.package == @context.root_package
100
+ AlreadyDefinedError.check(definition, @configurations)
101
+ @configurations[definition.name] = definition
102
+ end
103
+ when Project
104
+ AlreadyDefinedError.check(definition, @projects)
105
+ @projects[definition.name] = definition
106
+ when Rule
107
+ AlreadyDefinedError.check(definition, @rules)
108
+ @rules << definition
109
+ end
110
+ end
111
+
112
+ def load_package!(package)
113
+ begin
114
+ script = @context.load(package)
115
+
116
+ # Load the definitions into the current selection:
117
+ script.defined.each do |definition|
118
+ append(definition)
119
+ end
120
+ rescue NonexistantTeapotError, IncompatibleTeapotError
121
+ # If the package doesn't exist or the teapot version is too old, it failed:
122
+ @unresolved << package
123
+ end
124
+ end
125
+
126
+ def load!(configuration, names)
127
+ # Load the root package which makes all the named configurations and targets available.
128
+ load_package!(@context.root_package)
129
+
130
+ # Load all packages defined by this configuration.
131
+ configuration.traverse(@configurations) do |configuration|
132
+ @configuration.merge(configuration) do |package|
133
+ # puts "Load package: #{package} from #{configuration}"
134
+ load_package!(package)
135
+ end
136
+ end
137
+
138
+ @configuration.freeze
139
+
140
+ names.each do |name|
141
+ if @targets.key? name
142
+ @selection << name
143
+ else
144
+ @dependencies << name
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end
data/lib/teapot/target.rb CHANGED
@@ -32,23 +32,28 @@ module Teapot
32
32
  class Target < Definition
33
33
  include Build::Dependency
34
34
 
35
- def initialize(context, package, name)
36
- super context, package, name
35
+ def initialize(*)
36
+ super
37
37
 
38
38
  @build = nil
39
-
40
- @rulebook = Build::Rulebook.new
41
39
  end
42
40
 
43
- attr :rulebook
44
-
45
41
  def freeze
42
+ return self if frozen?
43
+
46
44
  @build.freeze
47
- @rulebook.freeze
48
45
 
49
46
  super
50
47
  end
51
48
 
49
+ def build(&block)
50
+ if block_given?
51
+ @build = block
52
+ end
53
+
54
+ return @build
55
+ end
56
+
52
57
  # Given a specific configuration, generate the build environment based on this target and it's provision chain.
53
58
  def environment(configuration, chain)
54
59
  chain = chain.partial(self)
@@ -62,16 +67,11 @@ module Teapot
62
67
  environment = Build::Environment.combine(*environments)
63
68
 
64
69
  environment.merge do
70
+ default build_path configuration.build_path
71
+
72
+ # TODO deprecated - remove in 3.0
65
73
  default platforms_path configuration.platforms_path
66
74
  end
67
75
  end
68
-
69
- def build(&block)
70
- if block_given?
71
- @build = block
72
- end
73
-
74
- return @build
75
- end
76
76
  end
77
77
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Teapot
22
- VERSION = "2.2.1"
22
+ VERSION = "2.3.0"
23
23
  end
data/spec/spec_helper.rb CHANGED
@@ -1,29 +1,5 @@
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 "teapot"
21
- require 'pry'
22
-
23
- RSpec.shared_context Teapot::Context do
24
- let(:root) {Build::Files::Path[__dir__] + 'context'}
25
- let(:context) {Teapot::Context.new(root, load_root: false)}
26
- end
2
+ require "covered/rspec"
27
3
 
28
4
  RSpec.configure do |config|
29
5
  # Enable flags like --only-failures and --next-failure
data/teapot.gemspec CHANGED
@@ -38,10 +38,8 @@ Gem::Specification.new do |spec|
38
38
 
39
39
  spec.add_dependency "samovar", "~> 1.7"
40
40
 
41
- # This could be a good option in the future for teapot fetch:
42
- #spec.add_dependency "rugged"
43
-
44
- spec.add_development_dependency "bundler", "~> 1.3"
41
+ spec.add_development_dependency "covered"
42
+ spec.add_development_dependency "bundler"
45
43
  spec.add_development_dependency "rspec", "~> 3.6"
46
44
  spec.add_development_dependency "rake"
47
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teapot
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.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-01-05 00:00:00.000000000 Z
11
+ date: 2019-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -136,20 +136,34 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '1.7'
139
+ - !ruby/object:Gem::Dependency
140
+ name: covered
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: bundler
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - "~>"
157
+ - - ">="
144
158
  - !ruby/object:Gem::Version
145
- version: '1.3'
159
+ version: '0'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - "~>"
164
+ - - ">="
151
165
  - !ruby/object:Gem::Version
152
- version: '1.3'
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: rspec
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -214,6 +228,7 @@ files:
214
228
  - lib/teapot/loader.rb
215
229
  - lib/teapot/package.rb
216
230
  - lib/teapot/project.rb
231
+ - lib/teapot/select.rb
217
232
  - lib/teapot/target.rb
218
233
  - lib/teapot/version.rb
219
234
  - materials/kurocha.png
@@ -254,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
269
  - !ruby/object:Gem::Version
255
270
  version: '0'
256
271
  requirements: []
257
- rubygems_version: 3.0.1
272
+ rubygems_version: 3.0.2
258
273
  signing_key:
259
274
  specification_version: 4
260
275
  summary: Teapot is a tool for managing complex cross-platform builds.