slideshow 1.2.5 → 2.0.0

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.
@@ -12,8 +12,9 @@ lib/slideshow/cli/commands/gen_templates.rb
12
12
  lib/slideshow/cli/commands/list.rb
13
13
  lib/slideshow/cli/commands/plugins.rb
14
14
  lib/slideshow/cli/commands/quick.rb
15
+ lib/slideshow/cli/main.rb
16
+ lib/slideshow/cli/main_utils.rb
15
17
  lib/slideshow/cli/opts.rb
16
- lib/slideshow/cli/runner.rb
17
18
  lib/slideshow/config.rb
18
19
  lib/slideshow/filters/debug_filter.rb
19
20
  lib/slideshow/filters/headers_filter.rb
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ Hoe.spec 'slideshow' do
10
10
 
11
11
  self.author = 'Gerald Bauer'
12
12
  self.email = 'webslideshow@googlegroups.com'
13
-
13
+
14
14
  self.extra_deps = [
15
15
  ['props','>= 1.0.0'],
16
16
  ['markdown','>= 1.0.0'],
@@ -18,7 +18,8 @@ Hoe.spec 'slideshow' do
18
18
  ['pakman','>= 0.4.0'],
19
19
  ['activesupport', '>= 3.2.6'],
20
20
  ['RedCloth','>= 4.2.9'],
21
- ['logutils','>=0.6.0']
21
+ ['logutils','>= 0.6.0'],
22
+ ['gli', '>= 2.5.6']
22
23
  ]
23
24
 
24
25
  # switch extension to .markdown for gihub formatting
@@ -3,3 +3,4 @@
3
3
  require 'slideshow'
4
4
 
5
5
  Slideshow.main
6
+
@@ -50,7 +50,6 @@ require 'slideshow/plugin_helpers'
50
50
  require 'slideshow/slide'
51
51
 
52
52
  require 'slideshow/cli/opts'
53
- require 'slideshow/cli/runner'
54
53
  require 'slideshow/cli/commands/fetch'
55
54
  require 'slideshow/cli/commands/gen'
56
55
  require 'slideshow/cli/commands/gen_templates'
@@ -94,7 +93,7 @@ module Slideshow
94
93
  end
95
94
 
96
95
 
97
- def self.main
96
+ def self.main_old
98
97
 
99
98
  # allow env variable to set RUBYOPT-style default command line options
100
99
  # e.g. -o slides -t <your_template_manifest_here>
@@ -107,6 +106,12 @@ module Slideshow
107
106
  Runner.new.run(args)
108
107
  end
109
108
 
109
+ def self.main
110
+ require 'slideshow/cli/main'
111
+ ## Runner.new.run(ARGV) - old code
112
+ end
113
+
114
+
110
115
  end # module Slideshow
111
116
 
112
117
  # load built-in (optional) helpers/plugins/engines
@@ -14,18 +14,13 @@ class Fetch
14
14
  attr_reader :opts, :config
15
15
 
16
16
 
17
- def run
18
- if opts.fetch_all?
19
- config.default_fetch_shortcuts.keys.each do |shortcut|
20
- fetch_pak( shortcut )
21
- end
22
- else
23
- fetch_pak( opts.fetch_uri )
17
+ def fetch_all
18
+ config.default_fetch_shortcuts.keys.each do |shortcut|
19
+ fetch( shortcut )
24
20
  end
25
21
  end
26
22
 
27
- private
28
- def fetch_pak( src )
23
+ def fetch( src )
29
24
 
30
25
  logger.debug "src=>#{src}<"
31
26
 
@@ -0,0 +1,267 @@
1
+ # encoding: utf-8
2
+
3
+
4
+ require 'gli'
5
+
6
+ require 'slideshow/cli/main_utils'
7
+
8
+
9
+ include GLI::App
10
+
11
+ program_desc 'Slide Show (S9) - a free web alternative to PowerPoint and Keynote in Ruby'
12
+
13
+ version Slideshow::VERSION
14
+
15
+
16
+ ## some setup code
17
+
18
+ LogUtils::Logger.root.level = :info # set logging level to info
19
+
20
+ logger = LogUtils::Logger.root
21
+
22
+ opts = Slideshow::Opts.new
23
+ config = Slideshow::Config.new( opts )
24
+ headers = Slideshow::Headers.new( config ) ## NB: needed for build - move into build - why? why not?
25
+
26
+
27
+ config.load
28
+
29
+
30
+ ## gets all merged in one paragraph - does not honor whitespace
31
+ xxx_program_long_desc = <<EOS
32
+
33
+ Slide Show (S9) is a free web alternative to PowerPoint or Keynote in Ruby
34
+
35
+ Examples:
36
+ slideshow microformats
37
+ slideshow microformats.text # Process slides using Markdown (#{config.known_markdown_extnames.join(', ')})
38
+ slideshow microformats.textile # Process slides using Textile (#{config.known_textile_extnames.join(', ')})
39
+ slideshow microformats.rst # Process slides using reStructuredText (#{config.known_rest_extnames.join(', ')})
40
+ slideshow -o slides microformats # Output slideshow to slides folder
41
+
42
+ More examles:
43
+ slideshow -q # Generate quickstart slide show sample
44
+ slideshow -g # Generate slide show templates using built-in S6 pack
45
+
46
+ slideshow -l # List installed slide show templates
47
+ slideshow -f s5blank # Fetch (install) S5 blank starter template from internet
48
+ slideshow -t s5blank microformats # Use your own slide show templates (e.g. s5blank)
49
+
50
+ Further information:
51
+ http://slideshow-s9.github.io
52
+
53
+ EOS
54
+
55
+
56
+ ## "global" options (switches/flags)
57
+
58
+ desc '(Debug) Show debug messages'
59
+ switch [:verbose], negatable: false ## todo: use -w for short form? check ruby interpreter if in use too?
60
+
61
+ desc 'Only show warnings, errors and fatal messages'
62
+ switch [:q, :quiet], negatable: false
63
+
64
+
65
+ desc 'Configuration Path'
66
+ arg_name 'PATH'
67
+ default_value opts.config_path
68
+ flag [:c, :config]
69
+
70
+
71
+ desc 'Build slideshow'
72
+ arg_name 'FILE', multiple: true ## todo/fix: check multiple will not print typeo???
73
+ command [:build, :b] do |c|
74
+
75
+ # cmd.on( '--header NUM', 'Header Level (default is 1)' ) do |n|
76
+ # opts.header_level = n.to_i
77
+ # end
78
+
79
+
80
+ # ?? opts.on( "-s", "--style STYLE", "Select Stylesheet" ) { |s| $options[:style]=s }
81
+
82
+ # ?? cmd.on( '-i', '--include PATH', 'Load Path' ) { |s| opts.put( 'include', s ) }
83
+
84
+
85
+ c.desc 'Set Header Level to 1 (default)'
86
+ c.switch [:h1], negatable: false # todo: add :1 if it works e.g. -1 why? why not??
87
+
88
+ c.desc 'Set Header Level to 2'
89
+ c.switch [:h2], negatable: false
90
+
91
+ c.desc 'Use only !SLIDE for slide breaks (Showoff Compatible)'
92
+ c.switch [:slide], negatable: false
93
+
94
+ c.desc 'Allow // for slide breaks'
95
+ c.switch [:takahashi], negatable: false
96
+
97
+
98
+ c.desc 'Output Path'
99
+ c.arg_name 'PATH'
100
+ c.default_value opts.output_path
101
+ c.flag [:o,:output]
102
+
103
+ c.desc 'Template Manifest'
104
+ c.arg_name 'MANIFEST'
105
+ c.default_value opts.manifest
106
+ c.flag [:t, :template]
107
+
108
+
109
+ c.action do |g,o,args|
110
+ logger.debug 'hello from build command'
111
+
112
+ PluginLoader.new( config ).load_plugins # check for optional plugins/extension in ./lib folder
113
+
114
+ finder = FileFinder.new( config )
115
+
116
+ args.each do |arg|
117
+ files = finder.find_files( arg )
118
+ files.each do |file|
119
+ ### fix/todo: reset/clean headers
120
+ Slideshow::Gen.new( opts, config, headers ).create_slideshow( file )
121
+ end
122
+ end
123
+
124
+ end
125
+ end
126
+
127
+
128
+ desc 'List installed template packs'
129
+ command [:list,:ls,:l] do |c|
130
+
131
+ c.action do |g,o,args|
132
+ logger.debug 'hello from list command'
133
+
134
+ Slideshow::List.new( opts, config ).run ### todo: remove opts (merge access into config)
135
+ end
136
+ end
137
+
138
+
139
+ desc 'Install template pack'
140
+ arg_name 'MANIFEST', multiple: true
141
+ command [:install,:i] do |c|
142
+
143
+ c.desc "Template Packs (#{config.default_fetch_shortcuts.keys.join(', ')})"
144
+ c.switch [:a,:all], negatable: false
145
+
146
+ c.action do |g,o,args|
147
+ logger.debug 'hello from install command'
148
+
149
+ if opts.fetch_all?
150
+ Slideshow::Fetch.new( opts, config ).fetch_all ## todo: remove opts merge into config
151
+ end
152
+
153
+ args.each do |arg|
154
+ Slideshow::Fetch.new( opts, config ).fetch( arg ) ## todo: remove opts merge into config
155
+ end
156
+ end
157
+ end
158
+
159
+
160
+ ######
161
+ # add command :g,:gen,:generate ??? why? why not? better just git clone repos
162
+ # or use command copy?
163
+ #
164
+ # cmd.on( '-g', '--generate', 'Generate Slide Show Templates (using built-in S6 Pack)' ) { opts.generate = true }
165
+ #
166
+ # GenTemplates.new( opts, config ).run ### todo: remove opts
167
+
168
+
169
+ desc 'Generate quick starter sample'
170
+ command [:new,:n] do |c|
171
+
172
+ c.desc 'Output Path'
173
+ c.arg_name 'PATH'
174
+ c.default_value opts.output_path
175
+ c.flag [:o,:output]
176
+
177
+ c.desc 'Template Manifest'
178
+ c.arg_name 'MANIFEST'
179
+ c.default_value opts.quick_manifest
180
+ c.flag [:t, :template]
181
+
182
+
183
+ c.action do |g,o,args|
184
+ logger.debug 'hello from new command'
185
+
186
+ ## use quick_manifest (default) otherwise pass along/use args
187
+ Slideshow::Quick.new( opts, config ).run ### todo: remove opts
188
+
189
+ end
190
+ end
191
+
192
+ desc '(Debug) Show more version info'
193
+ skips_pre
194
+ command [:about,:a] do |c|
195
+ c.action do
196
+ logger.debug 'hello from about command'
197
+
198
+ SysInfo.new( config ).dump
199
+ end
200
+ end
201
+
202
+ desc '(Debug) List plugin scripts in load path'
203
+ command [:plugins,:plugin,:p] do |c|
204
+ c.action do
205
+ logger.debug 'hello from plugin command'
206
+
207
+ Slideshow::Plugins.new( opts, config ).run ### todo: remove opts (merge access into config)
208
+ end
209
+ end
210
+
211
+ desc '(Debug) Show global options, options, arguments for test command'
212
+ command :test do |c|
213
+ c.action do |g,o,args|
214
+ puts 'hello from test command'
215
+ puts 'g/global_options:'
216
+ pp g
217
+ puts 'o/options:'
218
+ pp o
219
+ puts 'args:'
220
+ pp args
221
+ end
222
+ end
223
+
224
+
225
+
226
+ pre do |g,c,o,args|
227
+ opts.merge_gli_options!( g )
228
+ opts.merge_gli_options!( o )
229
+
230
+ puts Slideshow.generator
231
+
232
+ if opts.verbose?
233
+ LogUtils::Logger.root.level = :debug
234
+
235
+ # dump Slideshow settings
236
+ config.dump
237
+ puts
238
+
239
+ # dump Markdown settings
240
+ Markdown.dump
241
+ puts
242
+ end
243
+
244
+ logger.debug " executing command #{c.name}"
245
+ true
246
+ end
247
+
248
+ post do |global,c,o,args|
249
+ logger.debug " executed command #{c.name}"
250
+ true
251
+ end
252
+
253
+
254
+ on_error do |e|
255
+ puts
256
+ puts "*** error: #{e.message}"
257
+ puts
258
+
259
+ ## todo/fix: find a better way to print; just raise exception e.g. raise e - why? why not??
260
+ ## puts e.backtrace.inspect if opts.verbose?
261
+ raise e if opts.verbose?
262
+
263
+ false # skip default error handling
264
+ end
265
+
266
+
267
+ exit run(ARGV)
@@ -0,0 +1,106 @@
1
+ # encoding: utf-8
2
+
3
+ class PluginLoader
4
+ include LogUtils::Logging
5
+ include Slideshow::PluginHelper # e.g. gets us load_plugins machinery
6
+
7
+ def initialize( config )
8
+ @config = config
9
+ end
10
+
11
+ attr_reader :config
12
+ end
13
+
14
+
15
+ class FileFinder
16
+ include LogUtils::Logging
17
+
18
+ def initialize( config )
19
+ @config = config
20
+ end
21
+
22
+ attr_reader :config
23
+
24
+ def find_file_with_known_extension( fn )
25
+ dirname = File.dirname( fn )
26
+ basename = File.basename( fn, '.*' )
27
+ extname = File.extname( fn )
28
+ logger.debug "dirname=#{dirname}, basename=#{basename}, extname=#{extname}"
29
+
30
+ config.known_extnames.each do |e|
31
+ newname = File.join( dirname, "#{basename}#{e}" )
32
+ logger.debug "File.exists? #{newname}"
33
+ return newname if File.exists?( newname )
34
+ end # each extension (e)
35
+
36
+ nil # not found; return nil
37
+ end
38
+
39
+
40
+ def find_files( file_or_dir_or_pattern )
41
+ filtered_files = []
42
+
43
+ ## for now process/assume only single file
44
+
45
+ ## (check for missing extension)
46
+ if File.exists?( file_or_dir_or_pattern )
47
+ file = file_or_dir_or_pattern
48
+ logger.debug " adding file '#{file}'..."
49
+ filtered_files << file
50
+ else # check for existing file w/ missing extension
51
+ file = find_file_with_known_extension( file_or_dir_or_pattern )
52
+ if file.nil?
53
+ puts " skipping missing file '#{file_or_dir_or_pattern}{#{config.known_extnames.join(',')}}'..."
54
+ else
55
+ logger.debug " adding file '#{file}'..."
56
+ filtered_files << file
57
+ end
58
+ end
59
+
60
+ filtered_files
61
+ end # method find_files
62
+ end # class FileFinder
63
+
64
+
65
+ class SysInfo
66
+ def initialize( config )
67
+ @config = config
68
+ end
69
+
70
+ attr_reader :config
71
+
72
+ def dump
73
+ puts <<EOS
74
+
75
+ #{Slideshow.generator}
76
+
77
+ Gems versions:
78
+ - pakman #{Pakman::VERSION}
79
+ - fetcher #{Fetcher::VERSION}
80
+ - markdown #{Markdown::VERSION}
81
+ - textutils #{TextUtils::VERSION}
82
+ - props #{Props::VERSION}
83
+
84
+ Env home: #{Env.home}
85
+ Slideshow config: #{config.config_dir}
86
+ Slideshow cache: #{config.cache_dir}
87
+ Slideshow root: #{Slideshow.root}
88
+
89
+ EOS
90
+
91
+ # dump Slideshow settings
92
+ config.dump
93
+ puts
94
+
95
+ # dump Markdown settings
96
+ Markdown.dump
97
+ puts
98
+
99
+ # todo:
100
+ # add verison for rubygems
101
+
102
+ ## todo: add more gem version info
103
+ #- redcloth
104
+ #- kramdown
105
+ end
106
+ end # class SysInfo
@@ -3,6 +3,27 @@ module Slideshow
3
3
 
4
4
  class Opts
5
5
 
6
+ def merge_gli_options!( options={} )
7
+ @header_level = 1 if options[:h1] == true
8
+ @header_level = 2 if options[:h2] == true
9
+
10
+ @slide = true if options[:slide] == true
11
+ @takahashi = true if options[:slide] == true
12
+
13
+ @verbose = true if options[:verbose] == true
14
+
15
+ @fetch_all = true if options[:all] == true
16
+
17
+ @config_path = options[:config] if options[:config].present?
18
+ @output_path = options[:output] if options[:output].present?
19
+
20
+ @manifest = options[:template] if options[:template].present?
21
+
22
+ ## NB: will use :template option too
23
+ @quick_manifest = options[:template] if options[:template].present?
24
+ end
25
+
26
+
6
27
  def header_level=(value)
7
28
  @header_level = value.to_i
8
29
  end
@@ -40,14 +61,6 @@ class Opts
40
61
  end
41
62
 
42
63
 
43
- def quick=(boolean)
44
- @quick = boolean
45
- end
46
-
47
- def quick?
48
- return false if @quick.nil? # default generate flag is false
49
- @quick == true
50
- end
51
64
 
52
65
  def quick_manifest=(value)
53
66
  @quick_manifest = value
@@ -58,33 +71,6 @@ class Opts
58
71
  end
59
72
 
60
73
 
61
- def plugins=(boolean)
62
- @plugins = boolean
63
- end
64
-
65
- def plugins?
66
- return false if @plugins.nil? # default generate flag is false
67
- @plugins == true
68
- end
69
-
70
-
71
- def generate=(boolean)
72
- @generate = boolean
73
- end
74
-
75
- def generate?
76
- return false if @generate.nil? # default generate flag is false
77
- @generate == true
78
- end
79
-
80
- def list=(boolean)
81
- @list = boolean
82
- end
83
-
84
- def list?
85
- return false if @list.nil? # default list flag is false
86
- @list == true
87
- end
88
74
 
89
75
  def fetch_all=(boolean)
90
76
  @fetch_all = boolean
@@ -95,17 +81,6 @@ class Opts
95
81
  @fetch_all == true
96
82
  end
97
83
 
98
- def fetch_uri=(value)
99
- @fetch_uri = value
100
- end
101
-
102
- def fetch_uri
103
- @fetch_uri || '-fetch uri required-'
104
- end
105
-
106
- def fetch?
107
- @fetch_uri.nil? ? false : true
108
- end
109
84
 
110
85
 
111
86
  def includes=(value)
@@ -120,7 +95,8 @@ class Opts
120
95
  def has_includes?
121
96
  @includes.nil? ? false : true
122
97
  end
123
-
98
+
99
+
124
100
  def manifest=(value)
125
101
  @manifest = value
126
102
  end
@@ -128,7 +104,8 @@ class Opts
128
104
  def manifest
129
105
  @manifest || 's6'
130
106
  end
131
-
107
+
108
+
132
109
  def config_path=(value)
133
110
  @config_path = value
134
111
  end
@@ -136,11 +113,11 @@ class Opts
136
113
  def config_path
137
114
  @config_path || File.join( Env.home, '.slideshow' )
138
115
  end
139
-
116
+
140
117
  def output_path=(value)
141
118
  @output_path = value
142
119
  end
143
-
120
+
144
121
  def output_path
145
122
  @output_path || '.'
146
123
  end
@@ -1,3 +1,3 @@
1
1
  module Slideshow
2
- VERSION = '1.2.5'
2
+ VERSION = '2.0.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: 1.2.5
4
+ version: 2.0.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-16 00:00:00.000000000 Z
12
+ date: 2013-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: props
16
- requirement: &84536570 !ruby/object:Gem::Requirement
16
+ requirement: &82743930 !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: *84536570
24
+ version_requirements: *82743930
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: markdown
27
- requirement: &84536350 !ruby/object:Gem::Requirement
27
+ requirement: &82743710 !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: *84536350
35
+ version_requirements: *82743710
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: textutils
38
- requirement: &84536130 !ruby/object:Gem::Requirement
38
+ requirement: &82743490 !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: *84536130
46
+ version_requirements: *82743490
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: pakman
49
- requirement: &84535910 !ruby/object:Gem::Requirement
49
+ requirement: &82743270 !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: *84535910
57
+ version_requirements: *82743270
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activesupport
60
- requirement: &84535700 !ruby/object:Gem::Requirement
60
+ requirement: &82743060 !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: *84535700
68
+ version_requirements: *82743060
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: RedCloth
71
- requirement: &84535480 !ruby/object:Gem::Requirement
71
+ requirement: &82742840 !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: *84535480
79
+ version_requirements: *82742840
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: logutils
82
- requirement: &84535260 !ruby/object:Gem::Requirement
82
+ requirement: &82742620 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,21 @@ dependencies:
87
87
  version: 0.6.0
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *84535260
90
+ version_requirements: *82742620
91
+ - !ruby/object:Gem::Dependency
92
+ name: gli
93
+ requirement: &82758790 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: 2.5.6
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: *82758790
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: rdoc
93
- requirement: &84535040 !ruby/object:Gem::Requirement
104
+ requirement: &82758570 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ~>
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: '3.10'
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *84535040
112
+ version_requirements: *82758570
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: hoe
104
- requirement: &84534820 !ruby/object:Gem::Requirement
115
+ requirement: &82758350 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ~>
@@ -109,7 +120,7 @@ dependencies:
109
120
  version: '3.3'
110
121
  type: :development
111
122
  prerelease: false
112
- version_requirements: *84534820
123
+ version_requirements: *82758350
113
124
  description: ! "The Slide Show (S9) Ruby gem lets you create slide shows and author
114
125
  slides in plain text\r\nusing a wiki-style markup language that's easy-to-write
115
126
  and easy-to-read.\r\nThe Slide Show (S9) project also collects and welcomes themes
@@ -137,8 +148,9 @@ files:
137
148
  - lib/slideshow/cli/commands/list.rb
138
149
  - lib/slideshow/cli/commands/plugins.rb
139
150
  - lib/slideshow/cli/commands/quick.rb
151
+ - lib/slideshow/cli/main.rb
152
+ - lib/slideshow/cli/main_utils.rb
140
153
  - lib/slideshow/cli/opts.rb
141
- - lib/slideshow/cli/runner.rb
142
154
  - lib/slideshow/config.rb
143
155
  - lib/slideshow/filters/debug_filter.rb
144
156
  - lib/slideshow/filters/headers_filter.rb
@@ -1,243 +0,0 @@
1
- module Slideshow
2
-
3
- class Runner
4
-
5
- include LogUtils::Logging
6
-
7
- include PluginHelper
8
-
9
-
10
- def initialize
11
- @opts = Opts.new
12
- @config = Config.new( @opts )
13
- @headers = Headers.new( @config )
14
-
15
- ## todo/fix: move into slideshow loader script - why? why not?
16
- LogUtils::Logger.root.level = :info
17
- end
18
-
19
- attr_reader :opts, :config, :headers
20
-
21
-
22
- def find_file_with_known_extension( fn )
23
- dirname = File.dirname( fn )
24
- basename = File.basename( fn, '.*' )
25
- extname = File.extname( fn )
26
- logger.debug "dirname=#{dirname}, basename=#{basename}, extname=#{extname}"
27
-
28
- config.known_extnames.each do |e|
29
- newname = File.join( dirname, "#{basename}#{e}" )
30
- logger.debug "File.exists? #{newname}"
31
- return newname if File.exists?( newname )
32
- end # each extension (e)
33
-
34
- nil # not found; return nil
35
- end
36
-
37
-
38
- def find_files( file_or_dir_or_pattern )
39
- filtered_files = []
40
-
41
- ## for now process/assume only single file
42
-
43
- ## (check for missing extension)
44
- if File.exists?( file_or_dir_or_pattern )
45
- file = file_or_dir_or_pattern
46
- logger.debug " adding file '#{file}'..."
47
- filtered_files << file
48
- else # check for existing file w/ missing extension
49
- file = find_file_with_known_extension( file_or_dir_or_pattern )
50
- if file.nil?
51
- puts " skipping missing file '#{file_or_dir_or_pattern}{#{config.known_extnames.join(',')}}'..."
52
- else
53
- logger.debug " adding file '#{file}'..."
54
- filtered_files << file
55
- end
56
- end
57
-
58
- filtered_files
59
- end # method find_files
60
-
61
-
62
-
63
- def run( args )
64
-
65
- config.load
66
-
67
- opt=OptionParser.new do |cmd|
68
-
69
- cmd.banner = "Usage: slideshow [options] name"
70
-
71
- cmd.on( '-o', '--output PATH', "Output Path (default is #{opts.output_path})" ) { |path| opts.output_path = path }
72
-
73
- cmd.on( "-t", "--template MANIFEST", "Template Manifest (default is #{opts.manifest})" ) do |t|
74
- # todo: do some checks on passed in template argument
75
- opts.manifest = t
76
- end
77
-
78
-
79
- # cmd.on( '--header NUM', 'Header Level (default is 1)' ) do |n|
80
- # opts.header_level = n.to_i
81
- # end
82
-
83
- cmd.on( '--h1', 'Set Header Level to 1 (default)' ) { opts.header_level = 1 }
84
- cmd.on( '--h2', 'Set Header Level to 2' ) { opts.header_level = 2 }
85
-
86
- cmd.on( '--slide', 'Use only !SLIDE for slide breaks (Showoff Compatible)' ) do
87
- opts.slide = true
88
- end
89
-
90
- cmd.on( '--takahashi', 'Allow // for slide breaks' ) do
91
- opts.takahashi = true
92
- end
93
-
94
-
95
- # ?? opts.on( "-s", "--style STYLE", "Select Stylesheet" ) { |s| $options[:style]=s }
96
-
97
- # ?? cmd.on( '-i', '--include PATH', 'Load Path' ) { |s| opts.put( 'include', s ) }
98
-
99
- cmd.on( '-f', '--fetch URI', 'Fetch Templates' ) do |uri|
100
- opts.fetch_uri = uri
101
- end
102
-
103
- cmd.on( '--all', "Fetch Template Packs (#{config.default_fetch_shortcuts.keys.join(', ')})" ) do
104
- opts.fetch_all = true
105
- end
106
-
107
- cmd.on( '-l', '--list', 'List Installed Templates' ) { opts.list = true }
108
-
109
- cmd.on( '-c', '--config PATH', "Configuration Path (default is #{opts.config_path})" ) do |path|
110
- opts.config_path = path
111
- end
112
-
113
- cmd.on( '-g', '--generate', 'Generate Slide Show Templates (using built-in S6 Pack)' ) { opts.generate = true }
114
-
115
- ## fix:/todo: add generator for quickstart
116
- cmd.on( '-q', '--quick [MANIFEST]', "Generate Quickstart Slide Show Sample (default is #{opts.quick_manifest})") do |q|
117
- opts.quick = true
118
- opts.quick_manifest = q if q.nil? == false
119
- end
120
-
121
- cmd.on( '-v', '--version', "Show version" ) do
122
- puts Slideshow.generator
123
- exit
124
- end
125
-
126
-
127
- cmd.on( "-h", "--help", "Show this message" ) do
128
- puts <<EOS
129
-
130
- Slide Show (S9) is a free web alternative to PowerPoint or Keynote in Ruby
131
-
132
- #{cmd.help}
133
-
134
- Examples:
135
- slideshow microformats
136
- slideshow microformats.text # Process slides using Markdown (#{config.known_markdown_extnames.join(', ')})
137
- slideshow microformats.textile # Process slides using Textile (#{config.known_textile_extnames.join(', ')})
138
- slideshow microformats.rst # Process slides using reStructuredText (#{config.known_rest_extnames.join(', ')})
139
- slideshow -o slides microformats # Output slideshow to slides folder
140
-
141
- More examles:
142
- slideshow -q # Generate quickstart slide show sample
143
- slideshow -g # Generate slide show templates using built-in S6 pack
144
-
145
- slideshow -l # List installed slide show templates
146
- slideshow -f s5blank # Fetch (install) S5 blank starter template from internet
147
- slideshow -t s5blank microformats # Use your own slide show templates (e.g. s5blank)
148
-
149
- Further information:
150
- http://slideshow-s9.github.io
151
-
152
- EOS
153
- exit
154
- end
155
-
156
- cmd.on( '-p', '--plugins', '(Debug) List Plugin Scripts in Load Path' ) { opts.plugins = true }
157
-
158
- cmd.on( '--about', "(Debug) Show more version info" ) do
159
- puts <<EOS
160
-
161
- #{Slideshow.generator}
162
-
163
- Gems versions:
164
- - pakman #{Pakman::VERSION}
165
- - fetcher #{Fetcher::VERSION}
166
- - markdown #{Markdown::VERSION}
167
- - textutils #{TextUtils::VERSION}
168
- - props #{Props::VERSION}
169
-
170
- Env home: #{Env.home}
171
- Slideshow config: #{config.config_dir}
172
- Slideshow cache: #{config.cache_dir}
173
- Slideshow root: #{Slideshow.root}
174
-
175
- EOS
176
-
177
- # dump Slideshow settings
178
- config.dump
179
- puts
180
-
181
- # dump Markdown settings
182
- Markdown.dump
183
- puts
184
-
185
- # todo:
186
- # add verison for rubygems
187
-
188
- ## todo: add more gem version info
189
- #- redcloth
190
- #- kramdown
191
-
192
- exit
193
- end
194
-
195
-
196
- cmd.on( "--verbose", "(Debug) Show debug trace" ) do
197
- LogUtils::Logger.root.level = :debug
198
- opts.verbose = true
199
- end
200
-
201
- end
202
-
203
- opt.parse!( args )
204
-
205
- puts Slideshow.generator
206
-
207
- if opts.verbose?
208
- # dump Slideshow settings
209
- config.dump
210
- puts
211
-
212
- # dump Markdown settings
213
- Markdown.dump
214
- puts
215
- end
216
-
217
- if opts.list?
218
- List.new( opts, config ).run ### todo: remove opts (merge access into config)
219
- elsif opts.plugins?
220
- Plugins.new( opts, config ).run ### todo: remove opts (merge access into config)
221
- elsif opts.generate?
222
- GenTemplates.new( opts, config ).run ### todo: remove opts
223
- elsif opts.quick?
224
- Quick.new( opts, config ).run ### todo: remove opts
225
- elsif opts.fetch? || opts.fetch_all?
226
- Fetch.new( opts, config ).run ### todo: remove opts
227
- else
228
- load_plugins # check for optional plugins/extension in ./lib folder
229
-
230
- args.each do |arg|
231
- files = find_files( arg )
232
- files.each do |file|
233
- ### fix/todo: reset/clean headers
234
- Gen.new( opts, config, headers ).create_slideshow( file )
235
- end
236
- end
237
- end
238
- end
239
-
240
-
241
- end # class Runner
242
-
243
- end # module Slideshow