asproject 0.1.33 → 0.1.34
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +0 -2
- data/MIT-LICENSE.txt +1 -1
- data/README.txt +0 -1
- data/TODO.txt +2 -2
- data/lib/asclass.rb +1 -1
- data/lib/asproject.rb +1 -0
- data/lib/asproject/version.rb +1 -1
- data/lib/asproject_utils.rb +5 -5
- data/lib/path_finder.rb +48 -0
- data/lib/player_fetcher.rb +2 -1
- data/lib/tasks/hamtasc.rb +66 -0
- data/lib/tasks/mtasc.rb +110 -0
- data/lib/tasks/rake.rb +6 -0
- data/lib/tasks/remote_file_task.rb +248 -0
- data/lib/tasks/swfmill.rb +66 -0
- data/lib/test_suite_generator.rb +3 -2
- data/rakefile.rb +4 -1
- data/templates/asproject/as2/project/rakefile.rb +7 -15
- metadata +8 -14
- data/templates/asclass/mxml/.crap_file +0 -10
- data/templates/asproject/as2/art/.crap_file +0 -10
- data/templates/asproject/as2/doc/.crap_file +0 -10
- data/templates/asproject/as2/project/bin/.crap_file +0 -10
- data/templates/asproject/as2/project/lib/.crap_file +0 -10
- data/templates/asproject/as3/art/.crap_file +0 -10
- data/templates/asproject/as3/doc/.crap_file +0 -10
- data/templates/asproject/as3/project/bin/.crap_file +0 -10
- data/templates/asproject/as3/project/lib/.crap_file +0 -10
- data/templates/asproject/as3/project/test/.crap_file +0 -10
- data/templates/asproject/mxml/.crap_file +0 -10
data/CHANGELOG.txt
CHANGED
data/MIT-LICENSE.txt
CHANGED
data/README.txt
CHANGED
data/TODO.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---------------------
|
2
|
-
|
2
|
+
TODO
|
3
3
|
|
4
|
-
* Get empty directories to bundle in the gem file
|
5
4
|
* Get Flash Player to run on mac and win
|
5
|
+
* Add support for arbitrary external dependencies (mtasc, swfmill, hamtasc, etc)
|
6
6
|
* Display trace output across platforms for running flash players
|
7
7
|
|
data/lib/asclass.rb
CHANGED
@@ -59,7 +59,7 @@ module AsProject
|
|
59
59
|
elsif(name.match(/Test$/))
|
60
60
|
is_test_case = true
|
61
61
|
template = test_case_template
|
62
|
-
elsif(name.
|
62
|
+
elsif(name.match(/^I[A-Z]/) || name.match(/able$/))
|
63
63
|
is_interface = true
|
64
64
|
template = interface_template
|
65
65
|
else
|
data/lib/asproject.rb
CHANGED
data/lib/asproject/version.rb
CHANGED
data/lib/asproject_utils.rb
CHANGED
@@ -21,12 +21,12 @@ def AsProject::windowize_cygwin_path2(name)
|
|
21
21
|
return name
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def AsProject::unique_tmpdir(application='RubyApplication')
|
25
25
|
rand_max = RAND_CHARS.size
|
26
26
|
uniqueish_name = ''
|
27
27
|
24.times{ uniqueish_name << RAND_CHARS[rand(rand_max)] }
|
28
28
|
|
29
|
-
tmp =
|
29
|
+
tmp = AsProject.asproject_tmpdir
|
30
30
|
app_tmp = File.join(tmp, application)
|
31
31
|
if(!File.exists?(app_tmp))
|
32
32
|
Dir.mkdir(app_tmp)
|
@@ -34,16 +34,16 @@ def Dir::unique_tmpdir(application='RubyApplication')
|
|
34
34
|
|
35
35
|
tmp = File.expand_path(File.join(app_tmp, uniqueish_name))
|
36
36
|
if(File.exists?(tmp) && is_retry)
|
37
|
-
raise ProjectError.new('
|
37
|
+
raise ProjectError.new('AsProject.unique_tmpdir attempted to create a new dir over an existing dir')
|
38
38
|
# else if(File.exists?(tmp))
|
39
39
|
# Try again once before failing, uniqueish names aren't too unique...
|
40
|
-
#
|
40
|
+
# AsProject.unique_tmpdir(application, true)
|
41
41
|
end
|
42
42
|
Dir.mkdir(tmp)
|
43
43
|
return tmp
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
46
|
+
def AsProject::asproject_tmpdir
|
47
47
|
tmp = nil
|
48
48
|
for dir in [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'],
|
49
49
|
ENV['USERPROFILE'], '/tmp']
|
data/lib/path_finder.rb
CHANGED
@@ -41,6 +41,10 @@ module AsProject
|
|
41
41
|
return @user.flash_player_trust
|
42
42
|
end
|
43
43
|
|
44
|
+
def remote_file_task(name, task)
|
45
|
+
return @user.remote_file_task(name, task)
|
46
|
+
end
|
47
|
+
|
44
48
|
def gem_asproject_home
|
45
49
|
parent = File.dirname(File.dirname(__FILE__))
|
46
50
|
return File.expand_path(parent)
|
@@ -228,6 +232,16 @@ module AsProject
|
|
228
232
|
@flash_log_file_name = 'flashlog.txt'
|
229
233
|
end
|
230
234
|
|
235
|
+
def remote_file_task(name, task)
|
236
|
+
return UnixRemoteFileTask.new(name, self) do |t|
|
237
|
+
if(task.unix_url.nil?)
|
238
|
+
raise UsageError.new("There was a problem finding a target for #{task.name}, it doesn't appear as if this task was expected to run on your system...")
|
239
|
+
end
|
240
|
+
t.url = task.unix_url
|
241
|
+
t.extracted_file = task.unix_extracted_file
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
231
245
|
def asproject_home
|
232
246
|
return get_or_create(File.join(home, @default_asproject))
|
233
247
|
end
|
@@ -301,6 +315,10 @@ EOF
|
|
301
315
|
return file
|
302
316
|
end
|
303
317
|
|
318
|
+
def downloads
|
319
|
+
return File.join(asproject_home, 'downloads')
|
320
|
+
end
|
321
|
+
|
304
322
|
def home
|
305
323
|
["HOME", "USERPROFILE"].each do |homekey|
|
306
324
|
return ENV[homekey] if ENV[homekey]
|
@@ -352,6 +370,16 @@ EOF
|
|
352
370
|
@osx_asproject = 'AsProject'
|
353
371
|
end
|
354
372
|
|
373
|
+
def remote_file_task(name, task)
|
374
|
+
return OSXRemoteFileTask.new(name, self) do |t|
|
375
|
+
if(task.osx_url.nil?)
|
376
|
+
raise UsageError.new("There was a problem finding a target for #{task.name}, it doesn't appear as if this task was expected to run on your system...")
|
377
|
+
end
|
378
|
+
t.url = task.osx_url
|
379
|
+
t.extracted_file = task.osx_extracted_file
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
355
383
|
def flash_player_home
|
356
384
|
return File.join(library, 'Preferences', 'Macromedia', 'Flash Player')
|
357
385
|
end
|
@@ -388,6 +416,16 @@ EOF
|
|
388
416
|
@win_asproject = 'AsProject'
|
389
417
|
end
|
390
418
|
|
419
|
+
def remote_file_task(name, task)
|
420
|
+
return WinRemoteFileTask.new(name, self) do |t|
|
421
|
+
if(task.win_url.nil?)
|
422
|
+
raise UsageError.new("There was a problem finding a target for #{task.name}, it doesn't appear as if this task was expected to run on your system...")
|
423
|
+
end
|
424
|
+
t.url = task.win_url
|
425
|
+
t.extracted_file = task.win_extracted_file
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
391
429
|
def home
|
392
430
|
usr = super
|
393
431
|
if(usr.index "My Documents")
|
@@ -433,6 +471,16 @@ EOF
|
|
433
471
|
windowized = File.join("#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}", 'Application Data', 'Macromedia', 'Flash Player', 'Logs', 'flashlog.txt')
|
434
472
|
content.gsub!(flash_player_log, windowized)
|
435
473
|
end
|
474
|
+
|
475
|
+
def remote_file_task(name, task)
|
476
|
+
return CygwinRemoteFileTask.new(name, self) do |t|
|
477
|
+
if(task.win_url.nil?)
|
478
|
+
raise UsageError.new("There was a problem finding a target for #{task.name}, it doesn't appear as if this task was expected to run on your system...")
|
479
|
+
end
|
480
|
+
t.url = task.win_url
|
481
|
+
t.extracted_file = task.win_extracted_file
|
482
|
+
end
|
483
|
+
end
|
436
484
|
end
|
437
485
|
|
438
486
|
class VistaUser < WinUser
|
data/lib/player_fetcher.rb
CHANGED
@@ -65,7 +65,7 @@ EOF
|
|
65
65
|
|
66
66
|
if(response.code != '200')
|
67
67
|
msg = "Download failed for\n"
|
68
|
-
msg <<"http://#{host}#{url}\n"
|
68
|
+
msg << "http://#{host}#{url}\n"
|
69
69
|
msg << "with HTTP Status code: #{response.code.to_s}\n"
|
70
70
|
msg << response.message
|
71
71
|
raise UsageError.new(msg)
|
@@ -77,6 +77,7 @@ EOF
|
|
77
77
|
|
78
78
|
|
79
79
|
result = ''
|
80
|
+
|
80
81
|
if(is_zip?(url))
|
81
82
|
File.open(zip_file, 'w') do |f|
|
82
83
|
f.write(response.body)
|
@@ -0,0 +1,66 @@
|
|
1
|
+
|
2
|
+
require File.dirname(__FILE__) + '/remote_file_task'
|
3
|
+
|
4
|
+
module AsProject
|
5
|
+
class HAMTASCError < StandardError; end
|
6
|
+
|
7
|
+
class HAMTASC < MTASC
|
8
|
+
|
9
|
+
attr_accessor :pack_path,
|
10
|
+
:rb_entry,
|
11
|
+
:rb_exclude_swf,
|
12
|
+
:rb_exclude_path
|
13
|
+
|
14
|
+
def initialize(name=:compile, do_not_define=false)
|
15
|
+
@pack_path = []
|
16
|
+
@exclude_packages = []
|
17
|
+
@rb_exclude_path = []
|
18
|
+
super(name, true) do |s|
|
19
|
+
s.compiler_version = '1.12.rb.20'
|
20
|
+
s.win_url = "http://asproject.googlecode.com/files/hamtasc-#{compiler_version}.zip"
|
21
|
+
s.win_extracted_file = "/hamtasc-#{compiler_version}/hamtasc.exe"
|
22
|
+
s.osx_url = nil
|
23
|
+
s.osx_extracted_file = nil
|
24
|
+
s.unix_url = nil
|
25
|
+
s.unix_extracted_file = nil
|
26
|
+
end
|
27
|
+
yield self if block_given?
|
28
|
+
define unless do_not_define
|
29
|
+
end
|
30
|
+
|
31
|
+
def define
|
32
|
+
if(rb_exclude_path.size > 0)
|
33
|
+
@exclude_packages = rb_exclude_path
|
34
|
+
# rb_exclude_path.each do |path|
|
35
|
+
# @exclude_packages << recurse_exclude_path(path)
|
36
|
+
# end
|
37
|
+
end
|
38
|
+
|
39
|
+
@cleaned_pack_path = []
|
40
|
+
pack_path.each do |path|
|
41
|
+
add_path(path, @cleaned_pack_path)
|
42
|
+
end
|
43
|
+
|
44
|
+
super
|
45
|
+
end
|
46
|
+
|
47
|
+
def remote_task_name
|
48
|
+
return "hamtasc-#{compiler_version}"
|
49
|
+
end
|
50
|
+
|
51
|
+
def compile_task_desc
|
52
|
+
return "Compile #{name} using HAMTASC"
|
53
|
+
end
|
54
|
+
|
55
|
+
def option_list
|
56
|
+
result = super
|
57
|
+
input = result.pop if(input)
|
58
|
+
result << "-rb_entry" << rb_entry if rb_entry
|
59
|
+
result << "-rb_exclude_swf" << clean_path(rb_exclude_swf) if rb_exclude_swf
|
60
|
+
result << "-rb_exclude_package " << @exclude_packages.join(" -rb_exclude_package ") if @exclude_packages.size > 0
|
61
|
+
result << "-pack " + @cleaned_pack_path.join(" -pack ") if pack_path.size > 0
|
62
|
+
result << input if input
|
63
|
+
return result
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/lib/tasks/mtasc.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
|
2
|
+
require File.dirname(__FILE__) + '/remote_file_task'
|
3
|
+
|
4
|
+
module AsProject
|
5
|
+
class MTASCError < StandardError; end
|
6
|
+
|
7
|
+
class MTASC < RemoteFileTask
|
8
|
+
|
9
|
+
attr_accessor :name,
|
10
|
+
:version,
|
11
|
+
:compiler_version,
|
12
|
+
:main,
|
13
|
+
:header,
|
14
|
+
:frame,
|
15
|
+
:verbose,
|
16
|
+
:mx,
|
17
|
+
:input,
|
18
|
+
:input_swf,
|
19
|
+
:class_path,
|
20
|
+
:output
|
21
|
+
|
22
|
+
def initialize(name=:compile, do_not_define=false)
|
23
|
+
@compiler_version = '1.13'
|
24
|
+
@options = []
|
25
|
+
@class_path = []
|
26
|
+
@user_task = nil
|
27
|
+
@win_url = "http://www.mtasc.org/zip/mtasc-#{compiler_version}.zip"
|
28
|
+
@win_extracted_file = "/mtasc-#{compiler_version}/mtasc.exe"
|
29
|
+
@osx_url = "http://www.mtasc.org/zip/mtasc-#{compiler_version}.dmg"
|
30
|
+
@osx_extracted_file = "/mtasc-#{compiler_version}/mtasc.app"
|
31
|
+
@unix_url = "http://www.mtasc.org/zip/mtasc-#{compiler_version}.tar.gz"
|
32
|
+
@unix_extracted_file = "/mtasc-#{compiler_version}/mtasc"
|
33
|
+
super(name, true)
|
34
|
+
define unless do_not_define
|
35
|
+
end
|
36
|
+
|
37
|
+
def remote_task_name
|
38
|
+
return "mtasc-#{compiler_version}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def compile_task_desc
|
42
|
+
return "Compile #{name} using MTASC"
|
43
|
+
end
|
44
|
+
|
45
|
+
# Create the tasks defined by this task lib.
|
46
|
+
def define
|
47
|
+
super
|
48
|
+
# if(!input_swf && !header && pack_path.size == 0)
|
49
|
+
# raise MTASCError.new('MTASC task must be provided with an input_swf, a header argument, or at least one pack_path')
|
50
|
+
# end
|
51
|
+
# if(header && !input_swf && output)
|
52
|
+
# raise MTASCError.new('It looks like you used the output parameter where you should have used the swf parameter')
|
53
|
+
# end
|
54
|
+
desc compile_task_desc
|
55
|
+
task name => [output]
|
56
|
+
CLEAN.add(output)
|
57
|
+
|
58
|
+
if(input_swf)
|
59
|
+
file input_swf
|
60
|
+
task name => [input_swf]
|
61
|
+
end
|
62
|
+
|
63
|
+
@cleaned_class_paths = []
|
64
|
+
class_path.each do |path|
|
65
|
+
add_path(path, @cleaned_class_paths)
|
66
|
+
end
|
67
|
+
|
68
|
+
file output do |f|
|
69
|
+
user_task.execute(option_list.join(' '))
|
70
|
+
end
|
71
|
+
|
72
|
+
self
|
73
|
+
end
|
74
|
+
|
75
|
+
def recurse_exclude_path(dir)
|
76
|
+
paths = [dir]
|
77
|
+
Dir[dir + '/*'].each do |f|
|
78
|
+
if(File.directory?(f))
|
79
|
+
paths << recurse_exclude_path(f)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
return paths
|
83
|
+
end
|
84
|
+
|
85
|
+
def add_path(path, list)
|
86
|
+
as_files = FileList[path + '/**/**/*.as']
|
87
|
+
file as_files
|
88
|
+
file output => as_files
|
89
|
+
xml_files = FileList[path + '/**/**/*.xml']
|
90
|
+
file xml_files
|
91
|
+
file output => xml_files
|
92
|
+
|
93
|
+
list << clean_path(path)
|
94
|
+
end
|
95
|
+
|
96
|
+
def option_list
|
97
|
+
result = @options.dup
|
98
|
+
result << "-header" << header if header
|
99
|
+
result << "-mx" if mx
|
100
|
+
result << "-v" if verbose
|
101
|
+
result << "-frame" << frame if frame
|
102
|
+
result << "-cp " + @cleaned_class_paths.join(" -cp ") if class_path.size > 0
|
103
|
+
result << "-swf" << clean_path(input_swf) if input_swf
|
104
|
+
result << "-out" << clean_path(output) if output
|
105
|
+
result << "-main" if main
|
106
|
+
result << clean_path(input) if input
|
107
|
+
return result
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
data/lib/tasks/rake.rb
ADDED
@@ -0,0 +1,248 @@
|
|
1
|
+
require 'rake/tasklib'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'uri'
|
4
|
+
require 'ftools'
|
5
|
+
|
6
|
+
# Tell Rake NOT to remove directory(ies) named 'core'
|
7
|
+
CLEAN.exclude("core")
|
8
|
+
|
9
|
+
module AsProject
|
10
|
+
# The RemoteFileTask was created to resolve
|
11
|
+
# external tool dependencies for relatively stable
|
12
|
+
# tools like mtasc, swfmill and mxmlc
|
13
|
+
# The intention is that common tools will have
|
14
|
+
# RemoteFileTasks deployed with AsProject and will
|
15
|
+
# include mac/win/unix targets so that users on
|
16
|
+
# each platform will seamlessly download and
|
17
|
+
# target these tools.
|
18
|
+
class RemoteFileTask < Rake::TaskLib
|
19
|
+
attr_accessor :name,
|
20
|
+
:user_task,
|
21
|
+
:remote_task_name,
|
22
|
+
:win_url,
|
23
|
+
:osx_url,
|
24
|
+
:unix_url,
|
25
|
+
:win_extracted_file,
|
26
|
+
:osx_extracted_file,
|
27
|
+
:unix_extracted_file
|
28
|
+
|
29
|
+
def initialize(name=:remote_file_task, do_not_define=false)
|
30
|
+
@name = name
|
31
|
+
@user_task = nil
|
32
|
+
@remote_task_name = name.to_s
|
33
|
+
yield self if block_given?
|
34
|
+
define unless do_not_define
|
35
|
+
end
|
36
|
+
|
37
|
+
def define
|
38
|
+
define_user_task
|
39
|
+
self
|
40
|
+
end
|
41
|
+
|
42
|
+
def define_user_task
|
43
|
+
if(@user_task.nil?)
|
44
|
+
if(remote_task_name.nil?)
|
45
|
+
raise UsageError.new('RemoteFileTask created without a remote_task_name value...')
|
46
|
+
end
|
47
|
+
@user_task = PathFinder.new().remote_file_task(remote_task_name, self)
|
48
|
+
task @name => remote_task_name
|
49
|
+
end
|
50
|
+
@user_task
|
51
|
+
end
|
52
|
+
|
53
|
+
def clean_path(path)
|
54
|
+
define_user_task
|
55
|
+
return user_task.clean_path(path)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class AbstractRemoteFileTask
|
60
|
+
attr_accessor :name,
|
61
|
+
:url,
|
62
|
+
:extracted_file
|
63
|
+
|
64
|
+
def initialize(name, user)
|
65
|
+
@name = name
|
66
|
+
@user = user
|
67
|
+
yield self if block_given?
|
68
|
+
define
|
69
|
+
end
|
70
|
+
|
71
|
+
def define
|
72
|
+
@uri = URI.parse(url)
|
73
|
+
downloaded_file = downloaded_file_path
|
74
|
+
file downloaded_file do |f|
|
75
|
+
get_remote_file(@uri, downloaded_file)
|
76
|
+
end
|
77
|
+
|
78
|
+
if(extracted_file_path != downloaded_file)
|
79
|
+
if(!Rake::Task.task_defined?(extracted_file_path))
|
80
|
+
file extracted_file_path => [downloaded_file] do |f|
|
81
|
+
unpack_downloaded_file(downloaded_file, extracted_file_path)
|
82
|
+
File.chmod(0755, extracted_file_path)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# else
|
87
|
+
# File.chmod(0755, downloaded_file)
|
88
|
+
# task @name => url
|
89
|
+
end
|
90
|
+
|
91
|
+
task @name => [extracted_file_path]
|
92
|
+
end
|
93
|
+
|
94
|
+
def extracted_file_path
|
95
|
+
return File.join(@user.downloads, @name.to_s, extracted_file)
|
96
|
+
end
|
97
|
+
|
98
|
+
def downloaded_file_path
|
99
|
+
parts = @uri.path.split('/')
|
100
|
+
file = parts.pop
|
101
|
+
return File.join(@user.downloads, @name.to_s, file)
|
102
|
+
end
|
103
|
+
|
104
|
+
def unpack_downloaded_file(file_name, expected_file)
|
105
|
+
if(!File.exists?(expected_file))
|
106
|
+
if(is_zip?(file_name))
|
107
|
+
unpack_zip(file_name, File.dirname(file_name))
|
108
|
+
elsif(!is_exe?(file_name))
|
109
|
+
raise UsageError.new("RemoteFileTask does not know how to unpack files of type: #{file_name}")
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def unpack_zip(zip_file, dir)
|
115
|
+
Zip::ZipFile::open(zip_file) do |zf|
|
116
|
+
zf.each do |e|
|
117
|
+
fpath = File.join(dir, e.name)
|
118
|
+
FileUtils.mkdir_p(File.dirname(fpath))
|
119
|
+
zf.extract(e, fpath)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def is_exe?(file)
|
125
|
+
return (file.split('.').pop == 'exe')
|
126
|
+
end
|
127
|
+
|
128
|
+
def is_zip?(file)
|
129
|
+
return (file.split('.').pop == 'zip')
|
130
|
+
end
|
131
|
+
|
132
|
+
def is_tar?(file)
|
133
|
+
return (file.split('.').pop == 'tar')
|
134
|
+
end
|
135
|
+
|
136
|
+
def is_gzip?(file)
|
137
|
+
return (file.split('.').pop == 'gz')
|
138
|
+
end
|
139
|
+
|
140
|
+
def is_dmg?(file)
|
141
|
+
return (file.split('.').pop == 'dmg')
|
142
|
+
end
|
143
|
+
|
144
|
+
def make_downloaded_dir(file)
|
145
|
+
dir = File.dirname(file)
|
146
|
+
File.makedirs(dir)
|
147
|
+
end
|
148
|
+
|
149
|
+
def remote_file_dir
|
150
|
+
return File.join(@user.downloads, @name.to_s)
|
151
|
+
end
|
152
|
+
|
153
|
+
def remote_location
|
154
|
+
return File.join(remote_file_dir, extracted_file)
|
155
|
+
end
|
156
|
+
|
157
|
+
def fetch(location, limit = 10)
|
158
|
+
uri = URI.parse(location)
|
159
|
+
|
160
|
+
# Download the file now to the downloads dir
|
161
|
+
# If the file is an archive (zip, gz, tar, tar.gz, dmg), extract to
|
162
|
+
# AsProject/remote_files/@name/@location
|
163
|
+
# Check the location again...
|
164
|
+
raise UsageError.new("The RemoteFileTask can only handle HTTP requests at this time, it seems you were trying: #{uri.scheme}") if uri.scheme != 'http'
|
165
|
+
raise UsageError.new('HTTP redirect too deep') if limit == 0
|
166
|
+
|
167
|
+
response = nil
|
168
|
+
t = Thread.new {
|
169
|
+
response = Net::HTTP.get_response(uri.host, uri.path)
|
170
|
+
}
|
171
|
+
# TODO: Add actual bytesLoaded vs bytesTotal
|
172
|
+
# To the output...
|
173
|
+
while t.alive?
|
174
|
+
print(".")
|
175
|
+
$stdout.flush
|
176
|
+
sleep(0.2)
|
177
|
+
end
|
178
|
+
|
179
|
+
if(response.is_a? Net::HTTPSuccess)
|
180
|
+
return response
|
181
|
+
elsif(response.is_a? Net::HTTPRedirection)
|
182
|
+
return fetch(response['location'], limit - 1)
|
183
|
+
else
|
184
|
+
puts response.to_s
|
185
|
+
return response.error!
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def get_remote_file(uri, target)
|
190
|
+
if(!File.exists?(target))
|
191
|
+
puts "Fetching #{uri.to_s} now!"
|
192
|
+
response = fetch(uri.to_s)
|
193
|
+
|
194
|
+
File.makedirs(File.dirname(target))
|
195
|
+
# Store the downloaded file on disk
|
196
|
+
File.open(target, 'wb') do |f|
|
197
|
+
f.write(response.body)
|
198
|
+
end
|
199
|
+
|
200
|
+
puts ""
|
201
|
+
puts "Downloaded #{(response.body.size / 1024).to_s} KB"
|
202
|
+
puts "to: #{target}"
|
203
|
+
puts ""
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
def clean_path(path)
|
208
|
+
if(path.index(' '))
|
209
|
+
return %{'#{path}'}
|
210
|
+
end
|
211
|
+
return path
|
212
|
+
end
|
213
|
+
|
214
|
+
def execute(params)
|
215
|
+
# Execute the system call with params
|
216
|
+
# Sometimes DOS wants a 'run' prefix
|
217
|
+
# Sometimes OSX wants a 'open' prefix
|
218
|
+
# Sometimes Cygwin wants a './' prefix
|
219
|
+
# This method should be overridden in
|
220
|
+
# subclasses
|
221
|
+
sh %{#{clean_path(extracted_file_path)} #{params}}
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
class WinRemoteFileTask < AbstractRemoteFileTask
|
226
|
+
|
227
|
+
def clean_path(path)
|
228
|
+
path = path.split('/').join(File::SEPARATOR)
|
229
|
+
if(path.index(' '))
|
230
|
+
return %{"#{path}"}
|
231
|
+
end
|
232
|
+
return path
|
233
|
+
end
|
234
|
+
|
235
|
+
def execute(params)
|
236
|
+
sh %{"#{extracted_file_path}" #{params}}
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
class CygwinRemoteFileTask < AbstractRemoteFileTask
|
241
|
+
end
|
242
|
+
|
243
|
+
class OSXRemoteFileTask < AbstractRemoteFileTask
|
244
|
+
end
|
245
|
+
|
246
|
+
class UnixRemoteFileTask < AbstractRemoteFileTask
|
247
|
+
end
|
248
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
|
2
|
+
require File.dirname(__FILE__) + '/remote_file_task'
|
3
|
+
|
4
|
+
module AsProject
|
5
|
+
class SWFMillError < StandardError; end
|
6
|
+
|
7
|
+
class SWFMill < RemoteFileTask
|
8
|
+
attr_accessor :name,
|
9
|
+
:simple,
|
10
|
+
:input,
|
11
|
+
:output,
|
12
|
+
:version
|
13
|
+
|
14
|
+
def initialize(name, do_not_define=false)
|
15
|
+
@simple = true
|
16
|
+
@input = nil
|
17
|
+
@output = nil
|
18
|
+
@options = []
|
19
|
+
@version = '0.2.12'
|
20
|
+
@win_url = "http://www.swfmill.org/releases/swfmill-#{version}-win32.zip"
|
21
|
+
@win_extracted_file = "/swfmill-#{version}-win32/swfmill.exe"
|
22
|
+
# @osx_url = "http://www.swfmill.org/releases/swfmill-0.2.12-macosx.tar.gz"
|
23
|
+
# @osx_extracted_file = nil
|
24
|
+
# @unix_url = nil
|
25
|
+
# @unix_extracted_file = nil
|
26
|
+
super(name, true)
|
27
|
+
define unless do_not_define
|
28
|
+
end
|
29
|
+
|
30
|
+
def remote_task_name
|
31
|
+
return "swfmill-#{version}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def define
|
35
|
+
super
|
36
|
+
|
37
|
+
if(@input.nil?)
|
38
|
+
raise Error.new('SWFMill task requires that input be set')
|
39
|
+
end
|
40
|
+
|
41
|
+
if(@output.nil?)
|
42
|
+
raise Error.new('SWFMill task requires that output be set')
|
43
|
+
end
|
44
|
+
file input
|
45
|
+
file output => [input] do |f|
|
46
|
+
user_task.execute(option_list.join(' '))
|
47
|
+
# sh %{swfmill #{option_list}}
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "#{name} using SWFMill"
|
51
|
+
task name => [input, output]
|
52
|
+
|
53
|
+
CLEAN.add(output)
|
54
|
+
|
55
|
+
self
|
56
|
+
end
|
57
|
+
|
58
|
+
def option_list
|
59
|
+
result = @options.dup
|
60
|
+
result << "simple" if simple
|
61
|
+
result << input if input
|
62
|
+
result << output if output
|
63
|
+
return result
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/lib/test_suite_generator.rb
CHANGED
@@ -116,8 +116,9 @@ module AsProject
|
|
116
116
|
@test_cases.sort!
|
117
117
|
|
118
118
|
parsed = ERB.new(template_content).result(binding)
|
119
|
-
file = File.
|
120
|
-
|
119
|
+
file = File.open(file_location, 'w') do |f|
|
120
|
+
f.write(parsed)
|
121
|
+
end
|
121
122
|
end
|
122
123
|
|
123
124
|
def to_s
|
data/rakefile.rb
CHANGED
@@ -8,6 +8,7 @@ require 'rake/rdoctask'
|
|
8
8
|
require 'rake/contrib/rubyforgepublisher'
|
9
9
|
require 'fileutils'
|
10
10
|
require 'lib/asproject/version'
|
11
|
+
require 'lib/asproject_utils'
|
11
12
|
|
12
13
|
AUTHOR = "lukebayes" # can also be an array of Authors
|
13
14
|
EMAIL = "lbayes@patternpark.com"
|
@@ -20,7 +21,9 @@ NAME = "asproject"
|
|
20
21
|
RELEASE_TYPES = ["gem"]
|
21
22
|
REV = nil
|
22
23
|
VERS = (AsProject::VERSION::STRING + (REV ? ".#{REV}" : ""))
|
23
|
-
CLEAN.include
|
24
|
+
CLEAN.include(['**/.*.sw?', '*.gem', 'pkg/*', 'pkg', '**/**/.crap_file'])
|
25
|
+
CLEAN.include(File.dirname(AsProject.unique_tmpdir('AsProjectTest')))
|
26
|
+
|
24
27
|
RDOC_OPTS = ['--quiet', '--title', 'asproject documentation',
|
25
28
|
'--opname', 'index.html',
|
26
29
|
'--line-numbers',
|
@@ -1,18 +1,10 @@
|
|
1
1
|
#! rake
|
2
|
-
#
|
3
|
-
# Rakefile for MXMLC development
|
4
|
-
# execute rake -T anywhere forward of this directory to see available tasks
|
5
|
-
# Tasks are executed from the command prompt like:
|
6
|
-
# rake deploy
|
7
|
-
# rake clean
|
8
2
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/clean'
|
6
|
+
require 'rake/tasklib'
|
7
|
+
require 'tasks/mtasc'
|
8
|
+
require 'tasks/hamtasc'
|
9
|
+
require 'tasks/swfmill'
|
14
10
|
|
15
|
-
#require_gem 'asproject'
|
16
|
-
#load 'asproject'
|
17
|
-
|
18
|
-
#load_rake_tasks
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: asproject
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.1.34
|
7
|
+
date: 2007-03-03 00:00:00 -08:00
|
8
8
|
summary: AsProject is a tool set that simplifies the process of beginning and growing a new ActionScript project.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -35,7 +35,6 @@ files:
|
|
35
35
|
- lib
|
36
36
|
- Manifest.txt
|
37
37
|
- MIT-LICENSE.txt
|
38
|
-
- pkg
|
39
38
|
- rakefile.rb
|
40
39
|
- README.txt
|
41
40
|
- setup.rb
|
@@ -56,9 +55,15 @@ files:
|
|
56
55
|
- lib/platform.rb
|
57
56
|
- lib/player_fetcher.rb
|
58
57
|
- lib/project.rb
|
58
|
+
- lib/tasks
|
59
59
|
- lib/template_resolver.rb
|
60
60
|
- lib/test_suite_generator.rb
|
61
61
|
- lib/asproject/version.rb
|
62
|
+
- lib/tasks/hamtasc.rb
|
63
|
+
- lib/tasks/mtasc.rb
|
64
|
+
- lib/tasks/rake.rb
|
65
|
+
- lib/tasks/remote_file_task.rb
|
66
|
+
- lib/tasks/swfmill.rb
|
62
67
|
- templates/asclass
|
63
68
|
- templates/asproject
|
64
69
|
- templates/ide
|
@@ -237,23 +242,12 @@ files:
|
|
237
242
|
- templates/ide/mate/Create Class.tmCommand
|
238
243
|
- templates/ide/mate/Rebuild Test Suites.tmCommand
|
239
244
|
- templates/ide/mate/Run Rake Task.tmCommand
|
240
|
-
- templates/asclass/mxml/.crap_file
|
241
|
-
- templates/asproject/as2/art/.crap_file
|
242
|
-
- templates/asproject/as2/doc/.crap_file
|
243
|
-
- templates/asproject/as2/project/bin/.crap_file
|
244
|
-
- templates/asproject/as2/project/lib/.crap_file
|
245
|
-
- templates/asproject/as3/art/.crap_file
|
246
|
-
- templates/asproject/as3/doc/.crap_file
|
247
|
-
- templates/asproject/as3/project/bin/.crap_file
|
248
|
-
- templates/asproject/as3/project/lib/.crap_file
|
249
|
-
- templates/asproject/as3/project/test/.crap_file
|
250
245
|
- templates/asproject/fb2as/project/.actionScriptProperties
|
251
246
|
- templates/asproject/fb2as/project/.project
|
252
247
|
- templates/asproject/fb2as/project/.settings
|
253
248
|
- templates/asproject/fdt/project/.as2_classpath
|
254
249
|
- templates/asproject/fdt/project/.project
|
255
250
|
- templates/asproject/fdt/project/.settings
|
256
|
-
- templates/asproject/mxml/.crap_file
|
257
251
|
test_files: []
|
258
252
|
|
259
253
|
rdoc_options:
|