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__))
require 'annotate/version'
require 'annotate/annotate_models'
......@@ -72,26 +70,14 @@ module Annotate
options
end
def self.loaded_tasks=(val)
@loaded_tasks = val
end
def self.loaded_tasks
@loaded_tasks
end
def self.load_tasks
return if loaded_tasks
self.loaded_tasks = true
return if @tasks_loaded
Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each do |rake|
load rake
end
end
def self.load_requires(options)
options[:require].count > 0 &&
options[:require].each { |path| require path }
@tasks_loaded = true
end
def self.eager_load(options)
......@@ -146,4 +132,13 @@ module Annotate
load_tasks
Rake::Task[:set_annotation_options].invoke
end
class << self
private
def load_requires(options)
options[:require].count > 0 &&
options[:require].each { |path| require path }
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