as3 1.0.3.pre → 1.0.4.pre

Sign up to get free protection for your applications and to get access to all the features.
data/lib/as3.rb CHANGED
@@ -14,7 +14,7 @@ module AS3
14
14
  module VERSION #:nodoc:
15
15
  MAJOR = 1
16
16
  MINOR = 0
17
- TINY = 3
17
+ TINY = 4
18
18
  SUFFIX = 'pre'
19
19
 
20
20
  STRING = [MAJOR, MINOR, TINY, SUFFIX].join('.')
@@ -13,3 +13,5 @@ end
13
13
  desc "Compile and run the debug swf"
14
14
  flashplayer :debug => "<%= bin %>/<%= debug_swf_name %>"
15
15
 
16
+ task :default => :debug
17
+
@@ -678,140 +678,6 @@ module AS3
678
678
  end
679
679
  end
680
680
 
681
- =begin
682
- def define # :nodoc:
683
- super
684
-
685
- if(!output)
686
- if(name.match(/.swf/) || name.match(/swc/))
687
- self.output = name
688
- end
689
- end
690
-
691
- if(input && !input.match(/.css/) && File.exists?(input))
692
- source_path << File.dirname(input)
693
- end
694
-
695
- if(include_path)
696
- include_path.each do |path|
697
- process_include_path(path) if(File.directory?(path))
698
- end
699
- end
700
-
701
- self.include_path = []
702
-
703
- if(link_report)
704
- CLEAN.add(link_report)
705
- end
706
-
707
- source_path.uniq!
708
- param_hash['source_path'].value = clean_nested_source_paths(source_path)
709
-
710
- CLEAN.add(output)
711
- if(incremental)
712
- CLEAN.add(FileList['**/**/*.cache'])
713
- end
714
-
715
- self
716
- end
717
-
718
- protected
719
-
720
- def process_include_path(path)
721
- symbols = []
722
- FileList["#{path}/**/*[.as|.mxml]"].each do |file|
723
- next if File.directory?(file)
724
- file.gsub!(path, '')
725
- file.gsub!(/^\//, '')
726
- file.gsub!('/', '.')
727
- file.gsub!(/.as$/, '')
728
- file.gsub!(/.mxml$/, '')
729
- file.gsub!(/.css$/, '')
730
- symbols << file
731
- end
732
-
733
- symbols.each do |symbol|
734
- self.includes << symbol
735
- end
736
- end
737
-
738
- def clean_nested_source_paths(paths)
739
- results = []
740
- paths.each do |path|
741
- # TODO: This should only happen if: allow_source_path_overlap != true
742
- if(check_nested_source_path(results, path))
743
- results << path
744
- end
745
- end
746
- return results
747
- end
748
-
749
- def check_nested_source_path(array, path)
750
- array.each_index do |index|
751
- item = array[index]
752
- if(item =~ /^#{path}/)
753
- array.slice!(index, 1)
754
- elsif(path =~ /^#{item}/)
755
- return false
756
- end
757
- end
758
- return true
759
- end
760
-
761
- # Use the swc path if possible
762
- # Otherwise add to source
763
- def resolve_library(library_task)
764
- #TODO: Add support for libraries that don't get
765
- # copied into the project
766
- path = library_task.project_path
767
- if(path.match(/.swc$/))
768
- library_path << library_task.project_path
769
- else
770
- source_path << library_task.project_path
771
- end
772
- end
773
-
774
- def execute_with_fcsh(command)
775
- begin
776
- display_preprocess_message
777
- puts FCSHSocket.execute("mxmlc #{command}")
778
- rescue FCSHError => fcsh_error
779
- raise fcsh_error
780
- rescue StandardError => std_error
781
- # TODO: Capture a more concrete error here...
782
- raise MXMLCError.new("[ERROR] There was a problem connecting to the Flex Compiler SHell, run 'rake fcsh:start' in another terminal.")
783
- end
784
- end
785
-
786
- def execute(*args)
787
- begin
788
- start = Time.now.to_i
789
- if(@use_fcsh)
790
- execute_with_fcsh(to_shell)
791
- else
792
- super
793
- end
794
- Log.puts "mxmlc finished compiling #{name} in #{Time.now.to_i - start} seconds"
795
- rescue ExecutionError => e
796
- if(e.message.index('Warning:'))
797
- # MXMLC sends warnings to stderr....
798
- Log.puts(e.message.gsub('[ERROR]', '[WARNING]'))
799
- else
800
- raise e
801
- end
802
- end
803
- end
804
-
805
- end
806
- end
807
-
808
- # Helper method for definining and accessing MXMLC instances in a rakefile
809
- def mxmlc(args, &block)
810
- AS3::MXMLC.define_task(args, &block)
811
- end
812
-
813
- =end
814
-
815
681
  # TODO: Assign mxmlc.output = args || args.first_key
816
682
  def mxmlc args, &block
817
683
  mxmlc_tool = AS3::MXMLC.new
@@ -0,0 +1,135 @@
1
+
2
+ =begin
3
+ def define # :nodoc:
4
+ super
5
+
6
+ if(!output)
7
+ if(name.match(/.swf/) || name.match(/swc/))
8
+ self.output = name
9
+ end
10
+ end
11
+
12
+ if(input && !input.match(/.css/) && File.exists?(input))
13
+ source_path << File.dirname(input)
14
+ end
15
+
16
+ if(include_path)
17
+ include_path.each do |path|
18
+ process_include_path(path) if(File.directory?(path))
19
+ end
20
+ end
21
+
22
+ self.include_path = []
23
+
24
+ if(link_report)
25
+ CLEAN.add(link_report)
26
+ end
27
+
28
+ source_path.uniq!
29
+ param_hash['source_path'].value = clean_nested_source_paths(source_path)
30
+
31
+ CLEAN.add(output)
32
+ if(incremental)
33
+ CLEAN.add(FileList['**/**/*.cache'])
34
+ end
35
+
36
+ self
37
+ end
38
+
39
+ protected
40
+
41
+ def process_include_path(path)
42
+ symbols = []
43
+ FileList["#{path}/**/*[.as|.mxml]"].each do |file|
44
+ next if File.directory?(file)
45
+ file.gsub!(path, '')
46
+ file.gsub!(/^\//, '')
47
+ file.gsub!('/', '.')
48
+ file.gsub!(/.as$/, '')
49
+ file.gsub!(/.mxml$/, '')
50
+ file.gsub!(/.css$/, '')
51
+ symbols << file
52
+ end
53
+
54
+ symbols.each do |symbol|
55
+ self.includes << symbol
56
+ end
57
+ end
58
+
59
+ def clean_nested_source_paths(paths)
60
+ results = []
61
+ paths.each do |path|
62
+ # TODO: This should only happen if: allow_source_path_overlap != true
63
+ if(check_nested_source_path(results, path))
64
+ results << path
65
+ end
66
+ end
67
+ return results
68
+ end
69
+
70
+ def check_nested_source_path(array, path)
71
+ array.each_index do |index|
72
+ item = array[index]
73
+ if(item =~ /^#{path}/)
74
+ array.slice!(index, 1)
75
+ elsif(path =~ /^#{item}/)
76
+ return false
77
+ end
78
+ end
79
+ return true
80
+ end
81
+
82
+ # Use the swc path if possible
83
+ # Otherwise add to source
84
+ def resolve_library(library_task)
85
+ #TODO: Add support for libraries that don't get
86
+ # copied into the project
87
+ path = library_task.project_path
88
+ if(path.match(/.swc$/))
89
+ library_path << library_task.project_path
90
+ else
91
+ source_path << library_task.project_path
92
+ end
93
+ end
94
+
95
+ def execute_with_fcsh(command)
96
+ begin
97
+ display_preprocess_message
98
+ puts FCSHSocket.execute("mxmlc #{command}")
99
+ rescue FCSHError => fcsh_error
100
+ raise fcsh_error
101
+ rescue StandardError => std_error
102
+ # TODO: Capture a more concrete error here...
103
+ raise MXMLCError.new("[ERROR] There was a problem connecting to the Flex Compiler SHell, run 'rake fcsh:start' in another terminal.")
104
+ end
105
+ end
106
+
107
+ def execute(*args)
108
+ begin
109
+ start = Time.now.to_i
110
+ if(@use_fcsh)
111
+ execute_with_fcsh(to_shell)
112
+ else
113
+ super
114
+ end
115
+ Log.puts "mxmlc finished compiling #{name} in #{Time.now.to_i - start} seconds"
116
+ rescue ExecutionError => e
117
+ if(e.message.index('Warning:'))
118
+ # MXMLC sends warnings to stderr....
119
+ Log.puts(e.message.gsub('[ERROR]', '[WARNING]'))
120
+ else
121
+ raise e
122
+ end
123
+ end
124
+ end
125
+
126
+ end
127
+ end
128
+
129
+ # Helper method for definining and accessing MXMLC instances in a rakefile
130
+ def mxmlc(args, &block)
131
+ AS3::MXMLC.define_task(args, &block)
132
+ end
133
+
134
+ =end
135
+
@@ -30,8 +30,8 @@ class MXMLCTest < Test::Unit::TestCase
30
30
  mxmlc.input = @input
31
31
  # Turn on to trigger an actual compilation:
32
32
  # (This is too damn slow to leave in the every-time test run)
33
- mxmlc.execute
34
- assert_file @expected_output
33
+ #mxmlc.execute
34
+ #assert_file @expected_output
35
35
  end
36
36
 
37
37
  should "assign simple output" do
@@ -40,6 +40,8 @@ class MXMLCTest < Test::Unit::TestCase
40
40
  end
41
41
  assert_equal 'bin/SomeProject.swf', t.output
42
42
  end
43
+
43
44
  end
45
+
44
46
  end
45
47
 
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - pre
10
- version: 1.0.3.pre
10
+ version: 1.0.4.pre
11
11
  platform: ruby
12
12
  authors:
13
13
  - Luke Bayes
@@ -107,6 +107,7 @@ files:
107
107
  - lib/as3/generators/templates/Gemfile
108
108
  - lib/as3/generators/templates/rakefile.rb
109
109
  - lib/as3/tasks/mxmlc.rb
110
+ - lib/as3/tasks/mxmlc_legacy.rb
110
111
  - lib/as3.rb
111
112
  - rakefile.rb
112
113
  - README.rdoc