flammarion 0.1.14 → 0.2.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/lib/flammarion.rb +1 -1
- data/lib/flammarion/engraving.rb +12 -1
- data/lib/flammarion/revelator.rb +15 -5
- data/lib/flammarion/server.rb +1 -1
- data/lib/flammarion/version.rb +1 -1
- data/lib/flammarion/writeable.rb +12 -8
- data/lib/html/build/javascripts/actions.js +9 -7
- data/lib/html/build/javascripts/all.js +9 -7
- data/lib/html/build/stylesheets/all.css +1 -0
- data/lib/html/build/stylesheets/code.css +1 -0
- data/lib/html/source/javascripts/actions.coffee +5 -4
- data/lib/html/source/stylesheets/code.styl +1 -0
- metadata +3 -3
data/lib/flammarion.rb
CHANGED
data/lib/flammarion/engraving.rb
CHANGED
@@ -12,7 +12,7 @@ module Flammarion
|
|
12
12
|
# blank window, and then display that thing.
|
13
13
|
class Engraving
|
14
14
|
include Revelator
|
15
|
-
attr_accessor :on_disconnect, :on_connect, :actions
|
15
|
+
attr_accessor :on_disconnect, :on_callback_exception, :on_connect, :actions
|
16
16
|
attr_accessor :callbacks, :sockets # @api private
|
17
17
|
include Writeable
|
18
18
|
|
@@ -21,6 +21,10 @@ module Flammarion
|
|
21
21
|
# connected (i.e., displayed)
|
22
22
|
# @option options [Proc] :on_disconnect Called when the display windows is
|
23
23
|
# disconnected (i.e., closed)
|
24
|
+
# @option options [Proc] :on_callback_exception Called when there is an
|
25
|
+
# exception executing a provided callback. (e.g., so you can log it)
|
26
|
+
# If no handler is provided, Flammarion will attempt to pass the exception
|
27
|
+
# back to the original calling thread.
|
24
28
|
# @option options [Boolean] :exit_on_disconnect (false) Will call +exit+
|
25
29
|
# when the widow is closed if this option is true.
|
26
30
|
# @option options [Boolean] :close_on_exit (false) Will close the window
|
@@ -39,6 +43,7 @@ module Flammarion
|
|
39
43
|
@pane_name = "default"
|
40
44
|
@on_connect = options[:on_connect]
|
41
45
|
@on_disconnect = options[:on_disconnect]
|
46
|
+
@on_callback_exception = options[:on_callback_exception]
|
42
47
|
@exit_on_disconnect = options.fetch(:exit_on_disconnect, false)
|
43
48
|
|
44
49
|
start_server
|
@@ -154,6 +159,12 @@ module Flammarion
|
|
154
159
|
end
|
155
160
|
end
|
156
161
|
@actions[m["action"]].call(m) if @actions.include?(m["action"])
|
162
|
+
rescue Exception
|
163
|
+
if @on_callback_exception then
|
164
|
+
@on_callback_exception.call($!)
|
165
|
+
else
|
166
|
+
raise
|
167
|
+
end
|
157
168
|
end
|
158
169
|
|
159
170
|
# @api private
|
data/lib/flammarion/revelator.rb
CHANGED
@@ -20,11 +20,7 @@ module Flammarion
|
|
20
20
|
CHROME_PATH = ENV["FLAMMARION_REVELATOR_PATH"] || 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
|
21
21
|
|
22
22
|
def open_a_window(options = {})
|
23
|
-
|
24
|
-
development_mode = ENV["FLAMMARION_DEVELOPMENT"] == "true"
|
25
|
-
else
|
26
|
-
development_mode = system("lsof -i:#{4567}", out: '/dev/null') and File.exist?("#{File.dirname(__FILE__)}/../html/source/index.html.slim")
|
27
|
-
end
|
23
|
+
development_mode = Flammarion.development_mode?
|
28
24
|
host_path = File.absolute_path(File.join(File.dirname(File.absolute_path(__FILE__)), "/../html/build/index.html"))
|
29
25
|
host_path = `cygpath -w '#{host_path}'`.strip if RbConfig::CONFIG["host_os"] == "cygwin"
|
30
26
|
host = "file://#{host_path}"
|
@@ -117,4 +113,18 @@ module Flammarion
|
|
117
113
|
return nil
|
118
114
|
end
|
119
115
|
end
|
116
|
+
|
117
|
+
private
|
118
|
+
def self.development_mode?
|
119
|
+
if RbConfig::CONFIG["host_os"] =~ /cygwin|mswin|mingw/
|
120
|
+
development_mode = ENV["FLAMMARION_DEVELOPMENT"] == "true"
|
121
|
+
else
|
122
|
+
development_mode = system("lsof -i:#{4567}", out: '/dev/null') and File.exist?("#{File.dirname(__FILE__)}/../html/source/index.html.slim")
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.development_mode=(turnOn)
|
127
|
+
raise StandardError.new("Can't turn on development mode on unix system. (Just start the middleman server, and flammarion will detect it automatically.") unless RbConfig::CONFIG["host_os"] =~ /cygwin|mswin|mingw/
|
128
|
+
ENV["FLAMMARION_DEVELOPMENT"] = "true"
|
129
|
+
end
|
120
130
|
end
|
data/lib/flammarion/server.rb
CHANGED
data/lib/flammarion/version.rb
CHANGED
data/lib/flammarion/writeable.rb
CHANGED
@@ -361,14 +361,18 @@ module Flammarion
|
|
361
361
|
# extensions to enable.
|
362
362
|
# @macro add_options
|
363
363
|
def markdown(text, options = {})
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
364
|
+
if defined?(Redcarpet::Markdown) then
|
365
|
+
markdown_html = Redcarpet::Markdown.new(Redcarpet::Render::HTML, {
|
366
|
+
tables: true,
|
367
|
+
fenced_code_blocks: true,
|
368
|
+
autolink: true,
|
369
|
+
strikethrough: true,
|
370
|
+
superscript: true,
|
371
|
+
}.merge(options[:markdown_extensions] || {})).render(text)
|
372
|
+
else
|
373
|
+
markdown_html = Kramdown::Document.new(text, {input: 'GFM', hard_wrap: false, syntax_highlighter: nil}.merge(options)).to_html
|
374
|
+
end
|
375
|
+
send_json({action:'markdown', text: markdown_html, hard_wrap:false}.merge(options))
|
372
376
|
end
|
373
377
|
|
374
378
|
# Hides (but doesn't close) the pane. This allows the pane to be written
|
@@ -261,15 +261,17 @@ return"undefined"!=typeof b&&""!==b&&b in a.jsEscapeMap?(d=a.jsEscapeMap[b],e=a.
|
|
261
261
|
}
|
262
262
|
element = $("#console-" + data.target);
|
263
263
|
element.append(this.__parent.escape(data.text, data));
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
264
|
+
if (data.auto_scroll !== false) {
|
265
|
+
results = [];
|
266
|
+
while (element.hasClass("pane")) {
|
267
|
+
atBottom = atBottomStack.shift();
|
268
|
+
if (atBottom) {
|
269
|
+
element.scrollTop(element[0].scrollHeight - element.height() - marginSize);
|
270
|
+
}
|
271
|
+
results.push(element = element.parent());
|
269
272
|
}
|
270
|
-
results
|
273
|
+
return results;
|
271
274
|
}
|
272
|
-
return results;
|
273
275
|
},
|
274
276
|
replace: function(data) {
|
275
277
|
this.__parent.check_target(data);
|
@@ -7439,15 +7439,17 @@ window.font_awesome_list = ["glass","music","search","envelope-o","heart","star"
|
|
7439
7439
|
}
|
7440
7440
|
element = $("#console-" + data.target);
|
7441
7441
|
element.append(this.__parent.escape(data.text, data));
|
7442
|
-
|
7443
|
-
|
7444
|
-
|
7445
|
-
|
7446
|
-
|
7442
|
+
if (data.auto_scroll !== false) {
|
7443
|
+
results = [];
|
7444
|
+
while (element.hasClass("pane")) {
|
7445
|
+
atBottom = atBottomStack.shift();
|
7446
|
+
if (atBottom) {
|
7447
|
+
element.scrollTop(element[0].scrollHeight - element.height() - marginSize);
|
7448
|
+
}
|
7449
|
+
results.push(element = element.parent());
|
7447
7450
|
}
|
7448
|
-
results
|
7451
|
+
return results;
|
7449
7452
|
}
|
7450
|
-
return results;
|
7451
7453
|
},
|
7452
7454
|
replace: function(data) {
|
7453
7455
|
this.__parent.check_target(data);
|
@@ -14,10 +14,11 @@ $.extend WSClient.prototype.actions,
|
|
14
14
|
element = $("#console-#{data.target}")
|
15
15
|
element.append(@__parent.escape(data.text, data))
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
unless data.auto_scroll is false
|
18
|
+
while element.hasClass("pane")
|
19
|
+
atBottom = atBottomStack.shift()
|
20
|
+
element.scrollTop(element[0].scrollHeight - element.height() - marginSize) if atBottom
|
21
|
+
element = element.parent()
|
21
22
|
|
22
23
|
replace: (data) ->
|
23
24
|
@__parent.check_target(data)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flammarion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubame
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
111
|
+
name: kramdown
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
114
114
|
requirements:
|