fluby 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.mdown +0 -95
- data/VERSION +1 -1
- data/bin/fluby +16 -6
- data/lib/fluby.rb +154 -54
- data/lib/templates/README +0 -1
- data/lib/templates/Rakefile +13 -93
- data/lib/templates/config.yml +7 -0
- data/lib/templates/index.rhtml +2 -2
- data/lib/templates/project.rxml +2 -2
- data/test/test_fluby.rb +2 -52
- metadata +3 -9
- data/.gitignore +0 -2
- data/Changelog +0 -37
- data/Rakefile +0 -49
- data/fluby.gemspec +0 -62
- data/lib/templates/generate +0 -17
data/README.mdown
CHANGED
@@ -37,98 +37,3 @@ There are other rake tasks available:
|
|
37
37
|
rake package # Creates a ZIP file containing your SWF file on the 'pkg' folder
|
38
38
|
rake test # Opens a HTML file with your SWF for testing on your default browser (available on Mac only)
|
39
39
|
|
40
|
-
|
41
|
-
### script/generate
|
42
|
-
|
43
|
-
Starting from version 0.6, fluby installs a 'generate' script in the 'scripts' folder that you can use to speed up the creation of new classes.
|
44
|
-
|
45
|
-
Right now there are 3 template types:
|
46
|
-
|
47
|
-
#### **class**
|
48
|
-
|
49
|
-
Use it to create a generic class by running:
|
50
|
-
|
51
|
-
script/generate class your.class.path.ClassName attribute:Type attribute:Type (...)
|
52
|
-
|
53
|
-
For example: if you want to create a "Car" class with attributes "make" and "model" of type String and an attribute "year" of type Number, you'd run:
|
54
|
-
|
55
|
-
script/generate class com.yourdomain.Car make:String model:String year:Number
|
56
|
-
|
57
|
-
This will create a file in com/yourdomain/Car.as with this content:
|
58
|
-
|
59
|
-
class com.yourdomain.Car {
|
60
|
-
var make:String;
|
61
|
-
var model:String;
|
62
|
-
var year:Number;
|
63
|
-
function Car(){
|
64
|
-
// Init class
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
|
69
|
-
#### **xml_loader**
|
70
|
-
|
71
|
-
Use to create a simple XML loader class by running:
|
72
|
-
|
73
|
-
script/generate xml_loader your.class.path.ClassName
|
74
|
-
|
75
|
-
Example: if you run
|
76
|
-
|
77
|
-
script/generate xml_loader com.bomberstudios.xml.Loader
|
78
|
-
|
79
|
-
you'll get a com/bomberstudios/xml/Loader.as file containing:
|
80
|
-
|
81
|
-
class com.bomberstudios.xml.Loader {
|
82
|
-
var _path:String;
|
83
|
-
var raw_data:XML;
|
84
|
-
function Loader(path:String,callback:Function){
|
85
|
-
_path = path;
|
86
|
-
raw_data = new XML();
|
87
|
-
raw_data.ignoreWhite = true;
|
88
|
-
raw_data.onLoad = callback;
|
89
|
-
}
|
90
|
-
function give_me(node_name){
|
91
|
-
if (raw_data.firstChild.nodeName == node_name) {
|
92
|
-
return raw_data.firstChild;
|
93
|
-
}
|
94
|
-
for(var i=raw_data.firstChild.childNodes.length; i>=0; i--){
|
95
|
-
if(raw_data.firstChild.childNodes[i].nodeName == node_name){
|
96
|
-
return raw_data.firstChild.childNodes[i];
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
public function load(){
|
101
|
-
raw_data.load(_path);
|
102
|
-
}
|
103
|
-
}
|
104
|
-
|
105
|
-
|
106
|
-
#### **delegate**
|
107
|
-
|
108
|
-
To generate a MTASC-compatible Delegate class, run
|
109
|
-
|
110
|
-
script/generate delegate your.class.path.Delegate
|
111
|
-
|
112
|
-
This will produce a your/class/path/Delegate.as file containing:
|
113
|
-
|
114
|
-
/**
|
115
|
-
*
|
116
|
-
* Delegate Class, MTASC compatible
|
117
|
-
*
|
118
|
-
**/
|
119
|
-
class your.class.path.Delegate {
|
120
|
-
public static function create(scope:Object,method:Function):Function{
|
121
|
-
var params:Array = arguments.splice(2,arguments.length-2);
|
122
|
-
var proxyFunc:Function = function():Void{
|
123
|
-
method.apply(scope,arguments.concat(params));
|
124
|
-
}
|
125
|
-
return proxyFunc;
|
126
|
-
}
|
127
|
-
public static function createR(scope:Object,method:Function):Function{
|
128
|
-
var params:Array = arguments.splice(2,arguments.length-2);
|
129
|
-
var proxyFunc:Function = function():Void{
|
130
|
-
method.apply(scope,params.concat(arguments));
|
131
|
-
}
|
132
|
-
return proxyFunc;
|
133
|
-
}
|
134
|
-
}
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.1
|
data/bin/fluby
CHANGED
@@ -3,13 +3,23 @@
|
|
3
3
|
# Handcrafted with love by bomberstudios & mamuso
|
4
4
|
# 2008-03-16
|
5
5
|
|
6
|
+
actions = ['build','release','create','generate']
|
7
|
+
|
6
8
|
require File.dirname(__FILE__) + '/../lib/fluby.rb'
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
puts "Fluby v#{Fluby
|
10
|
+
case ARGV.size
|
11
|
+
when 0
|
12
|
+
puts "Fluby v#{Fluby.version}"
|
11
13
|
puts "Usage: fluby project_name"
|
12
14
|
exit
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
when 1
|
16
|
+
action = ARGV[0]
|
17
|
+
if actions.include? action
|
18
|
+
Fluby.send(action)
|
19
|
+
else
|
20
|
+
Fluby.create_project(ARGV[0])
|
21
|
+
end
|
22
|
+
else
|
23
|
+
action = ARGV[0]
|
24
|
+
Fluby.send(action,ARGV[1..ARGV.size-1])
|
25
|
+
end
|
data/lib/fluby.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
require "rubygems"
|
1
2
|
require "erb"
|
3
|
+
require "yaml"
|
4
|
+
# require "rake"
|
2
5
|
require "fileutils"
|
3
6
|
|
4
7
|
module Fluby
|
5
8
|
NAME = 'fluby'
|
6
|
-
VERSION = %x(cat VERSION)
|
7
|
-
|
8
9
|
COLORS = {
|
9
10
|
:black => "\033[0;30m",
|
10
11
|
:red => "\033[0;31m",
|
@@ -16,63 +17,66 @@ module Fluby
|
|
16
17
|
:white => "\033[0;37m",
|
17
18
|
:whitebold => "\033[1;37m"
|
18
19
|
}
|
19
|
-
PATH = File.expand_path(__FILE__)
|
20
20
|
|
21
|
-
def self.
|
22
|
-
|
23
|
-
|
21
|
+
def self.version
|
22
|
+
%x(cat #{gem_path}/VERSION)
|
23
|
+
end
|
24
|
+
def self.gem_path
|
25
|
+
File.dirname(__FILE__) + "/../"
|
26
|
+
end
|
27
|
+
def self.template_path
|
28
|
+
gem_path + "/lib/templates"
|
29
|
+
end
|
30
|
+
def self.current_path
|
31
|
+
Dir.pwd
|
32
|
+
end
|
33
|
+
def self.is_a_project?
|
34
|
+
File.exist?("#{current_path}/index.rhtml")
|
35
|
+
end
|
24
36
|
|
37
|
+
# Project creation
|
38
|
+
def self.create_project(name)
|
25
39
|
# TODO: Support project creation in subfolders (i.e: fluby test/project)
|
26
40
|
@project_name = name
|
27
|
-
@project_folder = FileUtils.pwd + "/" +
|
41
|
+
@project_folder = FileUtils.pwd + "/" + name
|
28
42
|
|
29
|
-
puts "\n#{COLORS[:green]}Creating project #{
|
43
|
+
puts "\n#{COLORS[:green]}Creating project #{name}"
|
30
44
|
|
31
45
|
# Make folders
|
32
46
|
if File.exist? @project_folder
|
33
|
-
puts "#{COLORS[:red]}Folder #{
|
47
|
+
puts "#{COLORS[:red]}Folder #{name} already exists,"
|
34
48
|
puts "#{COLORS[:red]}please choose a different name for your project"
|
35
49
|
raise RuntimeError
|
36
50
|
end
|
37
51
|
FileUtils.mkdir [@project_folder,"#{@project_folder}/deploy","#{@project_folder}/assets","#{@project_folder}/script"], :verbose => false
|
38
52
|
|
39
53
|
# Make files
|
40
|
-
["Rakefile","README"].each do |file|
|
41
|
-
render_template file
|
54
|
+
["Rakefile","README","config.yml"].each do |file|
|
55
|
+
render_template "#{template_path}/#{file}", "#{@project_folder}/#{file}"
|
42
56
|
end
|
43
57
|
|
44
58
|
# Static Templates
|
45
|
-
copy_template "index.rhtml"
|
46
|
-
copy_template "project.rxml", "#{@
|
47
|
-
copy_template "swfobject.js", "assets/swfobject.js"
|
59
|
+
copy_template "#{template_path}/index.rhtml", "#{@project_folder}/index.rhtml"
|
60
|
+
copy_template "#{template_path}/project.rxml", "#{@project_folder}/#{name}.rxml"
|
61
|
+
copy_template "#{template_path}/swfobject.js", "#{@project_folder}/assets/swfobject.js"
|
48
62
|
|
49
63
|
# Main Class
|
50
|
-
render_template "ASClass.as", "#{@
|
51
|
-
|
52
|
-
# script/generate
|
53
|
-
render_template "generate", "script/generate"
|
54
|
-
%x(chmod 755 "#{@project_folder}/script/generate")
|
64
|
+
render_template "#{template_path}/ASClass.as", "#{@project_folder}/#{name}.as"
|
55
65
|
|
56
66
|
end
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
destination = source
|
61
|
-
end
|
62
|
-
FileUtils.cp "#{File.dirname(__FILE__)}/templates/#{source}", "#{@project_folder}/#{destination}", :verbose => false
|
63
|
-
log "create", "#{@project_name}/#{destination}"
|
67
|
+
def self.copy_template source, destination
|
68
|
+
FileUtils.cp source, destination, :verbose => false
|
69
|
+
log "create", destination
|
64
70
|
end
|
65
|
-
|
66
71
|
def self.render_template source, destination=nil
|
67
72
|
if destination.nil?
|
68
73
|
destination = source
|
69
74
|
end
|
70
|
-
open(
|
71
|
-
f << ERB.new(IO.read(
|
75
|
+
open(destination,"w") do |f|
|
76
|
+
f << ERB.new(IO.read(source)).result(binding)
|
72
77
|
end
|
73
|
-
log "create",
|
78
|
+
log "create", destination
|
74
79
|
end
|
75
|
-
|
76
80
|
def self.log type, string
|
77
81
|
case type
|
78
82
|
when "alert"
|
@@ -81,7 +85,6 @@ module Fluby
|
|
81
85
|
puts "\t#{COLORS[:white]}Created:\t#{COLORS[:cyan]}#{string}#{COLORS[:white]}"
|
82
86
|
end
|
83
87
|
end
|
84
|
-
|
85
88
|
def self.in_textmate?
|
86
89
|
begin
|
87
90
|
if TextMate
|
@@ -91,41 +94,138 @@ module Fluby
|
|
91
94
|
return false
|
92
95
|
end
|
93
96
|
end
|
94
|
-
|
95
97
|
def self.is_mac?
|
96
98
|
return RUBY_PLATFORM =~ /darwin/
|
97
99
|
end
|
98
|
-
|
99
100
|
def self.has_growl?
|
100
101
|
return is_mac? && !`which "growlnotify"`.empty?
|
101
102
|
end
|
103
|
+
def self.create *args
|
104
|
+
create_project(*args[0])
|
105
|
+
end
|
106
|
+
|
107
|
+
# Utils
|
108
|
+
def self.setup_debug
|
109
|
+
debug_cfg_file = "/Library/Application\ Support/Macromedia/mm.cfg"
|
110
|
+
system("touch '#{debug_cfg_file}'")
|
111
|
+
File.open(debug_cfg_file,"w") do |f|
|
112
|
+
f << <<-EOF
|
113
|
+
ErrorReportingEnable=1
|
114
|
+
TraceOutputFileEnable=1
|
115
|
+
EOF
|
116
|
+
|
117
|
+
end unless File.exist?(debug_cfg_file)
|
118
|
+
%x(touch "$HOME/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt")
|
119
|
+
end
|
102
120
|
|
103
121
|
# these functions are used by script/generate
|
104
|
-
def self.generate(type, name, options={})
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
122
|
+
# def self.generate(type, name, options={})
|
123
|
+
# target_path = File.dirname(name.split(".").join("/").to_s)
|
124
|
+
# target_file = name.split(".").join("/") + ".as".to_s
|
125
|
+
# if File.exist?(target_file)
|
126
|
+
# log "alert", "File #{target_file} already exists!"
|
127
|
+
# raise RuntimeError
|
128
|
+
# end
|
129
|
+
# FileUtils.mkdir_p target_path unless File.exist? target_path
|
130
|
+
# @classpath = target_path.split("/").join(".")
|
131
|
+
# @classname = name.split(".").last
|
132
|
+
# options = options.map { |i| i = i.split(":") } unless options == {}
|
133
|
+
# @opts = options
|
134
|
+
# File.open(target_file,"w") do |file|
|
135
|
+
# file << ERB.new(File.read("#{template_path}/generators/#{type}")).result(binding)
|
136
|
+
# end
|
137
|
+
# log "create", "#{target_path}/#{@classname}.as"
|
138
|
+
# end
|
139
|
+
|
140
|
+
def self.available_templates
|
141
|
+
return Dir["#{template_path}/generators/**"]
|
142
|
+
end
|
143
|
+
|
144
|
+
# Terminal
|
145
|
+
def self.alert txt
|
146
|
+
puts "\n\t#{COLORS[:red]}#{txt}#{COLORS[:white]}"
|
147
|
+
end
|
148
|
+
def self.say txt
|
149
|
+
puts "\n\t#{COLORS[:green]}#{txt}#{COLORS[:white]}"
|
150
|
+
end
|
151
|
+
def self.txt txt=""
|
152
|
+
puts "\t#{COLORS[:white]}#{txt}#{COLORS[:white]}"
|
153
|
+
end
|
154
|
+
|
155
|
+
# Project data
|
156
|
+
def self.project_name
|
157
|
+
options["app"]
|
158
|
+
end
|
159
|
+
def self.project_fullname
|
160
|
+
"#{project_name} v#{options['version']}"
|
161
|
+
end
|
162
|
+
def self.options
|
163
|
+
YAML.load_file('config.yml')
|
164
|
+
end
|
165
|
+
|
166
|
+
# Compilation
|
167
|
+
def self.build *args
|
168
|
+
if is_a_project?
|
169
|
+
say "Building #{project_fullname}"
|
170
|
+
assets
|
171
|
+
preprocess
|
172
|
+
compile
|
173
|
+
notify if has_growl?
|
174
|
+
else
|
175
|
+
alert "This is not a fluby project!"
|
110
176
|
end
|
111
|
-
|
112
|
-
|
113
|
-
@
|
114
|
-
|
115
|
-
@
|
116
|
-
|
117
|
-
|
177
|
+
end
|
178
|
+
def self.release *args
|
179
|
+
@nodebug = true
|
180
|
+
build
|
181
|
+
@nodebug = false
|
182
|
+
end
|
183
|
+
def self.notify
|
184
|
+
%x(growlnotify --name Rake -m 'Finished building #{project_name} in #{@end - @start} seconds')
|
185
|
+
end
|
186
|
+
def self.assets
|
187
|
+
Dir.glob(['assets/*.js','assets/*.xml']).each do |file|
|
188
|
+
FileUtils.cp file, "deploy/#{File.basename(file)}"
|
118
189
|
end
|
119
|
-
log "create", "#{target_path}/#{@classname}.as"
|
120
190
|
end
|
191
|
+
def self.compile
|
192
|
+
if @nodebug
|
193
|
+
txt "Trace disabled"
|
194
|
+
trace = " -trace no"
|
195
|
+
else
|
196
|
+
txt "Trace enabled"
|
197
|
+
trace = ""
|
198
|
+
end
|
199
|
+
|
200
|
+
txt
|
201
|
+
|
202
|
+
@start = Time.now
|
203
|
+
|
204
|
+
render_template "index.rhtml", "index.html"
|
205
|
+
render_template "#{project_name}.rxml", "#{project_name}.xml"
|
206
|
+
|
207
|
+
txt
|
208
|
+
|
209
|
+
system("swfmill simple #{project_name}.xml #{project_name}.swf")
|
210
|
+
txt "√ swfmill"
|
211
|
+
FileUtils.rm "#{project_name}.xml", {:verbose => false}
|
121
212
|
|
122
|
-
|
123
|
-
|
213
|
+
system("mtasc -swf #{project_name}.swf -main -mx -version #{options["player"]} #{trace} #{project_name}.as")
|
214
|
+
txt "√ mtasc"
|
215
|
+
@end = Time.now
|
216
|
+
|
217
|
+
["*.html","*.swf"].each do |list|
|
218
|
+
Dir[list].each do |file|
|
219
|
+
FileUtils.mv file, "deploy/#{file}", {:verbose => false}
|
220
|
+
end
|
221
|
+
end
|
222
|
+
say "Project compiled in #{@end - @start} seconds"
|
124
223
|
end
|
125
|
-
def self.
|
126
|
-
|
224
|
+
def self.preprocess
|
225
|
+
|
127
226
|
end
|
128
|
-
|
129
|
-
|
227
|
+
|
228
|
+
def self.method_missing name
|
229
|
+
options[name.to_s]
|
130
230
|
end
|
131
231
|
end
|
data/lib/templates/README
CHANGED
data/lib/templates/Rakefile
CHANGED
@@ -1,79 +1,12 @@
|
|
1
|
-
require "
|
1
|
+
require "fluby"
|
2
2
|
require 'rake/packagetask'
|
3
3
|
|
4
|
-
|
5
|
-
HEIGHT = 480
|
6
|
-
FPS = 31
|
7
|
-
PLAYER = 8
|
8
|
-
BGCOLOR = "#ffffff"
|
9
|
-
APP = "<%= @project_name %>"
|
10
|
-
|
11
|
-
def render_template(file)
|
12
|
-
filename = File.basename(file).split(".")[0]
|
13
|
-
case File.basename(file).split(".")[1]
|
14
|
-
when "rhtml"
|
15
|
-
extension = "html"
|
16
|
-
when "rxml"
|
17
|
-
extension = "xml"
|
18
|
-
end
|
19
|
-
to_file = filename + "." + extension
|
20
|
-
puts "Rendering #{file}"
|
21
|
-
open(to_file,"w") do |f|
|
22
|
-
f << ERB.new(IO.read(file)).result
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
task :assets do
|
27
|
-
Dir.glob(['assets/*.js','assets/*.xml']).each do |file|
|
28
|
-
cp file, "deploy/#{File.basename(file)}", :verbose => true
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
task :compile => [:assets] do
|
33
|
-
if @nodebug
|
34
|
-
puts "Trace disabled"
|
35
|
-
trace = " -trace no"
|
36
|
-
else
|
37
|
-
trace = ""
|
38
|
-
end
|
39
|
-
@start = Time.now
|
40
|
-
["*.rhtml","*.rxml"].each do |list|
|
41
|
-
Dir[list].each do |tpl|
|
42
|
-
render_template(tpl)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
puts %x(swfmill simple #{APP}.xml #{APP}.swf)
|
46
|
-
rm "#{APP}.xml", {:verbose => false}
|
47
|
-
puts %x(mtasc -swf #{APP}.swf -main -mx -version #{PLAYER} #{trace} #{APP}.as)
|
48
|
-
@end = Time.now
|
49
|
-
|
50
|
-
["*.html","*.swf"].each do |list|
|
51
|
-
Dir[list].each do |file|
|
52
|
-
mv file, "deploy/#{file}", {:verbose => false}
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
Rake::PackageTask.new(APP, :noversion) do |p|
|
4
|
+
Rake::PackageTask.new("<%= @project_name %>", :noversion) do |p|
|
58
5
|
p.need_zip = true
|
59
|
-
p.name = Time.now.strftime("%Y%m%d") + "-" +
|
6
|
+
p.name = Time.now.strftime("%Y%m%d") + "-" + "<%= @project_name %>"
|
60
7
|
p.package_files.include("README",Dir["deploy/*"])
|
61
8
|
end
|
62
9
|
|
63
|
-
<% if Fluby.has_growl? %>
|
64
|
-
task :notify do
|
65
|
-
msg = "Finished compiling in #{@end - @start}s."
|
66
|
-
if @nodebug
|
67
|
-
msg += "\ntrace() disabled"
|
68
|
-
end
|
69
|
-
%x(growlnotify --name Rake -m '#{msg}' 'Rake')
|
70
|
-
end
|
71
|
-
<% end %>
|
72
|
-
|
73
|
-
task :nodebug do
|
74
|
-
@nodebug = true
|
75
|
-
end
|
76
|
-
|
77
10
|
task :monitor do
|
78
11
|
command = "rake"
|
79
12
|
files = {}
|
@@ -96,32 +29,19 @@ task :monitor do
|
|
96
29
|
end
|
97
30
|
end
|
98
31
|
|
99
|
-
|
100
|
-
desc "Test the SWF file in your default browser"
|
101
|
-
task :test => [:compile] do
|
32
|
+
task :test => [:build] do
|
102
33
|
%x(open deploy/index.html)
|
103
34
|
end
|
104
|
-
<% end %>
|
105
35
|
|
106
|
-
desc "
|
107
|
-
task :
|
108
|
-
|
109
|
-
%x(touch "#{debug_cfg_file}")
|
110
|
-
File.open(debug_cfg_file,"w") do |f|
|
111
|
-
f <<-EOF
|
112
|
-
ErrorReportingEnable=1
|
113
|
-
TraceOutputFileEnable=1
|
114
|
-
EOF
|
115
|
-
end unless File.exist?(debug_cfg_file)
|
116
|
-
%x(touch "$HOME/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt")
|
36
|
+
desc "Build <%= @project_name %>"
|
37
|
+
task :build do
|
38
|
+
system('fluby build')
|
117
39
|
end
|
118
40
|
|
119
|
-
<% if Fluby.has_growl? %>
|
120
41
|
desc "Build a release version of <%= @project_name %> (with trace() disabled)"
|
121
|
-
task :release
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
task :default => [:
|
127
|
-
<% end %>
|
42
|
+
task :release do
|
43
|
+
system('fluby release')
|
44
|
+
system('fluby pack')
|
45
|
+
end
|
46
|
+
|
47
|
+
task :default => [:test]
|
data/lib/templates/index.rhtml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
2
2
|
<head>
|
3
3
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
4
|
-
<title><%=
|
4
|
+
<title><%= Fluby.project_name %></title>
|
5
5
|
<script type="text/javascript" src="swfobject.js"></script>
|
6
6
|
</head>
|
7
7
|
<body>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
This text is replaced by the Flash movie.
|
10
10
|
</div>
|
11
11
|
<script type="text/javascript">
|
12
|
-
var so = new SWFObject("<%=
|
12
|
+
var so = new SWFObject("<%= Fluby.project_name %>.swf", "mymovie", "<%= Fluby.width %>", "<%= Fluby.height %>", "<%= Fluby.player %>", "<%= Fluby.bgcolor %>");
|
13
13
|
so.write("flashcontent");
|
14
14
|
</script>
|
15
15
|
</body>
|
data/lib/templates/project.rxml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
-
<movie width="<%=
|
3
|
-
<background color="<%=
|
2
|
+
<movie width="<%= Fluby.width %>" height="<%= Fluby.height %>" framerate="<%= Fluby.fps %>" version="<%= Fluby.player %>">
|
3
|
+
<background color="<%= Fluby.bgcolor %>"/>
|
4
4
|
<frame>
|
5
5
|
<library>
|
6
6
|
<% Dir["assets/*.png"].each do |file| %>
|
data/test/test_fluby.rb
CHANGED
@@ -13,7 +13,7 @@ class TestFluby < Test::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_fluby_is_loaded
|
16
|
-
assert_not_nil Fluby
|
16
|
+
assert_not_nil Fluby.version
|
17
17
|
assert_equal "fluby", Fluby::NAME
|
18
18
|
end
|
19
19
|
|
@@ -41,61 +41,11 @@ class TestFluby < Test::Unit::TestCase
|
|
41
41
|
|
42
42
|
def test_compilation
|
43
43
|
in_folder(PROJECT) do
|
44
|
-
%x(
|
44
|
+
%x(fluby build)
|
45
45
|
assert File.exist?("deploy/#{PROJECT}.swf"), "Compilation failed. Have you installed mtasc and swfmill?"
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
def test_generator
|
50
|
-
in_folder(PROJECT) do
|
51
|
-
Fluby.available_templates.each do |tpl|
|
52
|
-
Fluby.generate tpl, "com.bomberstudios.#{tpl}"
|
53
|
-
assert File.exist?("com/bomberstudios/#{tpl}.as"), "Error generating #{tpl}"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
def test_generator_with_single_option
|
58
|
-
in_folder(PROJECT) do
|
59
|
-
Fluby.generate "class", "com.bomberstudios.ClassTest", "foo:String"
|
60
|
-
assert File.exist?("com/bomberstudios/ClassTest.as")
|
61
|
-
assert_not_nil File.read("com/bomberstudios/ClassTest.as").match("var foo:String;")
|
62
|
-
end
|
63
|
-
end
|
64
|
-
def test_generator_with_multiple_options
|
65
|
-
in_folder(PROJECT) do
|
66
|
-
Fluby.generate "class", "com.bomberstudios.ClassTest", ["foo:String", "bar:XML"]
|
67
|
-
assert File.exist?("com/bomberstudios/ClassTest.as")
|
68
|
-
assert_not_nil File.read("com/bomberstudios/ClassTest.as").match("var foo:String;")
|
69
|
-
assert_not_nil File.read("com/bomberstudios/ClassTest.as").match("var bar:XML;")
|
70
|
-
end
|
71
|
-
end
|
72
|
-
def test_generator_with_multiple_options_via_commandline
|
73
|
-
in_folder(PROJECT) do
|
74
|
-
%x(script/generate class com.bomberstudios.Car make:String model:String year:Number)
|
75
|
-
assert File.exist?("com/bomberstudios/Car.as")
|
76
|
-
assert_not_nil File.read("com/bomberstudios/Car.as").match("var make:String;")
|
77
|
-
assert_not_nil File.read("com/bomberstudios/Car.as").match("var model:String;")
|
78
|
-
assert_not_nil File.read("com/bomberstudios/Car.as").match("var year:Number;")
|
79
|
-
end
|
80
|
-
end
|
81
|
-
def test_error_creating_existing_template
|
82
|
-
in_folder(PROJECT) do
|
83
|
-
assert_raise RuntimeError do
|
84
|
-
Fluby.generate "class", "com.bomberstudios.ClassTest", ["foo:String", "bar:XML"]
|
85
|
-
Fluby.generate "class", "com.bomberstudios.ClassTest", ["foo:String", "bar:XML"]
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_available_templates
|
91
|
-
assert_equal Dir["lib/templates/generators/*"].size, Fluby.available_templates.size, "Template count mismatch"
|
92
|
-
in_folder PROJECT do
|
93
|
-
templates = %x(script/generate)
|
94
|
-
tpl_list = Fluby.available_templates.join("\n\t")
|
95
|
-
assert_equal "Usage: script/generate type classpath [options]\nwhere type is one of\n\t#{tpl_list}\n", templates
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
49
|
def test_textmate
|
100
50
|
assert !Fluby.in_textmate?
|
101
51
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Ale Mu\xC3\xB1oz"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-15 00:00:00 +02:00
|
13
13
|
default_executable: fluby
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -22,26 +22,20 @@ extensions: []
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- README.mdown
|
24
24
|
files:
|
25
|
-
- .gitignore
|
26
|
-
- Changelog
|
27
25
|
- README.mdown
|
28
|
-
- Rakefile
|
29
26
|
- VERSION
|
30
27
|
- bin/fluby
|
31
|
-
- fluby.gemspec
|
32
28
|
- lib/fluby.rb
|
33
29
|
- lib/templates/ASClass.as
|
34
30
|
- lib/templates/README
|
35
31
|
- lib/templates/Rakefile
|
36
|
-
- lib/templates/
|
32
|
+
- lib/templates/config.yml
|
37
33
|
- lib/templates/generators/class
|
38
34
|
- lib/templates/generators/delegate
|
39
35
|
- lib/templates/generators/xml_loader
|
40
36
|
- lib/templates/index.rhtml
|
41
37
|
- lib/templates/project.rxml
|
42
38
|
- lib/templates/swfobject.js
|
43
|
-
- test/helper.rb
|
44
|
-
- test/test_fluby.rb
|
45
39
|
has_rdoc: true
|
46
40
|
homepage: http://github.com/bomberstudios/fluby
|
47
41
|
licenses: []
|
data/.gitignore
DELETED
data/Changelog
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
0.X.X
|
2
|
-
-----
|
3
|
-
* Support for user templates
|
4
|
-
|
5
|
-
0.7.0
|
6
|
-
-----
|
7
|
-
* Moved gem to gemcutter.org
|
8
|
-
|
9
|
-
0.6.4
|
10
|
-
-----
|
11
|
-
* Added 'rake monitor' task to fluby project, so the project autocompiles whenever you save the main .as file or any of the auxiliary files (index.rhtml, project.rxml or Rakefile)
|
12
|
-
* Added :assets task to fluby Rakefile. js and xml files in the 'assets' folder are copied to the 'deploy' folder when compiling.
|
13
|
-
* Run 'pack' task when running 'rake release'
|
14
|
-
* Create swfobject.js in 'assets' folder instead of 'deploy'
|
15
|
-
* Added Video asset to the rxml template. It's commented out in case you don't need it, but it's nice to have it there as I always forget the syntax :)
|
16
|
-
* Use packed swfobject.js
|
17
|
-
|
18
|
-
0.6.1
|
19
|
-
-----
|
20
|
-
* Added 'delegate' template for script/generate
|
21
|
-
|
22
|
-
0.6
|
23
|
-
---
|
24
|
-
* Added colorized output to terminal operations
|
25
|
-
* Added 'rake package' task
|
26
|
-
* Added 'script/generate' tool to generate common classes (right now there's only a 'xml_loader' template)
|
27
|
-
|
28
|
-
0.5.7
|
29
|
-
-----
|
30
|
-
* Improved Rakefile for non-Mac systems
|
31
|
-
|
32
|
-
0.5.6
|
33
|
-
-----
|
34
|
-
|
35
|
-
* Added support for multiple weights of a font family (thanks mamuso)
|
36
|
-
* Fixed a bug on the project Rakefile that made it imposible to add assets (the SWF was overwritten by MTASC after swfmill imported the assets)
|
37
|
-
* Improved documentation (just a little bit :)
|
data/Rakefile
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
##### Requirements
|
2
|
-
|
3
|
-
require 'rake'
|
4
|
-
require 'rake/clean'
|
5
|
-
require 'rake/testtask'
|
6
|
-
require File.dirname(__FILE__) + '/lib/fluby.rb'
|
7
|
-
|
8
|
-
##### Jeweler
|
9
|
-
begin
|
10
|
-
require 'jeweler'
|
11
|
-
Jeweler::Tasks.new do |gemspec|
|
12
|
-
gemspec.name = "fluby"
|
13
|
-
gemspec.summary = "MTASC + SWFMILL + Rake helper"
|
14
|
-
gemspec.description = "A simple command to create and compile an ActionScript project for MTASC + SWFMILL + Rake"
|
15
|
-
gemspec.email = "bomberstudios@gmail.com"
|
16
|
-
gemspec.homepage = "http://github.com/bomberstudios/fluby"
|
17
|
-
gemspec.authors = ["Ale Muñoz"]
|
18
|
-
gemspec.rubyforge_project = 'fluby'
|
19
|
-
end
|
20
|
-
Jeweler::GemcutterTasks.new
|
21
|
-
# release with: $ rake gemcutter:release
|
22
|
-
rescue LoadError
|
23
|
-
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
24
|
-
end
|
25
|
-
|
26
|
-
##### Cleaning
|
27
|
-
CLEAN.include [ 'tmp', 'test/fixtures/*/output/*', 'test/fixtures/*/tmp' ]
|
28
|
-
CLOBBER.include [ 'pkg', '*.gem', 'coverage.data' ]
|
29
|
-
|
30
|
-
### Testing
|
31
|
-
Rake::TestTask.new(:test) do |test|
|
32
|
-
test.test_files = Dir['test/test_*.rb']
|
33
|
-
end
|
34
|
-
|
35
|
-
desc 'Test code coverage using rcov'
|
36
|
-
task :rcov do
|
37
|
-
rm_f "coverage"
|
38
|
-
rm_f "coverage.data"
|
39
|
-
rcov = "rcov --exclude gem --aggregate coverage.data --text-summary -Ilib"
|
40
|
-
sh "#{rcov} --no-html test/*", :verbose => false
|
41
|
-
end
|
42
|
-
|
43
|
-
desc "Test and package gem"
|
44
|
-
task :default => [ :test, :gemspec, :build ]
|
45
|
-
|
46
|
-
desc "Push GEM to Gemcutter"
|
47
|
-
task :push => [ :clobber, :default ] do
|
48
|
-
%x(rake gemcutter:release)
|
49
|
-
end
|
data/fluby.gemspec
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{fluby}
|
8
|
-
s.version = "0.7.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Ale Muñoz"]
|
12
|
-
s.date = %q{2009-10-14}
|
13
|
-
s.default_executable = %q{fluby}
|
14
|
-
s.description = %q{A simple command to create and compile an ActionScript project for MTASC + SWFMILL + Rake}
|
15
|
-
s.email = %q{bomberstudios@gmail.com}
|
16
|
-
s.executables = ["fluby"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"README.mdown"
|
19
|
-
]
|
20
|
-
s.files = [
|
21
|
-
".gitignore",
|
22
|
-
"Changelog",
|
23
|
-
"README.mdown",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"bin/fluby",
|
27
|
-
"fluby.gemspec",
|
28
|
-
"lib/fluby.rb",
|
29
|
-
"lib/templates/ASClass.as",
|
30
|
-
"lib/templates/README",
|
31
|
-
"lib/templates/Rakefile",
|
32
|
-
"lib/templates/generate",
|
33
|
-
"lib/templates/generators/class",
|
34
|
-
"lib/templates/generators/delegate",
|
35
|
-
"lib/templates/generators/xml_loader",
|
36
|
-
"lib/templates/index.rhtml",
|
37
|
-
"lib/templates/project.rxml",
|
38
|
-
"lib/templates/swfobject.js",
|
39
|
-
"test/helper.rb",
|
40
|
-
"test/test_fluby.rb"
|
41
|
-
]
|
42
|
-
s.homepage = %q{http://github.com/bomberstudios/fluby}
|
43
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
44
|
-
s.require_paths = ["lib"]
|
45
|
-
s.rubyforge_project = %q{fluby}
|
46
|
-
s.rubygems_version = %q{1.3.5}
|
47
|
-
s.summary = %q{MTASC + SWFMILL + Rake helper}
|
48
|
-
s.test_files = [
|
49
|
-
"test/helper.rb",
|
50
|
-
"test/test_fluby.rb"
|
51
|
-
]
|
52
|
-
|
53
|
-
if s.respond_to? :specification_version then
|
54
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
55
|
-
s.specification_version = 3
|
56
|
-
|
57
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
58
|
-
else
|
59
|
-
end
|
60
|
-
else
|
61
|
-
end
|
62
|
-
end
|
data/lib/templates/generate
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require "rubygems"
|
3
|
-
require "fluby"
|
4
|
-
|
5
|
-
commandline = ARGV
|
6
|
-
if commandline.size < 2
|
7
|
-
puts "Usage: script/generate type classpath [options]"
|
8
|
-
puts "where type is one of"
|
9
|
-
Fluby.available_templates.each do |t|
|
10
|
-
puts "\t#{t}"
|
11
|
-
end
|
12
|
-
else
|
13
|
-
type = commandline.shift
|
14
|
-
name = commandline.shift
|
15
|
-
options = commandline
|
16
|
-
Fluby.generate(type,name,options)
|
17
|
-
end
|