sprout 0.7.220-mswin32 → 0.7.221-mswin32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sprout might be problematic. Click here for more details.

data/lib/sprout.rb CHANGED
@@ -30,6 +30,7 @@ require 'rubygems/source_info_cache'
30
30
  require 'rubygems/version'
31
31
  require 'rubygems/digest/md5'
32
32
 
33
+ require 'sprout/tool_task_model'
33
34
  require 'sprout/project_model'
34
35
  require 'sprout/builder'
35
36
  require 'sprout/version'
@@ -21,6 +21,12 @@ module DynamicAccessors
21
21
  super
22
22
  @missing_params_hash = Hash.new
23
23
  end
24
+
25
+ def each_attribute
26
+ @missing_params_hash.each do |param|
27
+ yield param if block_given?
28
+ end
29
+ end
24
30
 
25
31
  def method_missing(method, *params, &block)
26
32
  if(method.to_s.match(/=$/))
@@ -56,6 +56,7 @@ module Sprout
56
56
  def self.define_task(args, &block)
57
57
  t = super
58
58
  if(t.is_a?(ToolTask))
59
+ t.find_and_resolve_model
59
60
  yield t if block_given?
60
61
  t.define
61
62
  t.prepare
@@ -98,6 +99,12 @@ module Sprout
98
99
  return @gem_path ||= @default_gem_path
99
100
  end
100
101
 
102
+ def each_param
103
+ params.each do |param|
104
+ yield param if block_given?
105
+ end
106
+ end
107
+
101
108
  # Create a string that can be turned into a file
102
109
  # that rdoc can parse to describe the customized
103
110
  # or generated task using param name, type and
@@ -198,7 +205,6 @@ module Sprout
198
205
 
199
206
  def execute(*args)
200
207
  display_preprocess_message
201
- #puts ">> Executing #{File.basename(exe)} #{to_shell}"
202
208
  exe = Sprout.get_executable(gem_name, gem_path, gem_version)
203
209
  User.execute(exe, to_shell)
204
210
  end
@@ -230,14 +236,30 @@ module Sprout
230
236
  params.each do |param|
231
237
  param.prepare
232
238
  end
239
+ prepare_prerequisites
240
+ end
241
+
242
+ def prepare_prerequisites
233
243
  # Ensure there are no duplicates in the prerequisite collection
234
244
  @prerequisites = prerequisites.uniq
235
245
  end
236
-
246
+
237
247
  def define
238
248
  resolve_libraries(prerequisites)
239
249
  end
240
250
 
251
+ # Look for a ToolTaskModel in the list
252
+ # of prerequisites. If found, apply
253
+ # any applicable params to self...
254
+ def find_and_resolve_model
255
+ prerequisites.each do |prereq|
256
+ instance = Rake::application[prereq]
257
+ if(instance.is_a?(ToolTaskModel))
258
+ resolve_model(instance)
259
+ end
260
+ end
261
+ end
262
+
241
263
  # The default file expression to append to each PathParam
242
264
  # in order to build file change prerequisites.
243
265
  #
@@ -247,7 +269,7 @@ module Sprout
247
269
  @default_file_expression ||= '/**/**/*'
248
270
  end
249
271
 
250
- protected
272
+ protected
251
273
 
252
274
  def initialize_task
253
275
  end
@@ -317,8 +339,6 @@ module Sprout
317
339
  end
318
340
  end
319
341
 
320
- protected
321
-
322
342
  def create_param(type)
323
343
  return eval("#{type.to_s.capitalize}Param.new")
324
344
  end
@@ -330,7 +350,7 @@ module Sprout
330
350
  def respond_to?(name)
331
351
  result = super
332
352
  if(!result)
333
- result = param_hash.has_key? name
353
+ result = param_hash.has_key? name.to_s
334
354
  end
335
355
  return result
336
356
  end
@@ -339,7 +359,7 @@ module Sprout
339
359
  name.gsub(/=$/, '')
340
360
  end
341
361
 
342
- def method_missing(name,*args)
362
+ def method_missing(name, *args)
343
363
  name = name.to_s
344
364
  cleaned = clean_name(name)
345
365
  if(!respond_to?(cleaned))
@@ -375,6 +395,14 @@ module Sprout
375
395
  def resolve_library(library_task)
376
396
  end
377
397
 
398
+ def resolve_model(model)
399
+ model.each_attribute do |key, value|
400
+ if(respond_to? key)
401
+ self.send("#{key}=", value)
402
+ end
403
+ end
404
+ end
405
+
378
406
  # If the provided path contains spaces, wrap it in quotes so that
379
407
  # shell tools won't choke on the spaces
380
408
  def clean_path(path)
@@ -55,7 +55,7 @@ module Sprout
55
55
  # this parameter.
56
56
  attr_writer :output
57
57
 
58
- def self.define_task(args, &block) # :nodoc:
58
+ def self.define_task(*args, &block) # :nodoc:
59
59
  t = super
60
60
  yield t if block_given?
61
61
  t.define
@@ -153,6 +153,6 @@ module Sprout
153
153
  end
154
154
  end
155
155
 
156
- def zip(args, &block)
156
+ def zip(*args, &block)
157
157
  Sprout::ZipTask.define_task(args, &block)
158
158
  end
@@ -0,0 +1,19 @@
1
+
2
+ module Sprout
3
+
4
+ class ToolTaskModel < Rake::FileTask
5
+ include DynamicAccessors
6
+
7
+ def self.define_task(args, &block)
8
+ t = super
9
+ yield t if block_given?
10
+ end
11
+
12
+ end
13
+
14
+
15
+ end
16
+
17
+ def tool_task_model(*args, &block)
18
+ Sprout::ToolTaskModel.define_task(args, &block)
19
+ end
@@ -3,7 +3,7 @@ module Sprout
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
5
  MINOR = 7
6
- TINY = 220
6
+ TINY = 221
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
9
9
  MAJOR_MINOR = [MAJOR, MINOR].join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.220
4
+ version: 0.7.221
5
5
  platform: mswin32
6
6
  authors:
7
7
  - Luke Bayes
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-28 00:00:00 -04:00
12
+ date: 2009-10-29 00:00:00 -04:00
13
13
  default_executable: sprout
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -123,6 +123,7 @@ files:
123
123
  - lib/sprout/tasks/tool_task.rb
124
124
  - lib/sprout/tasks/zip_task.rb
125
125
  - lib/sprout/template_resolver.rb
126
+ - lib/sprout/tool_task_model.rb
126
127
  - lib/sprout/user.rb
127
128
  - lib/sprout/version.rb
128
129
  - lib/sprout/version_file.rb