asproject 0.1.80 → 0.1.84

Sign up to get free protection for your applications and to get access to all the features.
data/bin/fcshs CHANGED
@@ -11,8 +11,8 @@ if ARGV.size > 0 && ARGV[0][0]==95 && ARGV[0][-1]==95
11
11
  end
12
12
  end
13
13
 
14
- require_gem 'asproject', version
15
- require 'fcshs.rb'
14
+ #require_gem 'asproject', version
15
+ #require 'fcshs.rb'
16
16
 
17
- #AsProject::FCSHS.new(ARGS.shift, ARGS.shift)
17
+ require File.dirname(__FILE__) + '/../lib/fcshs.rb'
18
18
  AsProject::FCSHS.new
@@ -2,7 +2,7 @@ module AsProject
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 81
5
+ TINY = 85
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,22 +1,87 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
- require "socket"
3
+ require 'socket'
4
+ require 'optparse'
4
5
 
5
6
  module AsProject
6
7
 
7
- class FCSHS
8
-
8
+ class FCSHS < Hash
9
+ attr_accessor :kill_process,
10
+ :start_process
11
+
9
12
  def initialize(ip=nil, port=nil)
10
13
  @ip = (ip.nil?) ? "127.0.0.1" : ip
11
14
  @port = (port.nil?) ? 20569 : port
15
+ parse!
16
+ if(self.kill_process)
17
+ puts '>> Attempting to kill process now!'
18
+ kill(@ip, @port)
19
+ elsif(self.start_process)
20
+ open(@ip, @port)
21
+ end
22
+ end
23
+
24
+ def instances
25
+ if(@instances.nil?)
26
+ @instances = Hash.new
27
+ end
28
+ return @instances
29
+ end
30
+
31
+ def parse!
32
+ opts = OptionParser.new do |opts|
33
+ opts.banner = <<EOF
34
+
35
+ Usage: #$0 [options]
36
+
37
+ Begin or kill the Flex Command Sell Socket (fcshs).
12
38
 
13
- @compile_commands = Hash.new
14
- @fcsh = nil
15
- start_fcsh
39
+ This is a simple ruby socket server that sits on top of the Flex Command Shell terminal tool that makes shell-based MXMLC compilation exponentially more performant.
16
40
 
17
- @socket = TCPServer.new(@ip, @port)
18
- @socket.setsockopt(Socket::SOL_SOCKET, Socket::TCP_NODELAY, true)
19
- puts "fcsh server started on #{@ip}:#{@port}"
41
+ Running this command with no options will start the service. This is not really necessary, as the FCSHS Rake task will automatically begin this process, you just need to know how to kill it later - when you want to shut down your shell.
42
+
43
+ Options:
44
+ EOF
45
+
46
+ opts.on('-k', '--kill', 'Kill the running fcshs process') do
47
+ self.kill_process = true
48
+ end
49
+
50
+ opts.on_tail('-h', '--help', 'Display this help and exit') do
51
+ puts opts
52
+ exit
53
+ end
54
+ end
55
+ if(ARGV.size > 0)
56
+ opts.parse!(ARGV)
57
+ else
58
+ self.start_process = true
59
+ end
60
+ end
61
+
62
+ def kill(ip, port)
63
+ begin
64
+ @socket = TCPSocket.open(@ip, @port) do |s|
65
+ s.puts '0'
66
+ end
67
+ puts '>> Successfully killed running fcshs process'
68
+ rescue SystemCallError
69
+ puts ">> Was unable to find the currently running process at #{ip}:#{port}, try running 'ps -a | egrep ruby' and then 'kill -9 [process id]'"
70
+ end
71
+ end
72
+
73
+ def open(ip, port)
74
+ begin
75
+ @compile_commands = Hash.new
76
+ @fcsh = nil
77
+ @socket = TCPServer.new(@ip, @port)
78
+ @socket.setsockopt(Socket::SOL_SOCKET, Socket::TCP_NODELAY, true)
79
+ puts "fcsh server started on #{@ip}:#{@port}"
80
+ puts "enter 'fcsh -k' to kill this process when you're done"
81
+ rescue StandardError => e
82
+ puts 'Error opening socket: ' + e.to_s + "\nTry running fcshs -k to kill the currently-running socket."
83
+ @compile_commands = nil
84
+ end
20
85
  start
21
86
  end
22
87
 
@@ -24,6 +89,11 @@ module AsProject
24
89
  while
25
90
  session = @socket.accept
26
91
  dir = session.gets
92
+ if(dir.match(/^0/))
93
+ puts '>> Kill all fcsh instances and the open socket now!'
94
+ close_fcsh
95
+ return
96
+ end
27
97
  command = session.gets
28
98
  execute(session, dir, command)
29
99
  session.close
@@ -32,30 +102,65 @@ module AsProject
32
102
  end
33
103
 
34
104
  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
105
+ io.puts "[execute] #{command} at #{Dir.pwd} and #{dir}"
106
+ fcsh = get_fcsh(io, dir)
107
+
41
108
  cmd = @compile_commands[command]
42
109
  if(cmd.nil?)
43
110
  cmd = CompileCommand.new(command)
44
111
  @compile_commands[command] = cmd
45
112
  cmd.index = @compile_commands.size
46
- io.write(command)
47
- @fcsh.write(command) do |f|
48
- io.write f.read
113
+
114
+ fcsh.puts(command)
115
+
116
+ t = Thread.new {
117
+ IO.new(2, 'r+') do |err|
118
+ while(line = err.gets)
119
+ puts '[error] ' + line
120
+ end
121
+ end
122
+ }
123
+
124
+ while(line = fcsh.gets)
125
+ io.puts '[socket] ' + line
126
+ puts '[line] ' + line
49
127
  end
128
+
129
+ puts 'FINISHED FCSH WRITE!'
50
130
  else
51
131
  msg = "compile #{cmd.index}"
52
- @fcsh.write(msg + "\n")
53
- io.write(msg)
132
+ # io.write(msg)
133
+ fcsh.write(msg + "\n") do |f|
134
+ io.puts(f.read)
135
+ end
54
136
  end
55
137
  end
56
138
 
57
- def start_fcsh
58
- @fcsh = IO.popen('fcsh', 'a')
139
+ def close_fcsh
140
+ @instances.each do |fc|
141
+ fc.close
142
+ end
143
+ end
144
+
145
+ def get_fcsh(session, dir)
146
+ begin
147
+ if(instances[dir])
148
+ return instances[dir]
149
+ else
150
+ dir.chomp!
151
+ if(File.directory?(dir))
152
+ Dir.chdir(dir)
153
+ else
154
+ msg = ">> Error - unable to locate: #{dir}"
155
+ session.puts msg
156
+ raise StandardError.new(msg)
157
+ end
158
+
159
+ instances[dir] = IO.popen('fcsh', 'r+')
160
+ end
161
+ rescue SystemCallError
162
+ puts ">> Failed to start the actual fcsh application, please make sure it's in your class path by opening a new terminal and typing 'fcsh'"
163
+ end
59
164
  end
60
165
  end
61
166
 
@@ -68,5 +173,3 @@ module AsProject
68
173
  end
69
174
  end
70
175
  end
71
-
72
- AsProject::FCSHS.new
@@ -26,11 +26,15 @@ module AsProject
26
26
  @socket = TCPSocket.open(@ip, @port) do |s|
27
27
  s.puts Dir.pwd
28
28
  s.puts "#{cmd} #{args}"
29
- puts s.read
29
+ s.close_write
30
+ while(line = s.gets)
31
+ puts line
32
+ end
30
33
  end
34
+ puts 'finished!'
31
35
  rescue StandardError
32
- IO.popen("fcshs &", "r")
33
- execute(cmd, args, retries)
36
+ # IO.popen("fcshs &", "r")
37
+ # execute(cmd, args, retries)
34
38
  end
35
39
  end
36
40
  end
@@ -74,7 +74,6 @@ module AsProject
74
74
  if(Logger.debug)
75
75
  thread = ThreadMock.new
76
76
  elsif(@user_task.is_a?(OSXRemoteFileTask) && !Logger.debug)
77
- @osx_process = true
78
77
  thread = run_osx
79
78
  else
80
79
  thread = run_other
@@ -83,11 +82,14 @@ module AsProject
83
82
  end
84
83
 
85
84
  def run_osx
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}`
85
+ player = clean_path(extracted_file_path)
86
+ swf = clean_path(File.expand_path(@swf))
87
+
88
+ t = Thread.new {
89
+ IO.popen(player) do |p|
90
+ IO.popen("open #{swf}")
91
+ end
92
+ }
91
93
  end
92
94
 
93
95
  def run_other
@@ -95,18 +97,7 @@ module AsProject
95
97
  execute("./#{@swf}")
96
98
  }
97
99
  end
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
-
100
+
110
101
  def read_log(player_thread, log_file)
111
102
  index = 0
112
103
 
@@ -114,7 +105,7 @@ module AsProject
114
105
  raise UsageError.new('Unable to find the trace output log file in the expected location: ' + log_file)
115
106
  end
116
107
 
117
- while(player_alive?(player_thread))
108
+ while(player_thread.alive?)
118
109
  sleep(0.2)
119
110
  incr = 0
120
111
 
@@ -138,22 +129,5 @@ module AsProject
138
129
  return false
139
130
  end
140
131
  end
141
-
142
- class OSXPlayerThread
143
-
144
- def initialize
145
- @alive = true
146
- end
147
-
148
- # def begin_listening
149
- # while(alive?)
150
- # sleep(0.4)
151
- # result = sh "ps -A"
152
- # end
153
- # end
154
-
155
- def alive?
156
- return @alive
157
- end
158
- end
132
+
159
133
  end
@@ -11,6 +11,8 @@ module AsProject
11
11
  :frames,
12
12
  :incremental,
13
13
  :library_path,
14
+ :link_report,
15
+ :load_externs,
14
16
  :locale,
15
17
  :optimize,
16
18
  :show_actionscript_warnings,
@@ -94,11 +96,13 @@ module AsProject
94
96
  result << "-default-background-color" << default_background_color if default_background_color
95
97
  result << "-default-script-limits" << default_script_limits if default_script_limits
96
98
  result << "-default-size" << default_size if default_size
99
+ result << "-load-externs" << load_externs if load_externs
100
+ result << "-link-report" << link_report if link_report
97
101
  result << "-output" << clean_path(output) if output
98
102
  result << "-theme " + theme.join(" -theme ") if theme.size > 0
99
103
  result << "-frame " + frames.join(" -frame ") if frames.size > 0
100
- result << "-rsl " + runtime_shared_libraries.join(" -rsl ") if runtime_shared_libraries.size > 0
101
- result << "-el=" + external_library_path.join(" -el=") if external_library_path.size > 0
104
+ result << "-rsl=" + runtime_shared_libraries.join(" -rsl=") if runtime_shared_libraries.size > 0
105
+ result << "-el+=" + external_library_path.join(" -el+=") if external_library_path.size > 0
102
106
  result << "-l=" + library_path.join(" -l=") if library_path.size > 0
103
107
  result << "-sp=" + source_path.join(" -sp=") if source_path.size > 0
104
108
  result << "-incremental" if incremental
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.80
7
- date: 2007-03-18 00:00:00 -07:00
6
+ version: 0.1.84
7
+ date: 2007-03-24 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,6 +35,7 @@ files:
35
35
  - lib
36
36
  - Manifest.txt
37
37
  - MIT-LICENSE.txt
38
+ - pkg
38
39
  - rakefile.rb
39
40
  - README.txt
40
41
  - setup.rb