sprout 1.0.25.pre → 1.0.26.pre
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/executable.rb +28 -1
- data/lib/sprout/library.rb +5 -2
- data/lib/sprout/ruby_feature.rb +8 -0
- data/lib/sprout/version.rb +1 -1
- data/test/fixtures/executable/mxmlc.rb +9 -0
- data/test/unit/executable_test.rb +21 -0
- data/test/unit/sprout_test_helper.rb +5 -1
- metadata +4 -4
data/lib/sprout/executable.rb
CHANGED
@@ -305,7 +305,7 @@ module Sprout
|
|
305
305
|
end
|
306
306
|
|
307
307
|
def to_rake *args
|
308
|
-
# Define the file task
|
308
|
+
# Define the file task first - so that
|
309
309
|
# desc blocks hook up to it...
|
310
310
|
file_task = file *args do
|
311
311
|
execute
|
@@ -313,6 +313,14 @@ module Sprout
|
|
313
313
|
update_rake_task_name_from_args *args
|
314
314
|
yield self if block_given?
|
315
315
|
prepare
|
316
|
+
|
317
|
+
# TODO: Tried auto-updating with library
|
318
|
+
# prerequisites, but this led to strange
|
319
|
+
# behavior with multiple registrations.
|
320
|
+
handle_library_prerequisites file_task.prerequisites
|
321
|
+
|
322
|
+
# Add the library resolution rake task
|
323
|
+
# as a prerequisite
|
316
324
|
file_task.prerequisites << task(Sprout::Library::TASK_NAME)
|
317
325
|
prerequisites.each do |prereq|
|
318
326
|
file_task.prerequisites << prereq
|
@@ -396,8 +404,27 @@ module Sprout
|
|
396
404
|
end
|
397
405
|
end
|
398
406
|
|
407
|
+
##
|
408
|
+
# This method will generally be overridden
|
409
|
+
# by subclasses and they can do whatever customization
|
410
|
+
# is necessary for a particular library type.
|
411
|
+
def library_added library
|
412
|
+
end
|
413
|
+
|
399
414
|
private
|
400
415
|
|
416
|
+
def handle_library_prerequisites items
|
417
|
+
items.each do |item|
|
418
|
+
t = Rake.application[item]
|
419
|
+
if(t.sprout_type == :library)
|
420
|
+
lib = Sprout::Library.load nil, item.to_s
|
421
|
+
lib.project_paths.each do |path|
|
422
|
+
library_added path
|
423
|
+
end unless lib.project_paths.nil?
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
401
428
|
def help_requested? options
|
402
429
|
options.include? '--help'
|
403
430
|
end
|
data/lib/sprout/library.rb
CHANGED
@@ -29,13 +29,14 @@ module Sprout
|
|
29
29
|
def define_task pkg_name, type=nil, version=nil
|
30
30
|
library = Sprout::Library.load type, pkg_name.to_s, version
|
31
31
|
library.installation_task = task pkg_name
|
32
|
+
library.installation_task.sprout_type = :library
|
32
33
|
|
33
34
|
define_lib_dir_task_if_necessary
|
34
35
|
path_or_paths = library.path
|
35
36
|
if path_or_paths.is_a?(Array)
|
36
37
|
# TODO: Need to add support for merging these directories
|
37
38
|
# rather than simply clobbering...
|
38
|
-
path_or_paths.
|
39
|
+
path_or_paths.collect { |p| define_path_task pkg_name, library, p }
|
39
40
|
else
|
40
41
|
define_path_task pkg_name, library, path_or_paths
|
41
42
|
end
|
@@ -67,6 +68,7 @@ module Sprout
|
|
67
68
|
FileUtils.cp_r path, installation_path
|
68
69
|
Sprout::Log.puts ">> Copied files from: (#{path}) to: (#{installation_path})"
|
69
70
|
end
|
71
|
+
installation_path
|
70
72
|
end
|
71
73
|
|
72
74
|
def define_file_copy_task path, installation_path
|
@@ -76,6 +78,7 @@ module Sprout
|
|
76
78
|
FileUtils.cp path, "#{installation_path}/"
|
77
79
|
Sprout::Log.puts ">> Copied file from: (#{path}) to: (#{task_name})"
|
78
80
|
end
|
81
|
+
task_name
|
79
82
|
end
|
80
83
|
|
81
84
|
def define_file_task name
|
@@ -96,7 +99,7 @@ end
|
|
96
99
|
# library :asunit4
|
97
100
|
#
|
98
101
|
# Or, if you would like to specify which registered
|
99
|
-
# library to pull from the identified package:
|
102
|
+
# library to pull from the identified package (by name):
|
100
103
|
#
|
101
104
|
# library :asunit4, :src
|
102
105
|
#
|
data/lib/sprout/ruby_feature.rb
CHANGED
data/lib/sprout/version.rb
CHANGED
@@ -644,6 +644,15 @@ module Sprout
|
|
644
644
|
#
|
645
645
|
add_param :warnings, Boolean
|
646
646
|
|
647
|
+
def library_added path
|
648
|
+
#puts ">> MXMLC.library_added with: #{path}"
|
649
|
+
if(path =~ /\.swc$/)
|
650
|
+
self.library_path << path
|
651
|
+
else
|
652
|
+
self.source_path << path
|
653
|
+
end
|
654
|
+
end
|
655
|
+
|
647
656
|
##
|
648
657
|
# Main source file to send compiler"
|
649
658
|
# This must be the last item in this list
|
@@ -217,8 +217,29 @@ class ExecutableTest < Test::Unit::TestCase
|
|
217
217
|
end
|
218
218
|
end
|
219
219
|
|
220
|
+
should "add libraries as provided" do
|
221
|
+
as_a_unix_system do
|
222
|
+
|
223
|
+
Sprout::Library.stubs(:define_path_task)
|
224
|
+
task 'abcd'
|
225
|
+
task 'bin/OtherFileTask.swf'
|
226
|
+
|
227
|
+
asunit_lib = OpenStruct.new :name => :asunit4, :project_paths => ['lib/AsUnit-4.4.2.swc']
|
228
|
+
Sprout::Library.register asunit_lib
|
229
|
+
|
230
|
+
library :asunit4
|
231
|
+
|
232
|
+
@tool = mxmlc 'bin/SomeFile.swf' => [:asunit4, 'abcd', 'bin/OtherFileTask.swf'] do |t|
|
233
|
+
t.source_path << 'test/fixtures/executable/src'
|
234
|
+
t.input = 'test/fixtures/executable/src/Main.as'
|
235
|
+
end
|
236
|
+
assert_equal "-library-path+=lib/AsUnit-4.4.2.swc -output=bin/SomeFile.swf -source-path+=test/fixtures/executable/src test/fixtures/executable/src/Main.as", @tool.to_shell
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
220
240
|
should "accept configuration with prereqs as a file task" do
|
221
241
|
as_a_unix_system do
|
242
|
+
task :clean
|
222
243
|
task :other_task
|
223
244
|
@tool = mxmlc 'bin/SomeFile.swf' => [:clean, :other_task] do |t|
|
224
245
|
t.source_path << 'test/fixtures/executable/src'
|
@@ -9,7 +9,11 @@ Bundler.setup :default, :development
|
|
9
9
|
require 'shoulda'
|
10
10
|
require 'mocha'
|
11
11
|
|
12
|
-
|
12
|
+
lib = File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
13
|
+
$:.unshift lib unless $:.include? lib
|
14
|
+
|
15
|
+
require 'sprout'
|
16
|
+
|
13
17
|
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
14
18
|
|
15
19
|
require 'unit/fake_process_runner'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1407429492
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
9
|
+
- 26
|
10
10
|
- pre
|
11
|
-
version: 1.0.
|
11
|
+
version: 1.0.26.pre
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Luke Bayes
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-07-
|
19
|
+
date: 2010-07-25 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|