teapot 0.7.5 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmNjNzk5MTgwZmJlNDE4NzEwY2I2MTdkY2U1M2M5MjRlNGUzYjM1Yw==
4
+ MmVkOTU2MGZiOTZlZThlMWI2NzkzNzFhNDRjNzQ1YWUwMThiMmQ0Mw==
5
5
  data.tar.gz: !binary |-
6
- NTQ4MTAyMTJjMzk4ZjgzYzEwMDhlYWE2ZjMwNjMxM2FlZjdiMDg2OA==
6
+ ZWI3ZjVhZTQ2Nzk1NDlkNDgzNzM4YTVmMjc2YTFkOTEwMzgxOGQ1ZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NjFjZTI5YjJiY2JmMjk3NGQxMzkwMTg0YjUxMTQ0YjJhYzI2YTUxNDA3ZGI5
10
- OWM1MzNmNDRiODNkODJiNzU4NTIyOWYyOWVhMmM3NzE5MDRhZDA4NTFhNzMw
11
- ZjliYWE5MGZhZWIyMzAyYmQyOWE4MmI1NGE0ZWU3MjZlZTk2N2M=
9
+ MmZjOWRhYWU0OTlkYjg5Y2U0Y2Q2NWY4NDZmMzIyODEyMjNjNGJmZGJlM2Vj
10
+ MGM2ZWI3ZWZlM2Y3NWU2YWNmYmJkNDExMDFhMDQ1ZjhkOWJmYjgyMGJhZjE3
11
+ MDUyMjMxN2VlNGE5MTIwZDU0NmZlZmIyZTJlZGM0YjJmYTI4Nzg=
12
12
  data.tar.gz: !binary |-
13
- Yzk0YWZlNDU1ODQ1OGZjNWI2YzAzYmQ5MzgxZTc3YWE2YWM1N2RjNTg1YTI1
14
- N2Q5MWNlZGY5NzFlODczZmVhZmM1YTNkMzRkOTZjYTlkMTJlMGE0OGJiZDM2
15
- YjhmMDFkOWVkODIzYjJlOGViMTI3NjlmOWZhNjc2NDdiMzRlNDc=
13
+ OWU0OTIzYTc4YmRkN2M2OTE2NmU4ZmRkMWMxYWFiYThjMTg0OTA0ZGJlYWNi
14
+ NmQ3NDQzNDdiNzE3NjMxY2IyNDEyYzM3NDdlNmJjOTc0MWFhNGIwZjcyNjlj
15
+ ZmQxZDM4NzJmY2FkMjhjODBkYzI0MjVhZWMyYzgxNTI3MTMwZDA=
data/bin/teapot CHANGED
@@ -27,6 +27,7 @@ require 'teapot/controller/create'
27
27
  require 'teapot/controller/fetch'
28
28
  require 'teapot/controller/generate'
29
29
  require 'teapot/controller/list'
30
+ require 'teapot/controller/run'
30
31
 
31
32
  require 'benchmark'
32
33
  require 'trollop'
@@ -53,12 +54,14 @@ module Application
53
54
  make_controller.fetch
54
55
  end
55
56
 
56
- def self.build
57
- targets = ARGV
58
-
57
+ def self.build(targets = ARGV)
59
58
  make_controller.build(targets)
60
59
  end
61
60
 
61
+ def self.run(targets = ARGV)
62
+ make_controller.run(targets)
63
+ end
64
+
62
65
  def self.list
63
66
  make_controller.list
64
67
  end
@@ -33,10 +33,10 @@ module Teapot
33
33
  class Configuration < Definition
34
34
  Import = Struct.new(:name, :options)
35
35
 
36
- def initialize(context, package, name, packages = Set.new)
36
+ def initialize(context, package, name, packages = Set.new, options = {})
37
37
  super context, package, name
38
38
 
39
- @options = {}
39
+ @options = options
40
40
 
41
41
  @packages = packages
42
42
  @imports = []
@@ -140,7 +140,7 @@ module Teapot
140
140
  @packages.each{|package| @context.load(package) rescue nil}
141
141
 
142
142
  # Create a new configuration which will represent the materialised version:
143
- configuration = self.class.new(@context, @package, @name, @packages.dup)
143
+ configuration = self.class.new(@context, @package, @name, @packages.dup, @options.dup)
144
144
 
145
145
  # Enumerate all imports and attempt to resolve the packages:
146
146
  @imports.each do |import|
@@ -32,14 +32,16 @@ module Teapot
32
32
  end
33
33
 
34
34
  ordered.each do |(target, dependency)|
35
- log "Building #{target.name} for dependency #{dependency}...".color(:cyan)
36
-
37
35
  if target.respond_to?(:build!) and !@options[:dry]
36
+ log "Building #{target.name} for dependency #{dependency}...".color(:cyan)
37
+
38
38
  target.build!(context.configuration)
39
39
  end
40
40
  end
41
41
 
42
42
  log "Completed build successfully.".color(:green)
43
+
44
+ return chain, ordered
43
45
  end
44
46
  end
45
47
  end
@@ -114,12 +114,12 @@ module Teapot
114
114
 
115
115
  Commands.run("git", "clone", external_url, destination_path, "--branch", branch)
116
116
 
117
- # Checkout the specific version if it was given:
118
- if package_lock
119
- Commands.run("git", "reset", "--hard", package_lock[:commit])
120
- end
121
-
122
117
  Dir.chdir(destination_path) do
118
+ # Checkout the specific version if it was given:
119
+ if package_lock
120
+ Commands.run("git", "reset", "--hard", package_lock[:commit])
121
+ end
122
+
123
123
  Commands.run("git", "submodule", "update", "--init", "--recursive")
124
124
  end
125
125
  rescue
@@ -0,0 +1,49 @@
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/controller'
22
+
23
+ module Teapot
24
+ class Controller
25
+ def run(dependency_names)
26
+ configuration = context.configuration
27
+
28
+ log "Running configuration #{configuration[:run].inspect}"
29
+
30
+ chain, ordered = build(configuration[:run] + dependency_names)
31
+
32
+ ordered.each do |(target, dependency)|
33
+ if target.respond_to?(:run!) and !@options[:dry]
34
+ log "Running #{target.name} for dependency #{dependency}...".color(:cyan)
35
+
36
+ target.run!(configuration)
37
+ end
38
+ end
39
+ end
40
+
41
+ def invoke(environment, command)
42
+ binary_path = environment[:install_prefix]
43
+
44
+ Dir.chdir(binary_path.to_s) do
45
+ Commands.run(*command)
46
+ end
47
+ end
48
+ end
49
+ end
data/lib/teapot/loader.rb CHANGED
@@ -26,8 +26,8 @@ require 'teapot/name'
26
26
  require 'teapot/build'
27
27
 
28
28
  module Teapot
29
- LOADER_VERSION = "0.7"
30
- MINIMUM_LOADER_VERSION = "0.7"
29
+ LOADER_VERSION = "0.8"
30
+ MINIMUM_LOADER_VERSION = "0.8"
31
31
 
32
32
  class IncompatibleTeapotError < StandardError
33
33
  def initialize(version)
data/lib/teapot/target.rb CHANGED
@@ -40,11 +40,7 @@ module Teapot
40
40
  Build.top(@path)
41
41
  end
42
42
 
43
- def build(&block)
44
- @build = Proc.new(&block)
45
- end
46
-
47
- def build_environment(configuration)
43
+ def environment_for_configuration(configuration)
48
44
  # Reduce the number of keystrokes for good health:
49
45
  context = configuration.context
50
46
 
@@ -73,12 +69,39 @@ module Teapot
73
69
  end
74
70
  end
75
71
 
72
+ def build(&block)
73
+ if block_given?
74
+ @build = Proc.new(&block)
75
+ end
76
+
77
+ return @build
78
+ end
79
+
76
80
  def build!(configuration)
77
81
  return unless @build
78
82
 
79
- local_environment = build_environment(configuration)
83
+ local_environment = environment_for_configuration(configuration)
80
84
 
81
85
  @build.call(local_environment)
82
86
  end
87
+
88
+ # Specify a default block which is used to run the configuration.
89
+ def run(&block)
90
+ if block_given?
91
+ @run = block
92
+ end
93
+
94
+ return @run
95
+ end
96
+
97
+ def run!(configuration)
98
+ return unless @run
99
+
100
+ local_environment = environment_for_configuration(configuration)
101
+
102
+ if @run
103
+ @run.call(local_environment)
104
+ end
105
+ end
83
106
  end
84
107
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Teapot
22
- VERSION = "0.7.5"
22
+ VERSION = "0.8.0"
23
23
  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: 0.7.5
4
+ version: 0.8.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: 2013-05-05 00:00:00.000000000 Z
11
+ date: 2013-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -106,6 +106,7 @@ files:
106
106
  - lib/teapot/controller/fetch.rb
107
107
  - lib/teapot/controller/generate.rb
108
108
  - lib/teapot/controller/list.rb
109
+ - lib/teapot/controller/run.rb
109
110
  - lib/teapot/definition.rb
110
111
  - lib/teapot/dependency.rb
111
112
  - lib/teapot/environment.rb