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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 157d8b346eea255e119daa75615fdad90a0f84db1c8b230ce818d63c8f475009
4
- data.tar.gz: 35bef130d086c757eb1258b172c4967b81caa9077788682c34fa69ecfd3fbad7
3
+ metadata.gz: e7d4f70a20b3f099882df5459337ea0987e090bb1399add54f4bcbc4c7e506f8
4
+ data.tar.gz: '09b8bf9fdb81dc6fb00a132b9b6c2ab25e101bb14441b3d86eb0a8f0d10923bd'
5
5
  SHA512:
6
- metadata.gz: af079cf685ccc01459969a02c4639ac895fb05eecb26e0e1269bfa7ffd53a15544ffaf160f1b3f5d1744757690f45f6f9e56ee2747b17f5a9b0fee60b0305b5f
7
- data.tar.gz: c3665a9b0c549b4217c1216685fabb8c71876cc5b7d5f00bab5c028bbae0f5e0f7a0f10cad380b4c753e266a90c4e0fae9117e3a49969e117eb9ef801d19ed00
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
@@ -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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pry/diff/routes`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- And then execute:
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
- $ bundle install
19
+ #### `-R` or `--removed`
18
20
 
19
- Or install it yourself as:
21
+ Show removed routes only.
20
22
 
21
- $ gem install pry-diff-routes
23
+ #### `-M` or `--modified`
22
24
 
23
- ## Usage
25
+ Show modified routes only.
26
+
27
+ #### `-N` or `--new`
28
+
29
+ Show new routes only.
30
+
31
+ #### `-S` or `--save`
24
32
 
25
- TODO: Write usage instructions here
33
+ Make current routes as the basis for changes.
26
34
 
27
- ## Development
35
+ You can combine `-R`, `-M`, and `-N` together, but not `-S`.
28
36
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+ ### Demo Screenshot
30
38
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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 https://github.com/styd/pry-diff-routes. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/pry-diff-routes/blob/master/CODE_OF_CONDUCT.md).
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 [MIT License](https://opensource.org/licenses/MIT).
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 and mailing lists is expected to follow the [code of conduct](https://github.com/styd/pry-diff-routes/blob/master/CODE_OF_CONDUCT.md).
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).
@@ -61,7 +61,7 @@ module PryDiffRoutes
61
61
 
62
62
  def constraints_changes(before, after)
63
63
  if before.constraints != after.constraints
64
- <<-DIFF.chomp
64
+ pad_lines <<~DIFF.chomp, 2
65
65
  #{arrow_key('Constraints')}-#{highlight_red before.constraints}
66
66
  +#{highlight_green after.constraints}
67
67
  DIFF
@@ -0,0 +1,8 @@
1
+ module PryDiffRoutes::ModernHashFormat
2
+ refine Hash do
3
+ alias old_to_s to_s
4
+ def to_s
5
+ old_to_s.gsub(%r{\:(\w+)\=\>}, "\\1: ")
6
+ end
7
+ end
8
+ end
@@ -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
 
@@ -1,5 +1,9 @@
1
+ require_relative 'modern_hash_format'
2
+
1
3
  module PryDiffRoutes
2
4
  module Util
5
+ using ModernHashFormat if RUBY_ENGINE == 'ruby'
6
+
3
7
  module_function
4
8
 
5
9
  def pad_lines(text="", pad_length=0)
@@ -1,3 +1,3 @@
1
1
  module PryDiffRoutes
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-21 00:00:00.000000000 Z
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.1.2
120
+ rubygems_version: 3.0.3
117
121
  signing_key:
118
122
  specification_version: 4
119
123
  summary: Inspect routes changes in Rails console