hyla 1.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 (72) hide show
  1. data/.rakeTasks +7 -0
  2. data/.travis.yml +10 -0
  3. data/Gemfile +7 -0
  4. data/Gemfile.lock +49 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.adoc +136 -0
  7. data/Rakefile +61 -0
  8. data/archive/GruntFile.js +72 -0
  9. data/archive/watch_files.rb +70 -0
  10. data/bin/hyla +155 -0
  11. data/data/generated/A_Introduction_module/1_Chapter.adoc +42 -0
  12. data/data/generated/A_Introduction_module/2_Chapter.adoc +31 -0
  13. data/data/generated/A_Introduction_module/3_Chapter.adoc +23 -0
  14. data/data/generated/A_Introduction_module/A_Introduction_module_AllSlides.index +9 -0
  15. data/data/generated/B_Instruction_module/1_Chapter.adoc +27 -0
  16. data/data/generated/B_Instruction_module/B_Instruction_module_AllSlides.index +7 -0
  17. data/data/generated/C_Installation_module/1_Chapter.adoc +14 -0
  18. data/data/generated/C_Installation_module/2_Chapter.adoc +17 -0
  19. data/data/generated/C_Installation_module/C_Installation_module_AllSlides.index +8 -0
  20. data/data/generated/camel_AllSlides.index +9 -0
  21. data/data/js/livereload.js +1055 -0
  22. data/data/mime.types +85 -0
  23. data/data/toc.adoc +63 -0
  24. data/hyla.gemspec +37 -0
  25. data/hyla_frog.jpg +0 -0
  26. data/lib/hyla.rb +47 -0
  27. data/lib/hyla/command.rb +21 -0
  28. data/lib/hyla/commands/build.rb +40 -0
  29. data/lib/hyla/commands/create.rb +25 -0
  30. data/lib/hyla/commands/generate.rb +264 -0
  31. data/lib/hyla/commands/new.rb +82 -0
  32. data/lib/hyla/commands/publish.rb +8 -0
  33. data/lib/hyla/commands/reload.rb +109 -0
  34. data/lib/hyla/commands/serve.rb +59 -0
  35. data/lib/hyla/commands/watch.rb +172 -0
  36. data/lib/hyla/configuration.rb +47 -0
  37. data/lib/hyla/logger.rb +89 -0
  38. data/lib/hyla/project.rb +5 -0
  39. data/lib/hyla/training.rb +25 -0
  40. data/lib/hyla/websocket.rb +53 -0
  41. data/lib/templates/sample/asciidoc_article.adoc +64 -0
  42. data/lib/templates/sample/asciidoc_audio.adoc +4 -0
  43. data/lib/templates/sample/asciidoc_source_highlight.adoc +37 -0
  44. data/lib/templates/sample/asciidoc_video.adoc +4 -0
  45. data/lib/templates/sample/audio/ocean_waves.mp3 +0 -0
  46. data/lib/templates/sample/image/hyla_arborea.jpg +0 -0
  47. data/lib/templates/sample/slideshow_deckjs.adoc +186 -0
  48. data/lib/templates/sample/video/small.ogv +0 -0
  49. data/lib/templates/training-exercises/Gemfile +4 -0
  50. data/lib/templates/training-exercises/README.md +1 -0
  51. data/lib/templates/training-exercises/modules/introduction/docs/audio/ocean_waves.mp3 +0 -0
  52. data/lib/templates/training-exercises/modules/introduction/docs/video/small.ogv +0 -0
  53. data/lib/templates/training-exercises/modules/introduction/pom.xml +114 -0
  54. data/lib/templates/training-exercises/modules/introduction/src/main/java/HelloWorld.java +16 -0
  55. data/lib/templates/training-exercises/modules/introduction/src/test/java/HelloWorldTest.java +29 -0
  56. data/lib/templates/training-exercises/modules/pom.xml +61 -0
  57. data/lib/templates/training-exercises/modules/src/main/assembly/code.xml +31 -0
  58. data/lib/templates/training-exercises/modules/src/main/assembly/content.xml +16 -0
  59. data/lib/templates/training-exercises/pom.xml +157 -0
  60. data/lib/templates/training/GemFile +4 -0
  61. data/lib/templates/training/development/article.adoc +64 -0
  62. data/lib/templates/training/development/audio/ocean_waves.mp3 +0 -0
  63. data/lib/templates/training/development/image/hyla_frog.jpg +0 -0
  64. data/lib/templates/training/development/video/small.ogv +0 -0
  65. data/lib/templates/training/introduction/article.adoc +64 -0
  66. data/lib/templates/training/introduction/audio/ocean_waves.mp3 +0 -0
  67. data/lib/templates/training/introduction/image/hyla_frog.jpg +0 -0
  68. data/lib/templates/training/introduction/video/small.ogv +0 -0
  69. data/lib/templates/training/readme.adoc +1 -0
  70. data/scenario.adoc +59 -0
  71. data/test/my_test.rb +23 -0
  72. metadata +265 -0
@@ -0,0 +1,89 @@
1
+ module Hyla
2
+ class Logger
3
+ attr_accessor :log_level
4
+
5
+ DEBUG = 0
6
+ INFO = 1
7
+ WARN = 2
8
+ ERROR = 3
9
+
10
+ # Public: Create a new instance of Hyla's logger
11
+ #
12
+ # level - (optional, integer) the log level
13
+ #
14
+ # Returns nothing
15
+ def initialize(level = INFO)
16
+ @log_level = level
17
+ end
18
+
19
+ # Public: Print a Hyla debug message to stdout
20
+ #
21
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
22
+ # message - the message detail
23
+ #
24
+ # Returns nothing
25
+ def debug(topic, message = nil)
26
+ $stdout.puts(message(topic, message)) if log_level <= DEBUG
27
+ end
28
+
29
+ # Public: Print a hyla message to stdout
30
+ #
31
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
32
+ # message - the message detail
33
+ #
34
+ # Returns nothing
35
+ def info(topic, message = nil)
36
+ $stdout.puts(message(topic, message)) if log_level <= INFO
37
+ end
38
+
39
+ # Public: Print a hyla message to stderr
40
+ #
41
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
42
+ # message - the message detail
43
+ #
44
+ # Returns nothing
45
+ def warn(topic, message = nil)
46
+ $stderr.puts(message(topic, message).yellow) if log_level <= WARN
47
+ end
48
+
49
+ # Public: Print a hyla error message to stderr
50
+ #
51
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
52
+ # message - the message detail
53
+ #
54
+ # Returns nothing
55
+ def error(topic, message = nil)
56
+ $stderr.puts(message(topic, message).red) if log_level <= ERROR
57
+ end
58
+
59
+ # Public: Print a hyla error message to stderr and immediately abort the process
60
+ #
61
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
62
+ # message - the message detail (can be omitted)
63
+ #
64
+ # Returns nothing
65
+ def abort_with(topic, message = nil)
66
+ error(topic, message)
67
+ abort
68
+ end
69
+
70
+ # Public: Build a hyla topic method
71
+ #
72
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
73
+ # message - the message detail
74
+ #
75
+ # Returns the formatted message
76
+ def message(topic, message)
77
+ formatted_topic(topic) + message.to_s.gsub(/\s+/, ' ')
78
+ end
79
+
80
+ # Public: Format the topic
81
+ #
82
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
83
+ #
84
+ # Returns the formatted topic statement
85
+ def formatted_topic(topic)
86
+ "#{topic} ".rjust(20)
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,5 @@
1
+ module Hyla
2
+ VERSION = '1.0'
3
+ DESCRIPTION = 'Asciidoctor Hyla - Command Line tool to create new project, watch modifications, generate content, publish or consult it live !'
4
+ SUMMARY = 'Asciidoctor Hyla - builder/generator of HTML5, slideshow. Watch modifications, generate content, publish or consult it live !'
5
+ end
@@ -0,0 +1,25 @@
1
+ module Hyla
2
+ class Training
3
+ def initialize(config)
4
+ self.config = config.clone
5
+ self.source = File.expand_path(config['source'])
6
+ self.dest = File.expand_path(config['destination'])
7
+ end
8
+
9
+ # Public: Generate HTML5 from Asciidoctor files (Training) to output.
10
+ #
11
+ # Returns nothing.
12
+ def process
13
+ self.generate
14
+ end
15
+
16
+ #
17
+ # Generate
18
+ #
19
+ def generate
20
+ # Here is where we will call AsciiDoctor
21
+ Hyla.logger.info 'Transforming Asciidoc files'
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,53 @@
1
+ require 'eventmachine'
2
+ require 'em-websocket'
3
+ require 'http/parser'
4
+
5
+ module Hyla
6
+ class WebSocket < EventMachine::WebSocket::Connection
7
+
8
+ def dispatch(data)
9
+ parser = Http::Parser.new
10
+ parser << data
11
+ if parser.http_method != 'GET' || parser.upgrade?
12
+ super #pass the request to websocket
13
+ elsif parser.request_path == '/livereload.js'
14
+ _serve_file(_livereload_js_file)
15
+ elsif File.exist?(parser.request_path[1..-1])
16
+ _serve_file(parser.request_path[1..-1]) # Strip leading slash
17
+ else
18
+ send_data("HTTP/1.1 404 Not Found\r\nContent-Type: text/plain\r\nContent-Length: 13\r\n\r\n404 Not Found")
19
+ close_connection_after_writing
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def _serve_file(path)
26
+ Hyla.logger.info "Serving file #{path}"
27
+ send_data "HTTP/1.1 200 OK\r\nContent-Type: #{_content_type(path)}\r\nContent-Length: #{File.size path}\r\n\r\n"
28
+ stream_file_data(path).callback { close_connection_after_writing }
29
+ end
30
+
31
+ def _content_type(path)
32
+ case File.extname(path)
33
+ when '.css' then
34
+ 'text/css'
35
+ when '.js' then
36
+ 'application/ecmascript'
37
+ when '.gif' then
38
+ 'image/gif'
39
+ when '.jpeg', '.jpg' then
40
+ 'image/jpeg'
41
+ when '.png' then
42
+ 'image/png'
43
+ else
44
+ ; 'text/plain'
45
+ end
46
+ end
47
+
48
+ def _livereload_js_file
49
+ File.expand_path("../../../data/js/livereload.js", __FILE__)
50
+ end
51
+
52
+ end # Class WebSocket
53
+ end # module Hyla
@@ -0,0 +1,64 @@
1
+ :icons: font
2
+ :data-uri:
3
+
4
+ == Links
5
+
6
+ Asciidoctor will automatically turn the url scheme:/// into a hyperlink when it is processed : http://asciidoctor.org/docs/user-manual/
7
+ The schemes HTTP, HTTPS, FTP, IRC, mailto, email@email.com are recognize
8
+
9
+ To attach a URL to text, enclose the text in square brackets at the end of the URL : http://asciidoctor.org/docs/user-manual/[Asciidoctor - Manual]
10
+
11
+ == Paragraph
12
+
13
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed iaculis, justo non scelerisque varius, metus lorem feugiat metus, eget hendrerit lorem nulla eu velit.
14
+ Proin vehicula gravida orci eu hendrerit. Ut ornare aliquam imperdiet. Sed et pulvinar dui, eu facilisis lorem. Duis molestie nunc dolor, ut pharetra dolor eleifend et.
15
+ Duis adipiscing sed est consectetur euismod. Sed sed velit sit amet justo elementum malesuada ac quis nulla. Nam varius posuere est, sit amet vestibulum neque vulputate id.
16
+ Fusce sem turpis, congue non dapibus ut, cursus in nisi. Sed non massa varius, rutrum augue vel, rutrum turpis. Pellentesque iaculis gravida malesuada.
17
+ Nullam tristique mauris vitae feugiat consectetur. Ut pellentesque turpis faucibus leo convallis, in convallis neque blandit.
18
+
19
+ :numbered!:
20
+ == Unordered bullet List without numbers
21
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit.
22
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit.
23
+ :numbered!:
24
+
25
+ == Unordered bullet List without numbers (including title)
26
+ .Title of a unordered list
27
+ * Sed at ante. Mauris eleifend, quam a vulputate dictum, massa quam dapibus leo, eget vulputate orci purus ut lorem.
28
+ * Sed at ante. Mauris eleifend, quam a vulputate dictum, massa quam dapibus leo, eget vulputate orci purus ut lorem.
29
+
30
+ :numbered:
31
+ == Numbered
32
+ === Numbered con't
33
+ . Lorem *ipsum* dolor sit amet, consectetur adipiscing elit
34
+ . Lorem **ipsum** dolor sit amet, consectetur adipiscing elit
35
+
36
+ :numbered!:
37
+ == Nested unordered list
38
+ * West wood maze
39
+ ** Maze heart
40
+ *** Reflection pool
41
+
42
+ == Image
43
+ .Text of the picture
44
+ image::image/hyla_frog.jpg[width="40%"]
45
+
46
+ == Admonition
47
+
48
+ NOTE: This is an example of NOTE.
49
+
50
+ TIP: This is an example of TIP.
51
+
52
+ WARNING: This is an example of WARNING.
53
+
54
+ == Table
55
+
56
+ .An example table
57
+ [width="60%",options="header"]
58
+ |==============================================
59
+ | Option | Description
60
+ | -a 'USER GROUP' | Add 'USER' to 'GROUP'.
61
+ | -R 'GROUP' | Disables access to 'GROUP'.
62
+ |==============================================
63
+
64
+
@@ -0,0 +1,4 @@
1
+ == Audio
2
+
3
+ audio::audio/ocean_waves.mp3[options="autoplay,loop"]
4
+
@@ -0,0 +1,37 @@
1
+ :source-highlighter: coderay
2
+
3
+ == Syntax HighLighter
4
+
5
+ === Java
6
+ [source,java]
7
+ ----
8
+ public class HelloWorld {
9
+
10
+ public static void main(String[] args) {
11
+ System.out.println(">> Hello Hyla Students");
12
+ }
13
+
14
+ }
15
+ ----
16
+
17
+ === XML
18
+ [source,xml]
19
+ ----
20
+ <note>
21
+ <to>Tove</to>
22
+ <from>Jani</from>
23
+ <heading>Reminder</heading>
24
+ <body>Don't forget me this weekend!</body>
25
+ </note>
26
+ ----
27
+
28
+ === Ruby
29
+
30
+ [source,ruby]
31
+ ----
32
+ require 'asciidoctor'
33
+
34
+ puts Asciidoctor.render_file('sample.adoc', :header_footer => true)
35
+ ----
36
+
37
+
@@ -0,0 +1,4 @@
1
+ == Video
2
+
3
+ video::video/small.ogv[options=autoplay]
4
+
@@ -0,0 +1,186 @@
1
+ = Getting Started with deck.js
2
+ Caleb Troughton
3
+ :description: A jQuery library for modern HTML presentations
4
+ :viewport: width=1024, user-scalable=no
5
+ :backend: deckjs
6
+ :deckjs_transition: horizontal-slide
7
+ :goto:
8
+ :menu:
9
+ :navigation:
10
+ :status:
11
+ :docs-link: http://imakewebthings.github.com/deck.js/docs[documentation]
12
+ :download-link: https://github.com/imakewebthings/deck.js/archive/latest.zip[download]
13
+ :sectids!:
14
+
15
+ //
16
+
17
+ [#how-to-overview]
18
+ == How to Make a Deck
19
+
20
+ [steps.headings]
21
+ Write Slides::
22
+ Slide content is simple HTML.
23
+
24
+ Choose Themes::
25
+ One for slide styles and one for deck transitions.
26
+
27
+ Include Extensions::
28
+ Add extra functionality to your deck, or leave it stripped down.
29
+
30
+ //
31
+
32
+ [#quick-start]
33
+ == Quick Start
34
+
35
+ When you {download-link} deck.js, it will include a file named +boilerplate.html+.
36
+ You can immediately start editing slides in this page and viewing them in your web browser.
37
+ Later on, when you are comfortable customizing the deck, you can edit the various pieces of the boilerplate or make your own to suit your needs.
38
+
39
+ //
40
+
41
+ [#markup]
42
+ == The Markup
43
+
44
+ Slides are just HTML elements with a slide of +slide+.
45
+
46
+ ----
47
+ <section class="slide">
48
+ <h2>How to Make a Deck</h2>
49
+ <ol>
50
+ <li>
51
+ <h3>Write Slides</h3>
52
+ <p>Slide content is simple HTML.</p>
53
+ </li>
54
+ <li>
55
+ <h3>Choose Themes</h3>
56
+ <p>One for slide styles and one for deck transitions.</p>
57
+ </li>
58
+ </ol>
59
+ </section>
60
+ ----
61
+
62
+ //
63
+
64
+ [#themes]
65
+ == Style Themes
66
+
67
+ Customizes the colors, typography, and layout of slide content.
68
+
69
+ ----
70
+ <link rel="stylesheet" href="/path/to/css/style-theme.css">
71
+ ----
72
+
73
+ [float]
74
+ == Transition Themes
75
+
76
+ Defines transitions between slides using CSS3 transitions.
77
+ Less capable browsers fall back to cutaways.
78
+ But *you* aren't using _those_ browsers to give your presentations, are you...
79
+
80
+ ----
81
+ <link rel="stylesheet" href="/path/to/css/transition-theme.css">
82
+ ----
83
+
84
+ //
85
+
86
+ [#extensions]
87
+ == Extensions
88
+
89
+ Core gives you basic slide functionality with left and right arrow navigation, but you may want more.
90
+ Here are the ones included in this deck:
91
+
92
+ [%step]
93
+ - *deck.goto*:
94
+ Adds a shortcut key to jump to any slide number.
95
+ Hit g, type in the slide number, and hit enter.
96
+
97
+ - *deck.hash*:
98
+ Enables internal linking within slides, deep linking to individual slides, and updates the address bar & a permalink anchor with each slide change.
99
+
100
+ - *deck.menu*:
101
+ Adds a menu view, letting you see all slides in a grid.
102
+ Hit m to toggle to menu view, continue navigating your deck, and hit m to return to normal view.
103
+ Touch devices can double-tap the deck to switch between views.
104
+
105
+ - *deck.navigation*:
106
+ Adds clickable left and right buttons for the less keyboard inclined.
107
+
108
+ - *deck.status*:
109
+ Adds a page number indicator. (current/total)
110
+
111
+ - *deck.scale*:
112
+ Scales each slide to fit within the deck container using CSS Transforms for those browsers that support them.
113
+
114
+ [#extension-folders.slide]
115
+ Each extension folder in the download package contains the necessary JavaScript, CSS, and HTML files.
116
+ For a complete list of extension modules included in deck.js, check out the {docs-link}.
117
+
118
+ //
119
+
120
+ [#nested]
121
+ == Nested Slides
122
+
123
+ That last slide had a few steps.
124
+ To create substeps in slides, just nest them:
125
+
126
+ ----
127
+ <section class="slide">
128
+ <h2>Extensions</h2>
129
+ <p>Core gives you basic slide functionality...</p>
130
+ <ul>
131
+ <li class="slide">
132
+ <h3>deck.goto</h3>
133
+ <p>Adds a shortcut key to jump to any slide number...</p>
134
+ </li>
135
+ <li class="slide">...</li>
136
+ <li class="slide">...</li>
137
+ <li class="slide">...</li>
138
+ </ul>
139
+ </section>
140
+ ----
141
+
142
+ //
143
+
144
+ [#elements-images]
145
+ == Other Elements: Images
146
+
147
+ image::http://placekitten.com/600/375[Kitties]
148
+
149
+ ----
150
+ <img src="http://placekitten.com/600/375" alt="Kitties">
151
+ ----
152
+
153
+ //
154
+
155
+ [#elements-blockquotes]
156
+ == Other Elements: Blockquotes
157
+
158
+ [quote,Fran Lebowitz]
159
+ Food is an important part of a balanced diet.
160
+
161
+ ----
162
+ <blockquote cite="http://example.org">
163
+ <p>Food is an important part of a balanced diet.</p>
164
+ <p><cite>Fran Lebowitz</cite></p>
165
+ </blockquote>
166
+ ----
167
+
168
+ //
169
+
170
+ [#elements-videos]
171
+ == Other Elements: Video Embeds
172
+
173
+ Embed videos from your favorite online video service or with an HTML5 video element.
174
+
175
+ video::1063136[vimeo,400,225]
176
+
177
+ ----
178
+ <iframe src="http://player.vimeo.com/video/1063136?title=0&amp;byline=0&amp;portrait=0" width="400" height="225" frameborder="0"></iframe>
179
+ ----
180
+
181
+ //
182
+
183
+ [#digging-deeper]
184
+ == Digging Deeper
185
+
186
+ If you want to learn about making your own themes, extending deck.js, and more, check out the {docs-link}.