textmate_fcsh 0.4.2 → 0.4.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
data/bin/textmate_fcsh CHANGED
@@ -7,6 +7,7 @@ require "open3"
7
7
 
8
8
  #a = TextmateFcsh.new
9
9
 
10
+ $DEBUG = false
10
11
 
11
12
  require 'optparse'
12
13
 
@@ -26,9 +27,15 @@ OptionParser.new do |opts|
26
27
  options[:run] = false
27
28
  end
28
29
 
30
+ opts.on("-v", "--verbose", "Verbose mode") do |v|
31
+ $DEBUG = true
32
+ end
33
+
29
34
  end.parse!
30
35
 
31
36
 
37
+
38
+
32
39
  if options[:run] != false
33
40
  TextmateFcsh.new
34
41
  end
data/lib/fcsh/fcsh.rb CHANGED
@@ -2,6 +2,7 @@ class Fcsh
2
2
  attr_reader :stdout, :stderr, :error_output_last_run
3
3
 
4
4
  def initialize(location)
5
+
5
6
  @targets = []
6
7
  @stdin, @stdout, @stderr = Open3.popen3(location)
7
8
  @error_output_last_run = ''
@@ -15,8 +16,8 @@ class Fcsh
15
16
  puts errors
16
17
  exit
17
18
  end
18
-
19
19
  end
20
+
20
21
  puts "Compiling..."
21
22
  @error_output_last_run = ''
22
23
  @stdin.puts "compile %d" % [@targets.index(command) + 1]
@@ -25,11 +26,18 @@ class Fcsh
25
26
 
26
27
  # watch std out till files changed
27
28
  @stdout.each_line do |line|
29
+ puts "FCSH OUT: " + line.inspect if $DEBUG
30
+
28
31
  if /.+\.swf/.match(line)
29
32
  puts ""
30
33
  break
31
34
  end
32
35
 
36
+ if /Nothing has changed/.match(line)
37
+ puts "Nothing has changed"
38
+ break
39
+ end
40
+
33
41
  if /Files changed/.match(line)
34
42
  capture_error_output
35
43
  break
@@ -42,7 +50,7 @@ class Fcsh
42
50
  # Create a target if this is the first time.
43
51
  def compile_first_time!(command)
44
52
  puts "Assigning target..."
45
- @stdin.puts command
53
+ @stdin.puts command if $DEBUG
46
54
 
47
55
  @mxmlc_errors = nil
48
56
  a = Thread.new do
@@ -67,18 +75,18 @@ class Fcsh
67
75
  # will be enough.
68
76
  def capture_error_output
69
77
  puts "Capturing error output"
70
- first_line_captured = nil
78
+ last_line_captured = nil
71
79
  started = Time.now
72
80
  a = Thread.new do
73
81
  @stderr.each_line do |line|
74
- puts line.inspect
75
- first_line_captured = Time.now if first_line_captured.nil?
82
+ puts "FCSH ERROR: " + line.inspect if $DEBUG
83
+ last_line_captured = Time.now
76
84
  @error_output_last_run << line
77
85
  end
78
86
  end
79
87
 
80
88
  loop do
81
- if (!first_line_captured.nil? && Time.now - first_line_captured > 1) || Time.now - started > 4
89
+ if (!last_line_captured.nil? && Time.now - last_line_captured > 1)
82
90
  break
83
91
  end
84
92
  end
@@ -4,7 +4,7 @@ require File.join(File.dirname(__FILE__), 'mxmlc_error')
4
4
  # Formats the mxmlc to errors
5
5
  class MxmlcOutputReader
6
6
  attr_reader :errors
7
- ERROR_LINE = /^((\/([\w\.]+))+)(\((\d+)\))?:\s*(col: (\d+))?\s*(\w+): (.+)$/
7
+ ERROR_LINE = /^((\/([\w\.]+))+)(\((\d+)\))?:\s*(col: (\d+))?:?\s*(Error|Warning+): (.+)$/
8
8
 
9
9
  def initialize(output)
10
10
  @output = output
data/lib/textmate_fcsh.rb CHANGED
@@ -55,6 +55,9 @@ class TextmateFcsh
55
55
  if k == :default_size
56
56
  splitter = ' '
57
57
  end
58
+ if k == :library_path
59
+ splitter = '+='
60
+ end
58
61
  mxmlc_command << " -%s%s%s" % [k.to_s.gsub(/\_/, '-'),splitter,vsplitted]
59
62
  end
60
63
  end
@@ -48,5 +48,23 @@ EOD
48
48
  reader = MxmlcOutputReader.new(out)
49
49
  reader.errors.size.should be 1
50
50
  end
51
+
52
+
53
+ it "should process error" do
54
+ out = <<EOD
55
+ /Users/japetheape/Projects/worldlogger/flash/src/com/worldlogger/air/view/globe/NebulaSkybox.as(12): col: 3: Error: unable to resolve 'assets/hot_nebula_0_lowquality.jpg' for transcoding.
56
+
57
+ sometext
58
+ EOD
59
+ reader = MxmlcOutputReader.new(out)
60
+ reader.errors.size.should be 1
61
+ error = reader.errors.first
62
+ error.line.should == "12"
63
+ error.level.should == "Error"
64
+
65
+ error.column.should == "3"
66
+
67
+
68
+ end
51
69
 
52
70
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{textmate_fcsh}
8
- s.version = "0.4.2"
8
+ s.version = "0.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jaap van der Meer"]
12
- s.date = %q{2010-03-04}
12
+ s.date = %q{2010-03-08}
13
13
  s.default_executable = %q{textmate_fcsh}
14
14
  s.description = %q{Compile Flex in Textmate using FCSH. Advanced error reporting.}
15
15
  s.email = %q{jaapvandermeer@gmail.com}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textmate_fcsh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaap van der Meer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-04 00:00:00 +01:00
12
+ date: 2010-03-08 00:00:00 +01:00
13
13
  default_executable: textmate_fcsh
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency