chusaku 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/bin/chusaku +6 -10
- data/lib/chusaku/cli.rb +12 -1
- data/lib/chusaku/version.rb +1 -1
- data/lib/chusaku.rb +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d38e9cae0023a682add1a559ef4c40e469247f55ef578b67fc190d81b35e824
|
4
|
+
data.tar.gz: d70d7f1d4aa61451fff49dd99ee1358c375db963db45728f08784827b7f6bfa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4d2aab917c320e5b821d4e53386b65d5017347e089fe2e62099c94838af14b1824fcde11f2c13c2b97a3af4417764849337a4e577d400d49410ce88e74e34ba
|
7
|
+
data.tar.gz: 67fc92a8285bc86f0d46ff76da41ec425385d131a088be4f76d18892cfc80aeeea2cc8bbdda3cbc2bb458901788711427162a620d3f18f62c1664795b2bcf32b
|
data/README.md
CHANGED
@@ -53,6 +53,7 @@ Usage: chusaku [options]
|
|
53
53
|
--dry-run Run without file modifications
|
54
54
|
--exit-with-error-on-annotation Fail if any file was annotated
|
55
55
|
-c, --controllers-pattern=GLOB Specify alternative controller files glob pattern
|
56
|
+
-e, --exclusion-pattern=GLOB Specify controller files exclusion glob pattern
|
56
57
|
--verbose Print all annotated files
|
57
58
|
-v, --version Show Chusaku version number and quit
|
58
59
|
-h, --help Show this help message and quit
|
data/bin/chusaku
CHANGED
@@ -1,18 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "rubygems"
|
4
|
+
require "bundler"
|
4
5
|
|
5
|
-
|
6
|
-
# Use project's bundle.
|
7
|
-
require "bundler"
|
8
|
-
Bundler.setup
|
6
|
+
Bundler.setup
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
rescue
|
15
|
-
end
|
8
|
+
# Use project's environment.
|
9
|
+
require "rake"
|
10
|
+
load "./Rakefile"
|
11
|
+
Rake::Task[:environment].invoke
|
16
12
|
|
17
13
|
require "chusaku/cli"
|
18
14
|
|
data/lib/chusaku/cli.rb
CHANGED
@@ -42,7 +42,7 @@ module Chusaku
|
|
42
42
|
# @return [void]
|
43
43
|
def check_for_rails_project
|
44
44
|
controllers_pattern = options[:controllers_pattern] || DEFAULT_CONTROLLERS_PATTERN
|
45
|
-
has_controllers =
|
45
|
+
has_controllers = FileList.new(Rails.root.join(controllers_pattern)).any?
|
46
46
|
has_rakefile = File.exist?("./Rakefile")
|
47
47
|
raise NotARailsProject unless has_controllers && has_rakefile
|
48
48
|
end
|
@@ -57,6 +57,7 @@ module Chusaku
|
|
57
57
|
add_dry_run_flag(opts)
|
58
58
|
add_error_on_annotation_flag(opts)
|
59
59
|
add_controllers_pattern_flag(opts)
|
60
|
+
add_exclusion_pattern_flag(opts)
|
60
61
|
add_verbose_flag(opts)
|
61
62
|
add_version_flag(opts)
|
62
63
|
add_help_flag(opts)
|
@@ -93,6 +94,16 @@ module Chusaku
|
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
97
|
+
# Adds `--exclusion-pattern` flag.
|
98
|
+
#
|
99
|
+
# @param opts [OptionParser] OptionParser instance
|
100
|
+
# @return [void]
|
101
|
+
def add_exclusion_pattern_flag(opts)
|
102
|
+
opts.on("-e", "--exclusion-pattern", "=GLOB", "Specify controller files exclusion glob pattern") do |value|
|
103
|
+
@options[:exclusion_pattern] = value
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
96
107
|
# Adds `--verbose` flag.
|
97
108
|
#
|
98
109
|
# @param opts [OptionParser] OptionParser instance
|
data/lib/chusaku/version.rb
CHANGED
data/lib/chusaku.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "rake"
|
1
2
|
require "chusaku/version"
|
2
3
|
require "chusaku/parser"
|
3
4
|
require "chusaku/routes"
|
@@ -5,6 +6,7 @@ require "chusaku/routes"
|
|
5
6
|
# Handles core functionality of annotating projects.
|
6
7
|
module Chusaku
|
7
8
|
DEFAULT_CONTROLLERS_PATTERN = "**/*_controller.rb".freeze
|
9
|
+
DEFAULT_EXCLUSION_PATTERN = "vendor/**/*_controller.rb".freeze
|
8
10
|
|
9
11
|
class << self
|
10
12
|
# The main method to run Chusaku. Annotate all actions in a Rails project as
|
@@ -22,7 +24,10 @@ module Chusaku
|
|
22
24
|
@routes = Chusaku::Routes.call
|
23
25
|
@changed_files = []
|
24
26
|
controllers_pattern = @flags[:controllers_pattern] || DEFAULT_CONTROLLERS_PATTERN
|
25
|
-
|
27
|
+
exclusion_pattern = @flags[:exclusion_pattern] || DEFAULT_EXCLUSION_PATTERN
|
28
|
+
controllers_paths = FileList
|
29
|
+
.new(Rails.root.join(controllers_pattern))
|
30
|
+
.exclude(Rails.root.join(exclusion_pattern))
|
26
31
|
|
27
32
|
@routes.each do |controller, actions|
|
28
33
|
next unless controller
|
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.
|
4
|
+
version: 1.4.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: 2024-08
|
11
|
+
date: 2024-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|