Commit 7248d794 by Shu Fujita Committed by Andrew W. Lee

Refactor namespace Annotate (#719)

* Remove Annotate.#loaded_tasks= and .loaded_tasks * Remove unnecessary comment for Rubocop * Make Annotate.load_requires private * Refactor Annotate.load_tasks
parent f9199e05
# rubocop:disable Metrics/ModuleLength
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.dirname(__FILE__))
require 'annotate/version' require 'annotate/version'
require 'annotate/annotate_models' require 'annotate/annotate_models'
...@@ -72,26 +70,14 @@ module Annotate ...@@ -72,26 +70,14 @@ module Annotate
options options
end end
def self.loaded_tasks=(val)
@loaded_tasks = val
end
def self.loaded_tasks
@loaded_tasks
end
def self.load_tasks def self.load_tasks
return if loaded_tasks return if @tasks_loaded
self.loaded_tasks = true
Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each do |rake| Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each do |rake|
load rake load rake
end end
end
def self.load_requires(options) @tasks_loaded = true
options[:require].count > 0 &&
options[:require].each { |path| require path }
end end
def self.eager_load(options) def self.eager_load(options)
...@@ -146,4 +132,13 @@ module Annotate ...@@ -146,4 +132,13 @@ module Annotate
load_tasks load_tasks
Rake::Task[:set_annotation_options].invoke Rake::Task[:set_annotation_options].invoke
end end
class << self
private
def load_requires(options)
options[:require].count > 0 &&
options[:require].each { |path| require path }
end
end
end 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