slideshow 0.7.1 → 0.7.2
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/lib/slideshow.rb +43 -26
- metadata +2 -2
data/lib/slideshow.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
$KCODE="U"
|
2
|
+
|
1
3
|
require 'optparse'
|
2
4
|
require 'erb'
|
3
5
|
require 'redcloth'
|
@@ -12,7 +14,7 @@ require 'pp'
|
|
12
14
|
|
13
15
|
module Slideshow
|
14
16
|
|
15
|
-
VERSION = '0.7.
|
17
|
+
VERSION = '0.7.2'
|
16
18
|
|
17
19
|
class Params
|
18
20
|
|
@@ -109,6 +111,10 @@ class Opts
|
|
109
111
|
def manifest
|
110
112
|
get( 'manifest', 's6.txt' )
|
111
113
|
end
|
114
|
+
|
115
|
+
def output_path
|
116
|
+
get( 'output', '.' )
|
117
|
+
end
|
112
118
|
|
113
119
|
DEFAULTS =
|
114
120
|
{
|
@@ -264,29 +270,33 @@ class Gen
|
|
264
270
|
# fallback load builtin template packaged with gem
|
265
271
|
load_builtin_template( builtin )
|
266
272
|
end
|
267
|
-
|
268
|
-
def load_builtin_template_old_delete( name )
|
269
|
-
templatesdir = "#{File.dirname(__FILE__)}/templates"
|
270
|
-
logger.debug "templatesdir=#{templatesdir}"
|
271
|
-
|
272
|
-
File.read( "#{templatesdir}/#{name}" )
|
273
|
-
end
|
274
273
|
|
274
|
+
def with_output_path( dest, output_path )
|
275
|
+
dest_full = File.expand_path( dest, output_path )
|
276
|
+
logger.debug "dest_full=#{dest_full}"
|
277
|
+
|
278
|
+
# make sure dest path exists
|
279
|
+
dest_path = File.dirname( dest_full )
|
280
|
+
logger.debug "dest_path=#{dest_path}"
|
281
|
+
File.makedirs( dest_path ) unless File.directory? dest_path
|
282
|
+
dest_full
|
283
|
+
end
|
275
284
|
|
276
285
|
def create_slideshow_templates
|
277
286
|
logger.debug "manifest=#{opts.manifest}.gen"
|
278
287
|
manifest = load_manifest( opts.manifest+".gen" )
|
279
288
|
|
289
|
+
# expand output path in current dir and make sure output path exists
|
290
|
+
outpath = File.expand_path( opts.output_path )
|
291
|
+
logger.debug "outpath=#{outpath}"
|
292
|
+
File.makedirs( outpath ) unless File.directory? outpath
|
293
|
+
|
280
294
|
manifest.each do |entry|
|
281
295
|
dest = entry[0]
|
282
296
|
source = entry[1]
|
283
|
-
|
284
|
-
# make sure dirs exist
|
285
|
-
logger.debug "makedirs( #{File.dirname(dest)} )"
|
286
|
-
File.makedirs( File.dirname(dest) )
|
287
|
-
|
297
|
+
|
288
298
|
puts "Copying to #{dest} from #{source}..."
|
289
|
-
File.copy( source, dest )
|
299
|
+
File.copy( source, with_output_path( dest, outpath ) )
|
290
300
|
end
|
291
301
|
|
292
302
|
puts "Done."
|
@@ -298,8 +308,15 @@ class Gen
|
|
298
308
|
manifest = load_manifest( opts.manifest )
|
299
309
|
# pp manifest
|
300
310
|
|
311
|
+
# expand output path in current dir and make sure output path exists
|
312
|
+
outpath = File.expand_path( opts.output_path )
|
313
|
+
logger.debug "outpath=#{outpath}"
|
314
|
+
File.makedirs( outpath ) unless File.directory? outpath
|
315
|
+
|
316
|
+
dirname = File.dirname( fn )
|
301
317
|
basename = File.basename( fn, '.*' )
|
302
318
|
extname = File.extname( fn )
|
319
|
+
logger.debug "dirname=#{dirname}, basename=#{basename}, extname=#{extname}"
|
303
320
|
|
304
321
|
known_extnames = KNOWN_TEXTILE_EXTNAMES + KNOWN_MARKDOWN_EXTNAMES
|
305
322
|
|
@@ -307,8 +324,8 @@ class Gen
|
|
307
324
|
extname = ".textile" # default to .textile
|
308
325
|
|
309
326
|
known_extnames.each do |e|
|
310
|
-
logger.debug "File.exists? #{basename}#{e}"
|
311
|
-
if File.exists?( "#{basename}#{e}" ) then
|
327
|
+
logger.debug "File.exists? #{dirname}/#{basename}#{e}"
|
328
|
+
if File.exists?( "#{dirname}/#{basename}#{e}" ) then
|
312
329
|
extname = e
|
313
330
|
logger.debug "extname=#{extname}"
|
314
331
|
break
|
@@ -316,7 +333,7 @@ class Gen
|
|
316
333
|
end
|
317
334
|
end
|
318
335
|
|
319
|
-
inname = "#{basename}#{extname}"
|
336
|
+
inname = "#{dirname}/#{basename}#{extname}"
|
320
337
|
|
321
338
|
logger.debug "inname=#{inname}"
|
322
339
|
|
@@ -437,7 +454,7 @@ class Gen
|
|
437
454
|
outname = outname.gsub( '__file__', basename )
|
438
455
|
puts "Preparing #{outname}..."
|
439
456
|
|
440
|
-
out = File.new( outname, "w+" )
|
457
|
+
out = File.new( with_output_path( outname, outpath ), "w+" )
|
441
458
|
|
442
459
|
out << render_template( load_template( entry[1] ), params.params_binding )
|
443
460
|
|
@@ -452,13 +469,9 @@ class Gen
|
|
452
469
|
else # just copy verbatim if target/dest has no __file__ in name
|
453
470
|
dest = entry[0]
|
454
471
|
source = entry[1]
|
455
|
-
|
456
|
-
# make sure dirs exist
|
457
|
-
logger.debug "makedirs( #{File.dirname(dest)} )"
|
458
|
-
File.makedirs( File.dirname(dest) )
|
459
|
-
|
472
|
+
|
460
473
|
puts "Copying to #{dest} from #{source}..."
|
461
|
-
File.copy( source, dest )
|
474
|
+
File.copy( source, with_output_path( dest, outpath ) )
|
462
475
|
end
|
463
476
|
end
|
464
477
|
|
@@ -498,6 +511,9 @@ def run( args )
|
|
498
511
|
# opts.on( "-v", "--version", "Show version" ) {}
|
499
512
|
|
500
513
|
cmd.on( '-g', '--generate', 'Generate Slide Show Templates' ) { opts.put( 'generate', true ) }
|
514
|
+
|
515
|
+
cmd.on( '-o', '--output PATH', 'outputs to Path' ) { |s| opts.put( 'output', s ) }
|
516
|
+
|
501
517
|
# use -d or -o to select output directory for slideshow or slideshow templates?
|
502
518
|
# cmd.on( '-d', '--directory DIRECTORY', 'Output Directory' ) { |s| opts.put( 'directory', s ) }
|
503
519
|
# cmd.on( '-i', '--include PATH', 'Load Path' ) { |s| opts.put( 'include', s ) }
|
@@ -522,8 +538,9 @@ def run( args )
|
|
522
538
|
puts "Examples:"
|
523
539
|
puts " slideshow microformats"
|
524
540
|
puts " slideshow microformats.textile"
|
525
|
-
puts " slideshow -s5 microformats
|
526
|
-
puts " slideshow -f microformats
|
541
|
+
puts " slideshow -s5 microformats # S5 compatible"
|
542
|
+
puts " slideshow -f microformats # FullerScreen compatible"
|
543
|
+
puts " slideshow -o slides microformats # Output slideshow to slides folder"
|
527
544
|
puts
|
528
545
|
puts "More examles:"
|
529
546
|
puts " slideshow -g # Generate slide show templates"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slideshow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-27 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|