textmate_fcsh 0.5.0 → 0.6.0
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/Rakefile +3 -15
- data/VERSION +1 -1
- data/bin/textmate_fcsh +9 -4
- data/lib/dir_watcher.rb +28 -0
- data/lib/output_watcher.rb +15 -0
- data/lib/textmate_fcsh.rb +70 -19
- data/lib/websocket_server.rb +28 -0
- data/templates/standard.html +108 -0
- data/templates/standard.html.erb +29 -18
- data/textmate_fcsh.gemspec +17 -7
- metadata +66 -12
- data/lib/fcsh/fcsh.rb +0 -99
- data/lib/mxmlc_output/mxmlc_error.rb +0 -21
- data/lib/mxmlc_output/mxmlc_output_reader.rb +0 -28
data/Rakefile
CHANGED
@@ -11,6 +11,9 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/japetheape/textmate_fcsh"
|
12
12
|
gem.authors = ["Jaap van der Meer"]
|
13
13
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
gem.add_dependency "fcsh"
|
15
|
+
gem.add_dependency "em-websocket"
|
16
|
+
gem.add_dependency "json"
|
14
17
|
gem.bindir = 'bin'
|
15
18
|
gem.executables = ["textmate_fcsh"]
|
16
19
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
@@ -20,21 +23,6 @@ rescue LoadError
|
|
20
23
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
24
|
end
|
22
25
|
|
23
|
-
require 'spec/rake/spectask'
|
24
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
25
|
-
spec.libs << 'lib' << 'spec'
|
26
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
-
end
|
28
|
-
|
29
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
30
|
-
spec.libs << 'lib' << 'spec'
|
31
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
32
|
-
spec.rcov = true
|
33
|
-
end
|
34
|
-
|
35
|
-
task :spec => :check_dependencies
|
36
|
-
|
37
|
-
task :default => :spec
|
38
26
|
|
39
27
|
require 'rake/rdoctask'
|
40
28
|
Rake::RDocTask.new do |rdoc|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/bin/textmate_fcsh
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
2
|
require File.join(File.dirname(__FILE__), '..', 'lib', 'textmate_fcsh')
|
5
|
-
|
3
|
+
|
6
4
|
require "open3"
|
7
5
|
|
8
6
|
#a = TextmateFcsh.new
|
@@ -11,7 +9,9 @@ $DEBUG = false
|
|
11
9
|
|
12
10
|
require 'optparse'
|
13
11
|
|
12
|
+
|
14
13
|
options = {}
|
14
|
+
|
15
15
|
OptionParser.new do |opts|
|
16
16
|
opts.banner = "Usage: textmate_fcsh [options]"
|
17
17
|
opts.on("-v", "--verbose", "Run verbosely") do |v|
|
@@ -27,6 +27,11 @@ OptionParser.new do |opts|
|
|
27
27
|
options[:run] = false
|
28
28
|
end
|
29
29
|
|
30
|
+
opts.on("-t", "--standalone", "Run standalone without fcsh") do |v|
|
31
|
+
options[:standalone] = true
|
32
|
+
end
|
33
|
+
|
34
|
+
|
30
35
|
opts.on("-v", "--verbose", "Verbose mode") do |v|
|
31
36
|
$DEBUG = true
|
32
37
|
end
|
@@ -37,7 +42,7 @@ end.parse!
|
|
37
42
|
|
38
43
|
|
39
44
|
if options[:run] != false
|
40
|
-
TextmateFcsh.new
|
45
|
+
TextmateFcsh.new(options)
|
41
46
|
end
|
42
47
|
|
43
48
|
|
data/lib/dir_watcher.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
class DirWatcher
|
3
|
+
|
4
|
+
def initialize(dir, options = {}, &block)
|
5
|
+
@dir = dir
|
6
|
+
@block = block
|
7
|
+
@sleep_time = options[:sleep_time] || 1
|
8
|
+
run
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
while true
|
13
|
+
new_run = `ls -lahRT #{@dir}`
|
14
|
+
if new_run != @last_run
|
15
|
+
on_change
|
16
|
+
end
|
17
|
+
@last_run = new_run
|
18
|
+
sleep @sleep_time
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def on_change
|
24
|
+
@block.call
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class OutputWatcher
|
2
|
+
attr_reader :stdout, :stderr
|
3
|
+
|
4
|
+
def initialize(command)
|
5
|
+
@stderr = ''
|
6
|
+
@stdout = ''
|
7
|
+
|
8
|
+
Open3.popen3(command) do |stdin, stdout, stderr|
|
9
|
+
stderr.each_line { |line| @stderr << line }
|
10
|
+
stdout.each_line { |line| @stdout << line }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
end
|
data/lib/textmate_fcsh.rb
CHANGED
@@ -1,26 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require File.join(File.dirname(__FILE__), 'dir_watcher')
|
3
|
+
|
1
4
|
require 'tempfile'
|
2
|
-
require File.join(File.dirname(__FILE__), 'mxmlc_output', 'mxmlc_output_reader')
|
3
5
|
require File.join(File.dirname(__FILE__), 'formatters', 'html_mxmlc_error_formatter')
|
4
|
-
require File.join(File.dirname(__FILE__), 'file_watcher')
|
5
6
|
require 'yaml'
|
7
|
+
require File.join(File.dirname(__FILE__), 'output_watcher')
|
8
|
+
require File.join(File.dirname(__FILE__), 'websocket_server')
|
9
|
+
require File.join(File.dirname(__FILE__), '../../fcsh/lib/fcsh')
|
10
|
+
require 'em-websocket'
|
11
|
+
require 'json'
|
12
|
+
|
6
13
|
|
7
14
|
class TextmateFcsh
|
8
15
|
CONFIG_FILE = '.textmate_fcsh'
|
9
16
|
TEXTMATE_BUNDLE_LOCATION = "git://github.com/japetheape/textmate_fcsh_bundle.git"
|
10
17
|
|
11
|
-
def initialize
|
18
|
+
def initialize(options = {})
|
19
|
+
@options = options
|
20
|
+
@server = WebsocketServer.new
|
21
|
+
open_browser_first_time
|
22
|
+
|
12
23
|
check_preconditions
|
13
24
|
read_config!
|
14
25
|
write_to_tempfile("Waiting for run...")
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
@file_watcher.each_change do |f|
|
26
|
+
|
27
|
+
if options[:standalone]
|
28
|
+
puts "Running standalone"
|
19
29
|
run
|
30
|
+
else
|
31
|
+
@fcsh = Fcsh.new
|
32
|
+
d = DirWatcher.new('src libs') do
|
33
|
+
run
|
34
|
+
end
|
20
35
|
end
|
21
36
|
end
|
22
37
|
|
23
38
|
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
24
43
|
# Write report to file
|
25
44
|
def write_to_tempfile(txt)
|
26
45
|
@report_file = File.new('/tmp/mxmlc_error_report.html', 'w+')
|
@@ -28,6 +47,13 @@ class TextmateFcsh
|
|
28
47
|
@report_file.close
|
29
48
|
end
|
30
49
|
|
50
|
+
def open_browser_first_time
|
51
|
+
if !@options[:standalone]
|
52
|
+
f = File.join(File.dirname(__FILE__), '..','templates', 'standard.html')
|
53
|
+
`open #{f}`
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
31
57
|
# Open the report in the browser
|
32
58
|
def open_browser
|
33
59
|
`open #{@report_file.path}`
|
@@ -35,17 +61,35 @@ class TextmateFcsh
|
|
35
61
|
|
36
62
|
# Compile the mxmlc, extract errors, create a report.
|
37
63
|
def run
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
64
|
+
if @options[:standalone]
|
65
|
+
puts get_compile_command
|
66
|
+
output_watcher = OutputWatcher.new("mxmlc " + get_compile_command)
|
67
|
+
output_watcher.stdout.each_line do |line|
|
68
|
+
puts " -->\t" + line
|
69
|
+
end
|
70
|
+
|
71
|
+
output = output_watcher.stderr
|
72
|
+
errors = MxmlcOutputReader.new(output)
|
73
|
+
|
74
|
+
@report = HtmlMxmlcErrorFormatter.new(errors)
|
75
|
+
write_report!
|
76
|
+
open_browser
|
77
|
+
|
78
|
+
else
|
79
|
+
output = run_mxmlc
|
80
|
+
errors = @fcsh.errors
|
81
|
+
|
82
|
+
puts "Complete: %d errors, %d warnings" % [errors.errors.size, errors.warnings.size]
|
83
|
+
error_array = errors.messages.map {|x| {"filename" => x.filename, "line" => x.line, "level" => x.level, "message" => x.message, "content" => x.content, "column" => x.column } }
|
84
|
+
@server.send JSON.generate(error_array)
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
|
43
89
|
end
|
44
90
|
|
45
|
-
|
46
|
-
|
47
|
-
def run_mxmlc
|
48
|
-
mxmlc_command = "mxmlc"
|
91
|
+
def get_compile_command
|
92
|
+
mxmlc_command = ""
|
49
93
|
#" -default-background-color=#FFFFFF -default-frame-rate=24 -default-size 970 550 -output=bin/editor-debug.swf -source-path+=src -source-path+=assets -source-path+=lib/mvc -source-path+=lib/editor_core -verbose-stacktraces=true -warnings=true src/editor.mxml"
|
50
94
|
@config[:mxmlc_options].each do |k,v|
|
51
95
|
#next if v
|
@@ -62,9 +106,16 @@ class TextmateFcsh
|
|
62
106
|
end
|
63
107
|
end
|
64
108
|
mxmlc_command << " %s" % @config[:main_file]
|
65
|
-
|
66
|
-
|
67
|
-
|
109
|
+
mxmlc_command
|
110
|
+
end
|
111
|
+
|
112
|
+
# Runs the mxmlc in the fcsh compiler
|
113
|
+
def run_mxmlc
|
114
|
+
if @target_id.nil?
|
115
|
+
@target_id = @fcsh.mxmlc(get_compile_command)
|
116
|
+
else
|
117
|
+
@fcsh.compile(@target_id)
|
118
|
+
end
|
68
119
|
end
|
69
120
|
|
70
121
|
# Run a bogus mxmlc command, not used anymore.
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'em-websocket'
|
2
|
+
|
3
|
+
class WebsocketServer
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@connected = []
|
7
|
+
a = Thread.start do
|
8
|
+
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080) do |ws|
|
9
|
+
ws.onopen {
|
10
|
+
|
11
|
+
@connected << ws
|
12
|
+
|
13
|
+
}
|
14
|
+
ws.onmessage { |msg|
|
15
|
+
}
|
16
|
+
ws.onclose { @connected.delete(ws) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def send(mess)
|
23
|
+
@connected.each do |c|
|
24
|
+
c.send mess
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Waiting...</title>
|
4
|
+
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js'></script>
|
5
|
+
<script>
|
6
|
+
$(document).ready(function(){
|
7
|
+
function debug(str){ $("#debug").append("<p>"+str+"</p>"); };
|
8
|
+
|
9
|
+
ws = new WebSocket("ws://localhost:8080/websocket");
|
10
|
+
ws.onmessage = function(evt) {
|
11
|
+
var data = $.parseJSON(evt.data);
|
12
|
+
|
13
|
+
var lErrors = [];
|
14
|
+
var lWarnings = [];
|
15
|
+
for(var i = 0; i < data.length; i++ ) {
|
16
|
+
if(data[i].level == 'Warning')
|
17
|
+
lWarnings.push(data[i]);
|
18
|
+
else if(data[i].level == 'Error')
|
19
|
+
lErrors.push(data[i]);
|
20
|
+
}
|
21
|
+
|
22
|
+
$("#errortable").empty();
|
23
|
+
$("#errortable").append('<tr><th class="level">Level</th><th class="file">File</th><th></th></tr>')
|
24
|
+
|
25
|
+
for(var i = 0; i < lErrors.length; i++) {
|
26
|
+
var e = createError(lErrors[i]);
|
27
|
+
$("#errortable").append(e);
|
28
|
+
}
|
29
|
+
|
30
|
+
for(var i = 0; i < lWarnings.length; i++) {
|
31
|
+
var e = createError(lWarnings[i]);
|
32
|
+
$("#errortable").append(e);
|
33
|
+
}
|
34
|
+
|
35
|
+
document.title = lErrors.length + " errors, " + lWarnings.length + " warnings"
|
36
|
+
var lDate = new Date();
|
37
|
+
$("#title").html(document.title + ", last run on " + lDate.getHours() + ":" + lDate.getMinutes() + ":" + lDate.getSeconds());
|
38
|
+
|
39
|
+
};
|
40
|
+
ws.onclose = function() { debug("socket closed"); };
|
41
|
+
ws.onopen = function() {
|
42
|
+
debug("connected...");
|
43
|
+
ws.send("hello server");
|
44
|
+
};
|
45
|
+
});
|
46
|
+
|
47
|
+
function createError(pError) {
|
48
|
+
var lTextmateUrl = "txmt://open/?url=file://" + pError.filename + "&line=" + pError.line + "&column=" + pError.column;
|
49
|
+
|
50
|
+
var lRow = $('<tr>').addClass(pError.level);
|
51
|
+
lRow.append($('<td>').html(pError.level));
|
52
|
+
|
53
|
+
|
54
|
+
var lLink = $('<a>').attr('href', lTextmateUrl).html(pError.filename + ":" + pError.line);
|
55
|
+
lRow.append($('<td>').append(lLink));
|
56
|
+
lRow.append($('<td>').html(pError.message));
|
57
|
+
|
58
|
+
|
59
|
+
return lRow;
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
</script>
|
65
|
+
|
66
|
+
<style>
|
67
|
+
* {font-family:arial; }
|
68
|
+
h1 {}
|
69
|
+
html {margin:0px;padding:0px;}
|
70
|
+
body {padding:0px;margin:0px;font-size:12px;}
|
71
|
+
.header {font-size:10px;border-bottom:1px solid #999;width:100%;text-align:right;background-color:black; color:white;}
|
72
|
+
.header .content {padding:10px;}
|
73
|
+
.header a {color:white;}
|
74
|
+
.container {padding:20px;}
|
75
|
+
|
76
|
+
table {width:100%;}
|
77
|
+
table, tr, td,th {border-spacing:0px;font-size:12px;}
|
78
|
+
th, td {padding-left:10px;}
|
79
|
+
th {text-align:left;border-bottom:1px solid #999;}
|
80
|
+
th.file {width:300px;}
|
81
|
+
th.level {width:50px;}
|
82
|
+
tr {height:35px;border:1px solid black;}
|
83
|
+
tr.warning { background-color:yellow;}
|
84
|
+
tr.warning a {color:black;}
|
85
|
+
|
86
|
+
tr.error { background-color:#FF3000;}
|
87
|
+
tr.error a {color:white;}
|
88
|
+
|
89
|
+
td a {display:block;}
|
90
|
+
tr.error td {color:white;}
|
91
|
+
td {border-bottom:1px dotted #ccc;}
|
92
|
+
</style>
|
93
|
+
</head>
|
94
|
+
<body>
|
95
|
+
<div class='header'>
|
96
|
+
<div class='content'>
|
97
|
+
Generated <strong><%=Time.now.to_s %></strong> by Textmate Fcsh, written by <a href="http://www.jaapvandermeer.com">Jaap van der Meer</a>
|
98
|
+
</div>
|
99
|
+
</div>
|
100
|
+
|
101
|
+
<div class='container' id="container">
|
102
|
+
<h1 id="title">Waiting...</h1>
|
103
|
+
<table id="errortable">
|
104
|
+
</table>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
</body>
|
108
|
+
</html>
|
data/templates/standard.html.erb
CHANGED
@@ -1,6 +1,28 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
|
-
<title
|
3
|
+
<title><%=@errors.errors.size %> Errors, <%=@errors.warnings.size %> Warnings</title>
|
4
|
+
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js'></script>
|
5
|
+
<script>
|
6
|
+
$(document).ready(function() {
|
7
|
+
function debug(str){ $("#debug").append("<p>"+str+"</p>"); };
|
8
|
+
|
9
|
+
ws = new WebSocket("ws://localhost:8080/websocket");
|
10
|
+
ws.onmessage = function(evt) {
|
11
|
+
errors = eval(evt.data);
|
12
|
+
for(var error in errors) {
|
13
|
+
console.info(error);
|
14
|
+
}
|
15
|
+
// $("#msg").append("<p>"+evt.data+"</p>");
|
16
|
+
|
17
|
+
};
|
18
|
+
ws.onclose = function() { debug("socket closed"); };
|
19
|
+
ws.onopen = function() {
|
20
|
+
debug("connected...");
|
21
|
+
ws.send("hello server");
|
22
|
+
};
|
23
|
+
});
|
24
|
+
</script>
|
25
|
+
|
4
26
|
<style>
|
5
27
|
* {font-family:arial; }
|
6
28
|
h1 {}
|
@@ -36,35 +58,23 @@
|
|
36
58
|
</div>
|
37
59
|
|
38
60
|
<div class='container'>
|
39
|
-
|
40
|
-
<%
|
41
|
-
errors = []
|
42
|
-
warnings = []
|
43
|
-
@errors.each do |e|
|
44
|
-
errors << e if e.level == "Error"
|
45
|
-
warnings << e if e.level == "Warning"
|
46
|
-
end
|
47
|
-
|
48
|
-
%>
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
<% if @errors.empty? %>
|
61
|
+
|
62
|
+
<% if @errors.messages.empty? %>
|
53
63
|
<h1>No errors</h1>
|
54
64
|
<% else %>
|
55
|
-
<h1
|
65
|
+
<h1><%=@errors.errors.size %> errors, <%=@errors.warnings.size %> warnings </h1>
|
56
66
|
<table>
|
57
67
|
<tr>
|
58
68
|
<th class='level'>Level</th><th class='file'>File</th><th class='Notice'>Notice</th>
|
59
69
|
</tr>
|
60
|
-
<% errors.each do |error| %>
|
70
|
+
<% @errors.errors.each do |error| %>
|
61
71
|
<tr class="<%=error.level %>">
|
62
72
|
<td><%=error.level %></td><td><a href="txmt://open/?url=file://<%=error.filename %>&line=<%=error.line %>&column=<%=error.column %>"><%=error.filename %>:<%=error.line %></a></td><td><%=error.message %></td>
|
63
73
|
</tr>
|
64
74
|
<% end %>
|
65
75
|
|
66
76
|
|
67
|
-
<% warnings.each do |error| %>
|
77
|
+
<% @errors.warnings.each do |error| %>
|
68
78
|
<tr class="<%=error.level %>">
|
69
79
|
<td><%=error.level %></td><td><a href="txmt://open/?url=file://<%=error.filename %>&line=<%=error.line %>&column=<%=error.column %>"><%=error.filename %>:<%=error.line %></a></td><td><%=error.message %></td>
|
70
80
|
</tr>
|
@@ -74,5 +84,6 @@
|
|
74
84
|
|
75
85
|
</div>
|
76
86
|
|
87
|
+
|
77
88
|
</body>
|
78
89
|
</html>
|
data/textmate_fcsh.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{textmate_fcsh}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
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-
|
12
|
+
s.date = %q{2010-08-17}
|
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}
|
@@ -26,25 +26,26 @@ Gem::Specification.new do |s|
|
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
28
|
"bin/textmate_fcsh",
|
29
|
-
"lib/
|
29
|
+
"lib/dir_watcher.rb",
|
30
30
|
"lib/file_watcher.rb",
|
31
31
|
"lib/formatters/html_mxmlc_error_formatter.rb",
|
32
|
-
"lib/
|
33
|
-
"lib/mxmlc_output/mxmlc_output_reader.rb",
|
32
|
+
"lib/output_watcher.rb",
|
34
33
|
"lib/textmate_fcsh.rb",
|
34
|
+
"lib/websocket_server.rb",
|
35
35
|
"spec/fixtures/mxmlc_output.txt",
|
36
36
|
"spec/html_mxmlc_error_formatter_spec.rb",
|
37
37
|
"spec/mxmlc_output_reader_spec.rb",
|
38
38
|
"spec/spec.opts",
|
39
39
|
"spec/spec_helper.rb",
|
40
40
|
"spec/textmate_fcsh_spec.rb",
|
41
|
+
"templates/standard.html",
|
41
42
|
"templates/standard.html.erb",
|
42
43
|
"textmate_fcsh.gemspec"
|
43
44
|
]
|
44
45
|
s.homepage = %q{http://github.com/japetheape/textmate_fcsh}
|
45
46
|
s.rdoc_options = ["--charset=UTF-8"]
|
46
47
|
s.require_paths = ["lib"]
|
47
|
-
s.rubygems_version = %q{1.3.
|
48
|
+
s.rubygems_version = %q{1.3.7}
|
48
49
|
s.summary = %q{Compile Flex in Textmate using FCSH. Advanced error reporting.}
|
49
50
|
s.test_files = [
|
50
51
|
"spec/html_mxmlc_error_formatter_spec.rb",
|
@@ -57,13 +58,22 @@ Gem::Specification.new do |s|
|
|
57
58
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
58
59
|
s.specification_version = 3
|
59
60
|
|
60
|
-
if Gem::Version.new(Gem::
|
61
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
61
62
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
63
|
+
s.add_runtime_dependency(%q<fcsh>, [">= 0"])
|
64
|
+
s.add_runtime_dependency(%q<em-websocket>, [">= 0"])
|
65
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
62
66
|
else
|
63
67
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
68
|
+
s.add_dependency(%q<fcsh>, [">= 0"])
|
69
|
+
s.add_dependency(%q<em-websocket>, [">= 0"])
|
70
|
+
s.add_dependency(%q<json>, [">= 0"])
|
64
71
|
end
|
65
72
|
else
|
66
73
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
74
|
+
s.add_dependency(%q<fcsh>, [">= 0"])
|
75
|
+
s.add_dependency(%q<em-websocket>, [">= 0"])
|
76
|
+
s.add_dependency(%q<json>, [">= 0"])
|
67
77
|
end
|
68
78
|
end
|
69
79
|
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textmate_fcsh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 6
|
8
|
+
- 0
|
9
|
+
version: 0.6.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Jaap van der Meer
|
@@ -9,19 +14,63 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-08-17 00:00:00 +02:00
|
13
18
|
default_executable: textmate_fcsh
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
20
25
|
requirements:
|
21
26
|
- - ">="
|
22
27
|
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 2
|
31
|
+
- 9
|
23
32
|
version: 1.2.9
|
24
|
-
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: fcsh
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: em-websocket
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
type: :runtime
|
60
|
+
version_requirements: *id003
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: json
|
63
|
+
prerelease: false
|
64
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
type: :runtime
|
73
|
+
version_requirements: *id004
|
25
74
|
description: Compile Flex in Textmate using FCSH. Advanced error reporting.
|
26
75
|
email: jaapvandermeer@gmail.com
|
27
76
|
executables:
|
@@ -39,18 +88,19 @@ files:
|
|
39
88
|
- Rakefile
|
40
89
|
- VERSION
|
41
90
|
- bin/textmate_fcsh
|
42
|
-
- lib/
|
91
|
+
- lib/dir_watcher.rb
|
43
92
|
- lib/file_watcher.rb
|
44
93
|
- lib/formatters/html_mxmlc_error_formatter.rb
|
45
|
-
- lib/
|
46
|
-
- lib/mxmlc_output/mxmlc_output_reader.rb
|
94
|
+
- lib/output_watcher.rb
|
47
95
|
- lib/textmate_fcsh.rb
|
96
|
+
- lib/websocket_server.rb
|
48
97
|
- spec/fixtures/mxmlc_output.txt
|
49
98
|
- spec/html_mxmlc_error_formatter_spec.rb
|
50
99
|
- spec/mxmlc_output_reader_spec.rb
|
51
100
|
- spec/spec.opts
|
52
101
|
- spec/spec_helper.rb
|
53
102
|
- spec/textmate_fcsh_spec.rb
|
103
|
+
- templates/standard.html
|
54
104
|
- templates/standard.html.erb
|
55
105
|
- textmate_fcsh.gemspec
|
56
106
|
has_rdoc: true
|
@@ -63,21 +113,25 @@ rdoc_options:
|
|
63
113
|
require_paths:
|
64
114
|
- lib
|
65
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
66
117
|
requirements:
|
67
118
|
- - ">="
|
68
119
|
- !ruby/object:Gem::Version
|
120
|
+
segments:
|
121
|
+
- 0
|
69
122
|
version: "0"
|
70
|
-
version:
|
71
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
72
125
|
requirements:
|
73
126
|
- - ">="
|
74
127
|
- !ruby/object:Gem::Version
|
128
|
+
segments:
|
129
|
+
- 0
|
75
130
|
version: "0"
|
76
|
-
version:
|
77
131
|
requirements: []
|
78
132
|
|
79
133
|
rubyforge_project:
|
80
|
-
rubygems_version: 1.3.
|
134
|
+
rubygems_version: 1.3.7
|
81
135
|
signing_key:
|
82
136
|
specification_version: 3
|
83
137
|
summary: Compile Flex in Textmate using FCSH. Advanced error reporting.
|
data/lib/fcsh/fcsh.rb
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
class Fcsh
|
2
|
-
attr_reader :stdout, :stderr, :error_output_last_run
|
3
|
-
|
4
|
-
def initialize(location)
|
5
|
-
|
6
|
-
@targets = []
|
7
|
-
@stdin, @stdout, @stderr = Open3.popen3(location)
|
8
|
-
@error_output_last_run = ''
|
9
|
-
end
|
10
|
-
|
11
|
-
|
12
|
-
def compile(command)
|
13
|
-
if !@targets.include?(command)
|
14
|
-
errors = compile_first_time!(command)
|
15
|
-
if !errors.nil?
|
16
|
-
puts errors
|
17
|
-
exit
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
puts "Compiling..."
|
22
|
-
@error_output_last_run = ''
|
23
|
-
@stdin.puts "compile %d" % [@targets.index(command) + 1]
|
24
|
-
|
25
|
-
outfile = "bin/"
|
26
|
-
|
27
|
-
# watch std out till files changed
|
28
|
-
@stdout.each_line do |line|
|
29
|
-
puts "FCSH OUT: " + line.inspect if $DEBUG
|
30
|
-
|
31
|
-
if /.+\.swf/.match(line)
|
32
|
-
puts ""
|
33
|
-
break
|
34
|
-
end
|
35
|
-
|
36
|
-
if /Nothing has changed/.match(line)
|
37
|
-
puts "Nothing has changed"
|
38
|
-
break
|
39
|
-
end
|
40
|
-
|
41
|
-
if /Files changed/.match(line)
|
42
|
-
capture_error_output
|
43
|
-
break
|
44
|
-
end
|
45
|
-
end
|
46
|
-
#puts @error_output_last_run
|
47
|
-
puts "Compiled."
|
48
|
-
end
|
49
|
-
|
50
|
-
# Create a target if this is the first time.
|
51
|
-
def compile_first_time!(command)
|
52
|
-
puts "Assigning target..."
|
53
|
-
@stdin.puts command if $DEBUG
|
54
|
-
|
55
|
-
@mxmlc_errors = nil
|
56
|
-
a = Thread.new do
|
57
|
-
@stderr.each_line do |line|
|
58
|
-
|
59
|
-
if /Error: /.match(line) || !@mxmlc_errors.nil?
|
60
|
-
@mxmlc_errors ||= "Errors while compiling, please check your .textmate_fcsh. Mxml output:\n"
|
61
|
-
@mxmlc_errors << line
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
@targets << command
|
68
|
-
sleep 3
|
69
|
-
return @mxmlc_errors
|
70
|
-
end
|
71
|
-
|
72
|
-
# Currently there is no way of knowing when error output has finished,
|
73
|
-
# so now we capture errors from start of receiving first line is 1 second
|
74
|
-
# ago or we started capturing error output is 4 seconds ago. Hope this
|
75
|
-
# will be enough.
|
76
|
-
def capture_error_output
|
77
|
-
puts "Capturing error output"
|
78
|
-
last_line_captured = nil
|
79
|
-
started = Time.now
|
80
|
-
a = Thread.new do
|
81
|
-
@stderr.each_line do |line|
|
82
|
-
puts "FCSH ERROR: " + line.inspect if $DEBUG
|
83
|
-
last_line_captured = Time.now
|
84
|
-
@error_output_last_run << line
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
loop do
|
89
|
-
if (!last_line_captured.nil? && Time.now - last_line_captured > 3)
|
90
|
-
break
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class MxmlcError
|
2
|
-
attr_reader :filename, :line, :column, :level, :message, :content
|
3
|
-
|
4
|
-
LEVEL_WARN = :warn
|
5
|
-
LEVEL_ERROR = :error
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
def initialize(filename, line, column, level, message)
|
10
|
-
@filename = filename
|
11
|
-
@line = line
|
12
|
-
@column = column
|
13
|
-
@level = level
|
14
|
-
@message = message
|
15
|
-
@content = ''
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'mxmlc_error')
|
2
|
-
|
3
|
-
|
4
|
-
# Formats the mxmlc to errors
|
5
|
-
class MxmlcOutputReader
|
6
|
-
attr_reader :errors
|
7
|
-
ERROR_LINE = /^((\/([\w\.]+))+)(\((-?\d+)\))?:\s*(col: (\d+))?:?\s*(Error|Warning+): (.+)$/
|
8
|
-
|
9
|
-
def initialize(output)
|
10
|
-
@output = output
|
11
|
-
@errors = []
|
12
|
-
parse!
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
# example: /Users/japetheape/Projects/tunedustry/editor/src/com/tunedustry/editor/view/Controls.as(43): col: 32 Warning: return value for function 'setPositions' has no type declaration.
|
17
|
-
def parse!
|
18
|
-
@output.each_line do |l|
|
19
|
-
matches = ERROR_LINE.match(l)
|
20
|
-
if !matches.nil?
|
21
|
-
@errors << MxmlcError.new(matches[1], matches[5], matches[7], matches[8], matches[9])
|
22
|
-
elsif !@errors.empty?
|
23
|
-
@errors.last.content << l
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|