Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 58 lines (42 sloc) 1.57 KB
#!/usr/bin/env ruby
# if this is the initial run, setup the load path and grab a mutex
if ! defined?(Sinatra)
root_dir = File.dirname(__FILE__)
$:.unshift "#{root_dir}/rack/lib" if File.directory?("#{root_dir}/rack")
$:.unshift "#{root_dir}/sinatra/lib" if File.directory?("#{root_dir}/sinatra")
$:.unshift "#{root_dir}/lib"
$:.unshift "#{root_dir}"
end
require 'rubygems'
require 'wink'
Wink.run! 'wink.conf' unless reloading?
# Reloading =================================================================
if development?
unless reloading?
# this is the initial load of this file. set our UNLOADING constant
# to an array of names to remove before each reload.
UNLOAD = %w[Entry Article Bookmark Comment Tag Tagging]
else
# remove all constants that we redefine in wink.rb
UNLOAD.each do |const_name|
begin
klass = Object.const_get(const_name)
klass.destroy! if klass.respond_to?(:destroy!)
Object.send :remove_const, const_name
rescue => boom
STDERR.puts "error unloading constant: #{const_name}"
end
end
Wink.send :remove_const, 'VERSION'
# We also remove DataMapper's schema cache and subclass tracking since it keeps
# references to the class objects we've removed above. This ensures that old
# class objects can be GC'd.
# DataMapper::Database[:default].adapter.instance_variable_set(:@schema, nil)
# DataMapper::Persistence.subclasses.clear
# reload all wink sources.
load 'wink.rb'
load 'wink.conf'
load 'wink/models.rb'
load 'wink/web.rb'
end
end