slideshow 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,7 +21,6 @@ lib/slideshow/filters/headers_filter.rb
21
21
  lib/slideshow/filters/slide_filter.rb
22
22
  lib/slideshow/filters/text_filter.rb
23
23
  lib/slideshow/headers.rb
24
- lib/slideshow/helpers/analytics_helper.rb
25
24
  lib/slideshow/helpers/background_helper.rb
26
25
  lib/slideshow/helpers/capture_helper.rb
27
26
  lib/slideshow/helpers/directive_helper.rb
@@ -74,21 +74,20 @@ rest:
74
74
 
75
75
 
76
76
  #############################
77
- # shortcuts for fetching template packs
77
+ # shortcuts for fetching template packs & plugins
78
78
  # map shortcut to URI
79
79
  fetch:
80
80
  s6syntax: https://raw.github.com/slideshow-s9/slideshow-s6-syntax-highlighter/master/s6syntax.txt
81
81
  s6blank: https://raw.github.com/slideshow-s9/slideshow-s6-blank/master/s6blank.txt
82
82
  s5blank: https://raw.github.com/slideshow-s9/slideshow-s5-blank/master/s5blank.txt
83
83
  s5themes: https://raw.github.com/slideshow-s9/slideshow-s5-themes/master/s5themes.txt
84
- fullerscreen: https://raw.github.com/slideshow-s9/slideshow-fullerscreen/master/fullerscreen.txt
85
84
  slidy: https://raw.github.com/slideshow-s9/slideshow-slidy/master/slidy.txt
86
85
  g5: https://raw.github.com/slideshow-s9/slideshow-google-html5-slides/master/g5.txt
87
- slippy: https://raw.github.com/slideshow-s9/slideshow-slippy/master/slippy.txt
88
86
  csss: https://raw.github.com/slideshow-s9/slideshow-csss/master/csss.txt
89
87
  deck.js: https://raw.github.com/slideshow-s9/slideshow-deck.js/master/deck.js.txt
90
88
  impress.js: https://raw.github.com/slideshow-s9/slideshow-impress.js/master/impress.js.txt
91
89
  shower: https://raw.github.com/slideshow-s9/slideshow-shower/master/shower.txt
90
+ analytics: https://raw.github.com/slideshow-s9/analytics/master/analytics.txt.plugin
92
91
 
93
92
  ###########################
94
93
  # shortcuts for quick starter templates
@@ -64,7 +64,6 @@ require 'slideshow/markup/markdown'
64
64
  # load built-in (required) helpers/plugins
65
65
  require 'slideshow/helpers/text_helper'
66
66
  require 'slideshow/helpers/capture_helper'
67
- require 'slideshow/helpers/analytics_helper'
68
67
  require 'slideshow/helpers/table_helper'
69
68
  require 'slideshow/helpers/step_helper'
70
69
  require 'slideshow/helpers/background_helper'
@@ -26,9 +26,9 @@ class Fetch
26
26
 
27
27
  ## check for builtin shortcut (assume no / or \)
28
28
  if src.index( '/' ).nil? && src.index( '\\' ).nil?
29
- shortcut = src.clone
29
+ shortcut = src.dup
30
30
  src = config.map_fetch_shortcut( src )
31
-
31
+
32
32
  if src.nil?
33
33
  puts "** Error: No mapping found for fetch shortcut '#{shortcut}'."
34
34
  return
@@ -37,7 +37,31 @@ class Fetch
37
37
  else
38
38
  shortcut = nil
39
39
  end
40
-
40
+
41
+ ## if manifest includes .plugin assume it's a plugin
42
+ if src.include?( '.plugin' )
43
+ fetch_plugin( src )
44
+ else # otherwise assume it's a template pack
45
+ fetch_template( src )
46
+
47
+ ###################################
48
+ ## step 2) if shortcut exists (auto include quickstarter manifest w/ same name/key)
49
+
50
+ if shortcut.present?
51
+
52
+ src = config.map_quick_shortcut( shortcut )
53
+ return if src.nil? # no shortcut found; sorry; returning (nothing more to do)
54
+
55
+ puts " Mapping quick shortcut '#{shortcut}' to: #{src}"
56
+
57
+ fetch_quick( src )
58
+ end
59
+ end
60
+
61
+ end # method run
62
+
63
+
64
+ def fetch_template( src )
41
65
  # src = 'http://github.com/geraldb/slideshow/raw/d98e5b02b87ee66485431b1bee8fb6378297bfe4/code/templates/fullerscreen.txt'
42
66
  # src = 'http://github.com/geraldb/sandbox/raw/13d4fec0908fbfcc456b74dfe2f88621614b5244/s5blank/s5blank.txt'
43
67
  uri = URI.parse( src )
@@ -50,31 +74,35 @@ class Fetch
50
74
  logger.debug "pakpath >#{pakpath}<"
51
75
 
52
76
  Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
77
+ end
78
+
79
+ def fetch_quick( src )
80
+ uri = URI.parse( src )
81
+ logger.debug "scheme: #{uri.scheme}, host: #{uri.host}, port: #{uri.port}, path: #{uri.path}"
53
82
 
54
- ###################################
55
- ## step 2) if shortcut exists (auto include quickstarter manifest w/ same name/key)
56
-
57
- if shortcut.present?
58
-
59
- src = config.map_quick_shortcut( shortcut )
60
- return if src.nil? # no shortcut found; sorry; returning (nothing more to do)
61
-
62
- puts " Mapping quick shortcut '#{shortcut}' to: #{src}"
83
+ # downcase basename w/ extension (remove .txt)
84
+ pakname = File.basename( uri.path ).downcase.gsub('.txt','')
85
+ pakpath = File.expand_path( "#{config.config_dir}/templates/#{pakname}" )
86
+
87
+ logger.debug "pakname >#{pakname}<"
88
+ logger.debug "pakpath >#{pakpath}<"
63
89
 
64
- uri = URI.parse( src )
65
- logger.debug "scheme: #{uri.scheme}, host: #{uri.host}, port: #{uri.port}, path: #{uri.path}"
90
+ Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
91
+ end
92
+
93
+ def fetch_plugin( src )
94
+ uri = URI.parse( src )
95
+ logger.debug "scheme: #{uri.scheme}, host: #{uri.host}, port: #{uri.port}, path: #{uri.path}"
66
96
 
67
- # downcase basename w/ extension (remove .txt)
68
- pakname = File.basename( uri.path ).downcase.gsub('.txt','')
69
- pakpath = File.expand_path( "#{config.config_dir}/templates/#{pakname}" )
97
+ # downcase basename w/ extension (remove .txt)
98
+ pakname = File.basename( uri.path ).downcase.gsub('.txt','').gsub('.plugin','')
99
+ pakpath = File.expand_path( "#{config.config_dir}/plugins/#{pakname}" )
70
100
 
71
- logger.debug "pakname >#{pakname}<"
72
- logger.debug "pakpath >#{pakpath}<"
101
+ logger.debug "pakname >#{pakname}<"
102
+ logger.debug "pakpath >#{pakpath}<"
73
103
 
74
- Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
75
- end
76
-
77
- end # method run
104
+ Pakman::Fetcher.new( logger ).fetch_pak( src, pakpath )
105
+ end
78
106
 
79
107
  end # class Fetch
80
108
 
@@ -19,7 +19,21 @@ class List
19
19
  home = Env.home
20
20
  ## replace home w/ ~ (to make out more readable (shorter))
21
21
  ## e.g. use gsub( home, '~' )
22
-
22
+
23
+ puts ''
24
+ puts 'Installed plugins in search path'
25
+
26
+ installed_plugin_manifest_patterns.each_with_index do |pattern,i|
27
+ puts " [#{i+1}] #{pattern.gsub(home,'~')}"
28
+ end
29
+ puts ' include:'
30
+
31
+ installed_plugin_manifests.each do |manifest|
32
+ pakname = manifest[0].gsub('.txt','').gsub('.plugin','')
33
+ manifestpath = manifest[1].gsub(home,'~')
34
+ puts "%16s (%s)" % [pakname,manifestpath]
35
+ end
36
+
23
37
  puts ''
24
38
  puts 'Installed quickstarter packs in search path'
25
39
 
@@ -16,14 +16,18 @@ class Plugins
16
16
  attr_reader :opts, :config
17
17
 
18
18
  def run
19
+ home = Env.home
20
+ ## replace home w/ ~ (to make out more readable (shorter))
21
+ ## e.g. use gsub( home, '~' )
22
+
19
23
  puts ''
20
24
  puts 'Plugin scripts on the load path'
21
25
 
22
26
  find_plugin_patterns.each_with_index do |pattern,i|
23
- puts " [#{i+1}] #{pattern}"
27
+ puts " [#{i+1}] #{pattern.gsub(home,'~')}"
24
28
  end
25
29
  puts ' include:'
26
-
30
+
27
31
  plugins = find_plugins
28
32
  if plugins.empty?
29
33
  puts " -- none --"
@@ -31,7 +35,7 @@ class Plugins
31
35
  plugins.each do |plugin|
32
36
  ## NB: use full_path - since Ruby 1.9.2 - ./ no longer included in load path for security
33
37
  plugin_fullpath = File.expand_path( plugin )
34
- puts " #{plugin} (#{plugin_fullpath})"
38
+ puts " #{plugin.gsub(home,'~')} (#{plugin_fullpath})"
35
39
  end
36
40
  end
37
41
  end
@@ -3,7 +3,30 @@ module Slideshow
3
3
  module ManifestHelper
4
4
 
5
5
  ## shared methods for handling manifest lookups
6
-
6
+
7
+ def installed_plugin_manifest_patterns
8
+ # 1) search ./plugins
9
+ # 2) search config_dir/plugins
10
+
11
+ config_patterns = [
12
+ "#{config.config_dir}/plugins/*.{txt.plugin,plugin.txt}",
13
+ "#{config.config_dir}/plugins/*/*.{txt.plugin,plugin.txt}"
14
+ ]
15
+ current_patterns = [
16
+ "plugins/*.{txt.plugin,plugin.txt}",
17
+ "plugins/*/*.{txt.plugin,plugin.txt}"
18
+ ]
19
+
20
+ patterns = []
21
+ patterns += current_patterns
22
+ patterns += config_patterns
23
+ end
24
+
25
+ def installed_plugin_manifests # quickstarter templates
26
+ Pakman::Finder.new( logger ).find_manifests( installed_plugin_manifest_patterns )
27
+ end
28
+
29
+
7
30
  def installed_template_manifest_patterns
8
31
  # 1) search ./templates
9
32
  # 2) search config_dir/templates
@@ -4,7 +4,24 @@ module PluginHelper
4
4
 
5
5
  def find_plugin_patterns
6
6
  patterns = []
7
+
8
+ ###
9
+ # todo/fix: only include rb files listed in plugin manifests!
10
+ # - for now load all ruby files in plugins folder
11
+
12
+ patterns << "#{config.config_dir}/plugins/**/*.rb"
13
+
14
+ ######
15
+ # also allow "ad-hoc" plugins e.g. no manifest required (not installed)
16
+ # just ruby scripts in lib in config folder or working folder
17
+
7
18
  patterns << "#{config.config_dir}/lib/**/*.rb"
19
+
20
+ #########
21
+ # todo/fix: only include rb files listed in plugin manifest (see above!)
22
+
23
+ patterns << 'plugins/**/*.rb'
24
+
8
25
  patterns << 'lib/**/*.rb' unless Slideshow.root == File.expand_path( '.' ) # don't include lib if we are in repo (don't include slideshow/lib)
9
26
  patterns
10
27
  end
@@ -1,3 +1,3 @@
1
1
  module Slideshow
2
- VERSION = '2.0.1'
2
+ VERSION = '2.1.0'
3
3
  end
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: 2.0.1
4
+ version: 2.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-21 00:00:00.000000000 Z
12
+ date: 2013-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: props
16
- requirement: &83862160 !ruby/object:Gem::Requirement
16
+ requirement: &84739570 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *83862160
24
+ version_requirements: *84739570
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: markdown
27
- requirement: &83861940 !ruby/object:Gem::Requirement
27
+ requirement: &84739350 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *83861940
35
+ version_requirements: *84739350
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: textutils
38
- requirement: &83861720 !ruby/object:Gem::Requirement
38
+ requirement: &84739130 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.2.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *83861720
46
+ version_requirements: *84739130
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: pakman
49
- requirement: &83861500 !ruby/object:Gem::Requirement
49
+ requirement: &84738910 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.4.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *83861500
57
+ version_requirements: *84738910
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activesupport
60
- requirement: &83861290 !ruby/object:Gem::Requirement
60
+ requirement: &84738700 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 3.2.6
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *83861290
68
+ version_requirements: *84738700
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: RedCloth
71
- requirement: &83861070 !ruby/object:Gem::Requirement
71
+ requirement: &84738480 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 4.2.9
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *83861070
79
+ version_requirements: *84738480
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: logutils
82
- requirement: &83860850 !ruby/object:Gem::Requirement
82
+ requirement: &84731960 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.6.0
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *83860850
90
+ version_requirements: *84731960
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: gli
93
- requirement: &83860630 !ruby/object:Gem::Requirement
93
+ requirement: &84731560 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 2.5.6
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *83860630
101
+ version_requirements: *84731560
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rdoc
104
- requirement: &83860410 !ruby/object:Gem::Requirement
104
+ requirement: &84731160 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '3.10'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *83860410
112
+ version_requirements: *84731160
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: hoe
115
- requirement: &83860190 !ruby/object:Gem::Requirement
115
+ requirement: &84730420 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '3.3'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *83860190
123
+ version_requirements: *84730420
124
124
  description: ! "The Slide Show (S9) Ruby gem lets you create slide shows and author
125
125
  slides in plain text\r\nusing a wiki-style markup language that's easy-to-write
126
126
  and easy-to-read.\r\nThe Slide Show (S9) project also collects and welcomes themes
@@ -165,7 +165,6 @@ files:
165
165
  - lib/slideshow/filters/slide_filter.rb
166
166
  - lib/slideshow/filters/text_filter.rb
167
167
  - lib/slideshow/headers.rb
168
- - lib/slideshow/helpers/analytics_helper.rb
169
168
  - lib/slideshow/helpers/background_helper.rb
170
169
  - lib/slideshow/helpers/capture_helper.rb
171
170
  - lib/slideshow/helpers/directive_helper.rb
@@ -1,42 +0,0 @@
1
- module Slideshow
2
- module AnalyticsHelper
3
-
4
-
5
- def google_analytics( opts = {} )
6
-
7
- # if no user account code (e.g. UA-397343-10) passed along use
8
- # code from *.yml settings
9
- code = opts.fetch( :code, config.google_analytics_code )
10
-
11
- puts " Adding JavaScript for Google Analytics tracker (#{code})..."
12
-
13
- text = <<EOS
14
- <!-- begin google-analytics #{opts.inspect} -->
15
- <script type="text/javascript">
16
-
17
- var _gaq = _gaq || [];
18
- _gaq.push(['_setAccount', '#{code}']);
19
- _gaq.push(['_trackPageview']);
20
-
21
- (function() {
22
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
23
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
24
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
25
- })();
26
-
27
- </script>
28
- <!-- end google-analytics -->
29
- EOS
30
-
31
- guard_block( text )
32
- end
33
-
34
-
35
- end # module AnalyticsHelper
36
- end # module Slideshow
37
-
38
-
39
- class Slideshow::Gen
40
- include Slideshow::AnalyticsHelper
41
- end
42
-