waffle-maker 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -2
- data/LICENSE +21 -0
- data/lib/waffle/maker/formatter.rb +2 -0
- data/lib/waffle/maker/matcher.rb +10 -5
- data/lib/waffle/maker/railtie.rb +5 -3
- data/lib/waffle/maker/version.rb +3 -1
- data/lib/waffle/maker.rb +2 -2
- data/waffle-maker.gemspec +1 -0
- metadata +16 -2
- data/Gemfile.lock +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86c85b0b4e8cf81b733e453d8b3f16f4536af97254fbb62976b1446547c94b55
|
4
|
+
data.tar.gz: 4ee930d2a91365027f3ace92c1f6db686cf517d3261b71fbf6ba7729881719f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2972e67aba86c9451e432d1e798268e82dd17a9e0ff18a334d903da00467e2e90d3cae5a1dc79c214978f0c86ae3ecc6b747cf4ec205cc38d12a6a3afd2f17a6
|
7
|
+
data.tar.gz: d03d5b3a4955eccd92158148a0aefdaee4d96950b59a1218208ab422566b8791d4449f02043908d13c5aeaf36a6cd6fbe01c3525802ec487c424efcc29b17be1
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 chibicco. All Rights Reserved.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/lib/waffle/maker/matcher.rb
CHANGED
@@ -10,25 +10,30 @@ module Waffle
|
|
10
10
|
@routes = routes
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def matched?
|
14
14
|
return true if routes.include?(waf_path)
|
15
15
|
|
16
16
|
routes.any? do |route|
|
17
17
|
-> {
|
18
|
-
params_route_2_regex_route
|
19
|
-
return false if route.start_with?(
|
18
|
+
route = params_route_2_regex_route(route)
|
19
|
+
return false if route.start_with?("/#{rep_regex}")
|
20
20
|
/#{route}$/.match?(waf_path)
|
21
21
|
}.call
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
# @override
|
26
|
+
def rep_regex
|
27
|
+
'(\w+)'
|
28
|
+
end
|
29
|
+
|
25
30
|
private
|
26
31
|
|
27
32
|
# /users/:id/edit/:example
|
28
33
|
# ↓
|
29
34
|
# /users/(.*)/edit/(.*)
|
30
|
-
def params_route_2_regex_route
|
31
|
-
route.gsub
|
35
|
+
def params_route_2_regex_route(route)
|
36
|
+
route.gsub(/:\w+/, rep_regex)
|
32
37
|
end
|
33
38
|
end
|
34
39
|
end
|
data/lib/waffle/maker/railtie.rb
CHANGED
data/lib/waffle/maker/version.rb
CHANGED
data/lib/waffle/maker.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "waffle/maker/version"
|
2
3
|
require "waffle/maker/route"
|
3
4
|
require "waffle/maker/waf"
|
@@ -34,8 +35,7 @@ module Waffle
|
|
34
35
|
|
35
36
|
def execute
|
36
37
|
wafs.each do |waf|
|
37
|
-
|
38
|
-
puts waf[:raw] if w.matche?
|
38
|
+
puts waf[:raw] if Waffle::Maker::Matcher.new(waf[:path], routes).matched?
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
data/waffle-maker.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waffle-maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chibicco
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Find waf logs that match rails routing.
|
56
70
|
email:
|
57
71
|
- chibiccoes@gmail.com
|
@@ -63,7 +77,7 @@ files:
|
|
63
77
|
- ".rspec"
|
64
78
|
- ".travis.yml"
|
65
79
|
- Gemfile
|
66
|
-
-
|
80
|
+
- LICENSE
|
67
81
|
- README.md
|
68
82
|
- Rakefile
|
69
83
|
- bin/console
|
data/Gemfile.lock
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
waffle-maker (0.1.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
diff-lcs (1.3)
|
10
|
-
rake (10.5.0)
|
11
|
-
rspec (3.9.0)
|
12
|
-
rspec-core (~> 3.9.0)
|
13
|
-
rspec-expectations (~> 3.9.0)
|
14
|
-
rspec-mocks (~> 3.9.0)
|
15
|
-
rspec-core (3.9.0)
|
16
|
-
rspec-support (~> 3.9.0)
|
17
|
-
rspec-expectations (3.9.0)
|
18
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
-
rspec-support (~> 3.9.0)
|
20
|
-
rspec-mocks (3.9.0)
|
21
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
-
rspec-support (~> 3.9.0)
|
23
|
-
rspec-support (3.9.0)
|
24
|
-
|
25
|
-
PLATFORMS
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
bundler (~> 2.0)
|
30
|
-
rake (~> 10.0)
|
31
|
-
rspec (~> 3.0)
|
32
|
-
waffle-maker!
|
33
|
-
|
34
|
-
BUNDLED WITH
|
35
|
-
2.0.1
|