mg_showoff 0.5.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.
- data/LICENSE +20 -0
- data/README.rdoc +532 -0
- data/Rakefile +7 -0
- data/bin/showoff +145 -0
- data/lib/commandline_parser.rb +67 -0
- data/lib/princely.rb +84 -0
- data/lib/showoff.rb +452 -0
- data/lib/showoff_utils.rb +369 -0
- data/public/css/fg.menu.css +114 -0
- data/public/css/onepage.css +60 -0
- data/public/css/pdf.css +12 -0
- data/public/css/reset.css +53 -0
- data/public/css/sh_style.css +66 -0
- data/public/css/showoff.css +361 -0
- data/public/css/spinner_bar.gif +0 -0
- data/public/css/theme/images/ui-bg_diagonals-small_100_f0efea_40x40.png +0 -0
- data/public/css/theme/images/ui-bg_flat_35_f0f0f0_40x100.png +0 -0
- data/public/css/theme/images/ui-bg_glass_55_fcf0ba_1x400.png +0 -0
- data/public/css/theme/images/ui-bg_glow-ball_25_2e2e28_600x600.png +0 -0
- data/public/css/theme/images/ui-bg_highlight-soft_100_f0efea_1x100.png +0 -0
- data/public/css/theme/images/ui-bg_highlight-soft_25_327E04_1x100.png +0 -0
- data/public/css/theme/images/ui-bg_highlight-soft_25_5A9D1A_1x100.png +0 -0
- data/public/css/theme/images/ui-bg_highlight-soft_95_ffedad_1x100.png +0 -0
- data/public/css/theme/images/ui-bg_inset-soft_22_3b3b35_1x100.png +0 -0
- data/public/css/theme/images/ui-icons_808080_256x240.png +0 -0
- data/public/css/theme/images/ui-icons_8DC262_256x240.png +0 -0
- data/public/css/theme/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/css/theme/images/ui-icons_e7e6e4_256x240.png +0 -0
- data/public/css/theme/images/ui-icons_eeeeee_256x240.png +0 -0
- data/public/css/theme/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/css/theme/ui.accordion.css +9 -0
- data/public/css/theme/ui.all.css +2 -0
- data/public/css/theme/ui.base.css +9 -0
- data/public/css/theme/ui.core.css +37 -0
- data/public/css/theme/ui.datepicker.css +62 -0
- data/public/css/theme/ui.dialog.css +13 -0
- data/public/css/theme/ui.progressbar.css +4 -0
- data/public/css/theme/ui.resizable.css +13 -0
- data/public/css/theme/ui.slider.css +17 -0
- data/public/css/theme/ui.tabs.css +9 -0
- data/public/css/theme/ui.theme.css +245 -0
- data/public/favicon.ico +0 -0
- data/public/js/core.js +79 -0
- data/public/js/fg.menu.js +645 -0
- data/public/js/jTypeWriter.js +26 -0
- data/public/js/jquery-1.4.2.min.js +154 -0
- data/public/js/jquery-print.js +109 -0
- data/public/js/jquery.batchImageLoad.js +56 -0
- data/public/js/jquery.cookie.js +96 -0
- data/public/js/jquery.cycle.all.js +1284 -0
- data/public/js/jquery.doubletap-0.1.js +105 -0
- data/public/js/jquery.uuid.js +24 -0
- data/public/js/jquery.ws-0.3pre.js +201 -0
- data/public/js/onepage.js +5 -0
- data/public/js/sh_lang/sh_bison.min.js +1 -0
- data/public/js/sh_lang/sh_c.min.js +1 -0
- data/public/js/sh_lang/sh_caml.min.js +1 -0
- data/public/js/sh_lang/sh_changelog.min.js +1 -0
- data/public/js/sh_lang/sh_cpp.min.js +1 -0
- data/public/js/sh_lang/sh_csharp.min.js +1 -0
- data/public/js/sh_lang/sh_css.min.js +1 -0
- data/public/js/sh_lang/sh_cucumber.min.js +2 -0
- data/public/js/sh_lang/sh_desktop.min.js +1 -0
- data/public/js/sh_lang/sh_diff.min.js +1 -0
- data/public/js/sh_lang/sh_flex.min.js +1 -0
- data/public/js/sh_lang/sh_glsl.min.js +1 -0
- data/public/js/sh_lang/sh_haxe.min.js +1 -0
- data/public/js/sh_lang/sh_html.min.js +1 -0
- data/public/js/sh_lang/sh_java.min.js +1 -0
- data/public/js/sh_lang/sh_javascript.min.js +1 -0
- data/public/js/sh_lang/sh_javascript_dom.min.js +1 -0
- data/public/js/sh_lang/sh_latex.min.js +1 -0
- data/public/js/sh_lang/sh_ldap.min.js +1 -0
- data/public/js/sh_lang/sh_log.min.js +1 -0
- data/public/js/sh_lang/sh_lsm.min.js +1 -0
- data/public/js/sh_lang/sh_m4.min.js +1 -0
- data/public/js/sh_lang/sh_makefile.min.js +1 -0
- data/public/js/sh_lang/sh_oracle.min.js +1 -0
- data/public/js/sh_lang/sh_pascal.min.js +1 -0
- data/public/js/sh_lang/sh_perl.min.js +1 -0
- data/public/js/sh_lang/sh_php.min.js +1 -0
- data/public/js/sh_lang/sh_prolog.min.js +1 -0
- data/public/js/sh_lang/sh_properties.min.js +1 -0
- data/public/js/sh_lang/sh_python.min.js +1 -0
- data/public/js/sh_lang/sh_ruby.min.js +1 -0
- data/public/js/sh_lang/sh_scala.min.js +1 -0
- data/public/js/sh_lang/sh_sh.min.js +1 -0
- data/public/js/sh_lang/sh_slang.min.js +1 -0
- data/public/js/sh_lang/sh_sml.min.js +1 -0
- data/public/js/sh_lang/sh_spec.min.js +1 -0
- data/public/js/sh_lang/sh_sql.min.js +1 -0
- data/public/js/sh_lang/sh_tcl.min.js +1 -0
- data/public/js/sh_lang/sh_xml.min.js +1 -0
- data/public/js/sh_lang/sh_xorg.min.js +1 -0
- data/public/js/sh_main.min.js +4 -0
- data/public/js/showoff.js +623 -0
- data/public/js/showoffcore.js +13 -0
- data/views/index.erb +85 -0
- data/views/onepage.erb +35 -0
- metadata +227 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
class ShowOffUtils
|
|
2
|
+
def self.presentation_config_file
|
|
3
|
+
@presentation_config_file ||= 'showoff.json'
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def self.presentation_config_file=(filename)
|
|
7
|
+
@presentation_config_file = filename
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.create(dirname,create_samples,dir='one')
|
|
11
|
+
Dir.mkdir(dirname) if !File.exists?(dirname)
|
|
12
|
+
Dir.chdir(dirname) do
|
|
13
|
+
if create_samples
|
|
14
|
+
# create section
|
|
15
|
+
Dir.mkdir(dir)
|
|
16
|
+
|
|
17
|
+
# create markdown file
|
|
18
|
+
File.open("#{dir}/01_slide.md", 'w+') do |f|
|
|
19
|
+
f.puts make_slide("My Presentation")
|
|
20
|
+
f.puts make_slide("Bullet Points","bullets incremental",["first point","second point","third point"])
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# create showoff.json
|
|
25
|
+
File.open(ShowOffUtils.presentation_config_file, 'w+') do |f|
|
|
26
|
+
f.puts "{ \"name\": \"My Preso\", \"sections\": [ {\"section\":\"#{dir}\"} ]}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
if create_samples
|
|
30
|
+
puts "done. run 'showoff serve' in #{dirname}/ dir to see slideshow"
|
|
31
|
+
else
|
|
32
|
+
puts "done. add slides, modify #{ShowOffUtils.presentation_config_file} and then run 'showoff serve' in #{dirname}/ dir to see slideshow"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
HEROKU_GEMS_FILE = '.gems'
|
|
38
|
+
HEROKU_BUNDLER_GEMS_FILE = 'Gemfile'
|
|
39
|
+
HEROKU_CONFIG_FILE = 'config.ru'
|
|
40
|
+
|
|
41
|
+
# Setup presentation to run on Heroku
|
|
42
|
+
#
|
|
43
|
+
# name - String containing heroku name
|
|
44
|
+
# force - boolean if .gems/Gemfile and config.ru should be overwritten if they don't exist
|
|
45
|
+
# password - String containing password to protect your heroku site; nil means no password protection
|
|
46
|
+
# use_dot_gems - boolea that, if true, indicates we should use the old, deprecated .gems file instead of Bundler
|
|
47
|
+
def self.heroku(name,force,password,use_dot_gems)
|
|
48
|
+
if !File.exists?(ShowOffUtils.presentation_config_file)
|
|
49
|
+
puts "fail. not a showoff directory"
|
|
50
|
+
return false
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
modified_something = false
|
|
54
|
+
|
|
55
|
+
if use_dot_gems
|
|
56
|
+
modified_something = create_gems_file(HEROKU_GEMS_FILE,
|
|
57
|
+
!password.nil?,
|
|
58
|
+
force,
|
|
59
|
+
lambda{ |gem| gem })
|
|
60
|
+
else
|
|
61
|
+
modified_something = create_gems_file(HEROKU_BUNDLER_GEMS_FILE,
|
|
62
|
+
!password.nil?,
|
|
63
|
+
force,
|
|
64
|
+
lambda{ |gem| "gem '#{gem}'" },
|
|
65
|
+
lambda{ "source :rubygems" })
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
create_file_if_needed(HEROKU_CONFIG_FILE,force) do |file|
|
|
69
|
+
modified_something = true
|
|
70
|
+
file.puts 'require "showoff"'
|
|
71
|
+
if password.nil?
|
|
72
|
+
file.puts 'run ShowOff.new'
|
|
73
|
+
else
|
|
74
|
+
file.puts 'require "rack"'
|
|
75
|
+
file.puts 'showoff_app = ShowOff.new'
|
|
76
|
+
file.puts 'protected_showoff = Rack::Auth::Basic.new(showoff_app) do |username, password|'
|
|
77
|
+
file.puts "\tpassword == '#{password}'"
|
|
78
|
+
file.puts 'end'
|
|
79
|
+
file.puts 'run protected_showoff'
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
if modified_something
|
|
84
|
+
puts "herokuized. run something like this to launch your heroku presentation:
|
|
85
|
+
|
|
86
|
+
heroku create #{name}"
|
|
87
|
+
|
|
88
|
+
if use_dot_gems
|
|
89
|
+
puts " git add #{HEROKU_GEMS_FILE} #{HEROKU_CONFIG_FILE}"
|
|
90
|
+
else
|
|
91
|
+
puts " bundle install
|
|
92
|
+
git add Gemfile.lock #{HEROKU_GEMS_FILE} #{HEROKU_CONFIG_FILE}"
|
|
93
|
+
end
|
|
94
|
+
puts " git commit -m 'herokuized'
|
|
95
|
+
git push heroku master
|
|
96
|
+
"
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# generate a static version of the site into the gh-pages branch
|
|
101
|
+
def self.github
|
|
102
|
+
puts "Generating static content"
|
|
103
|
+
ShowOff.do_static(nil)
|
|
104
|
+
`git add static`
|
|
105
|
+
sha = `git write-tree`.chomp
|
|
106
|
+
tree_sha = `git rev-parse #{sha}:static`.chomp
|
|
107
|
+
`git read-tree HEAD` # reset staging to last-commit
|
|
108
|
+
ghp_sha = `git rev-parse gh-pages 2>/dev/null`.chomp
|
|
109
|
+
extra = ghp_sha != 'gh-pages' ? "-p #{ghp_sha}" : ''
|
|
110
|
+
commit_sha = `echo 'static presentation' | git commit-tree #{tree_sha} #{extra}`.chomp
|
|
111
|
+
`git update-ref refs/heads/gh-pages #{commit_sha}`
|
|
112
|
+
puts "I've updated your 'gh-pages' branch with the static version of your presentation."
|
|
113
|
+
puts "Push it to GitHub to publish it. Probably something like:"
|
|
114
|
+
puts
|
|
115
|
+
puts " git push origin gh-pages"
|
|
116
|
+
puts
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Makes a slide as a string.
|
|
120
|
+
# [title] title of the slide
|
|
121
|
+
# [classes] any "classes" to include, such as 'smaller', 'transition', etc.
|
|
122
|
+
# [content] slide content. Currently, if this is an array, it will make a bullet list. Otherwise
|
|
123
|
+
# the string value of this will be put in the slide as-is
|
|
124
|
+
def self.make_slide(title,classes="",content=nil)
|
|
125
|
+
slide = "!SLIDE #{classes}\n"
|
|
126
|
+
slide << "# #{title} #\n"
|
|
127
|
+
slide << "\n"
|
|
128
|
+
if content
|
|
129
|
+
if content.kind_of? Array
|
|
130
|
+
content.each { |x| slide << "* #{x.to_s}\n" }
|
|
131
|
+
else
|
|
132
|
+
slide << content.to_s
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
slide
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
TYPES = {
|
|
139
|
+
:default => lambda { |t,size,source,type| make_slide(t,"#{size} #{type}",source) },
|
|
140
|
+
'title' => lambda { |t,size,dontcare| make_slide(t,size) },
|
|
141
|
+
'bullets' => lambda { |t,size,dontcare| make_slide(t,"#{size} bullets incremental",["bullets","go","here"])},
|
|
142
|
+
'smbullets' => lambda { |t,size,dontcare| make_slide(t,"#{size} smbullets incremental",["bullets","go","here","and","here"])},
|
|
143
|
+
'code' => lambda { |t,size,src| make_slide(t,size,blank?(src) ? " @@@ Ruby\n code_here()" : src) },
|
|
144
|
+
'commandline' => lambda { |t,size,dontcare| make_slide(t,"#{size} commandline"," $ command here\n output here")},
|
|
145
|
+
'full-page' => lambda { |t,size,dontcare| make_slide(t,"#{size} full-page","")},
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
# Adds a new slide to a given dir, giving it a number such that it falls after all slides
|
|
150
|
+
# in that dir.
|
|
151
|
+
# Options are:
|
|
152
|
+
# [:dir] - dir where we put the slide (if omitted, slide is output to $stdout)
|
|
153
|
+
# [:name] - name of the file, without the number prefix. (if omitted, a default is used)
|
|
154
|
+
# [:title] - title in the slide. If not specified the source file name is
|
|
155
|
+
# used. If THAT is not specified, uses the value of +:name+. If THAT is not
|
|
156
|
+
# specified, a suitable default is used
|
|
157
|
+
# [:code] - path to a source file to use as content (force :type to be 'code')
|
|
158
|
+
# [:number] - true if numbering should be done, false if not
|
|
159
|
+
# [:type] - the type of slide to create
|
|
160
|
+
def self.add_slide(options)
|
|
161
|
+
|
|
162
|
+
add_new_dir(options[:dir]) if options[:dir] && !File.exists?(options[:dir])
|
|
163
|
+
|
|
164
|
+
options[:type] = 'code' if options[:code]
|
|
165
|
+
|
|
166
|
+
title = determine_title(options[:title],options[:name],options[:code])
|
|
167
|
+
|
|
168
|
+
options[:name] = 'new_slide' if !options[:name]
|
|
169
|
+
|
|
170
|
+
size,source = determine_size_and_source(options[:code])
|
|
171
|
+
type = options[:type] || :default
|
|
172
|
+
slide = TYPES[type].call(title,size,source)
|
|
173
|
+
|
|
174
|
+
if options[:dir]
|
|
175
|
+
filename = determine_filename(options[:dir],options[:name],options[:number])
|
|
176
|
+
write_file(filename,slide)
|
|
177
|
+
else
|
|
178
|
+
puts slide
|
|
179
|
+
puts
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Adds the given directory to this presentation, appending it to
|
|
185
|
+
# the end of showoff.json as well
|
|
186
|
+
def self.add_new_dir(dir)
|
|
187
|
+
puts "Creating #{dir}..."
|
|
188
|
+
Dir.mkdir dir
|
|
189
|
+
|
|
190
|
+
showoff_json = JSON.parse(File.read(ShowOffUtils.presentation_config_file))
|
|
191
|
+
showoff_json["section"] = dir
|
|
192
|
+
File.open(ShowOffUtils.presentation_config_file,'w') do |file|
|
|
193
|
+
file.puts JSON.generate(showoff_json)
|
|
194
|
+
end
|
|
195
|
+
puts "#{ShowOffUtils.presentation_config_file} updated"
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def self.blank?(string)
|
|
199
|
+
string.nil? || string.strip.length == 0
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def self.determine_size_and_source(code)
|
|
203
|
+
size = ""
|
|
204
|
+
source = ""
|
|
205
|
+
if code
|
|
206
|
+
source,lines,width = read_code(code)
|
|
207
|
+
size = adjust_size(lines,width)
|
|
208
|
+
end
|
|
209
|
+
[size,source]
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def self.write_file(filename,slide)
|
|
213
|
+
File.open(filename,'w') do |file|
|
|
214
|
+
file.puts slide
|
|
215
|
+
end
|
|
216
|
+
puts "Wrote #{filename}"
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def self.determine_filename(slide_dir,slide_name,number)
|
|
220
|
+
filename = "#{slide_dir}/#{slide_name}.md"
|
|
221
|
+
if number
|
|
222
|
+
max = find_next_number(slide_dir)
|
|
223
|
+
filename = "#{slide_dir}/#{max}_#{slide_name}.md"
|
|
224
|
+
end
|
|
225
|
+
filename
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Finds the next number in the given dir to
|
|
229
|
+
# name a slide as the last slide in the dir.
|
|
230
|
+
def self.find_next_number(slide_dir)
|
|
231
|
+
max = 0
|
|
232
|
+
Dir.open(slide_dir).each do |file|
|
|
233
|
+
if file =~ /(\d+).*\.md/
|
|
234
|
+
num = $1.to_i
|
|
235
|
+
max = num if num > max
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
max += 1
|
|
239
|
+
max = "0#{max}" if max < 10
|
|
240
|
+
max
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
def self.determine_title(title,slide_name,code)
|
|
244
|
+
if blank?(title)
|
|
245
|
+
title = slide_name
|
|
246
|
+
title = File.basename(code) if code
|
|
247
|
+
end
|
|
248
|
+
title = "Title here" if blank?(title)
|
|
249
|
+
title
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Determines a more optimal value for the size (e.g. small vs. smaller)
|
|
253
|
+
# based upon the size of the code being formatted.
|
|
254
|
+
def self.adjust_size(lines,width)
|
|
255
|
+
size = ""
|
|
256
|
+
# These values determined empircally
|
|
257
|
+
size = "small" if width > 50
|
|
258
|
+
size = "small" if lines > 15
|
|
259
|
+
size = "smaller" if width > 57
|
|
260
|
+
size = "smaller" if lines > 19
|
|
261
|
+
puts "warning, some lines are too long and the code may be cut off" if width > 65
|
|
262
|
+
puts "warning, your code is too long and the code may be cut off" if lines > 23
|
|
263
|
+
size
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Reads the code from the source file, returning
|
|
267
|
+
# the code, indented for markdown, as well as the number of lines
|
|
268
|
+
# and the width of the largest line
|
|
269
|
+
def self.read_code(source_file)
|
|
270
|
+
code = " @@@ #{lang(source_file)}\n"
|
|
271
|
+
lines = 0
|
|
272
|
+
width = 0
|
|
273
|
+
File.open(source_file) do |code_file|
|
|
274
|
+
code_file.readlines.each do |line|
|
|
275
|
+
code += " #{line}"
|
|
276
|
+
lines += 1
|
|
277
|
+
width = line.length if line.length > width
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
[code,lines,width]
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
def self.showoff_sections(dir,logger)
|
|
284
|
+
index = File.join(dir, ShowOffUtils.presentation_config_file)
|
|
285
|
+
order = nil
|
|
286
|
+
if File.exists?(index)
|
|
287
|
+
data = JSON.parse(File.read(index))
|
|
288
|
+
logger.debug data
|
|
289
|
+
if data.is_a?(Hash)
|
|
290
|
+
order = data['sections']
|
|
291
|
+
else
|
|
292
|
+
order = data
|
|
293
|
+
end
|
|
294
|
+
order = order.map { |s| s['section'] }
|
|
295
|
+
else
|
|
296
|
+
order = ["."] # if there's no showoff.json file, make a boring one
|
|
297
|
+
end
|
|
298
|
+
order
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def self.showoff_title(dir = '.')
|
|
302
|
+
index = File.join(dir, ShowOffUtils.presentation_config_file )
|
|
303
|
+
order = nil
|
|
304
|
+
if File.exists?(index)
|
|
305
|
+
data = JSON.parse(File.read(index))
|
|
306
|
+
data.is_a?(Hash) && data['name'] || "Presentation"
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
EXTENSIONS = {
|
|
311
|
+
'pl' => 'perl',
|
|
312
|
+
'rb' => 'ruby',
|
|
313
|
+
'erl' => 'erlang',
|
|
314
|
+
# so not exhaustive, but probably good enough for now
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
def self.lang(source_file)
|
|
318
|
+
ext = File.extname(source_file).gsub(/^\./,'')
|
|
319
|
+
EXTENSIONS[ext] || ext
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
REQUIRED_GEMS = %w(bluecloth nokogiri showoff gli)
|
|
323
|
+
|
|
324
|
+
# Creates the file that lists the gems for heroku
|
|
325
|
+
#
|
|
326
|
+
# filename - String name of the file
|
|
327
|
+
# password - Boolean to indicate if we are setting a password
|
|
328
|
+
# force - Boolean to indicate if we should overwrite the existing file
|
|
329
|
+
# formatter - Proc/lambda that takes 1 argument, the gem name, and formats it for the file
|
|
330
|
+
# This is so we can support both the old .gems and the new bundler Gemfile
|
|
331
|
+
# header - Proc/lambda that creates any header information in the file
|
|
332
|
+
#
|
|
333
|
+
# Returns a boolean indicating that we had to create the file or not.
|
|
334
|
+
def self.create_gems_file(filename,password,force,formatter,header=nil)
|
|
335
|
+
create_file_if_needed(filename,force) do |file|
|
|
336
|
+
file.puts header.call unless header.nil?
|
|
337
|
+
REQUIRED_GEMS.each { |gem| file.puts formatter.call(gem) }
|
|
338
|
+
file.puts formatter.call("rack") if password
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Creates the given filename if it doesn't exist or if force is true
|
|
343
|
+
#
|
|
344
|
+
# filename - String name of the file to create
|
|
345
|
+
# force - if true, the file will always be created, if false, only create
|
|
346
|
+
# if it's not there
|
|
347
|
+
# block - takes a block that will be given the file handle to write
|
|
348
|
+
# data into the file IF it's being created
|
|
349
|
+
#
|
|
350
|
+
# Examples
|
|
351
|
+
#
|
|
352
|
+
# create_file_if_needed("config.ru",false) do |file|
|
|
353
|
+
# file.puts "require 'showoff'"
|
|
354
|
+
# file.puts "run ShowOff.new"
|
|
355
|
+
# end
|
|
356
|
+
#
|
|
357
|
+
# Returns true if the file was created
|
|
358
|
+
def self.create_file_if_needed(filename,force)
|
|
359
|
+
if !File.exists?(filename) || force
|
|
360
|
+
File.open(filename, 'w+') do |f|
|
|
361
|
+
yield f
|
|
362
|
+
end
|
|
363
|
+
true
|
|
364
|
+
else
|
|
365
|
+
puts "#{filename} exists; not overwriting (see showoff help heroku)"
|
|
366
|
+
false
|
|
367
|
+
end
|
|
368
|
+
end
|
|
369
|
+
end
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/* Styles for jQuery menu widget
|
|
2
|
+
Author: Maggie Wachs, maggie@filamentgroup.com
|
|
3
|
+
Date: September 2008
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/* REQUIRED STYLES - the menus will only render correctly with these rules */
|
|
8
|
+
|
|
9
|
+
.fg-menu-container { position: absolute; top:0; left:-999px; padding: .4em; overflow: hidden; }
|
|
10
|
+
.fg-menu-container.fg-menu-flyout { overflow: visible; }
|
|
11
|
+
|
|
12
|
+
.fg-menu, .fg-menu ul { list-style-type:none; padding: 0; margin:0; }
|
|
13
|
+
|
|
14
|
+
.fg-menu { position:relative; }
|
|
15
|
+
.fg-menu-flyout .fg-menu { position:static; }
|
|
16
|
+
|
|
17
|
+
.fg-menu ul { position:absolute; top:0; }
|
|
18
|
+
.fg-menu ul ul { top:-1px; }
|
|
19
|
+
|
|
20
|
+
.fg-menu-container.fg-menu-ipod .fg-menu-content,
|
|
21
|
+
.fg-menu-container.fg-menu-ipod .fg-menu-content ul { background: none !important; }
|
|
22
|
+
|
|
23
|
+
.fg-menu.fg-menu-scroll,
|
|
24
|
+
.fg-menu ul.fg-menu-scroll { overflow: scroll; overflow-x: hidden; }
|
|
25
|
+
|
|
26
|
+
.fg-menu li { clear:both; float:left; width:100%; margin: 0; padding:0; border: 0; }
|
|
27
|
+
.fg-menu li li { font-size:1em; } /* inner li font size must be reset so that they don't blow up */
|
|
28
|
+
|
|
29
|
+
.fg-menu-flyout ul ul { padding: .4em; }
|
|
30
|
+
.fg-menu-flyout li { position:relative; }
|
|
31
|
+
|
|
32
|
+
.fg-menu-scroll { overflow: scroll; overflow-x: hidden; }
|
|
33
|
+
|
|
34
|
+
.fg-menu-breadcrumb { margin: 0; padding: 0; }
|
|
35
|
+
|
|
36
|
+
.fg-menu-footer { margin-top: .4em; padding: .4em; }
|
|
37
|
+
.fg-menu-header { margin-bottom: .4em; padding: .4em; }
|
|
38
|
+
|
|
39
|
+
.fg-menu-breadcrumb li { float: left; list-style: none; margin: 0; padding: 0 .2em; font-size: .9em; opacity: .7; }
|
|
40
|
+
.fg-menu-breadcrumb li.fg-menu-prev-list,
|
|
41
|
+
.fg-menu-breadcrumb li.fg-menu-current-crumb { clear: left; float: none; opacity: 1; }
|
|
42
|
+
.fg-menu-breadcrumb li.fg-menu-current-crumb { padding-top: .2em; }
|
|
43
|
+
|
|
44
|
+
.fg-menu-breadcrumb a,
|
|
45
|
+
.fg-menu-breadcrumb span { float: left; }
|
|
46
|
+
|
|
47
|
+
.fg-menu-footer a:link,
|
|
48
|
+
.fg-menu-footer a:visited { float:left; width:100%; text-decoration: none; }
|
|
49
|
+
.fg-menu-footer a:hover,
|
|
50
|
+
.fg-menu-footer a:active { }
|
|
51
|
+
|
|
52
|
+
.fg-menu-footer a span { float:left; cursor: pointer; }
|
|
53
|
+
|
|
54
|
+
.fg-menu-breadcrumb .fg-menu-prev-list a:link,
|
|
55
|
+
.fg-menu-breadcrumb .fg-menu-prev-list a:visited,
|
|
56
|
+
.fg-menu-breadcrumb .fg-menu-prev-list a:hover,
|
|
57
|
+
.fg-menu-breadcrumb .fg-menu-prev-list a:active { background-image: none; text-decoration:none; }
|
|
58
|
+
|
|
59
|
+
.fg-menu-breadcrumb .fg-menu-prev-list a { float: left; padding-right: .4em; }
|
|
60
|
+
.fg-menu-breadcrumb .fg-menu-prev-list a .ui-icon { float: left; }
|
|
61
|
+
|
|
62
|
+
.fg-menu-breadcrumb .fg-menu-current-crumb a:link,
|
|
63
|
+
.fg-menu-breadcrumb .fg-menu-current-crumb a:visited,
|
|
64
|
+
.fg-menu-breadcrumb .fg-menu-current-crumb a:hover,
|
|
65
|
+
.fg-menu-breadcrumb .fg-menu-current-crumb a:active { display:block; background-image:none; font-size:1.3em; text-decoration:none; }
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/* REQUIRED LINK STYLES: links are "display:block" by default; if the menu options are split into
|
|
70
|
+
selectable node links and 'next' links, the script floats the node links left and floats the 'next' links to the right */
|
|
71
|
+
|
|
72
|
+
.fg-menu a:link,
|
|
73
|
+
.fg-menu a:visited,
|
|
74
|
+
.fg-menu a:hover,
|
|
75
|
+
.fg-menu a:active { float:left; width:92%; padding:.3em 3%; text-decoration:none; outline: 0 !important; }
|
|
76
|
+
|
|
77
|
+
.fg-menu a { border: 1px dashed transparent; }
|
|
78
|
+
|
|
79
|
+
.fg-menu a.ui-state-default:link,
|
|
80
|
+
.fg-menu a.ui-state-default:visited,
|
|
81
|
+
.fg-menu a.ui-state-default:hover,
|
|
82
|
+
.fg-menu a.ui-state-default:active,
|
|
83
|
+
.fg-menu a.ui-state-hover:link,
|
|
84
|
+
.fg-menu a.ui-state-hover:visited,
|
|
85
|
+
.fg-menu a.ui-state-hover:hover,
|
|
86
|
+
.fg-menu a.ui-state-hover:active,
|
|
87
|
+
.fg-menu a.ui-state-active:link,
|
|
88
|
+
.fg-menu a.ui-state-active:visited,
|
|
89
|
+
.fg-menu a.ui-state-active:hover,
|
|
90
|
+
.fg-menu a.ui-state-active:active { border-style: solid; font-weight: normal; }
|
|
91
|
+
|
|
92
|
+
.fg-menu a span { display:block; cursor:pointer; }
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
/* SUGGESTED STYLES - for use with jQuery UI Themeroller CSS */
|
|
96
|
+
|
|
97
|
+
.fg-menu-indicator span { float:left; }
|
|
98
|
+
.fg-menu-indicator span.ui-icon { float:right; }
|
|
99
|
+
|
|
100
|
+
.fg-menu-content.ui-widget-content,
|
|
101
|
+
.fg-menu-content ul.ui-widget-content { border:0; }
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
/* ICONS AND DIVIDERS */
|
|
105
|
+
|
|
106
|
+
.fg-menu.fg-menu-has-icons a:link,
|
|
107
|
+
.fg-menu.fg-menu-has-icons a:visited,
|
|
108
|
+
.fg-menu.fg-menu-has-icons a:hover,
|
|
109
|
+
.fg-menu.fg-menu-has-icons a:active { padding-left:20px; }
|
|
110
|
+
|
|
111
|
+
.fg-menu .horizontal-divider hr, .fg-menu .horizontal-divider span { padding:0; margin:5px .6em; }
|
|
112
|
+
.fg-menu .horizontal-divider hr { border:0; height:1px; }
|
|
113
|
+
.fg-menu .horizontal-divider span { font-size:.9em; text-transform: uppercase; padding-left:.2em; }
|
|
114
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* Screen */
|
|
2
|
+
@media screen {
|
|
3
|
+
.slide {
|
|
4
|
+
margin: 10px;
|
|
5
|
+
padding: 0;
|
|
6
|
+
width: 1020px;
|
|
7
|
+
height: 740px;
|
|
8
|
+
max-height: 740px !important;
|
|
9
|
+
margin-left:auto;
|
|
10
|
+
margin-right:auto;
|
|
11
|
+
overflow:hidden;
|
|
12
|
+
border: 1px solid #333;
|
|
13
|
+
page-break-after: always
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Print */
|
|
18
|
+
@media print {
|
|
19
|
+
.slide, .preso {
|
|
20
|
+
margin: 10px;
|
|
21
|
+
padding: 0;
|
|
22
|
+
width: 800px;
|
|
23
|
+
height: 600px;
|
|
24
|
+
overflow:hidden;
|
|
25
|
+
border: none;
|
|
26
|
+
page-break-after: always
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* iPhone */
|
|
31
|
+
/* Portrait */
|
|
32
|
+
@media screen and (max-width: 320px)
|
|
33
|
+
{
|
|
34
|
+
.preso {
|
|
35
|
+
margin: 10px;
|
|
36
|
+
padding: 0;
|
|
37
|
+
width: 320px;
|
|
38
|
+
min-height: 480px;
|
|
39
|
+
margin-left:auto;
|
|
40
|
+
margin-right:auto;
|
|
41
|
+
/* overflow:hidden;*/
|
|
42
|
+
border: 1px solid #333;
|
|
43
|
+
page-break-after: always
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/* Landscape */
|
|
47
|
+
@media screen and (min-width: 321px)
|
|
48
|
+
{
|
|
49
|
+
.preso {
|
|
50
|
+
margin: 10px;
|
|
51
|
+
padding: 0;
|
|
52
|
+
width: 480px;
|
|
53
|
+
min-height: 320px;
|
|
54
|
+
margin-left:auto;
|
|
55
|
+
margin-right:auto;
|
|
56
|
+
/* overflow:hidden;*/
|
|
57
|
+
border: 1px solid #333;
|
|
58
|
+
page-break-after: always
|
|
59
|
+
}
|
|
60
|
+
}
|
data/public/css/pdf.css
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* http://meyerweb.com/eric/tools/css/reset/ */
|
|
2
|
+
/* v1.0 | 20080212 */
|
|
3
|
+
|
|
4
|
+
html, body, div, span, applet, object, iframe,
|
|
5
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
|
6
|
+
a, abbr, acronym, address, big, cite, code,
|
|
7
|
+
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
|
8
|
+
small, strike, strong, sub, sup, tt, var,
|
|
9
|
+
b, u, i, center,
|
|
10
|
+
dl, dt, dd, ol, ul, li,
|
|
11
|
+
fieldset, form, label, legend,
|
|
12
|
+
table, caption, tbody, tfoot, thead, tr, th, td {
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
border: 0;
|
|
16
|
+
outline: 0;
|
|
17
|
+
font-size: 100%;
|
|
18
|
+
vertical-align: baseline;
|
|
19
|
+
background: transparent;
|
|
20
|
+
}
|
|
21
|
+
body {
|
|
22
|
+
line-height: 1;
|
|
23
|
+
}
|
|
24
|
+
ol, ul {
|
|
25
|
+
list-style: none;
|
|
26
|
+
}
|
|
27
|
+
blockquote, q {
|
|
28
|
+
quotes: none;
|
|
29
|
+
}
|
|
30
|
+
blockquote:before, blockquote:after,
|
|
31
|
+
q:before, q:after {
|
|
32
|
+
content: '';
|
|
33
|
+
content: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* remember to define focus styles! */
|
|
37
|
+
:focus {
|
|
38
|
+
outline: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* remember to highlight inserts somehow! */
|
|
42
|
+
ins {
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
}
|
|
45
|
+
del {
|
|
46
|
+
text-decoration: line-through;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* tables still need 'cellspacing="0"' in the markup */
|
|
50
|
+
table {
|
|
51
|
+
border-collapse: collapse;
|
|
52
|
+
border-spacing: 0;
|
|
53
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
pre.sh_sourceCode {
|
|
2
|
+
background-color: white;
|
|
3
|
+
color: black;
|
|
4
|
+
font-style: normal;
|
|
5
|
+
font-weight: normal;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
pre.sh_sourceCode .sh_keyword { color: blue; font-weight: bold; } /* language keywords */
|
|
9
|
+
pre.sh_sourceCode .sh_type { color: darkgreen; } /* basic types */
|
|
10
|
+
pre.sh_sourceCode .sh_usertype { color: teal; } /* user defined types */
|
|
11
|
+
pre.sh_sourceCode .sh_string { color: red; font-family: monospace; } /* strings and chars */
|
|
12
|
+
pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; } /* regular expressions */
|
|
13
|
+
pre.sh_sourceCode .sh_specialchar { color: pink; font-family: monospace; } /* e.g., \n, \t, \\ */
|
|
14
|
+
pre.sh_sourceCode .sh_comment { color: brown; font-style: italic; } /* comments */
|
|
15
|
+
pre.sh_sourceCode .sh_number { color: purple; } /* literal numbers */
|
|
16
|
+
pre.sh_sourceCode .sh_preproc { color: darkblue; font-weight: bold; } /* e.g., #include, import */
|
|
17
|
+
pre.sh_sourceCode .sh_symbol { color: darkred; } /* */
|
|
18
|
+
pre.sh_sourceCode .sh_function { color: black; font-weight: bold; } /* function calls and declarations */
|
|
19
|
+
pre.sh_sourceCode .sh_cbracket { color: red; } /* block brackets (e.g., {, }) */
|
|
20
|
+
pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: cyan; } /* TODO and FIXME */
|
|
21
|
+
|
|
22
|
+
/* Predefined variables and functions (for instance glsl) */
|
|
23
|
+
pre.sh_sourceCode .sh_predef_var { color: darkblue; }
|
|
24
|
+
pre.sh_sourceCode .sh_predef_func { color: darkblue; font-weight: bold; }
|
|
25
|
+
|
|
26
|
+
/* for OOP */
|
|
27
|
+
pre.sh_sourceCode .sh_classname { color: teal; }
|
|
28
|
+
|
|
29
|
+
/* line numbers (not yet implemented) */
|
|
30
|
+
pre.sh_sourceCode .sh_linenum { color: black; font-family: monospace; }
|
|
31
|
+
|
|
32
|
+
/* Internet related */
|
|
33
|
+
pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }
|
|
34
|
+
|
|
35
|
+
/* for ChangeLog and Log files */
|
|
36
|
+
pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
|
|
37
|
+
pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: darkblue; font-weight: bold; }
|
|
38
|
+
pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: darkgreen; }
|
|
39
|
+
|
|
40
|
+
/* for Prolog, Perl... */
|
|
41
|
+
pre.sh_sourceCode .sh_variable { color: darkgreen; }
|
|
42
|
+
|
|
43
|
+
/* for LaTeX */
|
|
44
|
+
pre.sh_sourceCode .sh_italics { color: darkgreen; font-style: italic; }
|
|
45
|
+
pre.sh_sourceCode .sh_bold { color: darkgreen; font-weight: bold; }
|
|
46
|
+
pre.sh_sourceCode .sh_underline { color: darkgreen; text-decoration: underline; }
|
|
47
|
+
pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
|
|
48
|
+
pre.sh_sourceCode .sh_argument { color: darkgreen; }
|
|
49
|
+
pre.sh_sourceCode .sh_optionalargument { color: purple; }
|
|
50
|
+
pre.sh_sourceCode .sh_math { color: orange; }
|
|
51
|
+
pre.sh_sourceCode .sh_bibtex { color: blue; }
|
|
52
|
+
|
|
53
|
+
/* for diffs */
|
|
54
|
+
pre.sh_sourceCode .sh_oldfile { color: orange; }
|
|
55
|
+
pre.sh_sourceCode .sh_newfile { color: darkgreen; }
|
|
56
|
+
pre.sh_sourceCode .sh_difflines { color: blue; }
|
|
57
|
+
|
|
58
|
+
/* for css */
|
|
59
|
+
pre.sh_sourceCode .sh_selector { color: purple; }
|
|
60
|
+
pre.sh_sourceCode .sh_property { color: blue; }
|
|
61
|
+
pre.sh_sourceCode .sh_value { color: darkgreen; font-style: italic; }
|
|
62
|
+
|
|
63
|
+
/* other */
|
|
64
|
+
pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
|
|
65
|
+
pre.sh_sourceCode .sh_paren { color: red; }
|
|
66
|
+
pre.sh_sourceCode .sh_attribute { color: darkgreen; }
|