slideshow 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -13,7 +13,8 @@ Hoe.spec 'slideshow' do
13
13
 
14
14
  self.extra_deps = [
15
15
  ['RedCloth','>= 4.2.9'],
16
- ['markdown_select','>= 0.1.3']
16
+ ['markdown','>= 0.1.0'],
17
+ ['fetcher','>= 0.1.0']
17
18
  ]
18
19
 
19
20
  self.remote_rdoc_dir = 'doc'
data/lib/slideshow.rb CHANGED
@@ -19,7 +19,8 @@ require 'cgi'
19
19
 
20
20
  # required gems
21
21
  require 'redcloth' # default textile library
22
- require 'markdown_select' # default markdown library
22
+ require 'markdown' # default markdown library
23
+ require 'fetcher' # fetch docs and blogs via http, https, etc.
23
24
 
24
25
  # our own code
25
26
  require 'slideshow/opts'
@@ -54,13 +55,14 @@ require 'slideshow/filters/slide_filter'
54
55
 
55
56
  module Slideshow
56
57
 
57
- VERSION = '1.0.3'
58
+ VERSION = '1.0.4'
58
59
 
59
60
  # version string for generator meta tag (includes ruby version)
60
61
  def Slideshow.generator
61
62
  "Slide Show (S9) #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
62
63
  end
63
64
 
65
+
64
66
  def Slideshow.main
65
67
 
66
68
  # allow env variable to set RUBYOPT-style default command line options
@@ -2,84 +2,12 @@ module Slideshow
2
2
  module Fetch
3
3
 
4
4
  def fetch_file( dest, src )
5
- logger.debug "fetch( dest: #{dest}, src: #{src})"
6
-
7
- uri = URI.parse( src )
8
-
9
- # new code: honor proxy env variable HTTP_PROXY
10
- proxy = ENV['HTTP_PROXY']
11
- proxy = ENV['http_proxy'] if proxy.nil? # try possible lower/case env variable (for *nix systems) is this necessary??
12
5
 
13
- if proxy
14
- proxy = URI.parse( proxy )
15
- logger.debug "using net http proxy: proxy.host=#{proxy.host}, proxy.port=#{proxy.port}"
16
- if proxy.user && proxy.password
17
- logger.debug " using credentials: proxy.user=#{proxy.user}, proxy.password=****"
18
- else
19
- logger.debug " using no credentials"
20
- end
21
- else
22
- logger.debug "using direct net http access; no proxy configured"
23
- proxy = OpenStruct.new # all fields return nil (e.g. proxy.host, etc.)
24
- end
25
-
26
- http_proxy = Net::HTTP::Proxy( proxy.host, proxy.port, proxy.user, proxy.password )
27
-
28
- redirect_limit = 4
29
- response = nil
30
-
31
- until false
32
- raise ArgumentError, 'HTTP redirect too deep' if redirect_limit == 0
33
- redirect_limit -= 1
34
-
35
- http = http_proxy.new( uri.host, uri.port )
6
+ ## note: code moved to its own gem, that is, fetcher
7
+ ## see https://github.com/geraldb/fetcher
36
8
 
37
- logger.debug "GET #{uri.request_uri} uri=#{uri}, redirect_limit=#{redirect_limit}"
38
-
39
- request = Net::HTTP::Get.new( uri.request_uri, { 'User-Agent'=> 'slideshow'} )
40
- if uri.instance_of? URI::HTTPS
41
- http.use_ssl = true
42
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
43
- end
44
-
45
- response = http.request( request )
46
-
47
- if response.code == '200'
48
- logger.debug "#{response.code} #{response.message}"
49
- break
50
- elsif (response.code == '301' || response.code == '302' || response.code == '303' || response.code == '307' )
51
- # 301 = moved permanently
52
- # 302 = found
53
- # 303 = see other
54
- # 307 = temporary redirect
55
- logger.debug "#{response.code} #{response.message} location=#{response.header['location']}"
56
- newuri = URI.parse( response.header['location'] )
57
- if newuri.relative?
58
- logger.debug "url relative; try to make it absolute"
59
- newuri = uri + response.header['location']
60
- end
61
- uri = newuri
62
- else
63
- msg = "#{response.code} #{response.message}"
64
- puts "*** error: #{msg}"
65
- return # todo: throw StandardException?
66
- end
67
- end
68
-
69
-
70
- logger.debug " content_type: #{response.content_type}, content_length: #{response.content_length}"
71
-
72
- # check for content type; use 'wb' for images
73
- if response.content_type =~ /image/
74
- logger.debug ' switching to binary'
75
- flags = 'wb'
76
- else
77
- flags = 'w'
78
- end
79
-
80
- File.open( dest, flags ) do |f|
81
- f.write( response.body )
82
- end
9
+ # nb: in new method src comes first (and dest second - might be optional in the future)
10
+ Fetcher::Worker.new( logger ).copy( src, dest )
83
11
  end
84
12
 
85
13
 
data/lib/slideshow/gen.rb CHANGED
@@ -464,28 +464,33 @@ def run( args )
464
464
  logger.level = Logger::DEBUG
465
465
  end
466
466
 
467
+ usage =<<EOS
468
+
469
+ Slide Show (S9) is a free web alternative to PowerPoint or KeyNote in Ruby
470
+
471
+ #{cmd.help}
472
+
473
+ Examples:
474
+ slideshow microformats
475
+ slideshow microformats.textile # Process slides using Textile
476
+ slideshow microformats.text # Process slides using Markdown
477
+ slideshow microformats.rst # Process slides using reStructuredText
478
+ slideshow -o slides microformats # Output slideshow to slides folder
479
+
480
+ More examles:
481
+ slideshow -g # Generate slide show templates using built-in S6 pack
482
+
483
+ slideshow -l # List installed slide show templates
484
+ slideshow -f s5blank # Fetch (install) S5 blank starter template from internet
485
+ slideshow -t s5blank microformats # Use your own slide show templates (e.g. s5blank)
486
+
487
+ Further information:
488
+ http://slideshow.rubyforge.org
489
+ EOS
490
+
491
+
467
492
  cmd.on_tail( "-h", "--help", "Show this message" ) do
468
- puts
469
- puts "Slide Show (S9) is a free web alternative to PowerPoint or KeyNote in Ruby"
470
- puts
471
- puts cmd.help
472
- puts
473
- puts "Examples:"
474
- puts " slideshow microformats"
475
- puts " slideshow microformats.textile # Process slides using Textile"
476
- puts " slideshow microformats.text # Process slides using Markdown"
477
- puts " slideshow microformats.rst # Process slides using reStructuredText"
478
- puts " slideshow -o slides microformats # Output slideshow to slides folder"
479
- puts
480
- puts "More examles:"
481
- puts " slideshow -g # Generate slide show templates using built-in S6 pack"
482
- puts
483
- puts " slideshow -l # List installed slide show templates"
484
- puts " slideshow -f s5blank # Fetch (install) S5 blank starter template from internet"
485
- puts " slideshow -t s5blank microformats # Use your own slide show templates (e.g. s5blank)"
486
- puts
487
- puts "Further information:"
488
- puts " http://slideshow.rubyforge.org"
493
+ puts usage
489
494
  exit
490
495
  end
491
496
  end
@@ -494,7 +499,7 @@ def run( args )
494
499
 
495
500
  config.load
496
501
 
497
- puts "Slide Show (S9) Version: #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
502
+ puts Slideshow.generator
498
503
 
499
504
  if opts.list?
500
505
  list_slideshow_templates
@@ -1,13 +1,13 @@
1
1
  module Slideshow
2
2
  module MarkdownEngines
3
3
 
4
- ## note: code move to its own gem, that is, markdown_select
5
- ## see https://github.com/geraldb/markdown_select
4
+ ## note: code moved to its own gem, that is, markdown
5
+ ## see https://github.com/geraldb/markdown
6
6
 
7
7
  def markdown_to_html( content )
8
8
  ## puts " Converting Markdown-text (#{content.length} bytes) to HTML using library '#{@markdown_libs.first}' calling '#{mn}'..."
9
9
 
10
- MarkdownSelect.new( content ).to_html
10
+ Markdown.new( content ).to_html
11
11
  end
12
12
 
13
13
  end # module MarkdownEngines
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideshow
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 3
10
- version: 1.0.3
9
+ - 4
10
+ version: 1.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gerald Bauer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-26 00:00:00 Z
18
+ date: 2012-06-03 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: RedCloth
@@ -34,25 +34,41 @@ dependencies:
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: markdown_select
37
+ name: markdown
38
38
  prerelease: false
39
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- hash: 29
44
+ hash: 27
45
45
  segments:
46
46
  - 0
47
47
  - 1
48
- - 3
49
- version: 0.1.3
48
+ - 0
49
+ version: 0.1.0
50
50
  type: :runtime
51
51
  version_requirements: *id002
52
52
  - !ruby/object:Gem::Dependency
53
- name: rdoc
53
+ name: fetcher
54
54
  prerelease: false
55
55
  requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 27
61
+ segments:
62
+ - 0
63
+ - 1
64
+ - 0
65
+ version: 0.1.0
66
+ type: :runtime
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: rdoc
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
56
72
  none: false
57
73
  requirements:
58
74
  - - ~>
@@ -63,22 +79,22 @@ dependencies:
63
79
  - 10
64
80
  version: "3.10"
65
81
  type: :development
66
- version_requirements: *id003
82
+ version_requirements: *id004
67
83
  - !ruby/object:Gem::Dependency
68
84
  name: hoe
69
85
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
86
+ requirement: &id005 !ruby/object:Gem::Requirement
71
87
  none: false
72
88
  requirements:
73
89
  - - ~>
74
90
  - !ruby/object:Gem::Version
75
- hash: 29
91
+ hash: 7
76
92
  segments:
77
- - 2
78
- - 15
79
- version: "2.15"
93
+ - 3
94
+ - 0
95
+ version: "3.0"
80
96
  type: :development
81
- version_requirements: *id004
97
+ version_requirements: *id005
82
98
  description: |-
83
99
  The Slide Show (S9) Ruby gem lets you create slide shows and author slides in plain text
84
100
  using a wiki-style markup language that's easy-to-write and easy-to-read.
@@ -139,7 +155,7 @@ files:
139
155
  - templates/slides.html.erb
140
156
  - templates/slides.pdf.html.erb
141
157
  - templates/style.css.erb
142
- homepage: http://slideshow.rubyforge.org
158
+ homepage: http://slideshow.rubyforge.org
143
159
  licenses: []
144
160
 
145
161
  post_install_message: |
@@ -176,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
192
  requirements: []
177
193
 
178
194
  rubyforge_project: slideshow
179
- rubygems_version: 1.8.17
195
+ rubygems_version: 1.8.24
180
196
  signing_key:
181
197
  specification_version: 3
182
198
  summary: Slide Show (S9) - A Free Web Alternative to PowerPoint and KeyNote in Ruby