chusaku 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8295890eb74a89ebc38a8651d4a5d5c8f87112a7336658e8dea1117d525a1a1a
4
- data.tar.gz: 6cb5e53d089e0996c0b6b7e9e0b7128902fa60bc54c3f458d737e56e5c5a7a2c
3
+ metadata.gz: 62bb838dd76c648a120303c3a0bde8c67ea7232f90accb9f3e739a3b69764026
4
+ data.tar.gz: 9af1726825550cb4ce7d642e6a80217b8810cb6a56e8703c6d7f4f23a8643f3a
5
5
  SHA512:
6
- metadata.gz: 885022690966e86943484029fc383572ea254487d18f4b9f43ac1fa225e99b5cfd75f8e7f1787929cf7bbccae872ce63149a260ec5c5ef00f8e1e61added54db
7
- data.tar.gz: 2d6151abb44a539dbd662af25f8f961a21ec72c2bd012268eff9a749da4affbe02589f38036a3926dadb430340c6fa4d84a2ceff052e4c1ca1045723bd1b8600
6
+ metadata.gz: 0baeb0a41404f911ef11b3d12709773a44ecc18aa542f5dcb854e1b67023b7fd79f640d10d7d8a4368121a33714327c5120ed701c9a67c238537023db78603e7
7
+ data.tar.gz: 1e5026ac8d35af5ff8c5d8c02d32d7d634716966dad3a61947398ee870203795ff91286bb43b7daf6802c4bace3df42b1ffb325c130e88b1fe26495d72100118
data/README.md CHANGED
@@ -52,12 +52,13 @@ Chusaku has some flags available for use as well:
52
52
  ```
53
53
  $ bundle exec chusaku --help
54
54
  Usage: chusaku [options]
55
- --dry-run Run without file modifications
56
- --exit-with-error-on-annotation
57
- Fail if any file was annotated
58
- --verbose Print all annotations
59
- -v, --version Show Chusaku version number and quit
60
- -h, --help Show this help message and quit
55
+ --dry-run Run without file modifications
56
+ --exit-with-error-on-annotation Fail if any file was annotated
57
+ -c, --controllers-pattern=GLOB Specify alternative controller files glob pattern
58
+ --verbose Print all annotations
59
+ -v, --version Show Chusaku version number and quit
60
+ -h, --help Show this help message and quit
61
+
61
62
  ```
62
63
 
63
64
 
data/lib/chusaku/cli.rb CHANGED
@@ -52,8 +52,10 @@ module Chusaku
52
52
  def optparser
53
53
  OptionParser.new do |opts|
54
54
  opts.banner = "Usage: chusaku [options]"
55
+ opts.set_summary_width(35)
55
56
  add_dry_run_flag(opts)
56
57
  add_error_on_annotation_flag(opts)
58
+ add_controllers_pattern_flag(opts)
57
59
  add_verbose_flag(opts)
58
60
  add_version_flag(opts)
59
61
  add_help_flag(opts)
@@ -80,6 +82,16 @@ module Chusaku
80
82
  end
81
83
  end
82
84
 
85
+ # Adds `--controllers-pattern` flag.
86
+ #
87
+ # @param opts [OptionParser] OptionParser instance
88
+ # @return [void]
89
+ def add_controllers_pattern_flag(opts)
90
+ opts.on("-c", "--controllers-pattern", "=GLOB", "Specify alternative controller files glob pattern") do |value|
91
+ @options[:controllers_pattern] = value
92
+ end
93
+ end
94
+
83
95
  # Adds `--verbose` flag.
84
96
  #
85
97
  # @param opts [OptionParser] OptionParser instance
@@ -1,3 +1,3 @@
1
1
  module Chusaku
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/chusaku.rb CHANGED
@@ -20,7 +20,7 @@ module Chusaku
20
20
  @routes = Chusaku::Routes.call
21
21
  @changes = []
22
22
  @changed_files = []
23
- controllers_pattern = "app/controllers/**/*_controller.rb"
23
+ controllers_pattern = @flags[:controllers_pattern] || "app/controllers/**/*_controller.rb"
24
24
 
25
25
  Dir.glob(Rails.root.join(controllers_pattern)).each do |path|
26
26
  controller = %r{controllers/(.*)_controller\.rb}.match(path)[1]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chusaku
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nishiki Liu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-08 00:00:00.000000000 Z
11
+ date: 2023-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  requirements: []
131
- rubygems_version: 3.4.17
131
+ rubygems_version: 3.4.19
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Annotate your Rails controllers with route info.