Commit be794769 by Brent Greeff

Using railtie to load rake tasks under Rails 3, this is not workiing as a gem anymore?

parent 6d11436b
$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
# $:.unshift(File.dirname(__FILE__)) unless
# $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
module Annotate
def self.load_tasks
if File.exists?('Rakefile')
load 'Rakefile'
Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each { |rake| load rake }
return true
else
return false
end
end
require 'annotate/railtie' if defined?(Rails)
end
require 'annotate'
require 'rails'
module Annotate
class Railtie < Rails::Railtie
railtie_name :annotate
rake_tasks do
load "lib/tasks/annotate_models.rake"
load "lib/tasks/annotate_old.rake"
end
end
end
desc "Add schema information (as comments) to model and fixture files"
task :annotate_models => :environment do
require 'annotate/annotate_models'
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'annotate', 'annotate_models'))
options={}
options[:position_in_class] = ENV['position_in_class'] || ENV['position'] || :before
options[:position_in_fixture] = ENV['position_in_fixture'] || ENV['position'] || :before
......@@ -14,7 +14,7 @@ end
desc "Remove schema information from model and fixture files"
task :remove_annotation => :environment do
require 'annotate/annotate_models'
File.expand_path(File.join(File.dirname(__FILE__), '..', 'annotate', 'annotate_models'))
options={}
options[:model_dir] = ENV['model_dir']
AnnotateModels.remove_annotations(options)
......
desc "Prepends the route map to the top of routes.rb"
task :annotate_routes do
require 'annotate/annotate_routes'
File.expand_path(File.join(File.dirname(__FILE__), '..', 'annotate', 'annotate_routes'))
AnnotateRoutes.do_annotate
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment