gibier 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/bin/console +14 -0
  3. data/bin/gibier +5 -0
  4. data/bin/setup +8 -0
  5. data/lib/gibier.rb +8 -0
  6. data/lib/gibier/cli.rb +95 -0
  7. data/lib/gibier/render.rb +234 -0
  8. data/lib/gibier/slide_helper.rb +25 -0
  9. data/lib/gibier/slide_loader.rb +77 -0
  10. data/lib/gibier/version.rb +3 -0
  11. data/template/app.rb +25 -0
  12. data/template/gh_pages/index.haml +13 -0
  13. data/template/gh_pages/slide.haml +18 -0
  14. data/template/project/Gemfile +8 -0
  15. data/template/project/app/page_base.rb +46 -0
  16. data/template/project/app/slide.rb +204 -0
  17. data/template/project/app/track_field.rb +43 -0
  18. data/template/project/assets/css/application.css +219 -0
  19. data/template/project/assets/css/highlight.css +101 -0
  20. data/template/project/assets/fonts/Inconsolata-Regular.ttf +0 -0
  21. data/template/project/assets/images/flag.png +0 -0
  22. data/template/project/assets/images/hunter.png +0 -0
  23. data/template/project/assets/images/rabbit.png +0 -0
  24. data/template/project/assets/images/turtle.png +0 -0
  25. data/template/project/assets/images/usagitokame.png +0 -0
  26. data/template/project/config.ru +35 -0
  27. data/template/project/data/sample/css/custom.css +0 -0
  28. data/template/project/data/sample/images/gibier.jpg +0 -0
  29. data/template/project/data/sample/images/youchan.jpg +0 -0
  30. data/template/project/data/sample/script.md +7 -0
  31. data/template/project/data/sample/slide.md +59 -0
  32. data/template/project/server.rb +76 -0
  33. data/template/project/views/index.haml +13 -0
  34. data/template/project/views/script.haml +10 -0
  35. data/template/project/views/slide.haml +15 -0
  36. data/template/script.rb +24 -0
  37. metadata +320 -0
@@ -0,0 +1,101 @@
1
+ @font-face{
2
+ font-family: Inconsolata;
3
+ src: url(fonts/Inconsolata-Regular.ttf) format(truetype);
4
+ }
5
+
6
+ .highlight {
7
+ padding: 8px;
8
+ }
9
+
10
+ .highlight pre {
11
+ font-family: Inconsolata, monospace;
12
+ font-size: 0.9em;
13
+ }
14
+
15
+ .highlight .code pre {
16
+ margin-left: 16px;
17
+ }
18
+
19
+ .highlight table td { padding: 5px; }
20
+ .highlight table pre { margin: 0; }
21
+ .highlight, .highlight .w {
22
+ color: #d0d0d0;
23
+ background-color: #151515;
24
+ }
25
+ .highlight .err {
26
+ color: #151515;
27
+ background-color: #ac4142;
28
+ }
29
+ .highlight .c, .highlight .cd, .highlight .cm, .highlight .c1, .highlight .cs {
30
+ color: #505050;
31
+ }
32
+ .highlight .cp {
33
+ color: #f4bf75;
34
+ }
35
+ .highlight .nt {
36
+ color: #f4bf75;
37
+ }
38
+ .highlight .o, .highlight .ow {
39
+ color: #d0d0d0;
40
+ }
41
+ .highlight .p, .highlight .pi {
42
+ color: #d0d0d0;
43
+ }
44
+ .highlight .gi {
45
+ color: #90a959;
46
+ }
47
+ .highlight .gd {
48
+ color: #ac4142;
49
+ }
50
+ .highlight .gh {
51
+ color: #6a9fb5;
52
+ background-color: #151515;
53
+ font-weight: bold;
54
+ }
55
+ .highlight .k, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kv {
56
+ color: #aa759f;
57
+ }
58
+ .highlight .kc {
59
+ color: #d28445;
60
+ }
61
+ .highlight .kt {
62
+ color: #d28445;
63
+ }
64
+ .highlight .kd {
65
+ color: #d28445;
66
+ }
67
+ .highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .s1 {
68
+ color: #90a959;
69
+ }
70
+ .highlight .sr {
71
+ color: #75b5aa;
72
+ }
73
+ .highlight .si {
74
+ color: #8f5536;
75
+ }
76
+ .highlight .se {
77
+ color: #8f5536;
78
+ }
79
+ .highlight .nn {
80
+ color: #f4bf75;
81
+ }
82
+ .highlight .nc {
83
+ color: #f4bf75;
84
+ }
85
+ .highlight .no {
86
+ color: #f4bf75;
87
+ }
88
+ .highlight .na {
89
+ color: #6a9fb5;
90
+ }
91
+ .highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mb, .highlight .mx {
92
+ color: #90a959;
93
+ }
94
+ .highlight .ss {
95
+ color: #90a959;
96
+ }
97
+
98
+ .highlight .gutter {
99
+ border-right: solid 1px #666;
100
+ color: #882;
101
+ }
@@ -0,0 +1,35 @@
1
+ require 'bundler/setup'
2
+ Bundler.require(:default)
3
+
4
+ require_relative 'server'
5
+
6
+ dir = 'data'
7
+
8
+ slide_loader = Gibier::SlideLoader.new
9
+ Gibier::SlideHelper.each_slides(dir) do |name|
10
+ slide_loader.add_slide(name)
11
+ end
12
+
13
+ app = Rack::Builder.app do
14
+ server = Server.new(slide_loader, host: 'localhost')
15
+
16
+ map '/' do
17
+ run server
18
+ end
19
+
20
+ map '/assets' do
21
+ run server.settings.opal.sprockets
22
+ end
23
+
24
+ map '/__OPAL_SOURCE_MAPS__' do
25
+ run Opal::SourceMapServer.new(server.settings.opal.sprockets, '/__OPAL_SOURCE_MAPS__')
26
+ end
27
+ end
28
+
29
+ Rack::Server.start({
30
+ app: app,
31
+ server: 'thin',
32
+ Host: '0.0.0.0',
33
+ Port: 8080,
34
+ signals: false,
35
+ })
@@ -0,0 +1,7 @@
1
+ # Sample
2
+
3
+ Write script here.
4
+
5
+ This page accessible from psth: '/script/sample'
6
+
7
+ You can controll the slide from this page. Press arrow keys.
@@ -0,0 +1,59 @@
1
+ # Hello Gibier
2
+
3
+ %author: youchan
4
+
5
+ %icon: ![](youchan.jpg)
6
+
7
+ %duration: 1min
8
+
9
+ ---
10
+
11
+ #### Press 's' then start race of the hunter and the rabbit.
12
+
13
+ ---
14
+
15
+ #### Press right key then go next page!
16
+
17
+ ## Listing
18
+
19
+ ```
20
+ * Listing item
21
+ * ...
22
+ ```
23
+
24
+ render as shown on the next page
25
+
26
+ ## Listing
27
+
28
+ * Listing item
29
+ * ...
30
+
31
+ ## Font size
32
+
33
+ ```
34
+ ### H3
35
+
36
+ #### H4
37
+
38
+ default font
39
+ ```
40
+
41
+ render as shown on the next page
42
+
43
+ ### H3
44
+
45
+ #### H4
46
+
47
+ default font
48
+
49
+ ## Image
50
+
51
+ ```
52
+ %large: ![](gibier.jpg)
53
+ ```
54
+
55
+ ## Image
56
+
57
+ ![large](gibier.jpg)
58
+
59
+
@@ -0,0 +1,76 @@
1
+ require 'sinatra'
2
+ require 'sinatra-websocket'
3
+ require 'opal'
4
+ require 'opal/sprockets'
5
+
6
+ class Server < Sinatra::Base
7
+ def initialize(slide_loader, *args, &block)
8
+ @slide_loader = slide_loader
9
+ super(*args, &block)
10
+ end
11
+
12
+ def sprockets
13
+ settings.opal.sprockets
14
+ end
15
+
16
+ configure do
17
+ opal = Opal::Server.new do |server|
18
+ server.append_path 'data'
19
+ server.append_path 'app'
20
+ server.append_path 'assets'
21
+
22
+ Opal.use_gem 'opal-router'
23
+ Opal.use_gem 'hyalite'
24
+ Opal.use_gem 'gibier'
25
+
26
+ Opal.paths.each {|path| server.append_path path }
27
+
28
+ server.main = 'application'
29
+ end
30
+
31
+ set :opal, opal
32
+ set :sockets, []
33
+ set :slide_sockets, {}
34
+ enable :sessions
35
+ end
36
+
37
+ get '/' do
38
+ @slides = @slide_loader.slides
39
+ haml :index
40
+ end
41
+
42
+ get "/favicon.ico" do
43
+ end
44
+
45
+ get '/:slide_name' do
46
+ @slide_name = params['slide_name']
47
+ haml :slide
48
+ end
49
+
50
+ get '/script/:slide_name' do
51
+ @slide_name = params['slide_name']
52
+ @script_html = "<h1>Test</h1>"
53
+ haml :script
54
+ end
55
+
56
+ get '/push_notification/start/:page/:slide_name' do
57
+ request.websocket do |ws|
58
+ ws.onopen do
59
+ if params['page'] == 'slide'
60
+ slide_name = params['slide_name']
61
+ (settings.slide_sockets[slide_name] ||= []) << ws
62
+ end
63
+ settings.sockets << ws
64
+ end
65
+ ws.onmessage do |msg|
66
+ (slide_name, evt, value) = msg.split(':')
67
+ EM.next_tick do
68
+ settings.slide_sockets[slide_name].each{|s| s.send("#{evt}:#{value}") }
69
+ end
70
+ end
71
+ ws.onclose do
72
+ settings.sockets.delete(ws)
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,13 @@
1
+ !!!
2
+ %html(lang="en" data-framework="hyalite")
3
+ %head
4
+ %meta{charset:"utf-8"}
5
+ %title Index of slides
6
+
7
+ %body
8
+ %h1 Index of slides
9
+ %section
10
+ %ul
11
+ - @slides.each do |slide|
12
+ %li
13
+ %a{href: slide[:name]}= "[#{slide[:name]}] \"#{slide[:title]}\""
@@ -0,0 +1,10 @@
1
+ !!!
2
+ %html(lang="en" data-framework="hyalite")
3
+ %head
4
+ %meta{charset:"utf-8"}
5
+ %title= "Script of #{@slide_name}"
6
+
7
+ %body
8
+ %section.script
9
+
10
+ = ::Opal::Sprockets.javascript_include_tag("slides/#{@slide_name}/script", sprockets: settings.opal.sprockets, prefix: '/assets', debug: true)
@@ -0,0 +1,15 @@
1
+ !!!
2
+ %html(lang="en" data-framework="hyalite")
3
+ %head
4
+ %meta{charset:"utf-8"}
5
+ %title= @slide_name
6
+ %link{rel:"stylesheet", href:"assets/css/application.css"}
7
+ %link{rel:"stylesheet", href:"assets/#{@slide_name}/css/custom.css"}
8
+ %link{rel:"stylesheet", href:"assets/css/highlight.css"}
9
+
10
+ %body
11
+ %section.gibier
12
+
13
+ :javascript
14
+ window.slideName = '#{@slide_name}'
15
+ = ::Opal::Sprockets.javascript_include_tag("slides/#{@slide_name}/app", sprockets: settings.opal.sprockets, prefix: 'assets', debug: true)
@@ -0,0 +1,24 @@
1
+ require 'hyalite'
2
+ require 'browser/http'
3
+ require 'browser/socket'
4
+ require 'browser/location'
5
+
6
+ class Script
7
+ include Hyalite::Component
8
+ include Hyalite::Component::ShortHand
9
+
10
+ def render
11
+ div({dangerouslySetInnerHTML: { __html: @props[:script_html]}})
12
+ end
13
+ end
14
+
15
+ $document.ready do
16
+ ws = Browser::Socket.new("ws://\#{$window.location.host}/push_notification/start/script/#{name}")
17
+ $window.on('keydown') do |evt|
18
+ ws.write("#{name}:keydown:\#{evt.code}")
19
+ end
20
+
21
+ response = Browser::HTTP.get!('/assets/scripts/#{name}/script.html')
22
+ Hyalite.render(Hyalite.create_element(Script, script_html: response.text), $document['.script'])
23
+ end
24
+
metadata ADDED
@@ -0,0 +1,320 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gibier
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.0
5
+ platform: ruby
6
+ authors:
7
+ - youchan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-07-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sinatra
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sinatra-contrib
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sinatra-websocket
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thin
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: haml
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sass
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: thor
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: opal
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: redcarpet
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: unindent
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rouge
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '1.10'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '1.10'
167
+ - !ruby/object:Gem::Dependency
168
+ name: fssm
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: eventmachine
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: rack
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '1.6'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '1.6'
209
+ - !ruby/object:Gem::Dependency
210
+ name: bundler
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '1.11'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '1.11'
223
+ - !ruby/object:Gem::Dependency
224
+ name: rake
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: '10.0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: '10.0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: rspec
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: '3.0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: '3.0'
251
+ description: |2-
252
+ This is a simple slideshow app using Hyalite(https://github.com/youchan/hyalite).
253
+ Its purpose are one of examples for Hyalite and also intend to be used as pratical presentation tool.
254
+ email:
255
+ - youchan01@gmail.com
256
+ executables:
257
+ - gibier
258
+ extensions: []
259
+ extra_rdoc_files: []
260
+ files:
261
+ - bin/console
262
+ - bin/gibier
263
+ - bin/setup
264
+ - lib/gibier.rb
265
+ - lib/gibier/cli.rb
266
+ - lib/gibier/render.rb
267
+ - lib/gibier/slide_helper.rb
268
+ - lib/gibier/slide_loader.rb
269
+ - lib/gibier/version.rb
270
+ - template/app.rb
271
+ - template/gh_pages/index.haml
272
+ - template/gh_pages/slide.haml
273
+ - template/project/Gemfile
274
+ - template/project/app/page_base.rb
275
+ - template/project/app/slide.rb
276
+ - template/project/app/track_field.rb
277
+ - template/project/assets/css/application.css
278
+ - template/project/assets/css/highlight.css
279
+ - template/project/assets/fonts/Inconsolata-Regular.ttf
280
+ - template/project/assets/images/flag.png
281
+ - template/project/assets/images/hunter.png
282
+ - template/project/assets/images/rabbit.png
283
+ - template/project/assets/images/turtle.png
284
+ - template/project/assets/images/usagitokame.png
285
+ - template/project/config.ru
286
+ - template/project/data/sample/css/custom.css
287
+ - template/project/data/sample/images/gibier.jpg
288
+ - template/project/data/sample/images/youchan.jpg
289
+ - template/project/data/sample/script.md
290
+ - template/project/data/sample/slide.md
291
+ - template/project/server.rb
292
+ - template/project/views/index.haml
293
+ - template/project/views/script.haml
294
+ - template/project/views/slide.haml
295
+ - template/script.rb
296
+ homepage: https://github.com/youchan/gibier
297
+ licenses:
298
+ - MIT
299
+ metadata: {}
300
+ post_install_message:
301
+ rdoc_options: []
302
+ require_paths:
303
+ - lib
304
+ required_ruby_version: !ruby/object:Gem::Requirement
305
+ requirements:
306
+ - - ">="
307
+ - !ruby/object:Gem::Version
308
+ version: '0'
309
+ required_rubygems_version: !ruby/object:Gem::Requirement
310
+ requirements:
311
+ - - ">="
312
+ - !ruby/object:Gem::Version
313
+ version: '0'
314
+ requirements: []
315
+ rubyforge_project:
316
+ rubygems_version: 2.6.11
317
+ signing_key:
318
+ specification_version: 4
319
+ summary: A slide tool inspired by Rabbit
320
+ test_files: []