slidemgr 1.0.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.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +3 -0
  5. data/Gemfile +13 -0
  6. data/LICENCE +674 -0
  7. data/README.md +153 -0
  8. data/Rakefile +3 -0
  9. data/bin/setup +7 -0
  10. data/bin/slidemgr +10 -0
  11. data/config.yml +0 -0
  12. data/lib/command_router.rb +27 -0
  13. data/lib/commands/create.rb +61 -0
  14. data/lib/commands/init.rb +78 -0
  15. data/lib/commands/list.rb +12 -0
  16. data/lib/commands/refresh.rb +49 -0
  17. data/lib/commands/remove.rb +32 -0
  18. data/lib/commands/rename.rb +31 -0
  19. data/lib/commands/start.rb +36 -0
  20. data/lib/commands/sync.rb +31 -0
  21. data/lib/template/config.yml.erb +4 -0
  22. data/lib/template/content.md.erb +2 -0
  23. data/lib/template/index.erb +103 -0
  24. data/lib/template/overview_index.erb +9 -0
  25. data/lib/template/reveal.js-3.0.0/.DS_Store +0 -0
  26. data/lib/template/reveal.js-3.0.0/Gruntfile.js +174 -0
  27. data/lib/template/reveal.js-3.0.0/LICENSE +19 -0
  28. data/lib/template/reveal.js-3.0.0/css/print/paper.css +202 -0
  29. data/lib/template/reveal.js-3.0.0/css/print/pdf.css +157 -0
  30. data/lib/template/reveal.js-3.0.0/css/reveal.css +1141 -0
  31. data/lib/template/reveal.js-3.0.0/css/reveal.scss +1316 -0
  32. data/lib/template/reveal.js-3.0.0/css/theme/README.md +25 -0
  33. data/lib/template/reveal.js-3.0.0/css/theme/beige.css +265 -0
  34. data/lib/template/reveal.js-3.0.0/css/theme/black.css +261 -0
  35. data/lib/template/reveal.js-3.0.0/css/theme/blood.css +291 -0
  36. data/lib/template/reveal.js-3.0.0/css/theme/league.css +267 -0
  37. data/lib/template/reveal.js-3.0.0/css/theme/moon.css +265 -0
  38. data/lib/template/reveal.js-3.0.0/css/theme/night.css +259 -0
  39. data/lib/template/reveal.js-3.0.0/css/theme/serif.css +261 -0
  40. data/lib/template/reveal.js-3.0.0/css/theme/simple.css +261 -0
  41. data/lib/template/reveal.js-3.0.0/css/theme/sky.css +268 -0
  42. data/lib/template/reveal.js-3.0.0/css/theme/solarized.css +265 -0
  43. data/lib/template/reveal.js-3.0.0/css/theme/source/beige.scss +39 -0
  44. data/lib/template/reveal.js-3.0.0/css/theme/source/black.scss +49 -0
  45. data/lib/template/reveal.js-3.0.0/css/theme/source/blood.scss +91 -0
  46. data/lib/template/reveal.js-3.0.0/css/theme/source/league.scss +34 -0
  47. data/lib/template/reveal.js-3.0.0/css/theme/source/moon.scss +57 -0
  48. data/lib/template/reveal.js-3.0.0/css/theme/source/night.scss +35 -0
  49. data/lib/template/reveal.js-3.0.0/css/theme/source/serif.scss +35 -0
  50. data/lib/template/reveal.js-3.0.0/css/theme/source/simple.scss +38 -0
  51. data/lib/template/reveal.js-3.0.0/css/theme/source/sky.scss +46 -0
  52. data/lib/template/reveal.js-3.0.0/css/theme/source/solarized.scss +63 -0
  53. data/lib/template/reveal.js-3.0.0/css/theme/source/white.scss +49 -0
  54. data/lib/template/reveal.js-3.0.0/css/theme/template/mixins.scss +29 -0
  55. data/lib/template/reveal.js-3.0.0/css/theme/template/settings.scss +43 -0
  56. data/lib/template/reveal.js-3.0.0/css/theme/template/theme.scss +339 -0
  57. data/lib/template/reveal.js-3.0.0/css/theme/white.css +261 -0
  58. data/lib/template/reveal.js-3.0.0/js/reveal.js +4276 -0
  59. data/lib/template/reveal.js-3.0.0/lib/css/zenburn.css +117 -0
  60. data/lib/template/reveal.js-3.0.0/lib/font/league-gothic/LICENSE +2 -0
  61. data/lib/template/reveal.js-3.0.0/lib/font/league-gothic/league-gothic.css +10 -0
  62. data/lib/template/reveal.js-3.0.0/lib/font/league-gothic/league-gothic.eot +0 -0
  63. data/lib/template/reveal.js-3.0.0/lib/font/league-gothic/league-gothic.ttf +0 -0
  64. data/lib/template/reveal.js-3.0.0/lib/font/league-gothic/league-gothic.woff +0 -0
  65. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/LICENSE +45 -0
  66. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-italic.eot +0 -0
  67. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-italic.ttf +0 -0
  68. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-italic.woff +0 -0
  69. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-regular.eot +0 -0
  70. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-regular.ttf +0 -0
  71. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-regular.woff +0 -0
  72. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-semibold.eot +0 -0
  73. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-semibold.ttf +0 -0
  74. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-semibold.woff +0 -0
  75. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot +0 -0
  76. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf +0 -0
  77. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff +0 -0
  78. data/lib/template/reveal.js-3.0.0/lib/font/source-sans-pro/source-sans-pro.css +39 -0
  79. data/lib/template/reveal.js-3.0.0/lib/js/classList.js +2 -0
  80. data/lib/template/reveal.js-3.0.0/lib/js/head.min.js +8 -0
  81. data/lib/template/reveal.js-3.0.0/lib/js/html5shiv.js +7 -0
  82. data/lib/template/reveal.js-3.0.0/plugin/highlight/highlight.js +30 -0
  83. data/lib/template/reveal.js-3.0.0/plugin/leap/leap.js +159 -0
  84. data/lib/template/reveal.js-3.0.0/plugin/markdown/example.html +129 -0
  85. data/lib/template/reveal.js-3.0.0/plugin/markdown/example.md +31 -0
  86. data/lib/template/reveal.js-3.0.0/plugin/markdown/markdown.js +393 -0
  87. data/lib/template/reveal.js-3.0.0/plugin/markdown/marked.js +37 -0
  88. data/lib/template/reveal.js-3.0.0/plugin/math/math.js +64 -0
  89. data/lib/template/reveal.js-3.0.0/plugin/multiplex/client.js +13 -0
  90. data/lib/template/reveal.js-3.0.0/plugin/multiplex/index.js +56 -0
  91. data/lib/template/reveal.js-3.0.0/plugin/multiplex/master.js +51 -0
  92. data/lib/template/reveal.js-3.0.0/plugin/notes/notes.html +406 -0
  93. data/lib/template/reveal.js-3.0.0/plugin/notes/notes.js +122 -0
  94. data/lib/template/reveal.js-3.0.0/plugin/notes-server/client.js +60 -0
  95. data/lib/template/reveal.js-3.0.0/plugin/notes-server/index.js +66 -0
  96. data/lib/template/reveal.js-3.0.0/plugin/notes-server/notes.html +396 -0
  97. data/lib/template/reveal.js-3.0.0/plugin/print-pdf/print-pdf.js +48 -0
  98. data/lib/template/reveal.js-3.0.0/plugin/remotes/remotes.js +39 -0
  99. data/lib/template/reveal.js-3.0.0/plugin/search/search.js +196 -0
  100. data/lib/template/reveal.js-3.0.0/plugin/zoom-js/zoom.js +278 -0
  101. data/lib/template/reveal.js-3.0.0/test/examples/assets/image1.png +0 -0
  102. data/lib/template/reveal.js-3.0.0/test/examples/assets/image2.png +0 -0
  103. data/lib/template/reveal.js-3.0.0/test/examples/barebones.html +41 -0
  104. data/lib/template/reveal.js-3.0.0/test/examples/embedded-media.html +49 -0
  105. data/lib/template/reveal.js-3.0.0/test/examples/math.html +185 -0
  106. data/lib/template/reveal.js-3.0.0/test/examples/slide-backgrounds.html +144 -0
  107. data/lib/template/reveal.js-3.0.0/test/qunit-1.12.0.css +244 -0
  108. data/lib/template/reveal.js-3.0.0/test/qunit-1.12.0.js +2212 -0
  109. data/lib/template/reveal.js-3.0.0/test/test-markdown-element-attributes.html +134 -0
  110. data/lib/template/reveal.js-3.0.0/test/test-markdown-element-attributes.js +46 -0
  111. data/lib/template/reveal.js-3.0.0/test/test-markdown-slide-attributes.html +128 -0
  112. data/lib/template/reveal.js-3.0.0/test/test-markdown-slide-attributes.js +47 -0
  113. data/lib/template/reveal.js-3.0.0/test/test-markdown.html +52 -0
  114. data/lib/template/reveal.js-3.0.0/test/test-markdown.js +15 -0
  115. data/lib/template/reveal.js-3.0.0/test/test-pdf.html +83 -0
  116. data/lib/template/reveal.js-3.0.0/test/test-pdf.js +15 -0
  117. data/lib/template/reveal.js-3.0.0/test/test.html +82 -0
  118. data/lib/template/reveal.js-3.0.0/test/test.js +572 -0
  119. data/lib/util.rb +99 -0
  120. data/lib/version.rb +3 -0
  121. data/slidemgr.gemspec +24 -0
  122. metadata +193 -0
data/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # slidemgr
2
+ A little commandline program to generate and manage reveal.js slides. Checkout
3
+ (https://github.com/hakimel/reveal.js/)[reveal.js].It's pretty cool.
4
+
5
+ ## Installation
6
+ You need Ruby installed in order to use slidemgr. I tested it with 2.2, but I
7
+ guess it is compatible with older releases as well.
8
+ Take a look at https://www.ruby-lang.org/en/documentation/installation/
9
+ to install ruby.
10
+ After that, fire up a terminal and type in:
11
+ ```bash
12
+ gem install slidemgr
13
+ ```
14
+ You can now use slidemgr.
15
+ ## Usage
16
+ slidemgr is a commandline program. Open a terminal and type in `slidemgr`
17
+ to get a list of options.
18
+
19
+ ### Initialize a new project
20
+
21
+ The first thing you want to do is initializing a new project. A project can contain
22
+ multiple cohesive presentations. I'll do an example for a lecture called *programming*.
23
+ The command for initializing a project is `init`:
24
+
25
+ ```bash
26
+ slidemgr init
27
+ ```
28
+
29
+ slidemgr will ask you a view questions about your project. In order to synchronize
30
+ your master-presentation with the audience, you need a token/secret pair. Thus
31
+ slidemgr will ask you for Socket.io-host. reveal.js offers a public server at
32
+ http://revealjs.jit.su/ , so you can use this one if you like.
33
+
34
+ You can skip the interactive process by passing the required information to slidemgr:
35
+ ```bash
36
+ slidemgr init programming --host revealjs.jit.su --git git@github.com/path/to/repo
37
+ ```
38
+ After the initialization you can see that slidemgr creates a new directory
39
+ containing your project. Now change into the project-directory.
40
+ ```bash
41
+ cd programming
42
+ ```
43
+ All following commands need you to be within the project-directory-structure.
44
+ Let's take a look what happened.
45
+ ```bash
46
+ ls
47
+ # output
48
+ client config.yml master
49
+ ```
50
+ Both master and clientfolder contain a minimal installation of reveal.js. The
51
+ idea is simple. You present the master-slides to your audience. The audience
52
+ should get served client-slides to their own devices.
53
+ The key strength of slidemgr is the synchrinization between master-slides and
54
+ client-slides, so you can easily make changes without the hassle of doing a
55
+ manual sync. The file `config.yml` is intended for project-wide meta information.
56
+ You can change your initial settings here if you want.
57
+
58
+ **Beware**
59
+
60
+ Do not rename or remove the config.yml file. You shouldn't move around files that are outside
61
+ the content-folder either.
62
+
63
+ ### Create a new presentation
64
+ To create a new presentation use the command `create`:
65
+ ```bash
66
+ slidemgr create hello_world
67
+ ```
68
+ this will create both a new master-presentation, as well as a client-presentation.
69
+
70
+ To alter the content of your newly generated presentation, change the file within
71
+ `master/slides/YOUR_PRESENTATION_NAME/content/content.md`
72
+
73
+ The content is written in [markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
74
+ To seperate slides, use the following:
75
+
76
+ | -- | vertical slide |
77
+ |-----|------------------|
78
+ | --- | horizontal slide |
79
+
80
+ ```markdown
81
+ ## Hello World
82
+
83
+ --
84
+
85
+ Tradition demands, that the first program should print "Hello World!"
86
+
87
+ ---
88
+
89
+ ## Java
90
+
91
+ --
92
+
93
+ ![an image](content/image.png)
94
+ ```
95
+
96
+ If you want to place an image, it's easiest to store them within the content-directory.
97
+ After that reference the image like in the example above.
98
+
99
+
100
+ ### Synchronize your work
101
+
102
+ After adding some content to your new presentation, you need to sync it with the client.
103
+ Use the `sync` command:
104
+
105
+ ```bash
106
+ slidemgr sync
107
+ ```
108
+
109
+ this syncs all your presentations. If you only want to sync a particular presentation,
110
+ give the name of the presentation as an argument:
111
+
112
+ ```bash
113
+ slidemgr sync hello_world
114
+ ```
115
+ The synchronization will copy all content from the master-slides to client-slides.
116
+ If you have a git-repository, it will also commit your changes and push them to the remote-repository (if present).
117
+
118
+ ### Start your presentation
119
+ Slidemgr has a built-in webserver to start your presentation. Use the `start` command.
120
+ ```bash
121
+ slidemgr start
122
+ ```
123
+ It will start the webserver and open your default-browser. If you specify a presentation as
124
+ a parameter, it will automatically navigate to the presentation.
125
+ To stop the server, switch back to your terminal where you started the server and press CTRL+C.
126
+
127
+ ### Other commands
128
+
129
+ Slidemgr comes with a view more commands. Use the builtin help to see their usage.
130
+
131
+ ## Copyright
132
+ ### slidemgr
133
+ Copyright (c) 2015 Rene Richter
134
+ slidemgr is free software; you can redistribute it and/or modify
135
+ it under the terms of the GNU General Public License as published by
136
+ the Free Software Foundation; either version 3 of the License, or
137
+ (at your option) any later version.
138
+ This program is distributed in the hope that it will be useful,
139
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
140
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
141
+ GNU General Public License for more details.
142
+ You should have received a copy of the GNU General Public License
143
+ along with this program; if not, write to the Free Software Foundation,
144
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
145
+
146
+
147
+ ### reveal.js
148
+ MIT licensed
149
+
150
+ Copyright (C) 2015 Hakim El Hattab, http://hakim.se
151
+
152
+
153
+
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ require "bundler/gem_tasks"
2
+
3
+
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/bin/slidemgr ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'command_router'
5
+ require 'thor'
6
+
7
+
8
+ CommandRouter::Main.start ARGV
9
+
10
+
data/config.yml ADDED
File without changes
@@ -0,0 +1,27 @@
1
+ require 'commands/create'
2
+ require 'commands/init'
3
+ require 'commands/sync'
4
+ require 'commands/start'
5
+ require 'commands/refresh'
6
+ require 'commands/rename'
7
+ require 'commands/remove'
8
+ require 'commands/list'
9
+ require 'thor'
10
+
11
+ module CommandRouter
12
+ include Util
13
+
14
+ class Main < Thor
15
+
16
+ register(Init, 'init', 'init [project_name]', 'Initializes a new project.')
17
+ register(Create, 'create', 'create [presentation_name]', 'Creates a new presentation')
18
+ register(Sync, 'sync', 'sync [name]', 'syncs master and client.')
19
+ register(Start,'start','start [presentation_name]','starts a presentation-server.')
20
+ register(Refresh,'refresh','refresh [presentation_name]','refreshes the token')
21
+ register(Remove,'remove','remove [presentation_name]', 'removes a presentation')
22
+ register(Rename,'rename','rename [old_name] [new_name]', 'renames a presentation')
23
+ register(List,'list','list','lists all presentations.')
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,61 @@
1
+ require 'thor'
2
+ require 'thor/group'
3
+ require 'pathname'
4
+ require 'util'
5
+ require 'nokogiri'
6
+ require 'net/http'
7
+ require 'json'
8
+ require 'yaml'
9
+
10
+
11
+ class Create < Thor::Group
12
+ include Thor::Actions
13
+ include Util
14
+
15
+ argument :name, :type => :string, :desc => 'The presentation name'
16
+
17
+ def self.source_root
18
+ File.expand_path('../',__dir__)
19
+ end
20
+
21
+ def prepare_parameters
22
+ @snake_case_name = @name.sub ' ','_'
23
+ end
24
+
25
+
26
+ def create_master
27
+ @config = parse_config
28
+ @token = request_token
29
+ @client = false
30
+ template 'template/index.erb',
31
+ "#{content_root}/master/slides/#{@snake_case_name}/index.html"
32
+
33
+ template 'template/content.md.erb',
34
+ "#{content_root}/master/slides/" \
35
+ "#{@snake_case_name}/content/content.md"
36
+ end
37
+
38
+ def create_client
39
+ @client = true
40
+ template 'template/index.erb',
41
+ "#{content_root}/client/slides/#{@snake_case_name}/index.html"
42
+ end
43
+
44
+ def append_index
45
+ index = "#{content_root}/client/index.html"
46
+ template 'template/overview_index.erb',index unless File.exist?(index)
47
+
48
+ alter_index_html do | doc |
49
+ unless doc.xpath('//a').map(&:content).include? @name
50
+ body = doc.at_css 'body'
51
+ h2 = Nokogiri::XML::Node.new 'h2', doc
52
+ link = Nokogiri::XML::Node.new 'a', doc
53
+ link['href'] = "slides/#{@snake_case_name}/"
54
+ link.content= "#{@name}"
55
+ h2 << link
56
+ body << h2
57
+ end
58
+ end
59
+ end
60
+
61
+ end
@@ -0,0 +1,78 @@
1
+ require 'thor'
2
+ require 'thor/group'
3
+ require 'fileutils'
4
+ require 'uri'
5
+ require 'util'
6
+
7
+ class Init < Thor::Group
8
+ include Thor::Actions
9
+ include Util
10
+
11
+ def self.source_root
12
+ File.expand_path('../',__dir__)
13
+ end
14
+
15
+ argument :project_name,
16
+ :type => :string,
17
+ :desc => 'The project name',
18
+ :required => false
19
+
20
+
21
+ class_option :host,
22
+ :type => :string,
23
+ :desc => 'host-server'
24
+
25
+ class_option :git,
26
+ :type => :string,
27
+ :desc => 'initializes a git-repository'
28
+
29
+ #TODO download latest reveal-framework. maybe rubyzip. duno
30
+ def create_project_structure
31
+
32
+ @host = options[:host]
33
+ @git = options[:git]
34
+
35
+ interactive_mode unless @host && @project_name
36
+
37
+ @url = URI.parse "http://#{@host}"
38
+
39
+ empty_directory "#{@project_name}/master/slides"
40
+ empty_directory "#{@project_name}/client/slides"
41
+
42
+ template 'template/config.yml.erb', "#{@project_name}/config.yml"
43
+ directory 'template/reveal.js-3.0.0/', "#{@project_name}/master/"
44
+ directory 'template/reveal.js-3.0.0/', "#{@project_name}/client/"
45
+
46
+ if @git
47
+ @git == 'git' ?
48
+ init_git(@project_name) : init_git(@project_name,@git)
49
+ end
50
+ end
51
+
52
+ no_commands do
53
+ def interactive_mode
54
+ say("so it seems that you didn't bother to give me some input. Fine. I'll ask")
55
+ @project_name = @project_name || ask('Whats the name of the project?')
56
+
57
+ abort('You need to specify a project name. Try again') if @project_name.empty?
58
+
59
+
60
+ @host = @host || ask('whats the host of your token-server?(host+port)')
61
+
62
+ abort('You need to specify a host.Try again') if @host.empty?
63
+
64
+ unless @git
65
+ if yes?('Do you want to use git?(y,n)')
66
+ git_answer = ask('specify a remote (leave blank for local repository)')
67
+ @git =
68
+ git_answer.empty? ? 'git' : git_answer
69
+ end
70
+ end
71
+
72
+
73
+ end
74
+ end
75
+
76
+
77
+
78
+ end
@@ -0,0 +1,12 @@
1
+ require 'util'
2
+ require 'thor/group'
3
+
4
+ class List < Thor::Group
5
+ include Util
6
+
7
+ def list
8
+ each_presentation do |master,client|
9
+ puts "#{File.basename(master)}"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,49 @@
1
+ require 'thor/group'
2
+ require 'util'
3
+
4
+ class Refresh < Thor::Group
5
+ include Util
6
+ include Thor::Actions
7
+
8
+
9
+ argument :presentation_name,
10
+ :type => :string,
11
+ :desc => 'The presentation name',
12
+ :required => false
13
+
14
+
15
+ def refresh_presentation
16
+
17
+ block = Proc.new do |master,client|
18
+ say "refreshing tokens and secrets for #{File.basename(master)}"
19
+ master = "#{master}/index.html"
20
+ client = "#{client}/index.html"
21
+ master_content = File.read(master)
22
+ token = request_token
23
+ config = parse_config
24
+ multiplex = %Q( multiplex: {
25
+ secret: "#{token.secret}",
26
+ id: "#{token.socket_id}",
27
+ url: "#{config.host}:#{config.port}"
28
+ },
29
+ )
30
+ regex = /multiplex: \{.*?\},/m
31
+ master_content.sub!(regex,multiplex)
32
+ File.write(master, master_content)
33
+
34
+ client_content = File.read(client)
35
+ multiplex = %Q( multiplex: {
36
+ secret: null,
37
+ id: "#{token.socket_id}",
38
+ url: "#{config.host}:#{config.port}"
39
+ },
40
+ )
41
+ client_content.sub!(regex,multiplex)
42
+ File.write(client, client_content)
43
+ end
44
+
45
+ @presentation_name ?
46
+ presentation(@presentation_name,&block) : each_presentation(&block)
47
+ end
48
+
49
+ end
@@ -0,0 +1,32 @@
1
+ require 'thor/group'
2
+ require 'util'
3
+ require 'fileutils'
4
+
5
+ class Remove < Thor::Group
6
+ include Thor::Actions
7
+ include Util
8
+
9
+
10
+ argument :name, :type => :string, :desc => 'The presentation name'
11
+ class_option :yes, :type => :boolean, :desc => 'do not ask'
12
+
13
+
14
+ def remove_presentation
15
+
16
+ presentation @name do |master,client|
17
+ if @yes.nil?
18
+ @yes = yes? "do you really want to delete #{File.basename(master)}?(y,N)"
19
+ end
20
+
21
+ if @yes
22
+ FileUtils.rm_rf master
23
+ FileUtils.rm_rf client
24
+ end
25
+ end
26
+
27
+ alter_link(@name) do | link |
28
+ link.parent.remove
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,31 @@
1
+ require 'util'
2
+ require 'thor/group'
3
+ require 'fileutils'
4
+ require 'nokogiri'
5
+
6
+
7
+ class Rename < Thor::Group
8
+ include Thor::Actions
9
+ include Util
10
+
11
+ argument :old_name, :type => :string, :desc => 'The old name'
12
+ argument :new_name, :type => :string, :desc => 'The new name'
13
+
14
+ def rename
15
+
16
+ presentation(@old_name) do |master,client|
17
+
18
+ say "renaming #{@old_name} to #{@new_name}..."
19
+ new_master = "#{content_root}/master/slides/#{@new_name}"
20
+ new_client = "#{content_root}/client/slides/#{@new_name}"
21
+ FileUtils.mv master,new_master
22
+ FileUtils.mv client,new_client
23
+
24
+ alter_link(File.basename(master)) do | link |
25
+ link['href'] = "slides/#{@new_name}/"
26
+ link.content= "#{@new_name}"
27
+ end
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,36 @@
1
+ require 'thor/group'
2
+ require 'util'
3
+ require 'webrick'
4
+ require 'launchy'
5
+
6
+
7
+ class Start < Thor::Group
8
+ include Util
9
+
10
+ class_option :port,
11
+ :type => :numeric,
12
+ :desc => "the server-port",
13
+ :default => 8080
14
+
15
+ argument :presentation_name,
16
+ :type => :string,
17
+ :desc => 'The name of the presentation',
18
+ :required => false
19
+
20
+ def start
21
+ root = "#{content_root}/master"
22
+ thr = Thread.new do
23
+ server =
24
+ WEBrick::HTTPServer.new :Port => options[:port], :DocumentRoot => root
25
+ trap 'INT' do server.shutdown end
26
+ server.start
27
+ end
28
+ if @presentation_name
29
+ Launchy.open("http://localhost:#{options[:port]}/slides/#{@presentation_name}")
30
+ else
31
+ Launchy.open("http://localhost:#{options[:port]}/slides/")
32
+ end
33
+ thr.join
34
+ end
35
+
36
+ end
@@ -0,0 +1,31 @@
1
+ require 'thor'
2
+ require 'thor/group'
3
+ require 'util'
4
+ require 'git'
5
+
6
+
7
+ class Sync < Thor::Group
8
+ include Thor::Actions
9
+ include Util
10
+
11
+ argument :name,
12
+ :type => :string,
13
+ :desc => 'The presentation name',
14
+ :required => false
15
+
16
+ def syn
17
+
18
+ block = Proc.new do | master,client |
19
+ puts "syncing content for #{File.basename(master)}"
20
+ FileUtils.cp_r "#{master}/content/",
21
+ "#{client}/content/"
22
+ end
23
+
24
+ @name ? presentation(@name.sub(' ','_'),&block) : each_presentation(&block)
25
+
26
+ if git_repository?
27
+ puts 'syncing wiht git...'
28
+ add_to_git
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,4 @@
1
+ project_name: <%=@project_name%>
2
+ host: <%=@url.host%>
3
+ port: <%=@url.port%>
4
+
@@ -0,0 +1,2 @@
1
+ ## <%= @name %>
2
+ ---
@@ -0,0 +1,103 @@
1
+ <!doctype html>
2
+ <html lang="de">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+
7
+ <title><%="#{@config.project_name} - #{@name}"%></title>
8
+
9
+ <meta name="author" content="Rene Richter">
10
+
11
+ <meta name="apple-mobile-web-app-capable" content="yes" />
12
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
13
+
14
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
15
+
16
+ <link rel="stylesheet" href="/css/reveal.css">
17
+ <link rel="stylesheet" href="/css/theme/black.css" id="theme">
18
+
19
+ <!-- Code syntax highlighting -->
20
+ <link rel="stylesheet" href="/lib/css/zenburn.css">
21
+
22
+ <!-- Printing and PDF exports -->
23
+ <script>
24
+ var link = document.createElement( 'link' );
25
+ link.rel = 'stylesheet';
26
+ link.type = 'text/css';
27
+ link.href = window.location.search.match( /print-pdf/gi ) ? '/css/print/pdf.css' : '/css/print/paper.css';
28
+ document.getElementsByTagName( 'head' )[0].appendChild( link );
29
+
30
+ function getParameterByName(name) {
31
+ name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
32
+ var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
33
+ results = regex.exec(location.search);
34
+ return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
35
+ }
36
+ var theme = getParameterByName('theme');
37
+ if (theme === null || theme === "" || theme === undefined)
38
+ theme = "black";
39
+
40
+ if(theme.substr(-1) == '/')
41
+ theme = theme.substr(0, theme.length - 1);
42
+ document.getElementById('theme').setAttribute('href','/css/theme/'+theme+'.css');
43
+
44
+ </script>
45
+
46
+ <!--[if lt IE 9]>
47
+ <script src="lib/js/html5shiv.js"></script>
48
+ <![endif]-->
49
+ </head>
50
+
51
+ <body>
52
+
53
+ <div class="reveal">
54
+ <div class="slides">
55
+ <section data-markdown="content/content.md"
56
+ data-separator="^---"
57
+ data-separator-vertical="^--"
58
+ data-separator-notes="^Note:"
59
+ data-charset="utf-8">
60
+ <section><pre><code class="java"> </code></pre></section>
61
+ </section>
62
+ </div>
63
+
64
+ </div>
65
+
66
+ <script src="/lib/js/head.min.js"></script>
67
+ <script src="/js/reveal.js"></script>
68
+
69
+ <script>
70
+
71
+ // Full list of configuration options available at:
72
+ // https://github.com/hakimel/reveal.js#configuration
73
+ Reveal.initialize({
74
+ controls: true,
75
+ progress: true,
76
+ history: true,
77
+ center: true,
78
+
79
+ multiplex: {
80
+ secret: <%=@client ? "null" : %Q("#{@token.secret}") %>,
81
+ id: "<%=@token.socket_id %>",
82
+ url: "<%="#{@config.host}:#{@config.port}"%>"
83
+ },
84
+
85
+ transition: 'slide', // none/fade/slide/convex/concave/zoom
86
+
87
+ // Optional reveal.js plugins
88
+ dependencies: [
89
+ { src: '/lib/js/classList.js', condition: function() { return !document.body.classList; } },
90
+ { src: '/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
91
+ { src: '/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
92
+ { src: '/plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
93
+ { src: '/plugin/zoom-js/zoom.js', async: true },
94
+ { src: '/plugin/notes/notes.js', async: true },
95
+ { src: 'http://cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js', async: true },
96
+ { src: '/plugin/multiplex/<%=@client ? "client" : "master" %>.js', async: true }
97
+ ]
98
+ });
99
+
100
+ </script>
101
+
102
+ </body>
103
+ </html>
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
+ <meta charset="utf-8">
5
+ </head>
6
+ <body>
7
+ <h1><%=@config.project_name%></h1>
8
+ </body>
9
+ </html>