pry-diff-routes 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/pry-diff-routes.yml +26 -0
- data/CHANGELOG.md +25 -0
- data/README.md +32 -17
- data/images/demo-screenshot.gif +0 -0
- data/lib/pry_diff_routes/formatters/modified_routes_formatter.rb +1 -1
- data/lib/pry_diff_routes/modern_hash_format.rb +8 -0
- data/lib/pry_diff_routes/route_wrapper.rb +3 -11
- data/lib/pry_diff_routes/util.rb +4 -0
- data/lib/pry_diff_routes/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7d4f70a20b3f099882df5459337ea0987e090bb1399add54f4bcbc4c7e506f8
|
4
|
+
data.tar.gz: '09b8bf9fdb81dc6fb00a132b9b6c2ab25e101bb14441b3d86eb0a8f0d10923bd'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 356b4ac8e6ba621c066b6ed24682075ab1afdbad4b179719dd2e4708f2a8c3dd7fbc35b7b61214ab90bec9ebda4d5f0e4dfe5dc793aacb39c15424e754310936
|
7
|
+
data.tar.gz: a154f819c891cb392cc2c57690db151d068f96f088e8644399a23925c1a3da94e6c578962bb52044c437e5459eff6ecd4ad32f76ee738402c2a906cf5d16a972
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: pry-diff-routes
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
os: [ubuntu-latest, macos-latest]
|
15
|
+
ruby: [2.5, 2.6, 2.7]
|
16
|
+
runs-on: ${{ matrix.os }}
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- uses: actions/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
22
|
+
- name: Build and test with Rake
|
23
|
+
run: |
|
24
|
+
gem install bundler
|
25
|
+
bundle install --jobs 4 --retry 3
|
26
|
+
bundle exec rake
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
|
5
|
+
## [Unreleased]
|
6
|
+
### Added
|
7
|
+
- Testing status badge
|
8
|
+
- Github action for testing workflow
|
9
|
+
- Demo screenshot to readme
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
- Constraints indentation on modified routes formatting
|
13
|
+
- Modern hash format on modified routes formatting
|
14
|
+
|
15
|
+
|
16
|
+
## [0.1.0] - 2020-03-21
|
17
|
+
### Added
|
18
|
+
- `diff-routes --removed`
|
19
|
+
- `diff-routes --modified`
|
20
|
+
- `diff-routes --new`
|
21
|
+
- `diff-routes --save`
|
22
|
+
|
23
|
+
|
24
|
+
[Unreleased]: https://github.com/styd/pry-diff-routes/compare/v0.1.0...HEAD
|
25
|
+
[0.1.0]: https://github.com/styd/pry-diff-routes/releases/tag/v0.1.0
|
data/README.md
CHANGED
@@ -1,44 +1,59 @@
|
|
1
|
-
# PryDiffRoutes
|
1
|
+
# PryDiffRoutes ![pry-diff-routes](https://github.com/styd/pry-diff-routes/workflows/pry-diff-routes/badge.svg?branch=master)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
> Inspect routes changes in Rails console.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
7
|
Add this line to your application's Gemfile:
|
10
8
|
|
11
9
|
```ruby
|
12
|
-
gem 'pry-diff-routes'
|
10
|
+
gem 'pry-diff-routes', group: :development
|
13
11
|
```
|
14
12
|
|
15
|
-
|
13
|
+
## Usage
|
14
|
+
### Flags
|
15
|
+
|
16
|
+
A route is considered the same route if it maintains its verb (http method, e.g. `GET`, `POST`,
|
17
|
+
etc.) and uri path. When its other properties are changed, we call it a modified route.
|
16
18
|
|
17
|
-
|
19
|
+
#### `-R` or `--removed`
|
18
20
|
|
19
|
-
|
21
|
+
Show removed routes only.
|
20
22
|
|
21
|
-
|
23
|
+
#### `-M` or `--modified`
|
22
24
|
|
23
|
-
|
25
|
+
Show modified routes only.
|
26
|
+
|
27
|
+
#### `-N` or `--new`
|
28
|
+
|
29
|
+
Show new routes only.
|
30
|
+
|
31
|
+
#### `-S` or `--save`
|
24
32
|
|
25
|
-
|
33
|
+
Make current routes as the basis for changes.
|
26
34
|
|
27
|
-
|
35
|
+
You can combine `-R`, `-M`, and `-N` together, but not `-S`.
|
28
36
|
|
29
|
-
|
37
|
+
### Demo Screenshot
|
30
38
|
|
31
|
-
|
39
|
+
![pry-diff-routes demo screenshot](/images/demo-screenshot.gif)
|
32
40
|
|
33
41
|
## Contributing
|
34
42
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at
|
43
|
+
Bug reports and pull requests are welcome on GitHub at
|
44
|
+
https://github.com/styd/pry-diff-routes.
|
45
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are
|
46
|
+
expected to adhere to the
|
47
|
+
[code of conduct](https://github.com/styd/pry-diff-routes/blob/master/CODE_OF_CONDUCT.md).
|
36
48
|
|
37
49
|
|
38
50
|
## License
|
39
51
|
|
40
|
-
The gem is available as open source under the terms of the
|
52
|
+
The gem is available as open source under the terms of the
|
53
|
+
[MIT License](https://opensource.org/licenses/MIT).
|
41
54
|
|
42
55
|
## Code of Conduct
|
43
56
|
|
44
|
-
Everyone interacting in the Pry::Diff::Routes project's codebases, issue trackers, chat rooms
|
57
|
+
Everyone interacting in the Pry::Diff::Routes project's codebases, issue trackers, chat rooms
|
58
|
+
and mailing lists is expected to follow the
|
59
|
+
[code of conduct](https://github.com/styd/pry-diff-routes/blob/master/CODE_OF_CONDUCT.md).
|
Binary file
|
@@ -61,7 +61,7 @@ module PryDiffRoutes
|
|
61
61
|
|
62
62
|
def constraints_changes(before, after)
|
63
63
|
if before.constraints != after.constraints
|
64
|
-
|
64
|
+
pad_lines <<~DIFF.chomp, 2
|
65
65
|
#{arrow_key('Constraints')}-#{highlight_red before.constraints}
|
66
66
|
+#{highlight_green after.constraints}
|
67
67
|
DIFF
|
@@ -1,19 +1,11 @@
|
|
1
1
|
require 'action_dispatch/routing/inspector'
|
2
2
|
require_relative 'util'
|
3
|
-
|
4
|
-
if RUBY_ENGINE == 'ruby'
|
5
|
-
using Module.new {
|
6
|
-
refine Hash do
|
7
|
-
alias old_to_s to_s
|
8
|
-
def to_s
|
9
|
-
old_to_s.gsub(%r{\:(\w+)\=\>}, "\\1: ")
|
10
|
-
end
|
11
|
-
end
|
12
|
-
}
|
13
|
-
end
|
3
|
+
require_relative 'modern_hash_format'
|
14
4
|
|
15
5
|
module PryDiffRoutes
|
16
6
|
class RouteWrapper < ActionDispatch::Routing::RouteWrapper
|
7
|
+
using ModernHashFormat if RUBY_ENGINE == 'ruby'
|
8
|
+
|
17
9
|
include Util
|
18
10
|
include Comparable
|
19
11
|
|
data/lib/pry_diff_routes/util.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-diff-routes
|
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
|
- Adrian Setyadi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -73,8 +73,10 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".github/workflows/pry-diff-routes.yml"
|
76
77
|
- ".gitignore"
|
77
78
|
- ".rspec"
|
79
|
+
- CHANGELOG.md
|
78
80
|
- CODE_OF_CONDUCT.md
|
79
81
|
- Gemfile
|
80
82
|
- LICENSE.txt
|
@@ -82,12 +84,14 @@ files:
|
|
82
84
|
- Rakefile
|
83
85
|
- bin/console
|
84
86
|
- bin/setup
|
87
|
+
- images/demo-screenshot.gif
|
85
88
|
- lib/pry-diff-routes.rb
|
86
89
|
- lib/pry_diff_routes/commands.rb
|
87
90
|
- lib/pry_diff_routes/commands/diff_routes.rb
|
88
91
|
- lib/pry_diff_routes/formatters/modified_routes_formatter.rb
|
89
92
|
- lib/pry_diff_routes/formatters/new_routes_formatter.rb
|
90
93
|
- lib/pry_diff_routes/formatters/removed_routes_formatter.rb
|
94
|
+
- lib/pry_diff_routes/modern_hash_format.rb
|
91
95
|
- lib/pry_diff_routes/railtie.rb
|
92
96
|
- lib/pry_diff_routes/route_wrapper.rb
|
93
97
|
- lib/pry_diff_routes/routes_diff_processor.rb
|
@@ -113,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
117
|
- !ruby/object:Gem::Version
|
114
118
|
version: '0'
|
115
119
|
requirements: []
|
116
|
-
rubygems_version: 3.
|
120
|
+
rubygems_version: 3.0.3
|
117
121
|
signing_key:
|
118
122
|
specification_version: 4
|
119
123
|
summary: Inspect routes changes in Rails console
|