rhet-butler 0.13.0 → 0.14.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.
Files changed (57) hide show
  1. checksums.yaml +6 -14
  2. data/default-configuration/assets/fonts.googleapis.com/css/family=Arimo:700|Droid Sans Mono|Cinzel Decorative:700,900|Slackey,subset=latin,latin-ext +30 -0
  3. data/default-configuration/assets/fonts.gstatic.com/s/arimo/v12/P5sBzZCDf9_T_1Wi4TRNrZc.ttf +0 -0
  4. data/default-configuration/assets/fonts.gstatic.com/s/cinzeldecorative/v7/daaHSScvJGqLYhG8nNt8KPPswUAPniZQa9lESTQ.ttf +0 -0
  5. data/default-configuration/assets/fonts.gstatic.com/s/cinzeldecorative/v7/daaHSScvJGqLYhG8nNt8KPPswUAPniZoadlESTQ.ttf +0 -0
  6. data/default-configuration/assets/fonts.gstatic.com/s/droidsansmono/v10/6NUO8FuJNQ2MbkrZ5-J8lKFrp7pRef2u.ttf +0 -0
  7. data/default-configuration/assets/fonts.gstatic.com/s/slackey/v9/N0bV2SdQO-5yM0-dGlNQIQ.ttf +0 -0
  8. data/default-configuration/assets/javascript/presenter.js +317 -0
  9. data/default-configuration/assets/javascript/rhet-butler/child-step.js +13 -0
  10. data/default-configuration/assets/javascript/rhet-butler/step.js +197 -0
  11. data/default-configuration/assets/javascript/rhet-butler/steps/group.js +50 -0
  12. data/default-configuration/assets/javascript/rhet-butler/steps/item.js +60 -0
  13. data/default-configuration/assets/javascript/rhet-butler/steps/root.js +41 -0
  14. data/default-configuration/assets/javascript/rhet-butler/steps/slide.js +96 -0
  15. data/default-configuration/assets/javascript/rhet-butler/transition-states.js +173 -0
  16. data/default-configuration/assets/javascript/rhet-butler/transition-station.js +133 -0
  17. data/default-configuration/assets/javascript/rhet-butler/transition-stations.js +107 -0
  18. data/default-configuration/assets/javascript/rhet-butler/tree-builder.js +103 -0
  19. data/default-configuration/assets/javascript/utils.js +78 -0
  20. data/default-configuration/assets/stylesheets/font.sass +5 -9
  21. data/default-configuration/common/templates/presentation.html.erb +5 -5
  22. data/lib/rhet-butler/file-loading.rb +1 -1
  23. data/lib/rhet-butler/stasis/transform-queue.rb +2 -0
  24. data/spec/command-line.rb +1 -0
  25. data/spec/configuration.rb +27 -0
  26. data/spec/javascripts/fixtures/long-animation-group-1.html +19 -0
  27. data/spec/javascripts/fixtures/long-transition-group-1.html +10 -0
  28. data/spec/javascripts/fixtures/looped-animation-group-1.html +20 -0
  29. data/spec/javascripts/fixtures/quiet_console.js +2 -0
  30. data/spec/javascripts/fixtures/test-presentation.html +49 -0
  31. data/spec/javascripts/helpers/.gitkeep +0 -0
  32. data/spec/javascripts/helpers/jasmine-jquery.js +841 -0
  33. data/spec/javascripts/helpers/jj-fixture-path.js +3 -0
  34. data/spec/javascripts/helpers/jquery-3.4.0.min.js +2 -0
  35. data/spec/javascripts/present_spec.js +728 -0
  36. data/spec/javascripts/support/jasmine.yml +148 -0
  37. data/spec/javascripts/support/jasmine_helper.rb +23 -0
  38. data/spec/javascripts/support/run.html.erb +22 -0
  39. data/spec/javascripts/utils_spec.js +7 -0
  40. data/spec/main-app.rb +18 -0
  41. data/spec/messaging.rb +32 -0
  42. data/spec/presentation-view.rb +4 -4
  43. data/spec/resource-localizer.rb +37 -0
  44. data/spec/sass-functions.rb +25 -0
  45. data/spec/slide-loader.rb +1 -1
  46. data/spec/slide-rendering.rb +58 -0
  47. data/spec/static-generator.rb +54 -0
  48. metadata +211 -178
  49. data/default-configuration/assets/javascript/rhet-present.js +0 -855
  50. data/default-configuration/assets/javascript/rhet-present.min.js +0 -55
  51. data/default-configuration/assets/stylesheets/animate/attention/._pulse.scss.swp +0 -0
  52. data/default-configuration/assets/themes.googleusercontent.com/static/fonts/arimo/v5/K-bXE71xZHgbUS_UdQjugvesZW2xOQ-xsNqO47m55DA.ttf +0 -0
  53. data/default-configuration/assets/themes.googleusercontent.com/static/fonts/cinzeldecorative/v1/pXhIVnhFtL_B9Vb1wq2F9wIh9oxuYcmvOvyh_107lQs.ttf +0 -0
  54. data/default-configuration/assets/themes.googleusercontent.com/static/fonts/cinzeldecorative/v1/pXhIVnhFtL_B9Vb1wq2F9zCUrkmwPfdnoTjOU_kXqBI.ttf +0 -0
  55. data/default-configuration/assets/themes.googleusercontent.com/static/fonts/droidsansmono/v4/ns-m2xQYezAtqh7ai59hJYW_AySPyikQrZReizgrnuw.ttf +0 -0
  56. data/default-configuration/assets/themes.googleusercontent.com/static/fonts/slackey/v3/bJZDrYrGx8atJRHR9DVdqg.ttf +0 -0
  57. data/default-configuration/skels/slides.yaml +0 -7
@@ -0,0 +1,148 @@
1
+ # src_files
2
+ #
3
+ # Return an array of filepaths relative to src_dir to include before jasmine specs.
4
+ # Default: []
5
+ #
6
+ # EXAMPLE:
7
+ #
8
+ # src_files:
9
+ # - lib/source1.js
10
+ # - lib/source2.js
11
+ # - 'dist/**/*.js'
12
+ #
13
+ # Empty because imported from spec files
14
+ src_files: []
15
+
16
+ # stylesheets
17
+ #
18
+ # Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
19
+ # Default: []
20
+ #
21
+ # EXAMPLE:
22
+ #
23
+ # stylesheets:
24
+ # - css/style.css
25
+ # - 'stylesheets/*.css'
26
+ #
27
+ stylesheets:
28
+ - assets/application.css
29
+
30
+ # helpers
31
+ #
32
+ # Return an array of filepaths relative to spec_dir to include before jasmine specs.
33
+ # Default: ["helpers/**/*.js"]
34
+ #
35
+ # EXAMPLE:
36
+ #
37
+ # helpers:
38
+ # - 'helpers/**/*.js'
39
+ #
40
+ helpers:
41
+ - 'helpers/jquery-3.4.0.min.js'
42
+ - 'helpers/jasmine-jquery.js'
43
+ - 'helpers/jj-fixture-path.js'
44
+
45
+ # spec_files
46
+ #
47
+ # Return an array of filepaths relative to spec_dir to include.
48
+ # Default: ["**/*[sS]pec.js"]
49
+ #
50
+ # EXAMPLE:
51
+ #
52
+ # spec_files:
53
+ # - '**/*[sS]pec.js'
54
+ #
55
+ # Empty because loaded manually as modules
56
+ spec_files: []
57
+
58
+ # src_dir
59
+ #
60
+ # Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
61
+ # Default: project root
62
+ #
63
+ # EXAMPLE:
64
+ #
65
+ # src_dir: public
66
+ #
67
+ src_dir:
68
+
69
+ # spec_dir
70
+ #
71
+ # Spec directory path. Your spec_files must be returned relative to this path.
72
+ # Default: spec/javascripts
73
+ #
74
+ # EXAMPLE:
75
+ #
76
+ # spec_dir: spec/javascripts
77
+ #
78
+ spec_dir:
79
+
80
+ # spec_helper
81
+ #
82
+ # Ruby file that Jasmine server will require before starting.
83
+ # Returned relative to your root path
84
+ # Default spec/javascripts/support/jasmine_helper.rb
85
+ #
86
+ # EXAMPLE:
87
+ #
88
+ # spec_helper: spec/javascripts/support/jasmine_helper.rb
89
+ #
90
+ spec_helper: spec/javascripts/support/jasmine_helper.rb
91
+
92
+ # boot_dir
93
+ #
94
+ # Boot directory path. Your boot_files must be returned relative to this path.
95
+ # Default: Built in boot file
96
+ #
97
+ # EXAMPLE:
98
+ #
99
+ # boot_dir: spec/javascripts/support/boot
100
+ #
101
+ boot_dir: #spec/javascripts/support
102
+
103
+ # boot_files
104
+ #
105
+ # Return an array of filepaths relative to boot_dir to include in order to boot Jasmine
106
+ # Default: Built in boot file
107
+ #
108
+ # EXAMPLE
109
+ #
110
+ # boot_files:
111
+ # - '**/*.js'
112
+ #
113
+ boot_files:
114
+ #- boot.js
115
+ # - '**/*.js'
116
+
117
+ # rack_options
118
+ #
119
+ # Extra options to be passed to the rack server
120
+ # by default, Port and AccessLog are passed.
121
+ #
122
+ # This is an advanced options, and left empty by default
123
+ #
124
+ # EXAMPLE
125
+ #
126
+ # rack_options:
127
+ # server: 'thin'
128
+
129
+ # phantom_cli_options
130
+ #
131
+ # Extra options to be passed to the phantomjs cli,
132
+ # e.g. to enable localStorage in PhantomJs 2.5
133
+ #
134
+ # EXAMPLE
135
+ #
136
+ # phantom_cli_options:
137
+ # local-storage-quota: 5000
138
+
139
+ # random
140
+ #
141
+ # Run specs in semi-random order.
142
+ # Default: true
143
+ #
144
+ # EXAMPLE:
145
+ #
146
+ # random: false
147
+ #
148
+ random:
@@ -0,0 +1,23 @@
1
+ require 'jasmine'
2
+
3
+ class JasminePage < Jasmine::Page
4
+ def runner_template
5
+ File.read(File.join(File.dirname(__FILE__), "run.html.erb"))
6
+ end
7
+
8
+ def render
9
+ ERB.new(runner_template).result(@context.instance_eval { binding })
10
+ end
11
+ end
12
+
13
+ Jasmine.configure do |config|
14
+ config.prevent_phantom_js_auto_install = true
15
+ config.runner_browser = :chromeheadless
16
+ config.src_dir = 'default-configuration/assets/javascript'
17
+ config.add_rack_path(config.src_path, lambda {
18
+ Rack::Cascade.new([
19
+ Rack::URLMap.new('/' => Rack::File.new(config.src_dir)),
20
+ Rack::Jasmine::Runner.new(JasminePage.new(config))
21
+ ])
22
+ })
23
+ end
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2
+ <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <title>Jasmine suite</title>
7
+ <link rel="shortcut icon" type="image/png" href="/__images__/jasmine_favicon.png">
8
+ <% css_files.each do |css_file| %>
9
+ <link rel="stylesheet" href="<%= css_file %>" type="text/css" media="screen"/>
10
+ <% end %>
11
+ <% js_files.each do |js_file| %>
12
+ <script src="<%= js_file %>" type="text/javascript"></script>
13
+ <% end %>
14
+ <script src="/__spec__/present_spec.js" type ="module"></script>
15
+ <script src="/__spec__/utils_spec.js" type ="module"></script>
16
+
17
+ </head>
18
+ <!-- TODO: turbolinks breaks spec filter links -->
19
+ <body data-no-turbolink data-turbolinks="false">
20
+ <div id="jasmine_content"></div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,7 @@
1
+ import { pfx } from "/utils.js";
2
+
3
+ describe("rhetButler.pfx", function() {
4
+ it("should have a string value for 'transition-duration'", function() {
5
+ expect(typeof pfx("transition-duration")).toBe("string");
6
+ });
7
+ });
@@ -0,0 +1,18 @@
1
+ require 'rhet-butler/web/main-app'
2
+
3
+ describe RhetButler::Web::MainApp do
4
+ let :files do
5
+ RhetButler::FileManager.new
6
+ end
7
+
8
+ let :app do
9
+ RhetButler::Web::MainApp.new(files).tap do |app|
10
+ app.presentation_app_class = RhetButler::Web::MemoizedPresentationApp
11
+ app.assets_app_class = RhetButler::Web::MemoizedAssetsApp
12
+ end
13
+ end
14
+
15
+ it "should build a server" do
16
+ app.build_server.should be_a(Thin::Server)
17
+ end
18
+ end
@@ -0,0 +1,32 @@
1
+ require 'rhet-butler/messaging'
2
+ require 'ostruct'
3
+
4
+ describe RhetButler::SlideMessageQueue do
5
+ let :queue do
6
+ RhetButler::SlideMessageQueue.new
7
+ end
8
+
9
+ let :sockjs_options do
10
+ OpenStruct.new(:options =>{ :sockjs_url => "/assets/javascript/sockjs-0.2.1.js", :queue => queue})
11
+ end
12
+
13
+ let :leader do
14
+ RhetButler::LeaderSession.new(sockjs_options)
15
+ end
16
+
17
+ let :follower do
18
+ RhetButler::FollowerSession.new(sockjs_options).tap do |follower|
19
+ follower.opened
20
+ end
21
+ end
22
+
23
+ it "should transmit messages from leader to follower" do
24
+ leader
25
+ follower.should_receive(:send).with("testing")
26
+ leader.process_message("testing")
27
+ end
28
+
29
+ it "should transmit 'leader arrived' with slide when leader connects"
30
+ it "should transmit current slide to new followers"
31
+ it "should not send a current slide if leader has detached"
32
+ end
@@ -29,7 +29,7 @@ describe RhetButler::Web::MainApp do
29
29
 
30
30
  it "should have a script tag for impress.js" do
31
31
  doc = Nokogiri::HTML(last_response.body)
32
- doc.xpath("//script[contains(@src, 'rhet-present.js')]").should_not be_empty
32
+ doc.xpath("//script/text()[contains(., 'javascript/presenter.js')]").should_not be_empty
33
33
  end
34
34
  end
35
35
 
@@ -45,7 +45,7 @@ describe RhetButler::Web::MainApp do
45
45
 
46
46
  describe "/javascript/rhet-present.js" do
47
47
  before :each do
48
- get "/javascript/rhet-present.js"
48
+ get "/javascript/presenter.js"
49
49
  end
50
50
 
51
51
  it "should serve the javascript" do
@@ -57,9 +57,9 @@ describe RhetButler::Web::MainApp do
57
57
  end
58
58
  end
59
59
 
60
- describe "/assets/javascript/rhet-present.js" do
60
+ describe "/assets/javascript/presenter.js" do
61
61
  before :each do
62
- get "/assets/javascript/rhet-present.js"
62
+ get "/assets/javascript/presenter.js"
63
63
  end
64
64
 
65
65
  it "should serve the javascript" do
@@ -0,0 +1,37 @@
1
+ require 'rhet-butler/resource-localizer'
2
+
3
+ describe RhetButler::ResourceLocalizer, :vcr => {} do
4
+ let :test_target do
5
+ "spec_support/tmp/test_localize"
6
+ end
7
+
8
+ let :valise do
9
+ tgt = test_target
10
+ Valise::define do
11
+ rw tgt
12
+ end
13
+ end
14
+
15
+ let :localizer do
16
+ RhetButler::ResourceLocalizer.new.tap do |generator|
17
+ generator.files = valise
18
+ generator.source_uri = "http://fonts.googleapis.com/css?family=Arimo:700|Droid+Sans+Mono|Cinzel+Decorative:700,900|Slackey&subset=latin,latin-ext"
19
+ generator.target_path = "stylesheets/fonts.css"
20
+ end
21
+ end
22
+
23
+ before :each do
24
+ FileUtils::rm_rf test_target
25
+ FileUtils::mkdir_p test_target
26
+
27
+ localizer.go!
28
+ end
29
+
30
+ it "should make some files" do
31
+ Dir.entries(File::join(test_target, "stylesheets")).should include("fonts.css")
32
+ end
33
+
34
+ #it "should copy in static javascript"
35
+ #it "should copy in static stylesheets"
36
+ #it "should render sass files"
37
+ end
@@ -0,0 +1,25 @@
1
+ require 'rhet-butler/sass-functions'
2
+ require 'rhet-butler/web/assets-app'
3
+ require 'rhet-butler/file-manager'
4
+
5
+ describe Sass::Script::Functions do
6
+ let :files do
7
+ RhetButler::FileManager.new("sources" => %w{ spec_support/fixtures/project })
8
+ end
9
+
10
+ let :assets do
11
+ RhetButler::Web::AssetsApp.new(files)
12
+ end
13
+
14
+ let :rendered do
15
+ assets.assets_context.render("stylesheets/tricky.css")
16
+ end
17
+
18
+ it "should calculate exp(2px,2)" do
19
+ rendered.should match(/font-size: 4px/)
20
+ end
21
+
22
+ it "should calculate tween(1em, 3em, 50%)" do
23
+ rendered.should match(/height: 2em/)
24
+ end
25
+ end
@@ -31,7 +31,7 @@ describe RhetButler::SlideLoader do
31
31
  end
32
32
 
33
33
  it "should parse YAML for the configs" do
34
- slides.should have_at_least(1).slides
34
+ slides.slides.length.should be >= 1
35
35
  slides.should be_all{|slide| RhetButler::Slide === slide or RhetButler::SlideGroup === slide }
36
36
  end
37
37
 
@@ -0,0 +1,58 @@
1
+ require 'rhet-butler/slide-loader'
2
+
3
+ describe RhetButler::SlideRenderer do
4
+ def slide(content)
5
+ slide = RhetButler::Slide.new
6
+ slide.raw_content = content
7
+ slide.content_filters = default_content_filters
8
+ slide.note_filters = default_content_filters
9
+ slide
10
+ end
11
+
12
+ def group(*slides)
13
+ group = RhetButler::SlideGroup.new
14
+ group.slides = slides
15
+ group
16
+ end
17
+
18
+ let :slides do
19
+ [
20
+ slide("A"),
21
+ slide("B"),
22
+ group(slide("C"), slide("D"), slide("E"))
23
+ ]
24
+ end
25
+
26
+ let :root_group do
27
+ group(*slides)
28
+ end
29
+
30
+ let :default_content_filters do
31
+ [RhetButler::SlideRenderers::Textile.new]
32
+ end
33
+
34
+ let :rendering do
35
+ rendering = RhetButler::SlideRendering.new
36
+ rendering.root_group = root_group
37
+ rendering
38
+ end
39
+
40
+ let :result do
41
+ rendering.traverse
42
+ root_group
43
+ end
44
+
45
+ it "should apply rendering to all slides" do
46
+ result.first.content.should =~ /<p>/
47
+ end
48
+
49
+ describe "with markdown" do
50
+ let :default_content_filters do
51
+ [RhetButler::SlideRenderers::Markdown.new]
52
+ end
53
+
54
+ it "should apply rendering to all slides" do
55
+ result.first.content.should =~ /<p>/
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,54 @@
1
+ require 'rhet-butler/static-generator'
2
+ require 'rhet-butler/configuration'
3
+
4
+ describe RhetButler::Stasis::ResourceMapping do
5
+ let :mapper do
6
+ described_class.new.tap do |mapper|
7
+ mapper.default_uri = "http://example.com"
8
+ end
9
+ end
10
+
11
+ it "should map / to index.html" do
12
+ mapper.storage_for("/").should == "index.html"
13
+ end
14
+
15
+ it "should map /assets/stylesheet.css to assets/stylesheet.css" do
16
+ mapper.storage_for("/assets/stylesheet.css").should == "assets/stylesheet.css"
17
+ end
18
+ end
19
+
20
+ describe RhetButler::StaticGenerator do
21
+ let :test_target do
22
+ "spec_support/tmp/test_target"
23
+ end
24
+
25
+ let :store_log do
26
+ require 'stringio'
27
+ StringIO.new
28
+ end
29
+
30
+ before :each do
31
+ test_target = "spec_support/tmp/test_target"
32
+
33
+ files = RhetButler::FileManager.new(
34
+ "sources" => ["spec_support/fixtures/project"],
35
+ "static_target" => test_target)
36
+
37
+ generator = RhetButler::StaticGenerator.new(files)
38
+ generator.store_log = store_log
39
+
40
+ FileUtils::rm_rf test_target
41
+ FileUtils::mkdir_p test_target
42
+
43
+ generator.go!
44
+ end
45
+
46
+ it "should make some files" do
47
+ Dir.entries(test_target).should include("index.html")
48
+ store_log.string.lines.to_a.size.should > 3
49
+ end
50
+
51
+ #it "should copy in static javascript"
52
+ #it "should copy in static stylesheets"
53
+ #it "should render sass files"
54
+ end