slideshow 1.2.0.beta3 → 1.2.0.beta4

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/Rakefile CHANGED
@@ -17,7 +17,8 @@ Hoe.spec 'slideshow' do
17
17
  ['markdown','>= 0.4.0'],
18
18
  ['textutils','>= 0.2.0'],
19
19
  ['props','>= 0.2.0'],
20
- ['pakman','>= 0.1.0']
20
+ ['pakman','>= 0.2.0'],
21
+ ['activesupport', '>= 3.2.6']
21
22
  ]
22
23
 
23
24
  # switch extension to .markdown for gihub formatting
@@ -77,22 +77,22 @@ rest:
77
77
  # shortcuts for fetching template packs
78
78
  # map shortcut to URI
79
79
  fetch:
80
- s6syntax: https://github.com/geraldb/slideshow-s6-syntax-highlighter/raw/master/s6syntax.txt
81
- s6blank: https://github.com/geraldb/slideshow-s6-blank/raw/master/s6blank.txt
82
- s5blank: https://github.com/geraldb/slideshow-s5-blank/raw/master/s5blank.txt
83
- s5themes: https://github.com/geraldb/slideshow-s5-themes/raw/master/s5themes.txt
84
- fullerscreen: https://github.com/geraldb/slideshow-fullerscreen/raw/master/fullerscreen.txt
85
- slidy: https://github.com/geraldb/slideshow-slidy/raw/master/slidy.txt
86
- g5: https://github.com/geraldb/slideshow-google-html5-slides/raw/master/g5.txt
87
- slippy: https://github.com/geraldb/slideshow-slippy/raw/master/slippy.txt
88
- csss: https://github.com/geraldb/slideshow-csss/raw/master/csss.txt
89
- deck.js: https://github.com/geraldb/slideshow-deck.js/raw/master/deck.js.txt
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
80
+ s6syntax: https://raw.github.com/geraldb/slideshow-s6-syntax-highlighter/master/s6syntax.txt
81
+ s6blank: https://raw.github.com/geraldb/slideshow-s6-blank/master/s6blank.txt
82
+ s5blank: https://raw.github.com/geraldb/slideshow-s5-blank/master/s5blank.txt
83
+ s5themes: https://raw.github.com/geraldb/slideshow-s5-themes/master/s5themes.txt
84
+ fullerscreen: https://raw.github.com/geraldb/slideshow-fullerscreen/master/fullerscreen.txt
85
+ slidy: https://raw.github.com/geraldb/slideshow-slidy/master/slidy.txt
86
+ g5: https://raw.github.com/geraldb/slideshow-google-html5-slides/master/g5.txt
87
+ slippy: https://raw.github.com/geraldb/slideshow-slippy/master/slippy.txt
88
+ csss: https://raw.github.com/geraldb/slideshow-csss/master/csss.txt
89
+ deck.js: https://raw.github.com/geraldb/slideshow-deck.js/master/deck.js.txt
90
+ impress.js: https://raw.github.com/geraldb/slideshow-impress.js/master/impress.js.txt
91
+ shower: https://raw.github.com/geraldb/slideshow-shower/master/shower.txt
92
92
 
93
93
  ###########################
94
94
  # shortcuts for quick starter templates
95
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
96
+ slidy: https://raw.github.com/geraldb/slideshow-slidy/master/slidy.txt.quick
97
+ deck.js: https://raw.github.com/geraldb/slideshow-deck.js/master/deck.js.txt.quick
98
+ impress.js: https://raw.github.com/geraldb/slideshow-impress.js/master/impress.js.txt.quick
@@ -22,6 +22,8 @@ require 'yaml'
22
22
  require 'cgi'
23
23
 
24
24
  # required gems
25
+ require 'active_support/all'
26
+
25
27
  require 'redcloth' # default textile library
26
28
  require 'markdown' # default markdown library
27
29
  require 'fetcher' # fetch docs and blogs via http, https, etc.
@@ -28,6 +28,8 @@ class Fetch
28
28
  return
29
29
  end
30
30
  puts " Mapping fetch shortcut '#{shortcut}' to: #{src}"
31
+ else
32
+ shortcut = nil
31
33
  end
32
34
 
33
35
  # src = 'http://github.com/geraldb/slideshow/raw/d98e5b02b87ee66485431b1bee8fb6378297bfe4/code/templates/fullerscreen.txt'
@@ -35,19 +37,39 @@ class Fetch
35
37
  uri = URI.parse( src )
36
38
  logger.debug "scheme: #{uri.scheme}, host: #{uri.host}, port: #{uri.port}, path: #{uri.path}"
37
39
 
38
- basename = File.basename( uri.path, '.*' ) # e.g. fullerscreen (without extension)
39
- logger.debug "basename: #{basename}"
40
-
41
- pakpath = File.expand_path( "#{config.config_dir}/templates/#{basename}" )
42
- logger.debug "pakpath: #{pakpath}"
40
+ pakname = File.basename( uri.path ).downcase.gsub('.txt','')
41
+ pakpath = File.expand_path( "#{config.config_dir}/templates/#{pakname}" )
42
+
43
+ logger.debug "packname >#{pakname}<"
44
+ logger.debug "pakpath >#{pakpath}<"
45
+
46
+ Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
47
+
48
+ ###################################
49
+ ## step 2) if shortcut exists (auto include quickstarter manifest w/ same name/key)
50
+
51
+ if shortcut.present?
52
+
53
+ src = config.map_quick_shortcut( shortcut )
54
+ return if src.nil? # no shortcut found; sorry; returning (nothing more to do)
55
+
56
+ puts " Mapping quick shortcut '#{shortcut}' to: #{src}"
43
57
 
44
- ## note: code moved to its own gem, that is, pakman
45
- ## see https://github.com/geraldb/pakman
58
+ uri = URI.parse( src )
59
+ logger.debug "scheme: #{uri.scheme}, host: #{uri.host}, port: #{uri.port}, path: #{uri.path}"
60
+
61
+ # downcase basename w/ extension (remove .txt)
62
+ pakname = File.basename( uri.path ).downcase.gsub('.txt','')
63
+ pakpath = File.expand_path( "#{config.config_dir}/templates/#{pakname}" )
64
+
65
+ logger.debug "pakname >#{pakname}<"
66
+ logger.debug "pakpath >#{pakpath}<"
46
67
 
47
- Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
68
+ Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
69
+ end
70
+
48
71
  end # method run
49
72
 
50
-
51
73
  end # class Fetch
52
74
 
53
75
  end # module Slideshow
@@ -159,8 +159,9 @@ class Gen
159
159
  manifest_path_or_name = opts.manifest
160
160
 
161
161
  # add .txt file extension if missing (for convenience)
162
- manifest_path_or_name << ".txt" if File.extname( manifest_path_or_name ).empty?
163
-
162
+ if manifest_path_or_name.downcase.ends_with?( '.txt' ) == false
163
+ manifest_path_or_name << '.txt'
164
+ end
164
165
 
165
166
  logger.debug "manifest=#{manifest_path_or_name}"
166
167
 
@@ -14,13 +14,13 @@ class GenTemplates
14
14
  attr_reader :logger, :opts, :config
15
15
 
16
16
  def run
17
- manifest_name = opts.manifest
17
+ manifest_name = opts.manifest.gsub( '.txt', '' ) # remove (optional) .txt ending
18
18
  logger.debug "manifest=#{manifest_name}"
19
19
 
20
20
  manifests = installed_generator_manifests
21
21
 
22
22
  # check for builtin generator manifests
23
- matches = manifests.select { |m| m[0] == manifest_name+".gen" }
23
+ matches = manifests.select { |m| m[0] == manifest_name+'.txt.gen' }
24
24
 
25
25
  if matches.empty?
26
26
  puts "*** error: unknown template manifest '#{manifest_name}'"
@@ -15,19 +15,39 @@ class List
15
15
  attr_reader :logger, :opts, :config
16
16
 
17
17
  def run
18
- manifests = installed_template_manifests
18
+ home = Env.home
19
+ ## replace home w/ ~ (to make out more readable (shorter))
20
+ ## e.g. use gsub( home, '~' )
19
21
 
22
+ puts ''
23
+ puts 'Installed quickstarter packs in search path'
24
+
25
+ installed_quick_manifest_patterns.each_with_index do |pattern,i|
26
+ puts " [#{i+1}] #{pattern.gsub(home,'~')}"
27
+ end
28
+ puts ' include:'
29
+
30
+ installed_quick_manifests.each do |manifest|
31
+ pakname = manifest[0].gsub('.txt','').gsub('.quick','')
32
+ manifestpath = manifest[1].gsub(home,'~')
33
+ puts "%16s (%s)" % [pakname,manifestpath]
34
+ end
35
+
36
+
20
37
  puts ''
21
38
  puts 'Installed template packs in search path'
22
39
 
23
40
  installed_template_manifest_patterns.each_with_index do |pattern,i|
24
- puts " [#{i+1}] #{pattern}"
41
+ puts " [#{i+1}] #{pattern.gsub(home,'~')}"
25
42
  end
26
43
  puts ' include:'
27
44
 
28
- manifests.each do |manifest|
29
- puts "%16s (%s)" % [manifest[0], manifest[1]]
45
+ installed_template_manifests.each do |manifest|
46
+ pakname = manifest[0].gsub('.txt','')
47
+ manifestpath = manifest[1].gsub(home,'~')
48
+ puts "%16s (%s)" % [pakname,manifestpath]
30
49
  end
50
+
31
51
  end
32
52
 
33
53
  end # class List
@@ -2,6 +2,8 @@ module Slideshow
2
2
 
3
3
  class Quick
4
4
 
5
+ include ManifestHelper
6
+
5
7
  ### fix: remove opts, use config (wrapped!!)
6
8
 
7
9
  def initialize( logger, opts, config )
@@ -13,20 +15,20 @@ class Quick
13
15
  attr_reader :logger, :opts, :config
14
16
 
15
17
  def run
16
- manifest_name = opts.quick_manifest
18
+ manifest_name = opts.quick_manifest.gsub('.txt','').gsub('.quick','') # make sure we get name w/o .quick and .txt extension
17
19
 
18
20
  ### todo:fix: always download quickstart templates (except welcome?)
19
21
  # how to make sure the won't go stale in the cache after the download?
20
22
 
21
23
  manifests = installed_quick_manifests
22
- matches = manifests.select { |m| m[0] == manifest_name+'.txt.quick' }
24
+ matches = manifests.select { |m| (m[0] == manifest_name+'.txt.quick') || (m[0] == manifest_name+'.quick.txt') }
23
25
 
24
26
  if matches.empty?
25
- fetch_pak( manifest_name )
27
+ fetch_pak( manifest_name )
26
28
 
27
29
  # retry
28
30
  manifests = installed_quick_manifests
29
- matches = manifests.select { |m| m[0] == manifest_name+'.txt.quick' }
31
+ matches = manifests.select { |m| (m[0] == manifest_name+'.txt.quick') || (m[0] == manifest_name+'.quick.txt') }
30
32
  if matches.empty?
31
33
  puts "*** error: quickstart template #{manifest_name} not found"
32
34
  exit 2
@@ -41,6 +43,8 @@ class Quick
41
43
  Pakman::Copier.new( logger ).copy_pak( manifestsrc, pakpath )
42
44
  end
43
45
 
46
+ ## todo rename to fetch_quick_pak??
47
+ ## share/use same code in fetch too??
44
48
 
45
49
  def fetch_pak( shortcut )
46
50
 
@@ -59,43 +63,14 @@ class Quick
59
63
  uri = URI.parse( src )
60
64
  logger.debug "scheme: #{uri.scheme}, host: #{uri.host}, port: #{uri.port}, path: #{uri.path}"
61
65
 
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
-
66
+ pakname = File.basename( uri.path ).downcase.gsub('.txt','')
67
+ pakpath = File.expand_path( "#{config.config_dir}/templates/#{pakname}" )
68
+
69
+ logger.debug "pakname >#{pakname}<"
70
+ logger.debug "pakpath >#{pakpath}<"
74
71
 
75
72
  Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
76
73
  end # method fetch_pak
77
74
 
78
- private
79
-
80
-
81
- def installed_quick_manifests
82
- # 1) search config_dir/templates
83
- # 2) search gem/templates
84
-
85
- builtin_patterns = [
86
- "#{Slideshow.root}/templates/*.txt.quick"
87
- ]
88
- config_patterns = [
89
- "#{config.config_dir}/quick/*.txt.quick",
90
- "#{config.config_dir}/quick/*/*.txt.quick"
91
- ]
92
-
93
- patterns = []
94
- patterns += config_patterns
95
- patterns += builtin_patterns
96
-
97
- Pakman::Finder.new( logger ).find_manifests( patterns )
98
- end
99
-
100
75
  end # class GenTemplates
101
76
  end # module Slideshow
@@ -90,7 +90,7 @@ class Opts
90
90
  end
91
91
 
92
92
  def manifest
93
- @manifest || 's6.txt'
93
+ @manifest || 's6'
94
94
  end
95
95
 
96
96
  def config_path=(value)
@@ -18,21 +18,54 @@ module ManifestHelper
18
18
  ]
19
19
  current_patterns = [
20
20
  "templates/*.txt",
21
- "templates/*/*.txt"
21
+ "templates/*/*.txt" # todo: use all in one line? {*.txt,*/*.txt} does it work?
22
22
  ]
23
23
 
24
24
  patterns = []
25
25
  patterns += current_patterns unless Slideshow.root == File.expand_path( '.' ) # don't include working dir if we test code from repo (don't include slideshow/templates)
26
26
  patterns += config_patterns
27
- patterns += builtin_patterns
27
+ patterns += builtin_patterns
28
28
  end
29
29
 
30
30
  def installed_template_manifests
31
31
  ## note: code moved to its own gem, that is, pakman
32
32
  ## see https://github.com/geraldb/pakman
33
33
 
34
- Pakman::Finder.new( logger ).find_manifests( installed_template_manifest_patterns )
34
+ ## exclude manifest.txt/i (avoid confusion w/ ruby gem manifest; not a specific name anyway)
35
+ ## also exclude patterns for quickstarter templates
36
+
37
+ excludes = [
38
+ 'manifest.txt',
39
+ '*/manifest.txt',
40
+ '*.{txt.quick,quick.txt}',
41
+ '*/*.{txt.quick,quick.txt}'
42
+ ]
43
+
44
+ Pakman::Finder.new( logger ).find_manifests( installed_template_manifest_patterns, excludes )
35
45
  end
46
+
47
+
48
+ def installed_quick_manifest_patterns
49
+ # 1) search config_dir/templates
50
+ # 2) search gem/templates
51
+
52
+ builtin_patterns = [
53
+ "#{Slideshow.root}/templates/*.{txt.quick,quick.txt}"
54
+ ]
55
+ config_patterns = [
56
+ "#{config.config_dir}/templates/*.{txt.quick,quick.txt}",
57
+ "#{config.config_dir}/templates/*/*.{txt.quick,quick.txt}"
58
+ ]
36
59
 
60
+ patterns = []
61
+ patterns += config_patterns
62
+ patterns += builtin_patterns
63
+ end
64
+
65
+ def installed_quick_manifests # quickstarter templates
66
+ Pakman::Finder.new( logger ).find_manifests( installed_quick_manifest_patterns )
67
+ end
68
+
69
+
37
70
  end # module Manifest
38
71
  end # module Slideshow
@@ -1,3 +1,3 @@
1
1
  module Slideshow
2
- VERSION = '1.2.0.beta3'
2
+ VERSION = '1.2.0.beta4'
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: -971607871
4
+ hash: 811109185
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
9
  - 0
10
10
  - beta
11
- - 3
12
- version: 1.2.0.beta3
11
+ - 4
12
+ version: 1.2.0.beta4
13
13
  platform: ruby
14
14
  authors:
15
15
  - Gerald Bauer
@@ -91,18 +91,34 @@ dependencies:
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- hash: 27
94
+ hash: 23
95
95
  segments:
96
96
  - 0
97
- - 1
97
+ - 2
98
98
  - 0
99
- version: 0.1.0
99
+ version: 0.2.0
100
100
  type: :runtime
101
101
  version_requirements: *id005
102
102
  - !ruby/object:Gem::Dependency
103
- name: rdoc
103
+ name: activesupport
104
104
  prerelease: false
105
105
  requirement: &id006 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ hash: 3
111
+ segments:
112
+ - 3
113
+ - 2
114
+ - 6
115
+ version: 3.2.6
116
+ type: :runtime
117
+ version_requirements: *id006
118
+ - !ruby/object:Gem::Dependency
119
+ name: rdoc
120
+ prerelease: false
121
+ requirement: &id007 !ruby/object:Gem::Requirement
106
122
  none: false
107
123
  requirements:
108
124
  - - ~>
@@ -113,11 +129,11 @@ dependencies:
113
129
  - 10
114
130
  version: "3.10"
115
131
  type: :development
116
- version_requirements: *id006
132
+ version_requirements: *id007
117
133
  - !ruby/object:Gem::Dependency
118
134
  name: hoe
119
135
  prerelease: false
120
- requirement: &id007 !ruby/object:Gem::Requirement
136
+ requirement: &id008 !ruby/object:Gem::Requirement
121
137
  none: false
122
138
  requirements:
123
139
  - - ~>
@@ -128,7 +144,7 @@ dependencies:
128
144
  - 0
129
145
  version: "3.0"
130
146
  type: :development
131
- version_requirements: *id007
147
+ version_requirements: *id008
132
148
  description: |-
133
149
  The Slide Show (S9) Ruby gem lets you create slide shows and author slides in plain text
134
150
  using a wiki-style markup language that's easy-to-write and easy-to-read.