fcshd 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
data/bin/fcshc CHANGED
@@ -124,10 +124,11 @@ EOF
124
124
  parser.separator "TL;DR: $ fcshc src/my_app.mxml"
125
125
  end.parse!
126
126
 
127
- $run_compilation = true unless $run_compilation == false
128
127
  $extra_arguments << "-debug" unless $production
129
128
 
130
129
  for name in ARGV
130
+ $run_compilation = true
131
+
131
132
  if not File.exists? name
132
133
  die "no such file or directory: #{name}"
133
134
  elsif File.directory? name
@@ -231,30 +232,47 @@ if $run_compilation
231
232
  $compilation_command.concat($extra_arguments)
232
233
  end
233
234
 
234
- warn $compilation_command.join(" ") if $verbose
235
- exit if $dry_run
235
+ def run_command(command)
236
+ begin
237
+ host, port = "localhost", FCSHD::Server::PORT
238
+ socket = TCPSocket.new(host, port)
239
+ rescue Errno::ECONNREFUSED
240
+ die "could not connect to fcshd at #{host}:#{port}"
241
+ end
242
+
243
+ socket.puts command
236
244
 
237
- begin
238
- host, port = "localhost", FCSHD::Server::PORT
239
- socket = TCPSocket.new(host, port)
240
- rescue Errno::ECONNREFUSED
241
- die "could not connect to fcshd at #{host}:#{port}"
245
+ compiler_output = ""
246
+ socket.each_line do |line|
247
+ case line
248
+ when /^fcshd: /
249
+ warn line.chomp
250
+ else
251
+ compiler_output << line
252
+ end
253
+ end
254
+
255
+ if $verbose
256
+ STDOUT.write compiler_output
257
+ end
258
+
259
+ compiler_output
242
260
  end
243
261
 
244
- socket.puts "restart" if $restart_compiler
245
- socket.puts $compilation_command.join(" ") if $run_compilation
262
+ run_command "restart" if $restart_compiler
263
+
264
+ if $run_compilation
265
+ command = $compilation_command.join(" ")
246
266
 
247
- compiler_output = ""
248
- socket.each_line do |line|
249
- case line
250
- when /^fcshd: /
251
- warn line.chomp
267
+ if $dry_run
268
+ warn command if $verbose
252
269
  else
253
- compiler_output << line
270
+ compiler_output = run_command command
271
+ transcript = FCSHD::Transcript[compiler_output]
272
+
273
+ basedir = File.join(File.expand_path("."), "")
274
+ STDOUT.write transcript.to_s(basedir)
275
+
276
+ exit 1 if not transcript.succeeded?
254
277
  end
255
278
  end
256
-
257
- transcript = FCSHD::Transcript[compiler_output]
258
- basedir = File.join(File.expand_path("."), "")
259
- STDOUT.write transcript.to_s(basedir)
260
- exit 1 if not transcript.succeeded?
data/bin/fcshc-repl CHANGED
@@ -33,18 +33,13 @@ end
33
33
 
34
34
  program_template = <<EOF
35
35
  package {
36
- import stdio.flash.Sprite
37
- import stdio.process
38
- import stdlib.inspect
39
- import flash.utils.*
36
+ import stdio.Sprite
40
37
 
38
+ [SWF(width=0, height=0)]
41
39
  public class dummy extends Sprite {
42
- override public function main(): void {
43
- process.immortal = false
44
- process.whiny = true
45
-
40
+ public function main(): void {
46
41
  try {
47
- process.warn(inspect(__CODE__))
42
+ process.warn(__CODE__)
48
43
  } finally {
49
44
  process.exit()
50
45
  }
@@ -57,13 +52,11 @@ get_program = lambda do |code|
57
52
  program_template.sub("__CODE__", code)
58
53
  end
59
54
 
60
- class MyInterrupt < StandardError; end
61
-
62
55
  while line = Readline.readline("as3> ", true)
63
56
  File.open("dummy.as", "w") { |file| file << get_program[line] }
64
- output = `fcshc -lstdlib -lstdio -lknock --no-rsls dummy.as`
57
+ output = `fcshc -lstdio --no-rsls dummy.as`
65
58
  puts output.gsub(/^dummy.as:\d+: /, "") unless output == ""
66
- if $? == 0
67
- system "run-stdio-swf dummy.swf"
68
- end
59
+ system "run-swf dummy.swf" if $? == 0
69
60
  end
61
+
62
+ puts
data/bin/fcshd CHANGED
@@ -22,16 +22,16 @@ EOF
22
22
  logger.log "fcshd #{FCSHD::VERSION}"
23
23
 
24
24
  compiler = FCSHD::Compiler.new(logger)
25
- compiler.start!
25
+ compiler.start!
26
26
 
27
27
  Thread.abort_on_exception = true
28
28
 
29
29
  begin
30
+ logger.log "listening to port #{FCSHD::Server::PORT}..."
30
31
  FCSHD::Server.new(FCSHD::Server::PORT, compiler, logger).run!
31
- logger.log "Now listening to port #{FCSHD_PORT}."
32
32
  rescue Interrupt
33
33
  logger.log ""
34
- logger.log "Exiting."
34
+ logger.log "exiting"
35
35
  rescue Exception => error
36
- logger.error "Could not listen to port #{FCSHD_PORT}: #{error}"
36
+ logger.error "could not listen to port #{FCSHD::Server::PORT}: #{error}"
37
37
  end
@@ -4,7 +4,7 @@ module FCSHD
4
4
  class Transcript; end
5
5
  class Transcript::Item < Struct.new(:location, :mxmlc_message)
6
6
  def to_s(basedir)
7
- problems.map { |problem| problem.to_s(basedir) }.join("\n")
7
+ problems.map { |problem| problem.to_s(basedir) + "\n" }
8
8
  end
9
9
 
10
10
  def problems
@@ -57,6 +57,17 @@ EOF
57
57
  when /^Incorrect number of arguments. Expected no more than (\d+)\.$/ then <<EOF
58
58
  error: expected at most #$1 arguments
59
59
  EOF
60
+
61
+ when /^Interface method (.+) in namespace (.+) not implemented by class (.+)\.$/ then <<EOF
62
+ error: #{quote $1} (from #{name $2}) not implemented
63
+ EOF
64
+ when /^Interface method (.+) in namespace (.+) not implemented by class (.+)\.$/ then <<EOF
65
+ error: #{quote $1} (from #{name $2}) not implemented
66
+ EOF
67
+ when /^Interface method (.+) in namespace (.+) is implemented with an incompatible signature in class (.+)\.$/ then <<EOF
68
+ error: #{quote $1} (from #{name $2}) implemented incorrectly
69
+ EOF
70
+
60
71
  when
61
72
  /^Access of possibly undefined property (.+) through a reference with static type (.+)\.$/,
62
73
  /^Call to a possibly undefined method (.+) through a reference with static type (.+)\.$/,
@@ -64,7 +75,7 @@ EOF
64
75
  then <<EOF
65
76
  error: #{quote $1} undeclared in #{name $2}
66
77
  EOF
67
- when /^Attempted access of inaccessible property (.+) through a reference with static type (.+)\.$/ then <<EOF
78
+ when /^Attempted access of inaccessible (?:property|method) (.+) through a reference with static type (.+)\.$/ then <<EOF
68
79
  error: #{quote $1} inaccessible in #{name $2}
69
80
  EOF
70
81
  when
@@ -120,18 +131,17 @@ EOF
120
131
  when /^A conflict exists with definition (.+) in namespace internal\.$/ then <<EOF
121
132
  error: #{quote $1} conflicts with an internal name
122
133
  EOF
123
- when
124
- /^Warning: return value for function '(.+)' has no type declaration\.$/
125
- then
134
+ when /^Warning: return value for function '(.+)' has no type declaration\.$/ then
126
135
  <<EOF
127
136
  error: #{quote($1) + " " unless $1 == "anonymous"}missing return type
128
137
  EOF
129
- when
130
- /^Warning: parameter '(.+)' has no type declaration\.$/
131
- then
132
- <<EOF
138
+ when /^Warning: parameter '(.+)' has no type declaration\.$/ then <<EOF
133
139
  error: #{quote($1)} missing type
134
140
  EOF
141
+
142
+ when "Warning: This compilation unit did not have a factoryClass specified in Frame metadata to load the configured runtime shared libraries. To compile without runtime shared libraries either set the -static-link-runtime-shared-libraries option to true or remove the -runtime-shared-libraries option."
143
+ then []
144
+
135
145
  when /^A file found in a source-path must have the same package structure '(.*)', as the definition's package, '(.*)'\.$/ then <<EOF
136
146
  error: package should be #{quote $1}
137
147
  EOF
@@ -146,9 +156,15 @@ error: modifying constant
146
156
  EOF
147
157
  when "Function does not have a body." then <<EOF
148
158
  error: missing function body"
159
+ EOF
160
+ when "Return value must be undefined." then <<EOF
161
+ error: cannot return something here
162
+ EOF
163
+ when "Return type of a getter definition must not be void." then <<EOF
164
+ error: must return something
149
165
  EOF
150
166
  when "Return type of a setter definition must be unspecified or void." then <<EOF
151
- error: setter must return void"
167
+ error: setter must not return anything"
152
168
  EOF
153
169
  when "Function does not return a value." then <<EOF
154
170
  error: missing return statement"
@@ -28,21 +28,16 @@ module FCSHD
28
28
  skip_indented_lines!
29
29
 
30
30
  when /^Required RSLs:$/
31
- # Does anybody care about this?
32
31
  skip_indented_lines!
33
32
 
34
33
  when /^(Recompile|Reason|Updated): /
35
34
  when /^Loading configuration file /
36
35
  when "Detected configuration changes. Recompile..."
37
36
 
37
+ when /^fcshd: /
38
+ result << line
38
39
  else
39
- # Let unrecognized lines pass through verbatim.
40
- if line.start_with? "fcshd: "
41
- result << line
42
- else
43
- # XXX: What about when we support compc?
44
- result << "mxmlc: #{line}"
45
- end
40
+ result << "mxmlc: #{line}" # XXX: Could be `compc` too.
46
41
  end
47
42
  end
48
43
  end
@@ -62,7 +57,7 @@ module FCSHD
62
57
  end
63
58
 
64
59
  def skip_problem_diagram!
65
- lines.shift(4) if lines[0...4].grep /^\s*\^\s*$/
60
+ lines.shift(4) unless lines[0...4].grep(/^\s*\^\s*$/).empty?
66
61
  end
67
62
 
68
63
  def skip_indented_lines!
@@ -21,9 +21,9 @@ module FCSHD
21
21
  @items.map do |item|
22
22
  case item
23
23
  when Item
24
- "#{item.to_s(basedir)}\n"
24
+ item.to_s(basedir)
25
25
  else
26
- "#{item}\n"
26
+ item
27
27
  end
28
28
  end.join
29
29
  end
data/lib/fcshd/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  unless defined? FCSHD::VERSION
2
2
  module FCSHD
3
- VERSION = "0.6.5"
3
+ VERSION = "0.6.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fcshd
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 5
10
- version: 0.6.5
9
+ - 6
10
+ version: 0.6.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Brockman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-09 00:00:00 Z
18
+ date: 2012-03-21 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: |
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  requirements: []
85
85
 
86
86
  rubyforge_project:
87
- rubygems_version: 1.8.15
87
+ rubygems_version: 1.8.13
88
88
  signing_key:
89
89
  specification_version: 3
90
90
  summary: Usable CLI for the Adobe Flex compiler shell (fcsh)