flexsdk-tasks 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+
2
+ # Interested in making this work?
3
+ # It should look almost identical to the mxmlctask.rb
4
+ # But with the command line options to match this tool
5
+ # Let me know at: lbayes@patternpark.com
6
+
@@ -0,0 +1,5 @@
1
+
2
+ # Interested in making this work?
3
+ # It should look almost identical to the mxmlctask.rb
4
+ # But with the command line options to match this tool
5
+ # Let me know at: lbayes@patternpark.com
@@ -0,0 +1,13 @@
1
+
2
+ # Interested in making this work?
3
+ # The FCSH process is pretty challenging
4
+ # because it's a persistent command line
5
+ # UI, rather than a simple fire-and-forget
6
+ # model found in most compilers.
7
+
8
+ # Some work has been done to support it, if
9
+ # you're interested in contributing, please
10
+ # let me know!
11
+
12
+ # lbayes@patternpark.com
13
+
File without changes
@@ -0,0 +1,12 @@
1
+ module Sprout
2
+ class FlexSDKTasks
3
+ module VERSION #:nodoc:
4
+ MAJOR = 0
5
+ MINOR = 1
6
+ TINY = 0
7
+
8
+ STRING = [MAJOR, MINOR, TINY].join('.')
9
+ MAJOR_MINOR = [MAJOR, MINOR].join('.')
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,213 @@
1
+ =begin
2
+ Copyright (c) 2007 Pattern Park
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ =end
23
+
24
+ require 'sprout'
25
+
26
+ module Sprout
27
+ class MXMLCError < StandardError; end
28
+ class ExecutionError < StandardError; end
29
+
30
+ class MXMLCTask < Rake::Task
31
+
32
+ attr_accessor :use_fcsh,
33
+ :fcsh_ip,
34
+ :fcsh_port,
35
+ :accessible,
36
+ :debug,
37
+ :external_library_path,
38
+ :default_frame_rate,
39
+ :default_background_color,
40
+ :default_script_limits,
41
+ :default_size,
42
+ :frames,
43
+ :incremental,
44
+ :library_path,
45
+ :link_report,
46
+ :load_externs,
47
+ :locale,
48
+ :optimize,
49
+ :show_actionscript_warnings,
50
+ :source_path,
51
+ :theme,
52
+ :runtime_shared_libraries,
53
+ :output,
54
+ :use_network,
55
+ :warnings,
56
+ :input
57
+
58
+ def initialize(task_name, app)
59
+ super(task_name, app)
60
+ @use_fcsh = true
61
+ @fcsh_ip = "127.0.0.1"
62
+ @fcsh_port = 20569
63
+ @options = []
64
+ @source_path = []
65
+ @warnings = false
66
+ @external_library_path = []
67
+ @frames = []
68
+ @library_path = []
69
+ @theme = []
70
+ @runtime_shared_libraries = []
71
+ @incremental = false
72
+ @optimize = false
73
+ @name = name
74
+ @input = nil
75
+ @output = nil
76
+ end
77
+
78
+ def self.define_task(args, &block)
79
+ t = super
80
+ yield t if block_given?
81
+ t.define
82
+ end
83
+
84
+ def define
85
+ @external_library_path = add_path_list(@external_library_path) if @external_library_path.size > 0
86
+ @library_path = add_path_list(@library_path) if @library_path.size > 0
87
+ @source_path = add_path_list(@source_path) if @source_path.size > 0
88
+
89
+ @theme.collect do |item|
90
+ file item
91
+ file @output => item
92
+ end
93
+
94
+ if(!@input.nil?)
95
+ add_path(File.dirname(@input))
96
+ end
97
+
98
+ file @output do |f|
99
+ # Execute the mxmlc tool sprout by name
100
+ # This will perform binary execution in
101
+ # a platform independent manner
102
+ compile
103
+ end
104
+
105
+ # TODO: Add dependency back in so
106
+ # that edits to the rakefile force
107
+ # a new build
108
+ #file @output => Sprout.rakefile
109
+
110
+ CLEAN.add(@output)
111
+ if(@incremental)
112
+ CLEAN.add(FileList['**/**/*.cache'])
113
+ end
114
+
115
+ task @name => [@output]
116
+ end
117
+
118
+ def has_fork
119
+ if(!(RUBY_PLATFORM =~ /vista/i) && !(RUBY_PLATFORM =~ /mswin/i))
120
+ return false
121
+ else
122
+ require 'task/fcsh'
123
+ return true
124
+ end
125
+ end
126
+
127
+ def compile
128
+ if(use_fcsh && has_fork)
129
+ fcsh = FCSH.new(fcsh_ip, fcsh_port)
130
+ fcsh.execute("mxmlc #{option_list.join(' ')}")
131
+ else
132
+ begin
133
+ User.execute('mxmlc', option_list.join(' '))
134
+ rescue ExecutionError => e
135
+ if(e.message.index('Warning:'))
136
+ Log.puts(e.message.gsub('[ERROR]', '[WARNING]'))
137
+ else
138
+ raise
139
+ end
140
+ end
141
+ end
142
+ end
143
+
144
+ def sp
145
+ return @source_path
146
+ end
147
+
148
+ def el
149
+ return @external_library_path
150
+ end
151
+
152
+ def rsl
153
+ return @runtime_shared_libraries
154
+ end
155
+
156
+ def l
157
+ return @library_path
158
+ end
159
+
160
+ def option_list
161
+ result = @options.dup
162
+ result << "-accessible" if accessible
163
+ result << "-debug" if debug
164
+ result << "-optimize" if optimize
165
+ result << "-warnings=#{warnings}"
166
+ result << "-use-network" if use_network
167
+ result << "-show-actionscript-warnings" if show_actionscript_warnings
168
+ result << "-locale" << locale if locale
169
+ result << "-default-frame-rate" << default_frame_rate if default_frame_rate
170
+ result << "-default-background-color=" + default_background_color if default_background_color
171
+ result << "-default-script-limits" << default_script_limits if default_script_limits
172
+ result << "-default-size" << default_size if default_size
173
+ result << "-load-externs" << load_externs if load_externs
174
+ result << "-link-report" << link_report if link_report
175
+ result << "-output" << clean_path(output) if output
176
+ result << "-theme " + theme.join(" -theme ") if theme.size > 0
177
+ result << "-frame " + frames.join(" -frame ") if frames.size > 0
178
+ result << "-rsl=" + runtime_shared_libraries.join(" -rsl=") if runtime_shared_libraries.size > 0
179
+ result << "-el+=" + external_library_path.join(" -el+=") if external_library_path.size > 0
180
+ result << "-l=" + library_path.join(" -l=") if library_path.size > 0
181
+ result << "-sp=" + source_path.join(" -sp=") if source_path.size > 0
182
+ result << "-incremental" if incremental
183
+ result << clean_path(input)
184
+ return result
185
+ end
186
+
187
+ def add_path_list(list)
188
+ list.collect do |path|
189
+ add_path(path)
190
+ clean_path(path)
191
+ end
192
+ end
193
+
194
+ def add_path(path)
195
+ ['*.mxml', '*.as'].each do |type|
196
+ input_files = FileList[File.dirname(path) + '/**/*' + type]
197
+ file input_files
198
+ file @output => input_files
199
+ end
200
+ end
201
+
202
+ def clean_path(path)
203
+ if(!path.index(' ').nil?)
204
+ path = %{"#{path}"}
205
+ end
206
+ return path
207
+ end
208
+ end
209
+ end
210
+
211
+ def mxmlc(args, &block)
212
+ Sprout::MXMLCTask.define_task(args, &block)
213
+ end
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+
3
+ # Run the mxmlctask from version control:
4
+ #require File.dirname(__FILE__) + '/../../lib/sprout/mxmlc_task'
5
+
6
+ # Run the installed version:
7
+ require 'sprout/mxmlc_task'
8
+
9
+ # To run the sample:
10
+ # 1) Open a terminal
11
+ # 2) cd into the directory that contains this file
12
+ # 3) run 'rake'
13
+ # 4) check for the newly-created bin/SomeProject.swf file
14
+ # 5) run 'rake clean' to get rid of the generated files
15
+
16
+ # Make the default (no-name)
17
+ # rake task compile using mxmlc
18
+ task :default => :compile
19
+
20
+ desc "Compile Using MXMLC"
21
+ mxmlc :compile do |t|
22
+ t.input = 'src/SomeProject.as'
23
+ t.output = 'bin/SomeProject.swf'
24
+ end
@@ -0,0 +1,10 @@
1
+ package {
2
+ import flash.display.Sprite;
3
+
4
+ public class SomeProject extends Sprite {
5
+
6
+ public function SomeProject() {
7
+ trace("SomeProject Instantiated");
8
+ }
9
+ }
10
+ }
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: flexsdk-tasks
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.0
7
+ date: 2007-12-17 00:00:00 -08:00
8
+ summary: Rake tasks and supporting tools for the Flex 2 SDK
9
+ require_paths:
10
+ - lib
11
+ email: projectsprouts.googlegroups.com
12
+ homepage: http://www.projectsprouts.org
13
+ rubyforge_project:
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Luke Bayes
31
+ files:
32
+ - lib/sprout
33
+ - lib/sprout/asdoc_task.rb
34
+ - lib/sprout/compc_task.rb
35
+ - lib/sprout/fcsh_task.rb
36
+ - lib/sprout/fdb_task.rb
37
+ - lib/sprout/flexsdk_tasks
38
+ - lib/sprout/flexsdk_tasks/version.rb
39
+ - lib/sprout/mxmlc_task.rb
40
+ - sample/mxmlc
41
+ - sample/mxmlc/bin
42
+ - sample/mxmlc/rakefile.rb
43
+ - sample/mxmlc/src
44
+ - sample/mxmlc/src/SomeProject.as
45
+ test_files: []
46
+
47
+ rdoc_options: []
48
+
49
+ extra_rdoc_files: []
50
+
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ requirements: []
56
+
57
+ dependencies:
58
+ - !ruby/object:Gem::Dependency
59
+ name: sprout
60
+ version_requirement:
61
+ version_requirements: !ruby/object:Gem::Version::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.7.1
66
+ version: