slideshow 1.2.0.beta2 → 1.2.0.beta3

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/config/slideshow.yml CHANGED
@@ -88,4 +88,11 @@ fetch:
88
88
  csss: https://github.com/geraldb/slideshow-csss/raw/master/csss.txt
89
89
  deck.js: https://github.com/geraldb/slideshow-deck.js/raw/master/deck.js.txt
90
90
  impress.js: https://github.com/geraldb/slideshow-impress.js/raw/master/impress.js.txt
91
- shower: https://github.com/geraldb/slideshow-shower/raw/master/shower.txt
91
+ shower: https://github.com/geraldb/slideshow-shower/raw/master/shower.txt
92
+
93
+ ###########################
94
+ # shortcuts for quick starter templates
95
+ quick:
96
+ slidy: https://github.com/geraldb/slideshow-slidy/raw/master/slidy.txt.quick
97
+ deck.js: https://github.com/geraldb/slideshow-deck.js/raw/master/deck.js.txt.quick
98
+ impress.js: https://github.com/geraldb/slideshow-impress.js/raw/master/impress.js.txt.quick
@@ -13,17 +13,26 @@ class Quick
13
13
  attr_reader :logger, :opts, :config
14
14
 
15
15
  def run
16
- manifest_name = 'welcome.txt.quick'
16
+ manifest_name = opts.quick_manifest
17
+
18
+ ### todo:fix: always download quickstart templates (except welcome?)
19
+ # how to make sure the won't go stale in the cache after the download?
17
20
 
18
21
  manifests = installed_quick_manifests
19
- matches = manifests.select { |m| m[0] == manifest_name }
22
+ matches = manifests.select { |m| m[0] == manifest_name+'.txt.quick' }
20
23
 
21
24
  if matches.empty?
22
- puts "*** error: unknown quick template manifest '#{manifest_name}'"
23
- # todo: list installed manifests
24
- exit 2
25
+ fetch_pak( manifest_name )
26
+
27
+ # retry
28
+ manifests = installed_quick_manifests
29
+ matches = manifests.select { |m| m[0] == manifest_name+'.txt.quick' }
30
+ if matches.empty?
31
+ puts "*** error: quickstart template #{manifest_name} not found"
32
+ exit 2
33
+ end
25
34
  end
26
-
35
+
27
36
  manifestsrc = matches[0][1]
28
37
  pakpath = opts.output_path
29
38
 
@@ -31,16 +40,60 @@ class Quick
31
40
 
32
41
  Pakman::Copier.new( logger ).copy_pak( manifestsrc, pakpath )
33
42
  end
43
+
44
+
45
+ def fetch_pak( shortcut )
46
+
47
+ src = config.map_quick_shortcut( shortcut )
48
+
49
+ if src.nil?
50
+ puts "*** error: no mapping found for quick shortcut '#{shortcut}'."
51
+ exit 2
52
+ end
53
+
54
+ puts " Mapping quick shortcut '#{shortcut}' to: #{src}"
55
+
56
+
57
+ # src = 'http://github.com/geraldb/slideshow/raw/d98e5b02b87ee66485431b1bee8fb6378297bfe4/code/templates/fullerscreen.txt'
58
+ # src = 'http://github.com/geraldb/sandbox/raw/13d4fec0908fbfcc456b74dfe2f88621614b5244/s5blank/s5blank.txt'
59
+ uri = URI.parse( src )
60
+ logger.debug "scheme: #{uri.scheme}, host: #{uri.host}, port: #{uri.port}, path: #{uri.path}"
61
+
62
+ basename = File.basename( uri.path, '.*' ) # e.g. fullerscreen (without extension)
63
+ logger.debug "basename: #{basename}"
64
+
65
+ #### fix: in find manifests
66
+ ## check for directories!!!
67
+ ## exclude directories in match
68
+
69
+
70
+ ## remove (.txt) in basename
71
+ pakpath = File.expand_path( "#{config.config_dir}/quick/#{basename.gsub('.txt','')}.quick" )
72
+ logger.debug "pakpath: #{pakpath}"
73
+
74
+
75
+ Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
76
+ end # method fetch_pak
34
77
 
35
78
  private
36
79
 
37
- def installed_quick_manifests
38
- # 1) search gem/templates
39
80
 
40
- patterns = [
81
+ def installed_quick_manifests
82
+ # 1) search config_dir/templates
83
+ # 2) search gem/templates
84
+
85
+ builtin_patterns = [
41
86
  "#{Slideshow.root}/templates/*.txt.quick"
42
87
  ]
88
+ config_patterns = [
89
+ "#{config.config_dir}/quick/*.txt.quick",
90
+ "#{config.config_dir}/quick/*/*.txt.quick"
91
+ ]
43
92
 
93
+ patterns = []
94
+ patterns += config_patterns
95
+ patterns += builtin_patterns
96
+
44
97
  Pakman::Finder.new( logger ).find_manifests( patterns )
45
98
  end
46
99
 
@@ -21,6 +21,14 @@ class Opts
21
21
  @quick == true
22
22
  end
23
23
 
24
+ def quick_manifest=(value)
25
+ @quick_manifest = value
26
+ end
27
+
28
+ def quick_manifest
29
+ @quick_manifest || 'welcome'
30
+ end
31
+
24
32
 
25
33
  def plugins=(boolean)
26
34
  @plugins = boolean
@@ -98,7 +98,10 @@ def run( args )
98
98
  cmd.on( '-g', '--generate', 'Generate Slide Show Templates (using built-in S6 Pack)' ) { opts.generate = true }
99
99
 
100
100
  ## fix:/todo: add generator for quickstart
101
- cmd.on( '-q', '--quick', 'Generate Quickstart Slide Show Sample') { opts.quick = true }
101
+ cmd.on( '-q', '--quick [MANIFEST]', "Generate Quickstart Slide Show Sample (default is #{opts.quick_manifest})") do |q|
102
+ opts.quick = true
103
+ opts.quick_manifest = q if q.nil? == false
104
+ end
102
105
 
103
106
  cmd.on( '-p', '--plugins', '(Debug) List Plugin Scripts in Load Path' ) { opts.plugins = true }
104
107
 
@@ -114,6 +114,11 @@ class Config
114
114
  @props.fetch_from_section( 'fetch', key, nil )
115
115
  end
116
116
 
117
+ def map_quick_shortcut( key )
118
+ ## todo: normalize key???
119
+ @props.fetch_from_section( 'quick', key, nil )
120
+ end
121
+
117
122
  def helper_renames
118
123
  ## NB: for now user cannot override/extent renames
119
124
  @props_builtin['helper']['renames']
@@ -1,3 +1,3 @@
1
1
  module Slideshow
2
- VERSION = '1.2.0.beta2'
2
+ VERSION = '1.2.0.beta3'
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideshow
3
3
  version: !ruby/object:Gem::Version
4
- hash: 604803290
4
+ hash: -971607871
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
9
  - 0
10
10
  - beta
11
- - 2
12
- version: 1.2.0.beta2
11
+ - 3
12
+ version: 1.2.0.beta3
13
13
  platform: ruby
14
14
  authors:
15
15
  - Gerald Bauer
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-06-18 00:00:00 Z
20
+ date: 2012-06-19 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: RedCloth