chusaku 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/chusaku.gemspec +1 -0
- data/lib/chusaku.rb +12 -8
- data/lib/chusaku/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7fd38001d891049886a95d54019ce4636dee3762e19f50e83bf7b0d53732cd6
|
4
|
+
data.tar.gz: a55e1bd009ad426e9258a6d6098d029d45bfb043a6736d9dda492a64b83d6ddf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f135d7d2979a67bf3b9f883f5775511a78088b9c8468676da7d028551d4bfbc80ba89b44c182c88da98bd3adbed2deed425a97f2d5fe7b46fe6ebdbac85dc966
|
7
|
+
data.tar.gz: 7efc39dbd3e86b1f4672900535d1f3556b907d7c6f5220a61182a4aa3b44685a333d41c67fa78fc923e41df33b39ba49bc520743a3e9b5186179b86eb78cdbf7
|
data/chusaku.gemspec
CHANGED
data/lib/chusaku.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'ruby-progressbar'
|
3
4
|
require 'chusaku/version'
|
4
5
|
require 'chusaku/parser'
|
5
6
|
require 'chusaku/routes'
|
@@ -8,17 +9,23 @@ module Chusaku
|
|
8
9
|
# The main method to run Chusaku. Annotate all actions in your Rails project
|
9
10
|
# as follows:
|
10
11
|
#
|
11
|
-
# # @route GET /waterlilies/:id (waterlilies)
|
12
|
+
# # @route [GET] /waterlilies/:id (waterlilies)
|
12
13
|
# def show
|
13
14
|
# # ...
|
14
15
|
# end
|
15
16
|
def self.call
|
16
|
-
puts 'Chusaku starting...'
|
17
17
|
routes = Chusaku::Routes.call
|
18
|
-
|
18
|
+
controller_pattern = 'app/controllers/**/*_controller.rb'
|
19
|
+
controller_paths = Dir.glob(Rails.root.join(controller_pattern))
|
20
|
+
|
21
|
+
# Start progress bar.
|
22
|
+
progressbar = ProgressBar.create \
|
23
|
+
title: 'Chusaku',
|
24
|
+
total: controller_paths.count
|
19
25
|
|
20
26
|
# Loop over all controller file paths.
|
21
|
-
|
27
|
+
controller_paths.each do |path|
|
28
|
+
progressbar.increment
|
22
29
|
controller = /controllers\/(.*)_controller\.rb/.match(path)[1]
|
23
30
|
actions = routes[controller]
|
24
31
|
next if actions.nil?
|
@@ -46,10 +53,7 @@ module Chusaku
|
|
46
53
|
# Write to file.
|
47
54
|
parsed_content = parsed_file.map { |pf| pf[:body] }
|
48
55
|
write(path, parsed_content.join)
|
49
|
-
puts "Annotated #{controller}"
|
50
56
|
end
|
51
|
-
|
52
|
-
puts 'Chusaku finished!'
|
53
57
|
end
|
54
58
|
|
55
59
|
# Write given content to a file. If we're using an overridden version of File,
|
@@ -70,7 +74,7 @@ module Chusaku
|
|
70
74
|
|
71
75
|
# Given a hash describing an action, generate an annotation in the form:
|
72
76
|
#
|
73
|
-
# @route GET /waterlilies/:id (waterlilies)
|
77
|
+
# @route [GET] /waterlilies/:id (waterlilies)
|
74
78
|
#
|
75
79
|
# @param {Hash} action_info
|
76
80
|
# @return {String}
|
data/lib/chusaku/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chusaku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nishiki Liu
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4.2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ruby-progressbar
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.10.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.10.1
|
69
83
|
description: Annotate your Rails controllers with route info.
|
70
84
|
email:
|
71
85
|
- nishiki.liu@gmail.com
|