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 CHANGED
@@ -46,43 +46,53 @@ task :fetch do
46
46
 
47
47
  destination_path = record.destination_path
48
48
 
49
- puts "Fetching #{record}...".color(:cyan)
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
- branch = record.options.fetch(:version, 'master')
60
+ branch = record.options.fetch(:version, 'master')
52
61
 
53
- unless File.exist? destination_path
54
- puts "Cloning package at path #{destination_path} ...".color(:cyan)
55
- FileUtils.mkdir_p(destination_path.to_s)
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
- source_uri = URI record.uri
66
+ source_uri = URI record.uri
58
67
 
59
- unless source_uri.absolute?
60
- source_uri = base_uri + source_uri
61
- end
68
+ unless source_uri.absolute?
69
+ source_uri = base_uri + source_uri
70
+ end
62
71
 
63
- # Git can't handle the default formatting that Ruby uses for file URIs.
64
- if source_uri.scheme == "file"
65
- source_uri = "file://" + source_uri.path
66
- end
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
- Teapot::Commands.run("git", "clone", source_uri, destination_path, "--branch", branch)
77
+ Teapot::Commands.run("git", "clone", source_uri, destination_path, "--branch", branch)
69
78
 
70
- Dir.chdir(destination_path) do
71
- Teapot::Commands.run("git", "submodule", "update", "--init", "--recursive")
72
- end
73
- else
74
- puts "Updating package at path #{destination_path} ...".color(:cyan)
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
- Dir.chdir(destination_path) do
77
- Teapot::Commands.run("git", "fetch", "origin")
85
+ Dir.chdir(destination_path) do
86
+ Teapot::Commands.run("git", "fetch", "origin")
78
87
 
79
- Teapot::Commands.run("git", "checkout", branch)
88
+ Teapot::Commands.run("git", "checkout", branch)
80
89
 
81
- # Pull any changes, if you might get the error from above:
82
- # Your branch is behind 'origin/0.1' by 1 commit, and can be fast-forwarded.
83
- Teapot::Commands.run("git", "pull")
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
- Teapot::Commands.run("git", "submodule", "update", "--init", "--recursive")
94
+ Teapot::Commands.run("git", "submodule", "update", "--init", "--recursive")
95
+ end
86
96
  end
87
97
  end
88
98
  end
@@ -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
- teapot_path = File.join(root, "Teapot")
174
+ yield config if block_given?
167
175
 
168
- if File.exist? teapot_path
169
- config.instance_eval(File.read(teapot_path), teapot_path)
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
- load(root, options)
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
@@ -110,7 +110,7 @@ module Teapot
110
110
  )
111
111
 
112
112
  local_build = environment.merge do
113
- default build_prefix "build-#{platform.name}-#{variant}"
113
+ default build_prefix "build/cache/#{platform.name}-#{config[:variant]}"
114
114
  default install_prefix platform.prefix
115
115
 
116
116
  buildflags [
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Teapot
22
- VERSION = "0.2.2"
22
+ VERSION = "0.3.1"
23
23
  end
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.2.2
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-20 00:00:00.000000000 Z
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: -4088469736954378212
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: -4088469736954378212
113
+ hash: 906117529996691770
114
114
  requirements: []
115
115
  rubyforge_project:
116
116
  rubygems_version: 1.8.24