instiki in instiki-0.9.2 vs instiki in instiki-0.10.0
- old
+ new
@@ -1,67 +1,6 @@
-#!/usr/local/bin/ruby
-
-if RUBY_VERSION < "1.8.1"
- puts "Instiki requires Ruby 1.8.1+"
- exit
-end
-
-require 'optparse'
-require 'fileutils'
-
-cdir = File.expand_path(File.dirname(__FILE__))
-%w( /libraries/ /app/models /app/controllers ).each { |dir| $:.unshift(cdir + dir) }
-%w( web_controller_server action_controller_servlet wiki_service wiki ).each { |lib| require lib }
-
-fork_available = true
-begin
- exit unless fork
-rescue NotImplementedError
- fork_available = false
-end
-
-begin
- pdflatex_available = system "pdflatex -version"
-rescue Errno::ENOENT
- pdflatex_available = false
-end
-
-OPTIONS = {
- :server_type => fork_available ? Daemon : SimpleServer,
- :port => 2500,
- :storage => "#{File.expand_path(FileUtils.pwd)}/storage",
- :pdflatex => pdflatex_available
-}
-
-ARGV.options do |opts|
- script_name = File.basename($0)
- opts.banner = "Usage: ruby #{script_name} [options]"
-
- opts.separator ""
-
- opts.on("-p", "--port=port", Integer,
- "Runs Instiki on the specified port.",
- "Default: 2500") { |OPTIONS[:port]| }
- opts.on("-s", "--simple", "--simple-server",
- "Forces Instiki not to run as a Daemon if fork is available."
- ) { OPTIONS[:server_type] = SimpleServer }
- opts.on("-t", "--storage=storage", String,
- "Makes Instiki use the specified directory for storage.",
- "Default: ./storage/[port]") { |OPTIONS[:storage]| }
-
- opts.separator ""
-
- opts.on("-h", "--help",
- "Show this help message.") { puts opts; exit }
-
- opts.parse!
-end
-
-Socket.do_not_reverse_lookup = true
-
-storage_dir = OPTIONS[:storage] + "/" + OPTIONS[:port].to_s
-FileUtils.mkdir_p(storage_dir)
-WikiService.storage_path = storage_dir
-
-WikiController.template_root = "#{cdir}/app/views/"
-
-WebControllerServer.new(OPTIONS[:port], OPTIONS[:server_type], "#{cdir}/app/controllers/")
\ No newline at end of file
+#!/usr/bin/ruby
+
+# Executable file for a gem
+# must be same as ./instiki.rb
+
+load File.dirname(__FILE__) + '/script/server'