lib/chusaku.rb in chusaku-1.3.1 vs lib/chusaku.rb in chusaku-1.4.0
- old
+ new
@@ -1,12 +1,14 @@
+require "rake"
require "chusaku/version"
require "chusaku/parser"
require "chusaku/routes"
# Handles core functionality of annotating projects.
module Chusaku
DEFAULT_CONTROLLERS_PATTERN = "**/*_controller.rb".freeze
+ DEFAULT_EXCLUSION_PATTERN = "vendor/**/*_controller.rb".freeze
class << self
# The main method to run Chusaku. Annotate all actions in a Rails project as
# follows:
#
@@ -20,10 +22,13 @@
def call(flags = {})
@flags = flags
@routes = Chusaku::Routes.call
@changed_files = []
controllers_pattern = @flags[:controllers_pattern] || DEFAULT_CONTROLLERS_PATTERN
- controllers_paths = Dir.glob(Rails.root.join(controllers_pattern))
+ exclusion_pattern = @flags[:exclusion_pattern] || DEFAULT_EXCLUSION_PATTERN
+ controllers_paths = FileList
+ .new(Rails.root.join(controllers_pattern))
+ .exclude(Rails.root.join(exclusion_pattern))
@routes.each do |controller, actions|
next unless controller
controller_class = "#{controller.underscore.camelize}Controller".constantize