teapot 0.9.0 → 0.9.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 +8 -8
- data/README.md +1 -0
- data/bin/teapot +7 -4
- data/lib/teapot/build/linker.rb +3 -1
- data/lib/teapot/commands.rb +10 -7
- data/lib/teapot/controller/create.rb +6 -2
- data/lib/teapot/controller/fetch.rb +8 -33
- data/lib/teapot/controller/generate.rb +8 -1
- data/lib/teapot/generator.rb +20 -3
- data/lib/teapot/name.rb +4 -0
- data/lib/teapot/repository.rb +106 -0
- data/lib/teapot/substitutions.rb +23 -2
- data/lib/teapot/version.rb +1 -1
- data/teapot.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTU3OWI1OTkxZTUxMGJjY2FhMmVmZTMyNDQ5OGUxNDcwMDcyNjk1Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWVmYzY1OGZjZjkxYzhmNTliOGY1ZjFmZDNiMjBlNTU0OTE4YjkxNw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjNmMzFkNGM1NmM2ZGY2ZDE4MDVlNzBlMGZjODExMzU5YzdlNWM3MzEwNjVm
|
10
|
+
MmNlZTc0ZDY3MWU0ZDhhYzc4ZTA2NTFmNjU5NjU3ZTdlZTQ5YjkwM2VlZjU0
|
11
|
+
YmNkOTM2ZDQ3MWU1NjJjM2I5ZDI0MGYzZDEzMmUyYjE5MWI3MzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2M1NmI5NTY1Y2ZmYmEyMTlhMjRhYTBkY2Q3OGI4YmRkMzdjYmJmYzUxZjMz
|
14
|
+
OTVmOTZjY2JhMmQ1ODQ5ODE0NTM3NmVmY2YzNjc3YzZmZDI2MmE3MzUxYmIx
|
15
|
+
OWVlMzU1ZTk5MWI5ZDFlMDMwZTBjOGQzOWI4NjUzZDEzMDQwMGU=
|
data/README.md
CHANGED
@@ -8,6 +8,7 @@ Teapot is a decentralised build tool for managing complex cross-platform project
|
|
8
8
|
- The build subsystem provides a simple set of canonical operations for building libraries and executables to minimise configuration overhead.
|
9
9
|
|
10
10
|
[](http://travis-ci.org/ioquatix/teapot)
|
11
|
+
[](https://codeclimate.com/github/ioquatix/teapot)
|
11
12
|
|
12
13
|
## Installation
|
13
14
|
|
data/bin/teapot
CHANGED
@@ -28,15 +28,20 @@ require 'teapot/controller/fetch'
|
|
28
28
|
require 'teapot/controller/generate'
|
29
29
|
require 'teapot/controller/list'
|
30
30
|
require 'teapot/controller/run'
|
31
|
+
require 'teapot/repository'
|
31
32
|
|
32
33
|
require 'time'
|
33
34
|
require 'trollop'
|
34
35
|
|
35
36
|
OPTIONS = Trollop::options do
|
37
|
+
version "teapot v#{Teapot::VERSION}"
|
38
|
+
|
36
39
|
opt :only, "Only compiled direct dependencies."
|
37
40
|
opt :in, "Work in the given directory.", :type => :string
|
38
41
|
opt :unlock, "Don't use package lockfile when fetching."
|
39
42
|
|
43
|
+
opt :force, "Force the operation if it would otherwise be be stopped due to a warning."
|
44
|
+
|
40
45
|
opt :configuration, "Specify a specific build configuration.", :type => :string
|
41
46
|
end
|
42
47
|
|
@@ -82,16 +87,14 @@ module Application
|
|
82
87
|
# Make the path:
|
83
88
|
root.mkpath
|
84
89
|
|
85
|
-
|
86
|
-
Teapot::Commands.run("git", "init")
|
87
|
-
end
|
90
|
+
Teapot::Repository.new(root).init!
|
88
91
|
|
89
92
|
make_controller(root).create(project_name, source, packages)
|
90
93
|
end
|
91
94
|
|
92
95
|
def self.generate(arguments = ARGV)
|
93
96
|
generator_name = arguments.shift
|
94
|
-
make_controller.generate(generator_name, arguments)
|
97
|
+
make_controller.generate(generator_name, arguments, OPTIONS[:force])
|
95
98
|
end
|
96
99
|
end
|
97
100
|
|
data/lib/teapot/build/linker.rb
CHANGED
@@ -25,7 +25,7 @@ module Teapot
|
|
25
25
|
module Linker
|
26
26
|
class UnsupportedPlatform < StandardError
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def self.link_static(environment, library_file, objects)
|
30
30
|
if RUBY_PLATFORM =~ /darwin/
|
31
31
|
Commands.run(
|
@@ -33,6 +33,8 @@ module Teapot
|
|
33
33
|
"-static", "-o", library_file, objects,
|
34
34
|
)
|
35
35
|
elsif RUBY_PLATFORM =~ /linux/
|
36
|
+
FileUtils.rm_rf library_file
|
37
|
+
|
36
38
|
Commands.run(
|
37
39
|
environment[:ar] || 'ar',
|
38
40
|
environment[:arflags] || "-cru",
|
data/lib/teapot/commands.rb
CHANGED
@@ -22,6 +22,7 @@ require 'set'
|
|
22
22
|
require 'rainbow'
|
23
23
|
require 'shellwords'
|
24
24
|
require 'facter'
|
25
|
+
require 'rexec/task'
|
25
26
|
|
26
27
|
module Teapot
|
27
28
|
module Commands
|
@@ -50,23 +51,25 @@ module Teapot
|
|
50
51
|
Shellwords.split(arg || "")
|
51
52
|
end
|
52
53
|
|
53
|
-
def self.run(*args)
|
54
|
+
def self.run(*args, &block)
|
55
|
+
options = Hash === args.last ? args.pop : {}
|
56
|
+
options[:passthrough] ||= :all
|
57
|
+
|
54
58
|
args = args.flatten.collect &:to_s
|
55
59
|
|
56
|
-
|
57
|
-
args[0] = [args[0], args[0]]
|
60
|
+
puts args.join(' ').color(:blue) + " in #{options[:chdir] || Dir.getwd}"
|
58
61
|
|
59
|
-
|
62
|
+
task = RExec::Task.open(args, options, &block)
|
60
63
|
|
61
|
-
if
|
64
|
+
if task.wait == 0
|
62
65
|
true
|
63
66
|
else
|
64
67
|
raise CommandError.new("Non-zero exit status: #{args.join(' ')}!")
|
65
68
|
end
|
66
69
|
end
|
67
70
|
|
68
|
-
def self.run!(*args)
|
69
|
-
run(*args)
|
71
|
+
def self.run!(*args, &block)
|
72
|
+
run(*args, &block)
|
70
73
|
rescue CommandError
|
71
74
|
false
|
72
75
|
end
|
@@ -35,6 +35,10 @@ module Teapot
|
|
35
35
|
|
36
36
|
output.puts "required_version #{VERSION.dump}", ''
|
37
37
|
|
38
|
+
output.puts "\# Build Targets", ''
|
39
|
+
|
40
|
+
output.puts "\# Configurations", ''
|
41
|
+
|
38
42
|
output.puts "define_configuration #{name.target.dump} do |configuration|"
|
39
43
|
|
40
44
|
output.puts "\tconfiguration[:source] = #{source.dump}", ''
|
@@ -43,7 +47,7 @@ module Teapot
|
|
43
47
|
output.puts "\tconfiguration.import! #{name.dump}"
|
44
48
|
end
|
45
49
|
|
46
|
-
output.puts "end"
|
50
|
+
output.puts "end", ''
|
47
51
|
end
|
48
52
|
|
49
53
|
# Fetch all packages:
|
@@ -57,7 +61,7 @@ module Teapot
|
|
57
61
|
|
58
62
|
def generate_project(project_name)
|
59
63
|
if context.generators.key? 'project'
|
60
|
-
generate('project', [project_name])
|
64
|
+
generate('project', [project_name], true)
|
61
65
|
end
|
62
66
|
end
|
63
67
|
end
|
@@ -19,6 +19,7 @@
|
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
21
|
require 'teapot/controller'
|
22
|
+
require 'teapot/repository'
|
22
23
|
|
23
24
|
module Teapot
|
24
25
|
class Controller
|
@@ -108,51 +109,25 @@ module Teapot
|
|
108
109
|
branch = package_lock[:branch]
|
109
110
|
end
|
110
111
|
|
112
|
+
commit = package_lock ? package_lock[:commit] : nil
|
113
|
+
|
111
114
|
unless destination_path.exist?
|
112
115
|
log "Cloning package at path #{destination_path} ...".color(:cyan)
|
113
116
|
|
114
117
|
begin
|
115
|
-
destination_path.mkpath
|
116
|
-
|
117
118
|
external_url = package.external_url(context.root)
|
118
119
|
|
119
|
-
|
120
|
-
|
121
|
-
Dir.chdir(destination_path) do
|
122
|
-
# Checkout the specific version if it was given:
|
123
|
-
if package_lock
|
124
|
-
Commands.run("git", "reset", "--hard", package_lock[:commit])
|
125
|
-
end
|
126
|
-
|
127
|
-
Commands.run("git", "submodule", "update", "--init", "--recursive")
|
128
|
-
end
|
120
|
+
Repository.new(destination_path).clone!(external_url, branch, commit)
|
129
121
|
rescue
|
130
|
-
log "
|
131
|
-
|
132
|
-
# Clean up if the git checkout process is interrupted:
|
133
|
-
destination_path.rmtree
|
134
|
-
|
122
|
+
log "Failed to clone #{external_url}...".color(:red)
|
123
|
+
|
135
124
|
raise
|
136
125
|
end
|
137
126
|
else
|
138
127
|
log "Updating package at path #{destination_path} ...".color(:cyan)
|
139
128
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
Commands.run("git", "checkout", branch)
|
144
|
-
|
145
|
-
# Pull any changes, if you might get the error from above:
|
146
|
-
# Your branch is behind 'origin/0.1' by 1 commit, and can be fast-forwarded.
|
147
|
-
Commands.run("git", "pull")
|
148
|
-
|
149
|
-
# Checkout the specific version if it was given:
|
150
|
-
if package_lock
|
151
|
-
Commands.run("git", "reset", "--hard", package_lock[:commit])
|
152
|
-
end
|
153
|
-
|
154
|
-
Commands.run("git", "submodule", "update", "--init", "--recursive")
|
155
|
-
end
|
129
|
+
commit = package_lock ? package_lock[:commit] : nil
|
130
|
+
Repository.new(destination_path).update(branch, commit)
|
156
131
|
end
|
157
132
|
|
158
133
|
# Lock the package, unless it was already locked:
|
@@ -22,9 +22,16 @@ require 'teapot/controller'
|
|
22
22
|
|
23
23
|
module Teapot
|
24
24
|
class Controller
|
25
|
-
def generate(name, arguments)
|
25
|
+
def generate(name, arguments, force = false)
|
26
26
|
context.configuration.load_all
|
27
27
|
|
28
|
+
unless force
|
29
|
+
# Check dirty status of local repository:
|
30
|
+
if Repository.new(@root).status.size != 0
|
31
|
+
abort "You have unstaged changes/unadded files. Please stash/commit them before running the generator.".color(:red)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
28
35
|
generator = context.generators[name]
|
29
36
|
|
30
37
|
unless generator
|
data/lib/teapot/generator.rb
CHANGED
@@ -97,17 +97,34 @@ module Teapot
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
+
def is_binary(path)
|
101
|
+
if path.exist?
|
102
|
+
return path.read(1024).bytes.find{|byte| byte >= 0 and byte <= 6}
|
103
|
+
else
|
104
|
+
return false
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def copy_binary(source_path, destination_path)
|
109
|
+
destination_path.dirname.mkpath
|
110
|
+
FileUtils.cp source_path, destination_path
|
111
|
+
end
|
112
|
+
|
100
113
|
def copy(source, destination, substitutions = nil)
|
101
114
|
source_path = Pathname(path) + source
|
115
|
+
destination_path = Pathname(context.root) + destination
|
102
116
|
|
103
117
|
if source_path.directory?
|
104
|
-
destination_path = Pathname(context.root) + destination
|
105
|
-
|
106
118
|
source_path.children(false).each do |child_path|
|
107
119
|
copy(source_path + child_path, destination_path + substitute(child_path.to_s, substitutions), substitutions)
|
108
120
|
end
|
109
121
|
else
|
110
|
-
|
122
|
+
if is_binary(source_path) or is_binary(destination)
|
123
|
+
destination_path = Pathname(context.root) + destination
|
124
|
+
copy_binary(source_path, destination_path)
|
125
|
+
else
|
126
|
+
merge(source_path, destination, substitutions)
|
127
|
+
end
|
111
128
|
end
|
112
129
|
end
|
113
130
|
end
|
data/lib/teapot/name.rb
CHANGED
@@ -0,0 +1,106 @@
|
|
1
|
+
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'teapot/commands'
|
22
|
+
|
23
|
+
module Teapot
|
24
|
+
module Git
|
25
|
+
class Repository
|
26
|
+
def initialize(root, options = {})
|
27
|
+
@root = root
|
28
|
+
@options = options
|
29
|
+
end
|
30
|
+
|
31
|
+
def init!
|
32
|
+
run!("init", @root)
|
33
|
+
end
|
34
|
+
|
35
|
+
def clone!(remote_url, branch = nil, commit = nil)
|
36
|
+
branch_args = branch ? ["--branch", branch] : []
|
37
|
+
|
38
|
+
@root.mkpath
|
39
|
+
|
40
|
+
run!("clone", remote_url, @root, *branch_args)
|
41
|
+
|
42
|
+
if commit
|
43
|
+
run("reset", "--hard", commit)
|
44
|
+
end
|
45
|
+
|
46
|
+
run("submodule", "update", "--init", "--recursive")
|
47
|
+
rescue
|
48
|
+
#@root.rmtree
|
49
|
+
|
50
|
+
raise
|
51
|
+
end
|
52
|
+
|
53
|
+
def update(branch, commit = nil)
|
54
|
+
run("fetch", "origin")
|
55
|
+
run("checkout", branch)
|
56
|
+
|
57
|
+
# Pull any changes, if you might get the error from above:
|
58
|
+
# Your branch is behind 'origin/0.1' by 1 commit, and can be fast-forwarded.
|
59
|
+
run("pull")
|
60
|
+
|
61
|
+
# Checkout the specific version if it was given:
|
62
|
+
if commit
|
63
|
+
run("reset", "--hard", commit)
|
64
|
+
end
|
65
|
+
|
66
|
+
run("submodule", "update", "--init", "--recursive")
|
67
|
+
end
|
68
|
+
|
69
|
+
def add(files)
|
70
|
+
if files == :all
|
71
|
+
run("add", "--all")
|
72
|
+
else
|
73
|
+
run("add", *files)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def commit(message)
|
78
|
+
run("commit", "-m", message)
|
79
|
+
end
|
80
|
+
|
81
|
+
def status
|
82
|
+
Commands.run("git", "status", "--porcelain", :passthrough => [:in, :err]) do |task|
|
83
|
+
if task.wait == 0
|
84
|
+
return task.output.readlines.collect{|line| line.chomp.split(/\s+/, 2)}
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def run(*args)
|
92
|
+
Commands.run("git", *args, :chdir => @root)
|
93
|
+
end
|
94
|
+
|
95
|
+
def run!(*args)
|
96
|
+
Commands.run("git", *args)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
module Repository
|
102
|
+
def self.new(*args)
|
103
|
+
Git::Repository.new(*args)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
data/lib/teapot/substitutions.rb
CHANGED
@@ -52,8 +52,8 @@ module Teapot
|
|
52
52
|
end
|
53
53
|
|
54
54
|
class Substitutions
|
55
|
-
def initialize
|
56
|
-
@ordered =
|
55
|
+
def initialize(ordered = [])
|
56
|
+
@ordered = ordered
|
57
57
|
end
|
58
58
|
|
59
59
|
def []= keyword, value
|
@@ -69,6 +69,10 @@ module Teapot
|
|
69
69
|
@ordered << substition
|
70
70
|
end
|
71
71
|
|
72
|
+
def + other
|
73
|
+
Substitutions.new(@ordered + other.ordered)
|
74
|
+
end
|
75
|
+
|
72
76
|
attr :ordered
|
73
77
|
|
74
78
|
def call(text)
|
@@ -198,5 +202,22 @@ module Teapot
|
|
198
202
|
return text
|
199
203
|
end
|
200
204
|
end
|
205
|
+
|
206
|
+
# Create a set of substitutions from the given context which includes a set of useful defaults.
|
207
|
+
def self.for_context(context)
|
208
|
+
substitutions = self.new
|
209
|
+
|
210
|
+
# The user's current name:
|
211
|
+
substitutions['AUTHOR_NAME'] = `git config --global user.name`.chomp
|
212
|
+
|
213
|
+
substitutions['PROJECT_NAME'] = context.project.name
|
214
|
+
substitutions['LICENSE'] = context.project.license
|
215
|
+
|
216
|
+
current_date = Time.new
|
217
|
+
substitutions['DATE'] = current_date.strftime("%-d/%-m/%Y")
|
218
|
+
substitutions['YEAR'] = current_date.strftime("%Y")
|
219
|
+
|
220
|
+
return substitutions
|
221
|
+
end
|
201
222
|
end
|
202
223
|
end
|
data/lib/teapot/version.rb
CHANGED
data/teapot.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
the infusions ecosystem of packages and platform tooling.
|
15
15
|
EOF
|
16
16
|
gem.summary = %q{Teapot is a tool for managing complex cross-platform builds.}
|
17
|
-
gem.homepage = ""
|
17
|
+
gem.homepage = "http://www.kyusu.org"
|
18
18
|
|
19
19
|
gem.files = `git ls-files`.split($/)
|
20
20
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
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: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- lib/teapot/name.rb
|
125
125
|
- lib/teapot/package.rb
|
126
126
|
- lib/teapot/project.rb
|
127
|
+
- lib/teapot/repository.rb
|
127
128
|
- lib/teapot/substitutions.rb
|
128
129
|
- lib/teapot/target.rb
|
129
130
|
- lib/teapot/version.rb
|
@@ -133,7 +134,7 @@ files:
|
|
133
134
|
- test/test_environment.rb
|
134
135
|
- test/test_substitutions.rb
|
135
136
|
- test/test_teapot.rb
|
136
|
-
homepage:
|
137
|
+
homepage: http://www.kyusu.org
|
137
138
|
licenses: []
|
138
139
|
metadata: {}
|
139
140
|
post_install_message:
|