Module: Chusaku
- Defined in:
- lib/chusaku.rb,
lib/chusaku/cli.rb,
lib/chusaku/parser.rb,
lib/chusaku/routes.rb,
lib/chusaku/version.rb
Overview
Handles core functionality of annotating projects.
Defined Under Namespace
Modules: Parser Classes: CLI, Routes
Constant Summary collapse
- VERSION =
"1.0.1"
Class Method Summary collapse
-
.call(flags = {}) ⇒ Integer
The main method to run Chusaku.
Class Method Details
.call(flags = {}) ⇒ Integer
The main method to run Chusaku. Annotate all actions in a Rails project as follows:
# @route GET /waterlilies/:id (waterlilies)
def show
# ...
end
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/chusaku.rb', line 18 def call(flags = {}) @flags = flags @routes = Chusaku::Routes.call @changes = [] @changed_files = [] controllers_pattern = "app/controllers/**/*_controller.rb" Dir.glob(Rails.root.join(controllers_pattern)).each do |path| controller = %r{controllers/(.*)_controller\.rb}.match(path)[1] actions = @routes[controller] next if actions.nil? annotate_file(path: path, controller: controller, actions: actions.keys) end output_results end |