sprout 0.7.220-x86-darwin-10 → 0.7.223-x86-darwin-10
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/bin/sprout +5 -0
- data/lib/sprout/dynamic_accessors.rb +6 -0
- data/lib/sprout/tasks/tool_task.rb +35 -7
- data/lib/sprout/tasks/zip_task.rb +2 -2
- data/lib/sprout/tool_task_model.rb +19 -0
- data/lib/sprout/version.rb +1 -1
- data/lib/sprout.rb +8 -0
- metadata +3 -2
data/bin/sprout
CHANGED
@@ -43,6 +43,9 @@ Create a new ActionScript 3.0 project named 'SomeProject':
|
|
43
43
|
Create a new ActionScript 2.0 project named 'OtherProject':
|
44
44
|
#{File.basename($0)} -n as2 OtherProject
|
45
45
|
|
46
|
+
Create a new MXML project named 'SomeProject':
|
47
|
+
#{File.basename($0)} -n mxml SomeProject
|
48
|
+
|
46
49
|
Remove all Sprout gems and cached files:
|
47
50
|
#{File.basename($0)} -R
|
48
51
|
|
@@ -88,6 +91,8 @@ BANNER
|
|
88
91
|
OPTIONS[:project_name] = ARGV.pop
|
89
92
|
if(OPTIONS[:project_name] == "=")
|
90
93
|
fail_with(opts, "Invalid project name #{OPTIONS[:project_name]}")
|
94
|
+
elsif(OPTIONS[:project_name] =~ /Test$/)
|
95
|
+
fail_with(opts, "Your project name should not match /Test$/ as this will quickly cause problems when generating test cases and test suites")
|
91
96
|
end
|
92
97
|
else
|
93
98
|
fail_with(opts, "You must provide a sprout name argument such as, '-n as2' or '-n as3'")
|
@@ -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
|
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
|
data/lib/sprout/version.rb
CHANGED
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'
|
@@ -425,9 +426,16 @@ EOF
|
|
425
426
|
end
|
426
427
|
|
427
428
|
def self.project_name=(name) # :nodoc:
|
429
|
+
validate_name(name)
|
428
430
|
@@project_name = name
|
429
431
|
end
|
430
432
|
|
433
|
+
def self.validate_name(name)
|
434
|
+
if(name =~ /Test$/)
|
435
|
+
raise UsageError.new('Your project name should not include Test as this will cause problems when generating test cases and test suites')
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
431
439
|
# Return the current project_name assuming someone has already set it, otherwise return an empty string
|
432
440
|
def self.project_name
|
433
441
|
@@project_name ||= ''
|
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.
|
4
|
+
version: 0.7.223
|
5
5
|
platform: x86-darwin-10
|
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-
|
12
|
+
date: 2009-10-30 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
|