Sha256: d21c800f416fbe5594fe2c4e5bf63a75c8556a6d73055dbee34b645472e3b8f9

Contents?: true

Size: 766 Bytes

Versions: 1

Compression:

Stored size: 766 Bytes

Contents

RAILS_INITIALIZERS_PATH = File.join(RAILS_ROOT, "config", "initializers")

desc "Add automatic annotation to project to invoke annotate each time when server boots in development mode"
task :automatic_annotate => :environment do
  unless File.exists?(File.join RAILS_INITIALIZERS_PATH, "automatic_annotation.rb")
    f = File.open(File.join(RAILS_INITIALIZERS_PATH, "automatic_annotation.rb"), "w")
    f.write <<-CODE
if RAILS_ENV == "development"
  require 'annotate'
  if Annotate.load_tasks
    Rake::Task[:annotate_models].invoke
  end
end
    CODE
  end
end

desc "Remove automatic annotation"
task :remove_automatic_annotation => :environment do
  if File.exists?(f = File.join(RAILS_INITIALIZERS_PATH, "automatic_annotation.rb"))
    File.delete(f)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
selleo-annotate-2.3.2 lib/tasks/automatic_annotation.rake