asproject 0.1.75 → 0.1.80
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/bin/fcshs +18 -0
- data/lib/asproject.rb +1 -0
- data/lib/asproject/version.rb +1 -1
- data/lib/fcshs.rb +72 -0
- data/lib/tasks/fcsh.rb +37 -0
- data/lib/tasks/flash_player.rb +22 -8
- data/lib/tasks/mxmlc.rb +5 -2
- data/rakefile.rb +1 -1
- data/templates/asproject/as3/project/rakefile.rb +54 -18
- metadata +6 -3
data/bin/fcshs
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
version = "> 0"
|
6
|
+
|
7
|
+
if ARGV.size > 0 && ARGV[0][0]==95 && ARGV[0][-1]==95
|
8
|
+
if Gem::Version.correct?(ARGV[0][1..-2])
|
9
|
+
version = ARGV[0][1..-2]
|
10
|
+
ARGV.shift
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
require_gem 'asproject', version
|
15
|
+
require 'fcshs.rb'
|
16
|
+
|
17
|
+
#AsProject::FCSHS.new(ARGS.shift, ARGS.shift)
|
18
|
+
AsProject::FCSHS.new
|
data/lib/asproject.rb
CHANGED
data/lib/asproject/version.rb
CHANGED
data/lib/fcshs.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require "socket"
|
4
|
+
|
5
|
+
module AsProject
|
6
|
+
|
7
|
+
class FCSHS
|
8
|
+
|
9
|
+
def initialize(ip=nil, port=nil)
|
10
|
+
@ip = (ip.nil?) ? "127.0.0.1" : ip
|
11
|
+
@port = (port.nil?) ? 20569 : port
|
12
|
+
|
13
|
+
@compile_commands = Hash.new
|
14
|
+
@fcsh = nil
|
15
|
+
start_fcsh
|
16
|
+
|
17
|
+
@socket = TCPServer.new(@ip, @port)
|
18
|
+
@socket.setsockopt(Socket::SOL_SOCKET, Socket::TCP_NODELAY, true)
|
19
|
+
puts "fcsh server started on #{@ip}:#{@port}"
|
20
|
+
start
|
21
|
+
end
|
22
|
+
|
23
|
+
def start
|
24
|
+
while
|
25
|
+
session = @socket.accept
|
26
|
+
dir = session.gets
|
27
|
+
command = session.gets
|
28
|
+
execute(session, dir, command)
|
29
|
+
session.close
|
30
|
+
sleep 0.75
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def execute(io, dir, command)
|
35
|
+
puts "[execute] #{command} at #{Dir.pwd} and #{dir}"
|
36
|
+
if(File.exists?(dir))
|
37
|
+
Dir.chdir(dir)
|
38
|
+
else
|
39
|
+
puts "Dir: #{dir} does not exist!?"
|
40
|
+
end
|
41
|
+
cmd = @compile_commands[command]
|
42
|
+
if(cmd.nil?)
|
43
|
+
cmd = CompileCommand.new(command)
|
44
|
+
@compile_commands[command] = cmd
|
45
|
+
cmd.index = @compile_commands.size
|
46
|
+
io.write(command)
|
47
|
+
@fcsh.write(command) do |f|
|
48
|
+
io.write f.read
|
49
|
+
end
|
50
|
+
else
|
51
|
+
msg = "compile #{cmd.index}"
|
52
|
+
@fcsh.write(msg + "\n")
|
53
|
+
io.write(msg)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def start_fcsh
|
58
|
+
@fcsh = IO.popen('fcsh', 'a')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class CompileCommand
|
63
|
+
attr_accessor :index,
|
64
|
+
:command
|
65
|
+
|
66
|
+
def initialize(command)
|
67
|
+
@command = command
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
AsProject::FCSHS.new
|
data/lib/tasks/fcsh.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
require 'socket'
|
3
|
+
|
4
|
+
module AsProject
|
5
|
+
|
6
|
+
# TODO: Add new task as a clean dependency
|
7
|
+
# That will call the fcshs and tell it to release
|
8
|
+
# all in-memory compilations
|
9
|
+
class FCSH < MXMLC
|
10
|
+
attr_accessor :ip,
|
11
|
+
:port
|
12
|
+
|
13
|
+
def initialize(name=:fcsh)
|
14
|
+
@ip = (ip.nil?) ? "127.0.0.1" : ip
|
15
|
+
@port = (port.nil?) ? 20569 : port
|
16
|
+
super(name)
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute(cmd, args, retries=0)
|
20
|
+
retries = retries+1
|
21
|
+
if(retries > 3)
|
22
|
+
puts "fcsh task was unable to connect to fcshs, please try starting this service by opening a new terminal and typing 'fcshs' (without quotes)"
|
23
|
+
return
|
24
|
+
end
|
25
|
+
begin
|
26
|
+
@socket = TCPSocket.open(@ip, @port) do |s|
|
27
|
+
s.puts Dir.pwd
|
28
|
+
s.puts "#{cmd} #{args}"
|
29
|
+
puts s.read
|
30
|
+
end
|
31
|
+
rescue StandardError
|
32
|
+
IO.popen("fcshs &", "r")
|
33
|
+
execute(cmd, args, retries)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/tasks/flash_player.rb
CHANGED
@@ -40,7 +40,8 @@ module AsProject
|
|
40
40
|
@win_extracted_file = "sa_flashplayer_9_debug.exe"
|
41
41
|
@osx_url = "http://download.macromedia.com/pub/flashplayer/updaters/9/sa_flashplayer_9_all_debug_ub.dmg"
|
42
42
|
@osx_mounted_path = "Adobe Flash Player Standalone"
|
43
|
-
@osx_extracted_file = "Flash\ Player.app"
|
43
|
+
# @osx_extracted_file = "Flash\ Player.app"
|
44
|
+
@osx_extracted_file = "Flash\ Player.app/Contents/MacOS/standalone"
|
44
45
|
@unix_url = nil
|
45
46
|
@unix_extracted_file = nil
|
46
47
|
else
|
@@ -68,24 +69,25 @@ module AsProject
|
|
68
69
|
File.open(log_file, 'w') do |f|
|
69
70
|
f.write('')
|
70
71
|
end
|
71
|
-
|
72
72
|
thread = nil
|
73
|
+
@osx_process = nil
|
73
74
|
if(Logger.debug)
|
74
75
|
thread = ThreadMock.new
|
75
76
|
elsif(@user_task.is_a?(OSXRemoteFileTask) && !Logger.debug)
|
77
|
+
@osx_process = true
|
76
78
|
thread = run_osx
|
77
79
|
else
|
78
80
|
thread = run_other
|
79
81
|
end
|
80
|
-
|
81
82
|
read_log(thread, log_file)
|
82
83
|
end
|
83
84
|
|
84
85
|
def run_osx
|
85
|
-
|
86
|
-
|
87
|
-
}
|
88
|
-
#
|
86
|
+
@osx_process = extracted_file_path
|
87
|
+
app = "#{clean_path(extracted_file_path)}"
|
88
|
+
swf = "#{clean_path(@swf)}"
|
89
|
+
msg = "open -a #{app} ./#{swf}"
|
90
|
+
`#{msg}`
|
89
91
|
end
|
90
92
|
|
91
93
|
def run_other
|
@@ -94,6 +96,17 @@ module AsProject
|
|
94
96
|
}
|
95
97
|
end
|
96
98
|
|
99
|
+
def player_alive?(thread)
|
100
|
+
if(@osx_process)
|
101
|
+
processes = `ps -A`
|
102
|
+
match = processes.match(/#{@osx_process}/)
|
103
|
+
return !match.nil?
|
104
|
+
else
|
105
|
+
return thread.alive?
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
97
110
|
def read_log(player_thread, log_file)
|
98
111
|
index = 0
|
99
112
|
|
@@ -101,7 +114,7 @@ module AsProject
|
|
101
114
|
raise UsageError.new('Unable to find the trace output log file in the expected location: ' + log_file)
|
102
115
|
end
|
103
116
|
|
104
|
-
while(player_thread
|
117
|
+
while(player_alive?(player_thread))
|
105
118
|
sleep(0.2)
|
106
119
|
incr = 0
|
107
120
|
|
@@ -110,6 +123,7 @@ module AsProject
|
|
110
123
|
incr = incr + 1
|
111
124
|
if(incr > index)
|
112
125
|
puts "[trace] #{line}"
|
126
|
+
$stdout.flush
|
113
127
|
index = index + 1
|
114
128
|
end
|
115
129
|
end
|
data/lib/tasks/mxmlc.rb
CHANGED
@@ -38,7 +38,6 @@ module AsProject
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def define
|
41
|
-
|
42
41
|
@external_library_path = add_path_list(@external_library_path) if @external_library_path.size > 0
|
43
42
|
@library_path = add_path_list(@library_path) if @library_path.size > 0
|
44
43
|
@source_path = add_path_list(@source_path) if @source_path.size > 0
|
@@ -50,7 +49,7 @@ module AsProject
|
|
50
49
|
add_path(File.dirname(@input))
|
51
50
|
|
52
51
|
file @output do |t|
|
53
|
-
|
52
|
+
execute(@target, option_list.join(' '))
|
54
53
|
end
|
55
54
|
|
56
55
|
CLEAN.add(@output)
|
@@ -62,6 +61,10 @@ module AsProject
|
|
62
61
|
task @name => [@output]
|
63
62
|
end
|
64
63
|
|
64
|
+
def execute(cmd, args)
|
65
|
+
sh(%{#{cmd} #{args}})
|
66
|
+
end
|
67
|
+
|
65
68
|
def sp
|
66
69
|
return @source_path
|
67
70
|
end
|
data/rakefile.rb
CHANGED
@@ -68,7 +68,7 @@ spec = Gem::Specification.new do |s|
|
|
68
68
|
s.require_path = 'lib'
|
69
69
|
|
70
70
|
s.bindir = 'bin' # Use these for applications.
|
71
|
-
s.executables = ['asproject', 'asclass']
|
71
|
+
s.executables = ['asproject', 'asclass', 'fcshs']
|
72
72
|
s.default_executable = 'asproject'
|
73
73
|
|
74
74
|
s.author = "Luke Bayes"
|
@@ -1,18 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
#
|
1
|
+
|
2
|
+
require 'rubygems'
|
3
|
+
require 'asproject'
|
4
|
+
|
5
|
+
############################################
|
6
|
+
# Launch the Application using Flash Player 9
|
7
|
+
|
8
|
+
desc "Compile and run main application"
|
9
|
+
task :run => :compile_main
|
10
|
+
task :default => :run
|
11
|
+
|
12
|
+
AsProject::FlashPlayer.new(:run) do |t|
|
13
|
+
t.version = 9
|
14
|
+
t.swf = 'bin/<%= project_name %>Application.swf'
|
15
|
+
end
|
16
|
+
|
17
|
+
############################################
|
18
|
+
# Launch the Test Suites using Flash Player 9
|
19
|
+
|
20
|
+
desc "Compile and run test suites"
|
21
|
+
task :test => [:compile_tests]
|
22
|
+
|
23
|
+
AsProject::FlashPlayer.new(:test) do |t|
|
24
|
+
t.version = 9
|
25
|
+
t.swf = 'bin/<%= project_name %>Runner.swf'
|
26
|
+
end
|
27
|
+
|
28
|
+
############################################
|
29
|
+
# Compile your Application using HAMTASC
|
30
|
+
|
31
|
+
AsProject::MXMLC.new(:compile_main) do |t|
|
32
|
+
t.default_background_color = '#FFFFFF'
|
33
|
+
t.default_frame_rate = 24
|
34
|
+
t.default_size = "600 400"
|
35
|
+
t.input = 'src/<%= project_name %>.as'
|
36
|
+
t.output = 'bin/<%= project_name %>Application.swf'
|
37
|
+
t.warnings = true
|
38
|
+
end
|
39
|
+
|
40
|
+
############################################
|
41
|
+
# Compile your Application using HAMTASC
|
42
|
+
|
43
|
+
AsProject::MXMLC.new(:compile_tests) do |t|
|
44
|
+
t.default_background_color = '#FFFFFF'
|
45
|
+
t.default_frame_rate = 24
|
46
|
+
t.default_size = "800 450"
|
47
|
+
t.input = 'test/<%= project_name %>Runner.as'
|
48
|
+
t.output = 'bin/<%= project_name %>Runner.swf'
|
49
|
+
t.warnings = true
|
50
|
+
t.source_path << 'src'
|
51
|
+
t.source_path << 'assets/img/skins'
|
52
|
+
# t.source_path << 'lib/asunit'
|
53
|
+
t.source_path << 'test'
|
54
|
+
end
|
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-03-
|
6
|
+
version: 0.1.80
|
7
|
+
date: 2007-03-18 00:00:00 -07: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
|
@@ -44,6 +43,7 @@ files:
|
|
44
43
|
- TODO.txt
|
45
44
|
- bin/asclass
|
46
45
|
- bin/asproject
|
46
|
+
- bin/fcshs
|
47
47
|
- lib/asclass.rb
|
48
48
|
- lib/asclass_arguments.rb
|
49
49
|
- lib/asproject
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- lib/asproject_base.rb
|
53
53
|
- lib/asproject_utils.rb
|
54
54
|
- lib/eclipse_project.rb
|
55
|
+
- lib/fcshs.rb
|
55
56
|
- lib/path_finder.rb
|
56
57
|
- lib/platform.rb
|
57
58
|
- lib/project.rb
|
@@ -60,6 +61,7 @@ files:
|
|
60
61
|
- lib/test_suite_generator.rb
|
61
62
|
- lib/asproject/version.rb
|
62
63
|
- lib/tasks/env_task.rb
|
64
|
+
- lib/tasks/fcsh.rb
|
63
65
|
- lib/tasks/flash_log.rb
|
64
66
|
- lib/tasks/flash_player.rb
|
65
67
|
- lib/tasks/flash_player_trust.rb
|
@@ -283,6 +285,7 @@ extra_rdoc_files: []
|
|
283
285
|
executables:
|
284
286
|
- asproject
|
285
287
|
- asclass
|
288
|
+
- fcshs
|
286
289
|
extensions: []
|
287
290
|
|
288
291
|
requirements: []
|