teapot 0.2.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/teapot +36 -26
- data/lib/teapot/config.rb +19 -5
- data/lib/teapot/package.rb +1 -1
- data/lib/teapot/version.rb +1 -1
- metadata +4 -4
data/bin/teapot
CHANGED
@@ -46,43 +46,53 @@ task :fetch do
|
|
46
46
|
|
47
47
|
destination_path = record.destination_path
|
48
48
|
|
49
|
-
|
49
|
+
if record.local?
|
50
|
+
puts "Linking local #{record}...".color(:cyan)
|
51
|
+
|
52
|
+
local_path = config.root + record.options[:local]
|
53
|
+
|
54
|
+
unless File.exist? destination_path
|
55
|
+
FileUtils.ln_s local_path, destination_path
|
56
|
+
end
|
57
|
+
else
|
58
|
+
puts "Fetching #{record}...".color(:cyan)
|
50
59
|
|
51
|
-
|
60
|
+
branch = record.options.fetch(:version, 'master')
|
52
61
|
|
53
|
-
|
54
|
-
|
55
|
-
|
62
|
+
unless File.exist? destination_path
|
63
|
+
puts "Cloning package at path #{destination_path} ...".color(:cyan)
|
64
|
+
FileUtils.mkdir_p(destination_path.to_s)
|
56
65
|
|
57
|
-
|
66
|
+
source_uri = URI record.uri
|
58
67
|
|
59
|
-
|
60
|
-
|
61
|
-
|
68
|
+
unless source_uri.absolute?
|
69
|
+
source_uri = base_uri + source_uri
|
70
|
+
end
|
62
71
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
72
|
+
# Git can't handle the default formatting that Ruby uses for file URIs.
|
73
|
+
if source_uri.scheme == "file"
|
74
|
+
source_uri = "file://" + source_uri.path
|
75
|
+
end
|
67
76
|
|
68
|
-
|
77
|
+
Teapot::Commands.run("git", "clone", source_uri, destination_path, "--branch", branch)
|
69
78
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
79
|
+
Dir.chdir(destination_path) do
|
80
|
+
Teapot::Commands.run("git", "submodule", "update", "--init", "--recursive")
|
81
|
+
end
|
82
|
+
else
|
83
|
+
puts "Updating package at path #{destination_path} ...".color(:cyan)
|
75
84
|
|
76
|
-
|
77
|
-
|
85
|
+
Dir.chdir(destination_path) do
|
86
|
+
Teapot::Commands.run("git", "fetch", "origin")
|
78
87
|
|
79
|
-
|
88
|
+
Teapot::Commands.run("git", "checkout", branch)
|
80
89
|
|
81
|
-
|
82
|
-
|
83
|
-
|
90
|
+
# Pull any changes, if you might get the error from above:
|
91
|
+
# Your branch is behind 'origin/0.1' by 1 commit, and can be fast-forwarded.
|
92
|
+
Teapot::Commands.run("git", "pull")
|
84
93
|
|
85
|
-
|
94
|
+
Teapot::Commands.run("git", "submodule", "update", "--init", "--recursive")
|
95
|
+
end
|
86
96
|
end
|
87
97
|
end
|
88
98
|
end
|
data/lib/teapot/config.rb
CHANGED
@@ -57,6 +57,10 @@ module Teapot
|
|
57
57
|
@klass == FakePackage
|
58
58
|
end
|
59
59
|
|
60
|
+
def local?
|
61
|
+
@options.key? :local
|
62
|
+
end
|
63
|
+
|
60
64
|
def load(context)
|
61
65
|
if @klass == FakePackage
|
62
66
|
context.packages[@name] = @klass.new(@context, self, @name)
|
@@ -160,14 +164,17 @@ module Teapot
|
|
160
164
|
@packages << Record.new(self, FakePackage, name, options)
|
161
165
|
end
|
162
166
|
|
167
|
+
def load(teapot_path)
|
168
|
+
instance_eval File.read(teapot_path), teapot_path
|
169
|
+
end
|
170
|
+
|
163
171
|
def self.load(root, options = {})
|
164
172
|
config = new(root, options)
|
165
173
|
|
166
|
-
|
174
|
+
yield config if block_given?
|
167
175
|
|
168
|
-
|
169
|
-
|
170
|
-
end
|
176
|
+
teapot_path = File.join(root, "Teapot")
|
177
|
+
config.load(teapot_path) if File.exist? teapot_path
|
171
178
|
|
172
179
|
return config
|
173
180
|
end
|
@@ -175,7 +182,14 @@ module Teapot
|
|
175
182
|
def self.load_default(root = Dir.getwd, options = {})
|
176
183
|
options.merge!(:variant => ENV['TEAPOT_VARIANT'])
|
177
184
|
|
178
|
-
|
185
|
+
# Load project specific Teapot file
|
186
|
+
load(root, options) do |config|
|
187
|
+
user_path = File.expand_path("~/.Teapot")
|
188
|
+
|
189
|
+
if File.exist? user_path
|
190
|
+
config.load(user_path)
|
191
|
+
end
|
192
|
+
end
|
179
193
|
end
|
180
194
|
end
|
181
195
|
end
|
data/lib/teapot/package.rb
CHANGED
@@ -110,7 +110,7 @@ module Teapot
|
|
110
110
|
)
|
111
111
|
|
112
112
|
local_build = environment.merge do
|
113
|
-
default build_prefix "build
|
113
|
+
default build_prefix "build/cache/#{platform.name}-#{config[:variant]}"
|
114
114
|
default install_prefix platform.prefix
|
115
115
|
|
116
116
|
buildflags [
|
data/lib/teapot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teapot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -101,7 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
segments:
|
103
103
|
- 0
|
104
|
-
hash:
|
104
|
+
hash: 906117529996691770
|
105
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
version: '0'
|
111
111
|
segments:
|
112
112
|
- 0
|
113
|
-
hash:
|
113
|
+
hash: 906117529996691770
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
116
|
rubygems_version: 1.8.24
|