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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b1b0e46c19776a221e711038296974e903924eb1d95d28263a85d79dff35358
4
- data.tar.gz: 04bb2c5facaa8d30e94adc47f6b65f6de3d66162866071aae0224a8a6af92c7b
3
+ metadata.gz: 86c85b0b4e8cf81b733e453d8b3f16f4536af97254fbb62976b1446547c94b55
4
+ data.tar.gz: 4ee930d2a91365027f3ace92c1f6db686cf517d3261b71fbf6ba7729881719f1
5
5
  SHA512:
6
- metadata.gz: 2878b418573b2038503229d7327270cfcb6edb2358f055d0906a62f68749ccd22fdc26154aa41c649c4ddd5da1cae498dff5614b22bee1fd2db869aedd0ebd09
7
- data.tar.gz: 64bf65bb061745b2009a22f4c1c5eadb02b0b33f727ed3b1b282ba635ff941f16e56ace800189f4908a57c9a663988d859b808a4f40c905341edabaa7beb02df
6
+ metadata.gz: 2972e67aba86c9451e432d1e798268e82dd17a9e0ff18a334d903da00467e2e90d3cae5a1dc79c214978f0c86ae3ecc6b747cf4ec205cc38d12a6a3afd2f17a6
7
+ data.tar.gz: d03d5b3a4955eccd92158148a0aefdaee4d96950b59a1218208ab422566b8791d4449f02043908d13c5aeaf36a6cd6fbe01c3525802ec487c424efcc29b17be1
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ Gemfile*.lock
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  sudo: false
3
- language: ruby
4
- cache: bundler
5
3
  rvm:
6
4
  - 2.5.5
7
5
  before_install: gem install bundler -v 2.0.1
6
+ bundler_args: --jobs=2
7
+ script: bundle exec rake spec
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.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Waffle
2
4
  module Maker
3
5
  class Formatter
@@ -10,25 +10,30 @@ module Waffle
10
10
  @routes = routes
11
11
  end
12
12
 
13
- def matche?
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!(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!(route)
31
- route.gsub!(/:\w+/, '(.*)')
35
+ def params_route_2_regex_route(route)
36
+ route.gsub(/:\w+/, rep_regex)
32
37
  end
33
38
  end
34
39
  end
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Waffle
4
- class Railtie < ::Rails::Railtie
5
- rake_tasks do
6
- load "tasks/waffle.rake"
4
+ module Maker
5
+ class Railtie < ::Rails::Railtie
6
+ rake_tasks do
7
+ load "tasks/waffle.rake"
8
+ end
7
9
  end
8
10
  end
9
11
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Waffle
2
4
  module Maker
3
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
4
6
  end
5
7
  end
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
- w = Waffle::Maker::Matcher.new(waf[:path], routes)
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
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "bundler", "~> 2.0"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "rspec", "~> 3.0"
28
+ spec.add_development_dependency "coveralls"
28
29
  end
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.0
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
- - Gemfile.lock
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