rhet-butler 0.11.1 → 0.12.1
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.
- checksums.yaml +8 -8
- data/default-configuration/assets/javascript/sockjs-0.3.4.js +2379 -0
- data/default-configuration/assets/stylesheets/rhet.css.sass +4 -3
- data/default-configuration/common/templates/header-javascript.html +1 -1
- data/default-configuration/common/templates/presentation.html.erb +1 -1
- data/default-configuration/common/templates/presenter-qr.html.erb +1 -1
- data/default-configuration/presenter/templates/stylesheets.html.erb +1 -0
- data/lib/rhet-butler/command-line.rb +2 -0
- data/lib/rhet-butler/filter-resolver.rb +10 -1
- data/lib/rhet-butler/messaging.rb +24 -7
- data/lib/rhet-butler/resource-localizer.rb +1 -1
- data/lib/rhet-butler/slide-contents/embed.rb +39 -0
- data/lib/rhet-butler/slide-contents.rb +40 -0
- data/lib/rhet-butler/slide-loader.rb +8 -7
- data/lib/rhet-butler/slide-rendering.rb +17 -6
- data/lib/rhet-butler/slide.rb +9 -78
- data/lib/rhet-butler/stasis/rack-loader.rb +3 -1
- data/lib/rhet-butler/stasis/transform-queue.rb +23 -13
- data/lib/rhet-butler/static-generator.rb +1 -1
- data/lib/rhet-butler/web/main-app.rb +12 -12
- data/lib/rhet-butler/web/presentation-app.rb +5 -1
- data/lib/rhet-butler/yaml-schema.rb +1 -1
- data/spec/slide-loader.rb +11 -1
- metadata +8 -12
- data/lib/rhet-butler/arrangement-finder.rb +0 -71
- data/lib/rhet-butler/arrangement.rb +0 -78
- data/lib/rhet-butler/layout-rule.rb +0 -61
- data/lib/rhet-butler/slide-arranger.rb +0 -39
- data/lib/rhet-butler/slide-processor.rb +0 -27
- data/spec/arrangements.rb +0 -76
- data/spec/slide-processing.rb +0 -76
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'rhet-butler/stasis'
|
2
2
|
module RhetButler
|
3
3
|
module Stasis
|
4
|
+
class LoadFailed < StandardError; end
|
5
|
+
|
4
6
|
class RackLoader
|
5
7
|
def initialize(url, app)
|
6
8
|
require 'stringio'
|
@@ -46,7 +48,7 @@ module RhetButler
|
|
46
48
|
code, headers, body = *response
|
47
49
|
|
48
50
|
unless code == 200
|
49
|
-
raise "Bad response from local server
|
51
|
+
raise LoadFailed, "Bad response from local server for #{source_uri}:\n#{response[0..1].inspect} body: #{response[2].to_a.join.length}"
|
50
52
|
end
|
51
53
|
doc.type = headers["Content-Type"]
|
52
54
|
doc.body = body.to_a.join("")
|
@@ -4,9 +4,9 @@ module RhetButler
|
|
4
4
|
class TranformationOrder
|
5
5
|
attr_accessor :source_link, :target_link, :storage_target
|
6
6
|
|
7
|
-
def initialize(source_link, target_link, storage_target)
|
8
|
-
@source_link, @target_link, @storage_target =
|
9
|
-
source_link, target_link, storage_target
|
7
|
+
def initialize(document, source_link, target_link, storage_target)
|
8
|
+
@document, @source_link, @target_link, @storage_target =
|
9
|
+
document, source_link, target_link, storage_target
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -33,16 +33,16 @@ module RhetButler
|
|
33
33
|
end
|
34
34
|
attr_accessor :loader, :writer, :mapping
|
35
35
|
|
36
|
-
def add(source)
|
36
|
+
def add(document, source)
|
37
37
|
store_to = mapping.storage_for(source)
|
38
38
|
link_target = mapping.target_link_for(source)
|
39
|
-
add_mapping(source, link_target, store_to)
|
39
|
+
add_mapping(document, source, link_target, store_to)
|
40
40
|
return link_target
|
41
41
|
end
|
42
42
|
|
43
|
-
def add_mapping(source_uri, target_uri, target_path)
|
43
|
+
def add_mapping(document, source_uri, target_uri, target_path)
|
44
44
|
@hash[source_uri] = target_uri
|
45
|
-
@list << TranformationOrder.new(source_uri, target_uri, target_path)
|
45
|
+
@list << TranformationOrder.new(document, source_uri, target_uri, target_path)
|
46
46
|
end
|
47
47
|
|
48
48
|
def transform_class(type)
|
@@ -50,9 +50,15 @@ module RhetButler
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def target_for(document, link)
|
53
|
-
link =
|
54
|
-
|
55
|
-
|
53
|
+
link = Addressable::URI.parse(link)
|
54
|
+
case link.scheme
|
55
|
+
when 'data'
|
56
|
+
link
|
57
|
+
else
|
58
|
+
link = canonicalize_uri(mapping.absolute_uri(document.source_uri).join(link))
|
59
|
+
@hash.fetch(link) do
|
60
|
+
add(document, link)
|
61
|
+
end
|
56
62
|
end
|
57
63
|
end
|
58
64
|
|
@@ -62,8 +68,12 @@ module RhetButler
|
|
62
68
|
uri
|
63
69
|
end
|
64
70
|
|
65
|
-
def load_document(
|
66
|
-
loader.load(canonicalize_uri(
|
71
|
+
def load_document(order)
|
72
|
+
loader.load(canonicalize_uri(order.source_link))
|
73
|
+
rescue LoadFailed
|
74
|
+
require 'pp'
|
75
|
+
puts "Problem loading #{order.pretty_inspect}"
|
76
|
+
raise
|
67
77
|
end
|
68
78
|
|
69
79
|
def write_document(target_path, document_body)
|
@@ -74,7 +84,7 @@ module RhetButler
|
|
74
84
|
until @list.empty?
|
75
85
|
order = @list.pop
|
76
86
|
|
77
|
-
doc = load_document(order
|
87
|
+
doc = load_document(order)
|
78
88
|
transformer = transform_class(doc.type).new
|
79
89
|
transformer.queue = self
|
80
90
|
transformer.document = doc
|
@@ -77,7 +77,7 @@ module RhetButler
|
|
77
77
|
|
78
78
|
def builder
|
79
79
|
sockjs_options = {
|
80
|
-
:sockjs_url => "/assets/javascript/sockjs-0.
|
80
|
+
:sockjs_url => "/assets/javascript/sockjs-0.3.4.js",
|
81
81
|
:queue => SlideMessageQueue.new
|
82
82
|
}
|
83
83
|
|
@@ -127,25 +127,25 @@ module RhetButler
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
-
def
|
130
|
+
def build_server
|
131
131
|
configuration = @file_manager.base_config
|
132
132
|
|
133
|
-
|
133
|
+
Thin::Logging.log_info "Starting server. Try one of these:"
|
134
134
|
require 'system/getifaddrs'
|
135
135
|
System.get_all_ifaddrs.each do |interface|
|
136
|
-
|
137
|
-
|
136
|
+
Thin::Logging.log_info " http://#{interface[:inet_addr].to_s}:#{configuration.serve_port}/"
|
137
|
+
Thin::Logging.log_info " http://#{interface[:inet_addr].to_s}:#{configuration.serve_port}/qr"
|
138
138
|
end
|
139
139
|
server = Thin::Server.new(builder.to_app, configuration.serve_port)
|
140
140
|
server.threaded = true
|
141
|
-
server
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
# end
|
141
|
+
server
|
142
|
+
end
|
143
|
+
|
144
|
+
#:nocov:
|
145
|
+
def start
|
146
|
+
build_server.start
|
148
147
|
end
|
148
|
+
#:nocov:
|
149
149
|
end
|
150
150
|
end
|
151
151
|
end
|
@@ -25,8 +25,12 @@ module RhetButler
|
|
25
25
|
@file_manager.slide_files
|
26
26
|
end
|
27
27
|
|
28
|
+
def assets_valise
|
29
|
+
@file_manager.base_assets(configuration.template_cache)
|
30
|
+
end
|
31
|
+
|
28
32
|
def root_step
|
29
|
-
slide_loader = SlideLoader.new(slides_valise, configuration)
|
33
|
+
slide_loader = SlideLoader.new(slides_valise, assets_valise, configuration)
|
30
34
|
slide_loader.load_slides
|
31
35
|
end
|
32
36
|
|
@@ -2,7 +2,7 @@ require 'yaml'
|
|
2
2
|
require 'rhet-butler/slide'
|
3
3
|
require 'rhet-butler/slide-group'
|
4
4
|
require 'rhet-butler/slide-includer'
|
5
|
-
require 'rhet-butler/
|
5
|
+
require 'rhet-butler/slide-contents'
|
6
6
|
|
7
7
|
#YAML.add_tag('!slide', RhetButler::Slide)
|
8
8
|
#YAML.add_tag('!group', RhetButler::SlideGroup)
|
data/spec/slide-loader.rb
CHANGED
@@ -14,12 +14,16 @@ describe RhetButler::SlideLoader do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
let :assets do
|
18
|
+
files.templates("assets")
|
19
|
+
end
|
20
|
+
|
17
21
|
let :configuration do
|
18
22
|
RhetButler::Configuration.new(files)
|
19
23
|
end
|
20
24
|
|
21
25
|
let :loader do
|
22
|
-
described_class.new(files, configuration)
|
26
|
+
described_class.new(files, assets, configuration)
|
23
27
|
end
|
24
28
|
|
25
29
|
let :slides do
|
@@ -37,6 +41,12 @@ describe RhetButler::SlideLoader do
|
|
37
41
|
end.should_not be_nil
|
38
42
|
end
|
39
43
|
|
44
|
+
it "should have the embedded text" do
|
45
|
+
slides.find do |slide|
|
46
|
+
slide.content =~ /which I embedded/ if slide.respond_to? :content
|
47
|
+
end.should_not be_nil
|
48
|
+
end
|
49
|
+
|
40
50
|
it "should have the slide group" do
|
41
51
|
slides.each_slide.find do |slide|
|
42
52
|
slide.content =~ /grouped/
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhet-butler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Judson Lester
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: compass-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0.0
|
19
|
+
version: 1.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0.0
|
26
|
+
version: 1.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: compass-import-once
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -225,20 +225,17 @@ files:
|
|
225
225
|
- lib/rhet-butler/command-line.rb
|
226
226
|
- lib/rhet-butler/html-generator.rb
|
227
227
|
- lib/rhet-butler/slide-group.rb
|
228
|
-
- lib/rhet-butler/arrangement.rb
|
229
228
|
- lib/rhet-butler/yaml-schema.rb
|
230
229
|
- lib/rhet-butler/slide-loader.rb
|
231
230
|
- lib/rhet-butler/slide.rb
|
232
231
|
- lib/rhet-butler/slide-includer.rb
|
233
232
|
- lib/rhet-butler/static-generator.rb
|
234
233
|
- lib/rhet-butler/yaml-type.rb
|
235
|
-
- lib/rhet-butler/layout-rule.rb
|
236
|
-
- lib/rhet-butler/arrangement-finder.rb
|
237
234
|
- lib/rhet-butler/file-loading.rb
|
238
235
|
- lib/rhet-butler/filter-resolver.rb
|
239
236
|
- lib/rhet-butler/include-processor.rb
|
240
|
-
- lib/rhet-butler/slide-
|
241
|
-
- lib/rhet-butler/slide-
|
237
|
+
- lib/rhet-butler/slide-contents.rb
|
238
|
+
- lib/rhet-butler/slide-contents/embed.rb
|
242
239
|
- lib/rhet-butler/slide-renderer.rb
|
243
240
|
- lib/rhet-butler/slide-renderers/code.rb
|
244
241
|
- lib/rhet-butler/slide-renderers/cues.rb
|
@@ -259,11 +256,9 @@ files:
|
|
259
256
|
- lib/rhet-butler/stasis/writer.rb
|
260
257
|
- bin/rhet-butler
|
261
258
|
- spec/slide-loader.rb
|
262
|
-
- spec/slide-processing.rb
|
263
259
|
- spec/html-generation.rb
|
264
260
|
- spec/rhet-butler.rb
|
265
261
|
- spec/presentation-view.rb
|
266
|
-
- spec/arrangements.rb
|
267
262
|
- default-configuration/assets/favicon.ico
|
268
263
|
- default-configuration/assets/apple-touch-icon-precomposed.png
|
269
264
|
- default-configuration/assets/apple-touch-icon.png
|
@@ -357,6 +352,7 @@ files:
|
|
357
352
|
- default-configuration/assets/stylesheets/setup.css
|
358
353
|
- default-configuration/assets/stylesheets/presentation.css
|
359
354
|
- default-configuration/assets/javascript/sockjs-0.2.1.js
|
355
|
+
- default-configuration/assets/javascript/sockjs-0.3.4.js
|
360
356
|
- default-configuration/assets/javascript/keyboard-nav.js
|
361
357
|
- default-configuration/assets/javascript/highlight.pack.js
|
362
358
|
- default-configuration/assets/javascript/highlight.js/LICENSE
|
@@ -394,7 +390,7 @@ rdoc_options:
|
|
394
390
|
- --main
|
395
391
|
- doc/README
|
396
392
|
- --title
|
397
|
-
- rhet-butler-0.
|
393
|
+
- rhet-butler-0.12.1 Documentation
|
398
394
|
require_paths:
|
399
395
|
- lib/
|
400
396
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -1,71 +0,0 @@
|
|
1
|
-
require 'rhet-butler/arrangement'
|
2
|
-
require 'rhet-butler/slide-traverser'
|
3
|
-
module RhetButler
|
4
|
-
class ArrangementFinder < SlideTraverser
|
5
|
-
attr_accessor :root_arrangement, :root_group, :blueprint
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
super
|
9
|
-
end
|
10
|
-
|
11
|
-
def setup
|
12
|
-
if @blueprint.empty?
|
13
|
-
raise "Empty blueprint - can't layout slides"
|
14
|
-
end
|
15
|
-
|
16
|
-
@blueprint.combination(2) do |first, second|
|
17
|
-
if first.match == second.match
|
18
|
-
if first.match == {}
|
19
|
-
raise "Two default rules (default or match: {}) - please fix"
|
20
|
-
end
|
21
|
-
warn "Blueprint rules with duplicate rules: will ignore the later one:"
|
22
|
-
warn second.inspect
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
unless @blueprint.last.match == {}
|
27
|
-
warn "Last blueprint rule not a default - fixing..."
|
28
|
-
defaults, rules = @blueprint.partition{|rule| rule.match == {}}
|
29
|
-
raise "Multiple default blueprint rules" unless defaults.length < 2
|
30
|
-
raise "No default blueprint rule" unless defaults.length > 0
|
31
|
-
@blueprint = rules + defaults
|
32
|
-
end
|
33
|
-
|
34
|
-
default_rule = @blueprint.last
|
35
|
-
@active_match = default_rule
|
36
|
-
@root_arrangement = default_rule.layout
|
37
|
-
descend(@root_group, @root_arrangement)
|
38
|
-
end
|
39
|
-
|
40
|
-
def on_slide(slide)
|
41
|
-
target_stack.last.slides << slide
|
42
|
-
end
|
43
|
-
|
44
|
-
def on_group(group)
|
45
|
-
arrangement = find_arrangement(group)
|
46
|
-
if arrangement != target_stack.last
|
47
|
-
target_stack.last.slides << arrangement
|
48
|
-
end
|
49
|
-
descend(group, arrangement)
|
50
|
-
end
|
51
|
-
|
52
|
-
def match?(filter, value)
|
53
|
-
return filter === value
|
54
|
-
end
|
55
|
-
|
56
|
-
def find_arrangement(group)
|
57
|
-
match = {}
|
58
|
-
template = nil
|
59
|
-
match = blueprint.find do |rule|
|
60
|
-
rule.match?(group)
|
61
|
-
end
|
62
|
-
|
63
|
-
if !match.nil? and match != @active_match
|
64
|
-
@active_match = match
|
65
|
-
return match.layout
|
66
|
-
else
|
67
|
-
return target_stack.last
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
module RhetButler
|
2
|
-
class Arrangement
|
3
|
-
include Enumerable
|
4
|
-
|
5
|
-
def initialize(*args)
|
6
|
-
@slides = []
|
7
|
-
@slide_width = 1000
|
8
|
-
@slide_height = 1000
|
9
|
-
end
|
10
|
-
|
11
|
-
attr_accessor :slides, :slide_width, :slide_height
|
12
|
-
|
13
|
-
def previous_slide
|
14
|
-
@slides.last
|
15
|
-
end
|
16
|
-
|
17
|
-
def each
|
18
|
-
if block_given?
|
19
|
-
@slides.each{|slide| yield slide}
|
20
|
-
else
|
21
|
-
@slides.each
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class << self
|
26
|
-
def register(name)
|
27
|
-
Arrangement.registry[name] = self
|
28
|
-
end
|
29
|
-
|
30
|
-
def registry
|
31
|
-
@registry ||= {}
|
32
|
-
end
|
33
|
-
|
34
|
-
def [](name)
|
35
|
-
@registry[name]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class Linear < Arrangement
|
41
|
-
register "linear"
|
42
|
-
|
43
|
-
def initialize(plus_x, plus_y)
|
44
|
-
super
|
45
|
-
@plus_x = plus_x
|
46
|
-
@plus_y = plus_y
|
47
|
-
end
|
48
|
-
|
49
|
-
def arrange(slideset)
|
50
|
-
slide = slideset.current_slide
|
51
|
-
slide.position.x = slideset.previous_slide.position.x + @plus_x
|
52
|
-
slide.position.y = slideset.previous_slide.position.y + @plus_y
|
53
|
-
return slide
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
class LinearDigression < Linear
|
58
|
-
register "digress-linear"
|
59
|
-
register "linear-digress"
|
60
|
-
|
61
|
-
def previous_slide
|
62
|
-
@preceeding
|
63
|
-
end
|
64
|
-
|
65
|
-
def arrange(slideset)
|
66
|
-
@preceeding ||= slideset.previous_slide
|
67
|
-
super
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
class Horizontal < Linear
|
72
|
-
register "horizontal"
|
73
|
-
|
74
|
-
def initialize
|
75
|
-
super(1000, 0)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'rhet-butler/yaml-type'
|
2
|
-
|
3
|
-
module RhetButler
|
4
|
-
class LayoutRule < YamlType
|
5
|
-
register "layout-rule"
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@match = {}
|
9
|
-
@layout_args = nil
|
10
|
-
end
|
11
|
-
attr_accessor :match, :layout_type, :layout_args
|
12
|
-
|
13
|
-
def self.optional_config
|
14
|
-
%w[match]
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.required_config
|
18
|
-
%w[layout]
|
19
|
-
end
|
20
|
-
|
21
|
-
def setup_defaults
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
def normalize_config(coder)
|
26
|
-
case coder.type
|
27
|
-
when :seq
|
28
|
-
{ 'match' => coder.seq[0], 'layout' => coder.seq[1] }
|
29
|
-
when :map
|
30
|
-
coder.map
|
31
|
-
else
|
32
|
-
raise "Tried to configure a layout rule with non-sequence: #{coder.inspect}"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def configure
|
37
|
-
value_from_config("match") do |value|
|
38
|
-
if value == 'default'
|
39
|
-
@match = {}
|
40
|
-
else
|
41
|
-
@match = value
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
@layout_type, @layout_args = *@config_hash['layout']
|
46
|
-
end
|
47
|
-
|
48
|
-
def layout
|
49
|
-
Arrangement[@layout_type].new(*(@layout_args||[]))
|
50
|
-
end
|
51
|
-
|
52
|
-
def match?(group)
|
53
|
-
@match.all? do |key, value|
|
54
|
-
target = group.metadata.fetch(key)
|
55
|
-
value === target
|
56
|
-
end
|
57
|
-
rescue KeyError
|
58
|
-
false
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|