tidyflash 0.9.6 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Assets/TidyHome.ai +1162 -2
- data/Gemfile +4 -0
- data/Gemfile.lock +26 -0
- data/Manifest +32 -11
- data/README +27 -14
- data/Rakefile +3 -3
- data/bin/tidyflash +58 -8
- data/{lib/script/server → bin/tidyflash-server} +0 -0
- data/lib/{script → tidy}/bwlimit.rb +0 -0
- data/lib/tidy/compile.rb +9 -9
- data/lib/tidy/server.rb +11 -0
- data/lib/tidy/template_binding.rb +2 -0
- data/lib/tidy/version.rb +1 -1
- data/templates/eclipsify/eclipsify.rb +12 -0
- data/templates/project/Gemfile +3 -0
- data/templates/project/project.rb +13 -12
- data/templates/project/rakefile.rb +6 -4
- data/templates/project/src/app/helpers/Typography.as +1 -1
- data/templates/project/src/app/views/PreloaderView.as +1 -0
- data/templates/project/src/library/fonts/Fonts.as +40 -0
- data/templates/project/src/library/images/README.txt +11 -0
- data/{lib/tasks/deploy.rb → templates/project/tasks/deploy.rake} +0 -0
- data/templates/project/tasks/library.rake +33 -0
- data/templates/scaffold/scaffold.rb +1 -1
- data/templates/{swfobject → web}/bin/index.html +0 -0
- data/templates/{swfobject → web}/bin/js/swfobject.js +0 -0
- data/templates/web/web.rb +13 -0
- data/test/test_tidy_project.rb +42 -47
- data/tidyflash.gemspec +10 -20
- data/{bin/test_project.axml → tools/TidyHarness/bin/tidy_harness.axml} +8 -8
- data/tools/TidyHarness/bin/tidy_harness.swf +0 -0
- data/tools/TidyHarness/config/templates/air.axml.erb +19 -0
- data/tools/TidyHarness/rakefile.rb +37 -0
- data/tools/TidyHarness/script/fcsh/rakefile.rb +6 -0
- data/tools/TidyHarness/src/app/helpers/Colours.as +1 -0
- data/tools/TidyHarness/src/app/helpers/Debug.as +17 -0
- data/tools/TidyHarness/src/app/helpers/Style.as +20 -0
- data/tools/TidyHarness/src/app/helpers/Typography.as +71 -0
- data/tools/TidyHarness/src/app/models/App.as +21 -0
- data/tools/TidyHarness/src/app/models/FlashVars.as +1 -0
- data/tools/TidyHarness/src/app/views/MainView.as +55 -0
- data/tools/TidyHarness/src/app/views/PreloaderView.as +36 -0
- data/tools/TidyHarness/src/app/views/ViewBase.as +19 -0
- data/{templates/project → tools/TidyHarness}/src/assets/fonts/Fonts.as +1 -1
- data/{lib → tools/TidyHarness}/tasks/assets.rb +1 -1
- data/tools/TidyHarness/tasks/deploy.rb +21 -0
- metadata +60 -103
- data/lib/script/generate +0 -124
- data/lib/script/server.rb +0 -20
- data/templates/swfobject/swfobject.rb +0 -12
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
ZenTest (4.6.1)
|
5
|
+
allison (2.0.3)
|
6
|
+
autotest (4.4.6)
|
7
|
+
ZenTest (>= 4.4.1)
|
8
|
+
echoe (4.6.1)
|
9
|
+
allison (>= 2.0.3)
|
10
|
+
gemcutter (>= 0.7.0)
|
11
|
+
rake (>= 0.9.2)
|
12
|
+
rdoc (>= 3.6.1)
|
13
|
+
rubyforge (>= 2.0.4)
|
14
|
+
gemcutter (0.7.0)
|
15
|
+
json_pure (1.5.3)
|
16
|
+
rake (0.9.2)
|
17
|
+
rdoc (3.9.2)
|
18
|
+
rubyforge (2.0.4)
|
19
|
+
json_pure (>= 1.1.7)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
autotest
|
26
|
+
echoe
|
data/Manifest
CHANGED
@@ -1,24 +1,25 @@
|
|
1
|
+
Assets/TidyHome.ai
|
2
|
+
Gemfile
|
3
|
+
Gemfile.lock
|
1
4
|
Manifest
|
2
5
|
README
|
3
6
|
Rakefile
|
4
|
-
bin/test_project.axml
|
5
7
|
bin/tidyflash
|
6
|
-
|
7
|
-
lib/script/generate
|
8
|
-
lib/script/server
|
9
|
-
lib/script/server.rb
|
10
|
-
lib/tasks/assets.rb
|
11
|
-
lib/tasks/deploy.rb
|
8
|
+
bin/tidyflash-server
|
12
9
|
lib/tidy/air_packager.rb
|
13
10
|
lib/tidy/axml.rb
|
11
|
+
lib/tidy/bwlimit.rb
|
14
12
|
lib/tidy/compile.rb
|
15
13
|
lib/tidy/demo_config.rb
|
16
14
|
lib/tidy/generate.rb
|
15
|
+
lib/tidy/server.rb
|
17
16
|
lib/tidy/template.rb
|
18
17
|
lib/tidy/template_binding.rb
|
19
18
|
lib/tidy/templates/demo_config.as.erb
|
20
19
|
lib/tidy/version.rb
|
21
20
|
lib/tidy_project.rb
|
21
|
+
templates/eclipsify/eclipsify.rb
|
22
|
+
templates/project/Gemfile
|
22
23
|
templates/project/config/templates/air.axml.erb
|
23
24
|
templates/project/project.rb
|
24
25
|
templates/project/rakefile.rb
|
@@ -32,14 +33,34 @@ templates/project/src/app/models/FlashVars.as
|
|
32
33
|
templates/project/src/app/views/MainView.as
|
33
34
|
templates/project/src/app/views/PreloaderView.as
|
34
35
|
templates/project/src/app/views/ViewBase.as
|
35
|
-
templates/project/src/
|
36
|
+
templates/project/src/library/fonts/Fonts.as
|
37
|
+
templates/project/src/library/images/README.txt
|
38
|
+
templates/project/tasks/deploy.rake
|
39
|
+
templates/project/tasks/library.rake
|
36
40
|
templates/scaffold/bin/xml/__model.xml
|
37
41
|
templates/scaffold/scaffold.rb
|
38
42
|
templates/scaffold/src/models/__Model.as
|
39
43
|
templates/scaffold/src/views/__model/__ModelDetailView.as
|
40
44
|
templates/scaffold/src/views/__model/__ModelListItemView.as
|
41
45
|
templates/scaffold/src/views/__model/__ModelListView.as
|
42
|
-
templates/
|
43
|
-
templates/
|
44
|
-
templates/
|
46
|
+
templates/web/bin/index.html
|
47
|
+
templates/web/bin/js/swfobject.js
|
48
|
+
templates/web/web.rb
|
45
49
|
test/test_tidy_project.rb
|
50
|
+
tools/TidyHarness/bin/tidy_harness.axml
|
51
|
+
tools/TidyHarness/bin/tidy_harness.swf
|
52
|
+
tools/TidyHarness/config/templates/air.axml.erb
|
53
|
+
tools/TidyHarness/rakefile.rb
|
54
|
+
tools/TidyHarness/script/fcsh/rakefile.rb
|
55
|
+
tools/TidyHarness/src/app/helpers/Colours.as
|
56
|
+
tools/TidyHarness/src/app/helpers/Debug.as
|
57
|
+
tools/TidyHarness/src/app/helpers/Style.as
|
58
|
+
tools/TidyHarness/src/app/helpers/Typography.as
|
59
|
+
tools/TidyHarness/src/app/models/App.as
|
60
|
+
tools/TidyHarness/src/app/models/FlashVars.as
|
61
|
+
tools/TidyHarness/src/app/views/MainView.as
|
62
|
+
tools/TidyHarness/src/app/views/PreloaderView.as
|
63
|
+
tools/TidyHarness/src/app/views/ViewBase.as
|
64
|
+
tools/TidyHarness/src/assets/fonts/Fonts.as
|
65
|
+
tools/TidyHarness/tasks/assets.rb
|
66
|
+
tools/TidyHarness/tasks/deploy.rb
|
data/README
CHANGED
@@ -1,25 +1,38 @@
|
|
1
|
-
|
1
|
+
Ruby just makes you want to do things neatly. Even Flash development.
|
2
|
+
|
3
|
+
TidyFlash creates projects that follow a set of conventions to dramatically simplify:
|
4
|
+
- Typography
|
5
|
+
- Animation
|
6
|
+
- MVC
|
7
|
+
- XML parsing
|
8
|
+
- Preloading
|
9
|
+
- Layout
|
10
|
+
- Low-bandwidth simulation
|
11
|
+
- Unit testing
|
12
|
+
- AIR development
|
2
13
|
|
3
|
-
|
14
|
+
USAGE:
|
15
|
+
tidyflash SomeProject
|
16
|
+
cd SomeProject
|
17
|
+
rake
|
4
18
|
|
5
|
-
|
19
|
+
|
20
|
+
INSTALLATION ON MAC:
|
6
21
|
gem install tidyflash
|
7
22
|
|
8
|
-
and make sure you have the rubygems bin folders in your path
|
9
|
-
edit ~/.bashrc
|
10
|
-
add the line:
|
11
|
-
export PATH=/var/lib/gems/1.8/bin:~/.gem/ruby/1.8/bin:$PATH
|
12
23
|
|
24
|
+
INSTALLATION ON UBUNTU:
|
13
25
|
|
14
|
-
|
26
|
+
sudo apt-get install ruby rake rubygems libopenssl-ruby git-core ubuntu-restricted-extras
|
27
|
+
gem install tidyflash
|
15
28
|
|
16
|
-
|
29
|
+
Make sure you have the rubygems bin folders in your path
|
30
|
+
echo "PATH=/var/lib/gems/1.8/bin:~/.gem/ruby/1.8/bin:\$PATH" >> ~/.bashrc && . ~/.bashrc
|
17
31
|
|
18
|
-
|
32
|
+
For now, you'll need to hack:
|
19
33
|
|
20
|
-
|
34
|
+
/var/lib/gems/1.8/gems/sprout-as3-bundle-1.0.36/lib/sprout/fcsh_service.rb
|
35
|
+
|
36
|
+
to reference flex4sdk instead of flex3sdk
|
21
37
|
|
22
|
-
tidyflash SomeProject
|
23
|
-
cd SomeProject
|
24
|
-
rake
|
25
38
|
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'psych'
|
3
3
|
require 'echoe'
|
4
|
-
require 'lib/tidy/version'
|
4
|
+
require './lib/tidy/version'
|
5
5
|
|
6
6
|
Echoe.new('tidyflash', Tidy::Version.number) do |p|
|
7
7
|
p.description = "Tidy Flash - an ActionScript framework for people who love Ruby"
|
@@ -10,7 +10,7 @@ Echoe.new('tidyflash', Tidy::Version.number) do |p|
|
|
10
10
|
p.email = "mf@grimaceworks.com"
|
11
11
|
p.ignore_pattern = ["tmp/**/*", "script/*", "tasks/**/*"]
|
12
12
|
p.development_dependencies = []
|
13
|
-
p.runtime_dependencies = ["sprout", "sprout-flex4sdk-tool","sprout-as3-bundle"]
|
13
|
+
p.runtime_dependencies = []#["active_support", "sprout", "sprout-flex4sdk-tool","sprout-as3-bundle"]
|
14
14
|
end
|
15
15
|
|
16
16
|
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/bin/tidyflash
CHANGED
@@ -4,6 +4,10 @@ require 'rubygems'
|
|
4
4
|
require 'optparse'
|
5
5
|
require File.dirname(__FILE__) + '/../lib/tidy_project'
|
6
6
|
|
7
|
+
def run(command)
|
8
|
+
IO.popen(command){ |process| process.each { |line| puts line } }
|
9
|
+
end
|
10
|
+
|
7
11
|
def fail_with(opts, message)
|
8
12
|
puts "[ERROR] #{message}"
|
9
13
|
puts ""
|
@@ -12,12 +16,23 @@ def fail_with(opts, message)
|
|
12
16
|
end
|
13
17
|
|
14
18
|
parser = OptionParser.new do |options|
|
15
|
-
options.banner = <<-
|
16
|
-
|
19
|
+
options.banner = <<-END
|
20
|
+
|
21
|
+
Tidy is an ActionScript toolkit for people who love Ruby.
|
22
|
+
See http://github.com/michaelforrest/tidy
|
17
23
|
|
18
|
-
|
19
|
-
|
20
|
-
|
24
|
+
Creating a project:
|
25
|
+
tidyflash new APP_PATH
|
26
|
+
cd APP_PATH
|
27
|
+
rake
|
28
|
+
|
29
|
+
Development server:
|
30
|
+
tidyflash server [--bandwidth 400k]
|
31
|
+
|
32
|
+
Air harness for easy tracing
|
33
|
+
tidyflash harness path/to/index
|
34
|
+
|
35
|
+
END
|
21
36
|
|
22
37
|
options.separator ""
|
23
38
|
|
@@ -28,6 +43,41 @@ parser = OptionParser.new do |options|
|
|
28
43
|
|
29
44
|
end
|
30
45
|
|
31
|
-
|
32
|
-
|
33
|
-
|
46
|
+
command = ARGV.shift
|
47
|
+
|
48
|
+
unless command.nil?
|
49
|
+
|
50
|
+
if command == 'new'
|
51
|
+
project_name = *ARGV
|
52
|
+
unless project_name.nil?
|
53
|
+
TidyProject.new(project_name[0])
|
54
|
+
else
|
55
|
+
fail_with "","Please provide a project name"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
if command == 'server'
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
if command == 'harness'
|
64
|
+
url = *ARGV
|
65
|
+
harness = File.expand_path(File.dirname(__FILE__) + "/../tools/TidyHarness/bin/tidy_harness.axml")
|
66
|
+
puts harness
|
67
|
+
run "adl #{harness} -nodebug -- #{url}"
|
68
|
+
end
|
69
|
+
|
70
|
+
if command == 'generate'
|
71
|
+
command, template_name = *ARGV
|
72
|
+
|
73
|
+
if template_name.nil?
|
74
|
+
fail_with "", "Please provide a generator name"
|
75
|
+
else
|
76
|
+
ARGV -= [ARGV[1]]
|
77
|
+
Tidy::Generate.new(:template_id=>template_name, :args=>ARGV)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
else
|
82
|
+
puts parser.banner
|
83
|
+
end
|
File without changes
|
File without changes
|
data/lib/tidy/compile.rb
CHANGED
@@ -11,16 +11,12 @@ class Hash
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
require 'sprout/user'
|
15
|
-
require 'sprout/fcsh_socket'
|
14
|
+
#require 'sprout/user'
|
15
|
+
#require 'sprout/fcsh_socket'
|
16
16
|
require "#{File.expand_path(File.dirname(__FILE__))}/axml"
|
17
17
|
require "#{File.expand_path(File.dirname(__FILE__))}/version"
|
18
18
|
require "#{File.expand_path(File.dirname(__FILE__))}/demo_config"
|
19
19
|
|
20
|
-
def method_name
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
20
|
module Tidy
|
25
21
|
class Compile
|
26
22
|
WIDTH, HEIGHT = 1200, 900
|
@@ -29,7 +25,9 @@ module Tidy
|
|
29
25
|
:default_frame_rate=> 30,
|
30
26
|
#:incremental=>true,
|
31
27
|
:use_network=>false,
|
32
|
-
:verbose_stacktraces=>true
|
28
|
+
:verbose_stacktraces=>true,
|
29
|
+
:omit_trace_statements=>false,
|
30
|
+
:static_link_runtime_shared_libraries=>true
|
33
31
|
#:warnings=>true
|
34
32
|
}
|
35
33
|
def self.swf_url(args)
|
@@ -56,7 +54,7 @@ module Tidy
|
|
56
54
|
# TODO: make adl launch an air file with a webkit instance and the swf inside it
|
57
55
|
#
|
58
56
|
def self.swf(args)
|
59
|
-
|
57
|
+
build args, "mxmlc " + parse_options(args)
|
60
58
|
end
|
61
59
|
# usage: DemoConfig.new(:vars=>{:varName=>'value', :anotherVar=>2.4}, :output=>'variation')
|
62
60
|
def self.demo(args)
|
@@ -82,12 +80,14 @@ module Tidy
|
|
82
80
|
puts filtered_result
|
83
81
|
=end
|
84
82
|
IO.popen(command){ |process| process.each { |line| puts line } }
|
83
|
+
swf_url(args)
|
85
84
|
end
|
85
|
+
|
86
86
|
DEFAULT_PATHS = %w[src ~/.tidy/tidy-as3]
|
87
87
|
def self.parse_options(args)
|
88
88
|
options = DEFAULTS.dup()
|
89
89
|
options.each_pair do |k,v|
|
90
|
-
|
90
|
+
options[k] = args[k] unless args[k].nil?
|
91
91
|
end
|
92
92
|
paths = DEFAULT_PATHS
|
93
93
|
paths = args[:paths].concat(DEFAULT_PATHS) unless args[:paths].nil?
|
data/lib/tidy/server.rb
ADDED
data/lib/tidy/version.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
|
-
|
2
1
|
def get_template_binding(template)
|
3
|
-
Project.new(template)
|
2
|
+
Tidy::Project.new(template)
|
4
3
|
end
|
4
|
+
module Tidy
|
5
5
|
|
6
|
-
class Project < Tidy::TemplateBinding
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
6
|
+
class Project < Tidy::TemplateBinding
|
7
|
+
def initialize(params)
|
8
|
+
super(params)
|
9
|
+
@project_name = params.args[0]
|
10
|
+
end
|
11
|
+
def init!
|
12
|
+
FileUtils.mkdir_p "bin"
|
13
|
+
FileUtils.mkdir_p "assets"
|
14
|
+
#puts "Getting Tidy libraries"
|
15
|
+
#puts `svn co http://lbi-useful-actionscript-3.googlecode.com/svn/trunk/TidyUseful/project/src lib/lbi`
|
16
|
+
end
|
16
17
|
end
|
17
18
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_support/inflector'
|
2
4
|
require 'tidy/compile'
|
3
5
|
require 'tidy/air_packager'
|
4
6
|
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
@@ -14,13 +16,13 @@ end
|
|
14
16
|
|
15
17
|
desc 'Compile and run app'
|
16
18
|
task :app do
|
17
|
-
|
19
|
+
# replace Compile.air with Compile.swf to compile a swf file (you'll need to open this yourself to test for now)
|
20
|
+
output = Tidy::Compile.air(:main=>'src/app/views/MainView.as',
|
18
21
|
:output=>"<%= @project_name.underscore %>",
|
19
22
|
:version=> "0.1",
|
20
|
-
:width=>
|
21
|
-
:height=>
|
23
|
+
:width=>960,
|
24
|
+
:height=>400,
|
22
25
|
:default_background_color=>"#FFFFFF")
|
23
|
-
|
24
26
|
end
|
25
27
|
task :package do
|
26
28
|
Tidy::AirPackager.package(:id=>"<%= @project_name.underscore %>")
|
@@ -0,0 +1,40 @@
|
|
1
|
+
package library.fonts {
|
2
|
+
|
3
|
+
/**
|
4
|
+
* <%= credit >
|
5
|
+
*
|
6
|
+
* UNICODE RANGES:
|
7
|
+
* Uppercase: U+0020,U+0041-U+005A
|
8
|
+
* Lowercase: U+0020,U+0061-U+007A
|
9
|
+
* Numerals: U+0030-U+0039,U+002E
|
10
|
+
* Punctuation: U+0020-U+002F,U+003A-U+0040,U+005B-U+0060,U+007B-U+007E
|
11
|
+
* Basic Latin: U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E
|
12
|
+
* Latin I: U+0020,U+00A1-U+00FF,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183
|
13
|
+
* Latin Extended A:U+0100-U+01FF,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183
|
14
|
+
* Latin Extended B:U+0180-U+024F,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183
|
15
|
+
* Latin Extended Add'l:U+1E00-U+1EFF,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183
|
16
|
+
* Greek: U+0374-U+03F2,U+1F00-U+1FFE,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183
|
17
|
+
* Cyrillic: U+0400-U+04CE,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183
|
18
|
+
* Armenian: U+0530-U+058F,U+FB13-U+FB17
|
19
|
+
* Arabic: U+0600-U+06FF,U+FB50-U+FDFF,U+FE70-U+FEFF
|
20
|
+
* Hebrew: U+05B0-U+05FF,U+FB1D-U+FB4F,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183
|
21
|
+
*
|
22
|
+
* See flash-unicode-table.xml in flex frameworks for others.
|
23
|
+
*
|
24
|
+
*/
|
25
|
+
public class Fonts {
|
26
|
+
/*
|
27
|
+
|
28
|
+
// SAMPLE OF HOW TO EMBED A FONT WITH TWO WEIGHTS (normal and bold)
|
29
|
+
|
30
|
+
public static var BITSTREAM_VERA_SANS : String = "Bitstream Vera Sans";
|
31
|
+
[Embed(source="Vera.ttf", fontFamily="Bitstream Vera Sans",fontWeight="normal")]
|
32
|
+
private static var bitstream_vera_sans : Class;
|
33
|
+
|
34
|
+
[Embed(source="Vera-Bold.ttf", fontFamily="Bitstream Vera Sans",fontWeight="bold")]
|
35
|
+
private static var bitstream_vera_sans_bold : Class;
|
36
|
+
*/
|
37
|
+
|
38
|
+
}
|
39
|
+
|
40
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Put images in this folder and run
|
2
|
+
|
3
|
+
rake library:images
|
4
|
+
|
5
|
+
to automatically generate an ActionScript mapping class.
|
6
|
+
|
7
|
+
Edit the library:images task in tasks/library.rb
|
8
|
+
|
9
|
+
Usually you will want to be more domain-specific with your library files,
|
10
|
+
e.g. rake library:playback_controls, rake library:carousel_elements, etc..
|
11
|
+
'images' is a generic term that should be avoided in production.
|
File without changes
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
namespace :library do
|
3
|
+
desc "Image assets"
|
4
|
+
task :images do
|
5
|
+
Dir.chdir("src/library/images/") do
|
6
|
+
asset_file ".", "ImageAssets", :package=>'library.images'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def asset_file dir, class_name, options={}
|
11
|
+
Dir.chdir("library/#{dir}") do
|
12
|
+
File.open("#{class_name}.as","w") do |file|
|
13
|
+
file << <<-END
|
14
|
+
package #{options[:package] || dir.gsub("/",".")}{
|
15
|
+
public class #{class_name}{
|
16
|
+
END
|
17
|
+
%w[.png .jpg .swf].each do |suffix|
|
18
|
+
add_entries file, suffix
|
19
|
+
end
|
20
|
+
file << "}}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_entries file, suffix
|
26
|
+
Dir.entries(".").select{ |f| f.match(suffix) }.each do |item|
|
27
|
+
file << "[Embed(source='#{item}')] "
|
28
|
+
file << "public static var #{item.gsub(suffix,"").gsub("-","_")}: Class;\n"
|
29
|
+
puts item
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
File without changes
|
File without changes
|