./pimki.rb in Pimki-1.8.092 vs ./pimki.rb in Pimki-1.8.200
- old
+ new
@@ -7,16 +7,16 @@
# Handle rubygems support & loading libraries: {{{
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "libraries")
begin
require 'rubygems'
- require_gem 'madeleine'
+ require_gem 'madeleine', '=0.7.1'
require_gem 'BlueCloth'
require_gem 'rubyzip'
require 'zip/zip'
-rescue LoadError => detail
+rescue LoadError, NoMethodError => detail
# no rubygems, so load from the libraries directory
p detail if $DEBUG
puts 'Unable to load libraries through RubyGems. Loading from ./libraries directory'
require 'bluecloth'
require 'zip/zip'
@@ -59,20 +59,20 @@
opts.banner = "Usage: ruby #{script_name} [options]"
opts.separator ""
opts.on("-p", "--port=port", Integer,
- "Runs Instiki on the specified port.",
+ "Runs Pimki on the specified port.",
"Default: 2500\n") { |OPTIONS[:port]| }
opts.on("-s", "--simple", "--simple-server",
- "Forces Instiki not to run as a Daemon if fork is available.\n"
+ "Forces Pimki not to run as a Daemon if fork is available.\n"
) { OPTIONS[:server_type] = SimpleServer }
opts.on("-t", "--storage=storage", String,
- "Makes Instiki use the specified directory for storage.",
+ "Makes Pimki use the specified directory for storage.",
"Default: [cwd]/storage/[port]\n") { |OPTIONS[:storage]| }
opts.on("-r", "--redcloth VERSION", String,
- "Makes Instiki use the specified RedCloth version.",
+ "Makes Pimki use the specified RedCloth version.",
"You can specify major version only (2 or 3)",
"Default: 2.0.11\n") { |OPTIONS[:redcloth]| }
opts.separator ""
@@ -92,18 +92,20 @@
if Gem.source_index.search('redcloth').map { |s| s.version.version }.include? OPTIONS[:redcloth]
require_gem 'RedCloth', "#{OPTIONS[:redcloth]}"
else
require_gem 'RedCloth', "~> #{OPTIONS[:redcloth]}"
end
- end
-
-rescue LoadError, NoMethodError => detail
- if OPTIONS[:redcloth] < '3'
- require 'redcloth_2.0.11'
else
- require 'redcloth'
+ if OPTIONS[:redcloth] < '3'
+ require 'redcloth_2.0.11'
+ else
+ require 'redcloth'
+ end
end
+rescue LoadError, NoMethodError => detail
+ # just try our luck
+ require 'redcloth'
end
# Remove the "caps" spanning:
RedCloth::GLYPHS.delete_if { |glyph| glyph[1] =~ /class=\"caps\"/ }
@@ -149,11 +151,11 @@
smooth_offtags text, pre_list
retrieve text
hard_break text # PIMKI: this is the missing bit!
- text.gsub!( /<\/?notextile>/, '' )
- text.gsub!( /x%x%/, '&' )
+ text.gsub!( %r/<\/?notextile>/, '' )
+ text.gsub!( %r/x%x%/, '&' )
text.strip!
text
end #}}}
end #}}}
end #}}}
\ No newline at end of file