sprout 0.7.171 → 0.7.182
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 +7 -4
- data/lib/sprout/generator/named_base.rb +12 -1
- data/lib/sprout/project_model.rb +110 -9
- data/lib/sprout/tasks/tool_task.rb +11 -2
- data/lib/sprout/version.rb +1 -1
- metadata +3 -2
data/lib/sprout.rb
CHANGED
@@ -69,7 +69,7 @@ module Sprout
|
|
69
69
|
# == Sprout
|
70
70
|
#
|
71
71
|
# Tools, Libraries and Bundles are distributed as RubyGems and given a specific gem name suffix. For some examples:
|
72
|
-
# sprout-
|
72
|
+
# sprout-flex3sdk-tool
|
73
73
|
# sprout-asunit-library
|
74
74
|
# sprout-as3-bundle
|
75
75
|
#
|
@@ -230,7 +230,7 @@ EOF
|
|
230
230
|
# * +archive_path+ Optional parameter for tools that contain more than one executable, or for
|
231
231
|
# when you don't want to use the default executable presented by the tool. For example, the Flex 2 SDK
|
232
232
|
# has many executables, when this method is called for them, one might use something like:
|
233
|
-
# Sprout::Sprout.get_executable('sprout-
|
233
|
+
# Sprout::Sprout.get_executable('sprout-flex3sdk-tool', 'bin/mxmlc')
|
234
234
|
# * +version+ Optional parameter to specify a particular gem version for this executable
|
235
235
|
def self.get_executable(name, archive_path=nil, version=nil)
|
236
236
|
target = self.sprout(name, version)
|
@@ -238,7 +238,7 @@ EOF
|
|
238
238
|
# If caller sent in a relative path to an executable (e.g., bin/mxmlc), use it
|
239
239
|
exe = File.join(target.installed_path, archive_path)
|
240
240
|
if(User.new.is_a?(WinUser) && !archive_path.match(/.exe$/))
|
241
|
-
# If we're on Win (even Cygwin), add .exe to support custom binaries (see sprout-
|
241
|
+
# If we're on Win (even Cygwin), add .exe to support custom binaries (see sprout-flex3sdk-tool)
|
242
242
|
exe << '.exe'
|
243
243
|
end
|
244
244
|
elsif(target.url)
|
@@ -414,11 +414,14 @@ EOF
|
|
414
414
|
# of that rakefile should be returned.
|
415
415
|
# If no rakefile is found, it should return Dir.pwd
|
416
416
|
def self.project_path
|
417
|
-
@@project_path ||= get_implicit_project_path(Dir.pwd)
|
417
|
+
@@project_path ||= self.project_path = get_implicit_project_path(Dir.pwd)
|
418
418
|
end
|
419
419
|
|
420
420
|
# Return the rakefile in the current +project_path+
|
421
421
|
def self.project_rakefile
|
422
|
+
if(!defined?(@@project_rakefile))
|
423
|
+
path = project_path
|
424
|
+
end
|
422
425
|
return @@project_rakefile ||= nil
|
423
426
|
end
|
424
427
|
|
@@ -108,11 +108,22 @@ module Sprout
|
|
108
108
|
def full_test_dir
|
109
109
|
@full_test_dir ||= full_class_dir.gsub(src_dir, test_dir)
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
# Filesystem path to the TestCase file
|
113
113
|
def full_test_case_path
|
114
114
|
@full_test_case_path ||= File.join(full_test_dir, test_case_name + '.as')
|
115
115
|
end
|
116
|
+
|
117
|
+
# Path to the in-project generate script
|
118
|
+
# pulled out for DOS branching
|
119
|
+
def generate_script_path
|
120
|
+
usr = User.new
|
121
|
+
if(usr.is_a?(WinUser) && !usr.is_a?(CygwinUser))
|
122
|
+
return File.join(class_name, 'script', "generate.rb")
|
123
|
+
else
|
124
|
+
return File.join(class_name, 'script', "generate")
|
125
|
+
end
|
126
|
+
end
|
116
127
|
|
117
128
|
def instance_name
|
118
129
|
name = class_name.dup;
|
data/lib/sprout/project_model.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
|
2
2
|
module Sprout
|
3
|
-
|
4
3
|
# The ProjectModel gives you a place to describe your project so that you
|
5
4
|
# don't need to repeat yourself throughout a rakefile.
|
6
5
|
#
|
@@ -17,13 +16,42 @@ module Sprout
|
|
17
16
|
# end
|
18
17
|
#
|
19
18
|
class ProjectModel < Hash
|
20
|
-
|
19
|
+
|
20
|
+
@@DEFAULT_TEST_WIDTH = 1000
|
21
|
+
@@DEFAULT_TEST_HEIGHT = 550
|
22
|
+
|
21
23
|
# Relative path to the folder where compile time assets will be stored
|
22
24
|
attr_accessor :asset_dir
|
23
25
|
# The folder where binary files will be created. Usually this is where any build artifacts like SWF files get placed.
|
24
26
|
attr_accessor :bin_dir
|
25
|
-
# The
|
26
|
-
|
27
|
+
# The Background Color of the SWF file
|
28
|
+
attr_accessor :background_color
|
29
|
+
# Contributors to the SWF file
|
30
|
+
attr_accessor :contributors
|
31
|
+
# If you don't want to use the default compiler for your language
|
32
|
+
# set it manually here.
|
33
|
+
# Possible values are:
|
34
|
+
# * sprout-flex2sdk-tool
|
35
|
+
# * sprout-flex3sdk-tool
|
36
|
+
# * sprout-mtasc-tool
|
37
|
+
attr_accessor :compiler_gem_name
|
38
|
+
# The version number of the compiler gem to use
|
39
|
+
attr_accessor :compiler_gem_version
|
40
|
+
# The primary creator of the SWF file
|
41
|
+
attr_accessor :creator
|
42
|
+
# Directory where documentation should be placed.
|
43
|
+
attr_accessor :doc_dir
|
44
|
+
# CSS documents that should be individually compiled
|
45
|
+
# for runtime stylesheet loading.
|
46
|
+
attr_accessor :external_css
|
47
|
+
# The default frame rate of the SWF file
|
48
|
+
attr_accessor :frame_rate
|
49
|
+
# The default height of the SWF file
|
50
|
+
# _(This value is overridden when embedded in an HTML page)_
|
51
|
+
attr_accessor :height
|
52
|
+
# The technology language that is being used, right now this value can be 'as2', 'as3' or 'mxml'.
|
53
|
+
# Code generators take advantage of this setting to determine which templates to use
|
54
|
+
# and build tasks use this setting to determin the input file suffix (.as or .mxml).
|
27
55
|
attr_accessor :language
|
28
56
|
# The relative path to your library directory. Defaults to 'lib'
|
29
57
|
#
|
@@ -31,6 +59,19 @@ module Sprout
|
|
31
59
|
# into this directory. Source libraries will be placed in a folder that matches the library name,
|
32
60
|
# while SWCs will be simply placed directly into the lib_dir.
|
33
61
|
attr_accessor :lib_dir
|
62
|
+
# Array of sprout library symbols
|
63
|
+
attr_accessor :libraries
|
64
|
+
# The Array of SWC paths to add to all compilation tasks
|
65
|
+
attr_accessor :library_path
|
66
|
+
# The locale for the SWF file
|
67
|
+
attr_accessor :locale
|
68
|
+
# A collection of Flex Module root source files. If this collection
|
69
|
+
# has items added to it, the deploy task will generate a 'link_report' from
|
70
|
+
# the main application compilation and then consume it as 'load_externs' for
|
71
|
+
# each module compilation.
|
72
|
+
attr_accessor :modules
|
73
|
+
# Organization responsible for this SWF file
|
74
|
+
attr_accessor :organization
|
34
75
|
# The production file that this Project will generate
|
35
76
|
attr_accessor :output
|
36
77
|
# The real name of the project, usually capitalized like a class name 'SomeProject'
|
@@ -39,17 +80,27 @@ module Sprout
|
|
39
80
|
attr_accessor :skin_dir
|
40
81
|
# The skin file that will be generated
|
41
82
|
attr_accessor :skin_output
|
83
|
+
# The Array of source paths to add to all compilation tasks
|
84
|
+
# _Do not add task-specific paths (like lib/asunit) to this value_
|
85
|
+
attr_accessor :source_path
|
42
86
|
# The relative path to your main source directory. Defaults to 'src'
|
43
87
|
attr_accessor :src_dir
|
88
|
+
# Enforce strict type checking
|
89
|
+
attr_accessor :strict
|
44
90
|
# The relative path to the directory where swc files should be kept.
|
45
91
|
# This value defaults to lib_dir
|
46
92
|
attr_accessor :swc_dir
|
47
|
-
# Directory where documentation should be placed.
|
48
|
-
attr_accessor :doc_dir
|
49
93
|
# Relative path to the folder that contains your test cases
|
50
94
|
attr_accessor :test_dir
|
51
95
|
# The test executable
|
52
96
|
attr_accessor :test_output
|
97
|
+
# The test runner SWF width
|
98
|
+
attr_writer :test_width
|
99
|
+
# The test runner SWF height
|
100
|
+
attr_writer :test_height
|
101
|
+
# The default width of the SWF file
|
102
|
+
# _(This value is overridden when embedded in an HTML page)_
|
103
|
+
attr_accessor :width
|
53
104
|
|
54
105
|
# TODO: Add clean hash interface so that users
|
55
106
|
# can simply add to this object's properties like:
|
@@ -59,6 +110,8 @@ module Sprout
|
|
59
110
|
# external generators...
|
60
111
|
def self.instance
|
61
112
|
@@instance ||= ProjectModel.new
|
113
|
+
yield @@instance if block_given?
|
114
|
+
return @@instance
|
62
115
|
end
|
63
116
|
|
64
117
|
def self.destroy # :nodoc:
|
@@ -67,9 +120,10 @@ module Sprout
|
|
67
120
|
|
68
121
|
# Patch submitted by Thomas Winkler
|
69
122
|
def self.setup(&block)
|
70
|
-
yield instance
|
123
|
+
yield instance if block_given?
|
124
|
+
return instance
|
71
125
|
end
|
72
|
-
|
126
|
+
|
73
127
|
def initialize
|
74
128
|
super
|
75
129
|
@project_name = ''
|
@@ -81,12 +135,20 @@ module Sprout
|
|
81
135
|
@test_dir = 'test'
|
82
136
|
@asset_dir = 'assets'
|
83
137
|
@skin_dir = File.join(@asset_dir, 'skins')
|
84
|
-
|
138
|
+
@frame_rate = 24
|
85
139
|
@language = 'as3'
|
86
140
|
|
141
|
+
@external_css = []
|
142
|
+
@libraries = []
|
143
|
+
@library_path = []
|
144
|
+
@modules = []
|
145
|
+
@source_path = []
|
146
|
+
|
87
147
|
@model_dir = nil
|
88
148
|
@view_dir = nil
|
89
149
|
@controller_dir = nil
|
150
|
+
|
151
|
+
@@instance = self
|
90
152
|
end
|
91
153
|
|
92
154
|
# Path to the project directory from which all other paths are created
|
@@ -136,5 +198,44 @@ module Sprout
|
|
136
198
|
return @controller_dir
|
137
199
|
end
|
138
200
|
|
201
|
+
def test_width
|
202
|
+
@test_width ||= @@DEFAULT_TEST_WIDTH
|
203
|
+
end
|
204
|
+
|
205
|
+
def test_height
|
206
|
+
@test_height ||= @@DEFAULT_TEST_HEIGHT
|
207
|
+
end
|
208
|
+
|
209
|
+
def name=(name)
|
210
|
+
@project_name = name
|
211
|
+
end
|
212
|
+
|
213
|
+
def name
|
214
|
+
@project_name
|
215
|
+
end
|
216
|
+
|
217
|
+
def to_s
|
218
|
+
return "[Sprout::ProjectModel project_name=#{project_name}]"
|
219
|
+
end
|
220
|
+
|
139
221
|
end
|
140
222
|
end
|
223
|
+
|
224
|
+
def project_model(args)
|
225
|
+
model = Sprout::ProjectModel.new
|
226
|
+
yield model if block_given?
|
227
|
+
|
228
|
+
t = task args
|
229
|
+
|
230
|
+
def t.project_model=(model)
|
231
|
+
@model = model
|
232
|
+
end
|
233
|
+
|
234
|
+
def t.project_model
|
235
|
+
return @model
|
236
|
+
end
|
237
|
+
|
238
|
+
t.project_model = model
|
239
|
+
return model
|
240
|
+
end
|
241
|
+
|
@@ -30,8 +30,15 @@ module Sprout
|
|
30
30
|
#
|
31
31
|
class ToolTask < Rake::FileTask
|
32
32
|
|
33
|
+
# Arguments to be prepended in front of the command line output
|
34
|
+
attr_accessor :prepended_args
|
35
|
+
# Arguments to appended at the end of the command line output
|
36
|
+
attr_accessor :appended_args
|
37
|
+
|
33
38
|
def initialize(name, app) # :nodoc:
|
34
39
|
super
|
40
|
+
@prepended_args = nil
|
41
|
+
@appended_args = nil
|
35
42
|
@default_gem_name = nil
|
36
43
|
@default_gem_path = nil
|
37
44
|
initialize_task
|
@@ -48,7 +55,7 @@ module Sprout
|
|
48
55
|
end
|
49
56
|
|
50
57
|
# Full name of the sprout tool gem that this tool task will use. For example, the MXMLCTask
|
51
|
-
# uses the sprout-
|
58
|
+
# uses the sprout-flex3sdk-tool at the time of this writing, but will at some point
|
52
59
|
# change to use the sprout-flex3sdk-tool. You can combine this value with gem_version
|
53
60
|
# in order to specify exactly which gem your tool task is executing.
|
54
61
|
def gem_name
|
@@ -81,7 +88,7 @@ module Sprout
|
|
81
88
|
def gem_path
|
82
89
|
return @gem_path ||= @default_gem_path
|
83
90
|
end
|
84
|
-
|
91
|
+
|
85
92
|
# Create a string that can be turned into a file
|
86
93
|
# that rdoc can parse to describe the customized
|
87
94
|
# or generated task using param name, type and
|
@@ -118,11 +125,13 @@ module Sprout
|
|
118
125
|
# Create a string that represents this configured tool for shell execution
|
119
126
|
def to_shell
|
120
127
|
result = []
|
128
|
+
result << @prepended_args unless @prepended_args.nil?
|
121
129
|
params.each do |param|
|
122
130
|
if(param.visible?)
|
123
131
|
result << param.to_shell
|
124
132
|
end
|
125
133
|
end
|
134
|
+
result << @appended_args unless @appended_args.nil?
|
126
135
|
return result.join(' ')
|
127
136
|
end
|
128
137
|
|
data/lib/sprout/version.rb
CHANGED
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.182
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Bayes
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-05-17 00:00:00 -07:00
|
13
13
|
default_executable: sprout
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- doc
|
62
62
|
- lib
|
63
63
|
- MIT-LICENSE
|
64
|
+
- pkg
|
64
65
|
- rakefile.rb
|
65
66
|
- samples
|
66
67
|
- script
|