#!/usr/bin/ruby require 'fileutils' require 'optparse' require 'webrick' default_storage_path = File.expand_path(File.dirname(__FILE__) + "/../storage/2500") print "Enter path to storage [#{default_storage_path}]: " storage_path = gets.chomp if storage_path.empty? storage_path = default_storage_path puts "Loading storage from the default storage path (#{storage_path})" else puts "Loading storage from the path you entered (#{storage_path})" end unless File.directory?(storage_path) and not (Dir["#{storage_path}/*.snapshot"] + Dir["#{storage_path}/*.command_log"]).empty? raise "Found no storage at #{storage_path}" end RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + '/../') unless defined? RAILS_ROOT unless defined? ADDITIONAL_LOAD_PATHS ADDITIONAL_LOAD_PATHS = %w( app/models lib vendor/madeleine-0.7.1/lib vendor/RedCloth-3.0.3/lib vendor/rubyzip-0.5.8/lib ).map { |dir| "#{File.expand_path(File.join(RAILS_ROOT, dir))}" }.delete_if { |dir| not File.exist?(dir) } # Prepend to $LOAD_PATH ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } end require 'wiki_service' WikiService.storage_path = storage_path $wiki = WikiService.instance puts "Instiki storage from #{storage_path} is loaded." puts 'Access it a global variable $wiki.' puts 'Happy poking!' nil