sprout 1.0.4.pre → 1.0.5.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/system/win_system.rb +1 -1
- data/lib/sprout/test/sprout_test_case.rb +0 -2
- data/lib/sprout/version.rb +1 -1
- data/test/fixtures/executable/mxmlc.rb +10 -128
- data/test/unit/executable_test.rb +25 -17
- metadata +2 -2
@@ -137,7 +137,6 @@ module SproutTestCase # :nodoc:[all]
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
=begin
|
141
140
|
def as_a_unix_system
|
142
141
|
sys = Sprout::System::UnixSystem.new
|
143
142
|
expectation = Sprout::System.stubs(:create).returns sys
|
@@ -167,7 +166,6 @@ module SproutTestCase # :nodoc:[all]
|
|
167
166
|
# TODO: Implement this feature without clobbering all stubs/mocks
|
168
167
|
Mocha::Mockery.instance.teardown
|
169
168
|
end
|
170
|
-
=end
|
171
169
|
|
172
170
|
|
173
171
|
private
|
data/lib/sprout/version.rb
CHANGED
@@ -669,134 +669,16 @@ module Sprout
|
|
669
669
|
end
|
670
670
|
end
|
671
671
|
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
if(input && !input.match(/.css/) && File.exists?(input))
|
683
|
-
source_path << File.dirname(input)
|
684
|
-
end
|
685
|
-
|
686
|
-
if(include_path)
|
687
|
-
include_path.each do |path|
|
688
|
-
process_include_path(path) if(File.directory?(path))
|
689
|
-
end
|
690
|
-
end
|
691
|
-
|
692
|
-
self.include_path = []
|
693
|
-
|
694
|
-
if(link_report)
|
695
|
-
CLEAN.add(link_report)
|
696
|
-
end
|
697
|
-
|
698
|
-
source_path.uniq!
|
699
|
-
param_hash['source_path'].value = clean_nested_source_paths(source_path)
|
700
|
-
|
701
|
-
CLEAN.add(output)
|
702
|
-
if(incremental)
|
703
|
-
CLEAN.add(FileList['**/**/*.cache'])
|
704
|
-
end
|
705
|
-
|
706
|
-
self
|
707
|
-
end
|
708
|
-
|
709
|
-
protected
|
710
|
-
|
711
|
-
def process_include_path(path)
|
712
|
-
symbols = []
|
713
|
-
FileList["#{path}/**/*[.as|.mxml]"].each do |file|
|
714
|
-
next if File.directory?(file)
|
715
|
-
file.gsub!(path, '')
|
716
|
-
file.gsub!(/^\//, '')
|
717
|
-
file.gsub!('/', '.')
|
718
|
-
file.gsub!(/.as$/, '')
|
719
|
-
file.gsub!(/.mxml$/, '')
|
720
|
-
file.gsub!(/.css$/, '')
|
721
|
-
symbols << file
|
722
|
-
end
|
723
|
-
|
724
|
-
symbols.each do |symbol|
|
725
|
-
self.includes << symbol
|
726
|
-
end
|
727
|
-
end
|
728
|
-
|
729
|
-
def clean_nested_source_paths(paths)
|
730
|
-
results = []
|
731
|
-
paths.each do |path|
|
732
|
-
# TODO: This should only happen if: allow_source_path_overlap != true
|
733
|
-
if(check_nested_source_path(results, path))
|
734
|
-
results << path
|
735
|
-
end
|
736
|
-
end
|
737
|
-
return results
|
738
|
-
end
|
739
|
-
|
740
|
-
def check_nested_source_path(array, path)
|
741
|
-
array.each_index do |index|
|
742
|
-
item = array[index]
|
743
|
-
if(item =~ /^#{path}/)
|
744
|
-
array.slice!(index, 1)
|
745
|
-
elsif(path =~ /^#{item}/)
|
746
|
-
return false
|
747
|
-
end
|
748
|
-
end
|
749
|
-
return true
|
750
|
-
end
|
751
|
-
|
752
|
-
# Use the swc path if possible
|
753
|
-
# Otherwise add to source
|
754
|
-
def resolve_library(library_task)
|
755
|
-
#TODO: Add support for libraries that don't get
|
756
|
-
# copied into the project
|
757
|
-
path = library_task.project_path
|
758
|
-
if(path.match(/.swc$/))
|
759
|
-
library_path << library_task.project_path
|
760
|
-
else
|
761
|
-
source_path << library_task.project_path
|
762
|
-
end
|
763
|
-
end
|
764
|
-
|
765
|
-
def execute_with_fcsh(command)
|
766
|
-
begin
|
767
|
-
display_preprocess_message
|
768
|
-
puts FCSHSocket.execute("mxmlc #{command}")
|
769
|
-
rescue FCSHError => fcsh_error
|
770
|
-
raise fcsh_error
|
771
|
-
rescue StandardError => std_error
|
772
|
-
# TODO: Capture a more concrete error here...
|
773
|
-
raise MXMLCError.new("[ERROR] There was a problem connecting to the Flex Compiler SHell, run 'rake fcsh:start' in another terminal.")
|
774
|
-
end
|
775
|
-
end
|
776
|
-
|
777
|
-
def execute(*args)
|
778
|
-
begin
|
779
|
-
start = Time.now.to_i
|
780
|
-
if(@use_fcsh)
|
781
|
-
execute_with_fcsh(to_shell)
|
782
|
-
else
|
783
|
-
super
|
784
|
-
end
|
785
|
-
Log.puts "mxmlc finished compiling #{name} in #{Time.now.to_i - start} seconds"
|
786
|
-
rescue ExecutionError => e
|
787
|
-
if(e.message.index('Warning:'))
|
788
|
-
# MXMLC sends warnings to stderr....
|
789
|
-
Log.puts(e.message.gsub('[ERROR]', '[WARNING]'))
|
790
|
-
else
|
791
|
-
raise e
|
792
|
-
end
|
793
|
-
end
|
794
|
-
end
|
795
|
-
|
796
|
-
end
|
797
|
-
end
|
798
|
-
=end
|
799
|
-
|
672
|
+
##
|
673
|
+
# Rake task helper that delegates to
|
674
|
+
# the MXMLC executable.
|
675
|
+
#
|
676
|
+
# mxmlc 'bin/SomeProject.swf' do |t|
|
677
|
+
# t.input = 'src/SomeProject.as'
|
678
|
+
# t.source_path << 'lib/corelib'
|
679
|
+
# t.library_path << 'lib/SomeLib.swc'
|
680
|
+
# end
|
681
|
+
#
|
800
682
|
def mxmlc args, &block
|
801
683
|
mxmlc_tool = Sprout::MXMLC.new
|
802
684
|
mxmlc_tool.to_rake(args, &block)
|
@@ -151,9 +151,11 @@ class ExecutableTest < Test::Unit::TestCase
|
|
151
151
|
end
|
152
152
|
|
153
153
|
should "accept input" do
|
154
|
-
|
155
|
-
|
156
|
-
|
154
|
+
as_a_unix_system do
|
155
|
+
@tool.input = "test/fixtures/executable/src/Main.as"
|
156
|
+
assert_equal "test/fixtures/executable/src/Main.as", @tool.input
|
157
|
+
assert_equal "test/fixtures/executable/src/Main.as", @tool.to_shell
|
158
|
+
end
|
157
159
|
end
|
158
160
|
|
159
161
|
should "accept default gem name" do
|
@@ -184,28 +186,34 @@ class ExecutableTest < Test::Unit::TestCase
|
|
184
186
|
end
|
185
187
|
|
186
188
|
should "accept configuration as a file task" do
|
187
|
-
|
188
|
-
|
189
|
-
|
189
|
+
as_a_unix_system do
|
190
|
+
@tool = mxmlc 'bin/SomeFile.swf' do |t|
|
191
|
+
t.source_path << 'test/fixtures/executable/src'
|
192
|
+
t.input = 'test/fixtures/executable/src/Main.as'
|
193
|
+
end
|
194
|
+
assert_equal 'bin/SomeFile.swf', @tool.output
|
195
|
+
assert_equal "--output=bin/SomeFile.swf --source-path+=test/fixtures/executable/src test/fixtures/executable/src/Main.as", @tool.to_shell
|
190
196
|
end
|
191
|
-
assert_equal 'bin/SomeFile.swf', @tool.output
|
192
|
-
assert_equal "--output=bin/SomeFile.swf --source-path+=test/fixtures/executable/src test/fixtures/executable/src/Main.as", @tool.to_shell
|
193
197
|
end
|
194
198
|
|
195
199
|
should "accept configuration with prereqs as a file task" do
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
+
as_a_unix_system do
|
201
|
+
task :other_task
|
202
|
+
@tool = mxmlc 'bin/SomeFile.swf' => [:clean, :other_task] do |t|
|
203
|
+
t.source_path << 'test/fixtures/executable/src'
|
204
|
+
t.input = 'test/fixtures/executable/src/Main.as'
|
205
|
+
end
|
206
|
+
assert_equal 'bin/SomeFile.swf', @tool.output
|
207
|
+
assert_equal "--output=bin/SomeFile.swf --source-path+=test/fixtures/executable/src test/fixtures/executable/src/Main.as", @tool.to_shell
|
200
208
|
end
|
201
|
-
assert_equal 'bin/SomeFile.swf', @tool.output
|
202
|
-
assert_equal "--output=bin/SomeFile.swf --source-path+=test/fixtures/executable/src test/fixtures/executable/src/Main.as", @tool.to_shell
|
203
209
|
end
|
204
210
|
|
205
211
|
should "to_shell input" do
|
206
|
-
|
207
|
-
|
208
|
-
|
212
|
+
as_a_unix_system do
|
213
|
+
@tool.debug = true
|
214
|
+
@tool.source_path << "test/fixtures/executable/src"
|
215
|
+
assert_equal "--debug --source-path+=test/fixtures/executable/src", @tool.to_shell
|
216
|
+
end
|
209
217
|
end
|
210
218
|
|
211
219
|
should "execute the registered executable" do
|