teapot 0.8.0 → 0.8.1

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
- MmVkOTU2MGZiOTZlZThlMWI2NzkzNzFhNDRjNzQ1YWUwMThiMmQ0Mw==
4
+ YjBiNDRhMDhhMjJiYzRhYmZlMDg3ZTM0ZTIwOTY0MmViNzllODA3Mg==
5
5
  data.tar.gz: !binary |-
6
- ZWI3ZjVhZTQ2Nzk1NDlkNDgzNzM4YTVmMjc2YTFkOTEwMzgxOGQ1ZA==
6
+ NTBhNjgxOTg4OWRiYTY5ZjA5Y2ZhZmQwYTI5YTQzYTEzYzY1ZDkxOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MmZjOWRhYWU0OTlkYjg5Y2U0Y2Q2NWY4NDZmMzIyODEyMjNjNGJmZGJlM2Vj
10
- MGM2ZWI3ZWZlM2Y3NWU2YWNmYmJkNDExMDFhMDQ1ZjhkOWJmYjgyMGJhZjE3
11
- MDUyMjMxN2VlNGE5MTIwZDU0NmZlZmIyZTJlZGM0YjJmYTI4Nzg=
9
+ YmFlN2NmMjRjYmMwZGYyNzJlZWI4MjVjNDZiNjVkOTc2NmI4OTA1MzdmNWFj
10
+ MzkzYjE3ZjY4NjRlNjNlZGIwOTYxYmFhZTJmYmNhNDU0NjYzZGY0ZGM2OTRl
11
+ NGIwYjA1MWVlY2YyODgwMGJkNWMzZDNkZjUyZDJhY2E3YjBlMTk=
12
12
  data.tar.gz: !binary |-
13
- OWU0OTIzYTc4YmRkN2M2OTE2NmU4ZmRkMWMxYWFiYThjMTg0OTA0ZGJlYWNi
14
- NmQ3NDQzNDdiNzE3NjMxY2IyNDEyYzM3NDdlNmJjOTc0MWFhNGIwZjcyNjlj
15
- ZmQxZDM4NzJmY2FkMjhjODBkYzI0MjVhZWMyYzgxNTI3MTMwZDA=
13
+ YWU4YjJhZjE5NWRlZjRmZTAxNjVlOWIzMmMxMGMzZDgxNzQ5YWJhZGM2MzRm
14
+ N2Q4YmUyY2QyNGM3MWRkM2UwOTdlM2ZlYjEwODI0NTQ4NjBlNGE4ODczNzEy
15
+ ZmU3YmM4NTNmMjYxN2YxZThiNjVkZWZlZmM2YTA0ZTYxNDliYTQ=
data/bin/teapot CHANGED
@@ -29,12 +29,13 @@ require 'teapot/controller/generate'
29
29
  require 'teapot/controller/list'
30
30
  require 'teapot/controller/run'
31
31
 
32
- require 'benchmark'
32
+ require 'time'
33
33
  require 'trollop'
34
34
 
35
35
  OPTIONS = Trollop::options do
36
36
  opt :only, "Only compiled direct dependencies."
37
37
  opt :in, "Work in the given directory.", :type => :string
38
+ opt :unlock, "Don't use package lockfile when fetching."
38
39
 
39
40
  opt :configuration, "Specify a specific build configuration.", :type => :string
40
41
  end
@@ -94,24 +95,45 @@ module Application
94
95
  end
95
96
  end
96
97
 
98
+ def track_time
99
+ start_time = Time.now
100
+
101
+ yield
102
+
103
+ ensure
104
+ end_time = Time.now
105
+ elapsed_time = end_time - start_time
106
+
107
+ $stdout.flush
108
+ $stderr.puts ("Elapsed Time: %0.3fs" % elapsed_time).color(:magenta)
109
+ end
110
+
97
111
  valid_actions = (Application.public_methods - Module.methods).collect(&:to_s)
98
112
  action = ARGV.shift
99
113
 
100
114
  # Check that the command was invoked correctly...
101
115
  unless action and valid_actions.include?(action)
102
116
  puts "You must specify an action from: #{valid_actions.join(', ')}".color(:red)
117
+
103
118
  exit -1
104
119
  end
105
120
 
106
- time = Benchmark.measure do
121
+ track_time do
107
122
  begin
108
123
  Application.send(action.to_sym)
109
124
  rescue Teapot::NonexistantTeapotError => error
110
125
  $stderr.puts error.message.color(:red)
126
+
127
+ exit -2
111
128
  rescue Teapot::IncompatibleTeapotError => error
112
129
  $stderr.puts error.message.color(:red)
130
+ $stderr.puts "Supported minimum version #{Teapot::MINIMUM_LOADER_VERSION.dump} to #{Teapot::LOADER_VERSION.dump}."
131
+
132
+ exit -3
113
133
  rescue Teapot::Commands::CommandError => error
114
134
  $stderr.puts error.message.color(:red)
135
+
136
+ exit -4
115
137
  rescue Teapot::Dependency::UnresolvedDependencyError => error
116
138
  $stderr.puts "Unresolved dependencies:"
117
139
 
@@ -128,8 +150,7 @@ time = Benchmark.measure do
128
150
  end
129
151
 
130
152
  $stderr.puts "Cannot continue due to unresolved dependencies!".color(:red)
153
+
154
+ exit -5
131
155
  end
132
156
  end
133
-
134
- $stdout.flush
135
- $stderr.puts time.format("Elapsed Time: %r").color(:magenta)
@@ -154,7 +154,8 @@ module Teapot
154
154
  packages.collect do |package|
155
155
  begin
156
156
  definitions = load(package)
157
- rescue NonexistantTeapotError
157
+ rescue NonexistantTeapotError, IncompatibleTeapotError
158
+ # If the package doesn't exist or the teapot version is too old, it failed:
158
159
  failed_to_load << package
159
160
  end
160
161
  end
@@ -86,7 +86,11 @@ module Teapot
86
86
  destination_path.make_symlink(local_path)
87
87
  end
88
88
  elsif package.external?
89
- package_lock = lock_store.transaction(true){|store| store[package.name]}
89
+ package_lock = nil
90
+
91
+ unless @options[:unlock]
92
+ package_lock = lock_store.transaction(true){|store| store[package.name]}
93
+ end
90
94
 
91
95
  log "Fetching #{package}...".color(:cyan)
92
96
 
@@ -70,6 +70,8 @@ module Teapot
70
70
  end
71
71
  rescue NonexistantTeapotError => error
72
72
  log "\t#{error.message}".color(:red)
73
+ rescue IncompatibleTeapotError => error
74
+ log "\t#{error.message}".color(:red)
73
75
  end
74
76
  end
75
77
  end
@@ -22,7 +22,7 @@ require 'teapot/controller'
22
22
 
23
23
  module Teapot
24
24
  class Controller
25
- def run(dependency_names)
25
+ def run(dependency_names = [])
26
26
  configuration = context.configuration
27
27
 
28
28
  log "Running configuration #{configuration[:run].inspect}"
@@ -30,8 +30,8 @@ module Teapot
30
30
  MINIMUM_LOADER_VERSION = "0.8"
31
31
 
32
32
  class IncompatibleTeapotError < StandardError
33
- def initialize(version)
34
- super "Version #{version} isn't compatible with current loader! Minimum supported version: #{MINIMUM_LOADER_VERSION}; Current version: #{LOADER_VERSION}."
33
+ def initialize(package, version)
34
+ super "Unsupported teapot_version #{version} in #{package.path}!"
35
35
  end
36
36
 
37
37
  attr :version
@@ -39,7 +39,7 @@ module Teapot
39
39
 
40
40
  class NonexistantTeapotError < StandardError
41
41
  def initialize(path)
42
- super "Could not load #{path}!"
42
+ super "Could not read file at #{path}!"
43
43
  end
44
44
 
45
45
  attr :path
@@ -74,7 +74,7 @@ module Teapot
74
74
  if version >= MINIMUM_LOADER_VERSION && version <= LOADER_VERSION
75
75
  @version = version
76
76
  else
77
- raise IncompatibleTeapotError.new(version)
77
+ raise IncompatibleTeapotError.new(package, version)
78
78
  end
79
79
  end
80
80
 
@@ -128,7 +128,7 @@ module Teapot
128
128
  self.instance_eval(absolute_path.read, absolute_path.to_s)
129
129
 
130
130
  if @version == nil
131
- raise IncompatibleTeapotError.new("<unspecified>")
131
+ raise IncompatibleTeapotError.new(@package, "<unspecified>")
132
132
  end
133
133
  end
134
134
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Teapot
22
- VERSION = "0.8.0"
22
+ VERSION = "0.8.1"
23
23
  end
@@ -3,7 +3,7 @@
3
3
  # This file is part of the "Teapot" project, and is released under the MIT license.
4
4
  #
5
5
 
6
- required_version "0.7"
6
+ teapot_version "0.8"
7
7
 
8
8
  define_configuration 'test' do |configuration|
9
9
  configuration.public!
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.8.0
4
+ version: 0.8.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-05-07 00:00:00.000000000 Z
11
+ date: 2013-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow