rails_url_shortener 0.5.0 → 0.6.0

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: ae03b882f4a2f8bae0e1834fc16433cc38dbdc21caeca1a4ecd64f362a825c65
4
- data.tar.gz: c8e43db57a10cc50f8c6357b7179cac5f12a9ca77a0ea378883149beafaef953
3
+ metadata.gz: d4cc011facb5faaf918c6259c775e13aa8554c0e2ddc4ae030cc5465c398ef81
4
+ data.tar.gz: 58419048c10c497c28ce6f774cd3925174acb547f6bc5561ed1213b61dd1e278
5
5
  SHA512:
6
- metadata.gz: a5c3bfccc58814464e487973c22cb5d7cd53601e516be333fc21150adec33d5ff4a1c03ba911982c7ee6570018fea3643bfbdb7ac48beb9804166b87faa8d28e
7
- data.tar.gz: 10b3eec441ad74d0233fb5d519aba47364db0a0d8f621017e27fca242f6b893d5c0b095aebe7d1403b6415dfd8a6ae8d7a5eac744ad025c9bc7e3c3da18a8947
6
+ metadata.gz: 63c1963fed3b1bbde71d922c1f1ce57911d51574c0d7c6d8be10a266fca176eb7ce1104935c10d3fee4b3a820a6ca8900ebe0c80686a75a5d8c8ccd46f911029
7
+ data.tar.gz: 0cf6f3ee876c3f24d486e7335a95e6160075626fe5e9ba250cdede81682960a743f973fae46e932867ff6077f170eb335a3f5518713d3685e0117be84325b1e4
data/README.md CHANGED
@@ -25,46 +25,37 @@ Here are some of the things you can do with RailsUrlShortener:
25
25
 
26
26
  ## Installation
27
27
 
28
- Follow these steps to install and configure RailsUrlShortener:
28
+ Follow these steps to install and configure rails_url_shortener in your Rails application.
29
29
 
30
- 1. Add this line to your application's Gemfile:
30
+ 1. Add the Gem
31
+ Add the following line to your application's Gemfile:
31
32
 
32
33
  ```ruby
33
34
  gem "rails_url_shortener"
34
35
  ```
35
-
36
- 2. Install the gem by running:
36
+ 2. Install the Gem
37
+ Run the following command to install the gem:
37
38
 
38
39
  ```bash
39
40
  bundle install
40
41
  ```
41
-
42
- 3. Install and run the migrations:
43
-
44
- ```bash
45
- bin/rails rails_url_shortener:install:migrations db:migrate
46
- ```
47
-
48
- 4. Generate the initializer for configuration:
49
-
42
+ 3. Run the Generator
43
+ Run the generator to set up the necessary files:
50
44
  ```bash
51
45
  rails generate rails_url_shortener
52
46
  ```
47
+ This will:
48
+ ✅ Install and run the required migrations
53
49
 
54
- ## Usage
55
-
56
- 1. Mount the engine
57
-
58
- Mount the engine on your app adding the next code on your config/routes.rb:
50
+ Mount the engine
51
+ An entry will be added to the bottom of your config/routes.rb file, mounting the engine at the root of your application.
59
52
 
60
- **If you want to mount this on the root of your app, this should be on the bottom of your routes file.**
53
+ Generate an initializer for further configuration`
61
54
 
62
- ```ruby
63
- mount RailsUrlShortener::Engine, at: "/"
64
55
 
65
- ```
56
+ ## Usage
66
57
 
67
- 2. Generate the short link
58
+ 1. Generate the short link
68
59
 
69
60
  And generate the short links like you want:
70
61
 
@@ -80,7 +71,7 @@ short_url("https://www.github.com/a-chacon/rails-url-shortener")
80
71
  RailsUrlShortener::Url.generate("https://www.github.com/a-chacon/rails-url-shortener")
81
72
  ```
82
73
 
83
- 3. Share the short link
74
+ 2. Share the short link
84
75
 
85
76
  **Then share the short link to your users or wherever you want.**
86
77
 
@@ -5,6 +5,22 @@ require 'rails/generators'
5
5
  class RailsUrlShortenerGenerator < Rails::Generators::Base
6
6
  source_root File.expand_path('templates', __dir__)
7
7
 
8
+ def install_and_run_migrations
9
+ if Rails.env.test?
10
+ puts 'Skipping migrations in test environment'
11
+ else
12
+ rake 'rails_url_shortener:install:migrations'
13
+ rake 'db:migrate'
14
+ end
15
+ end
16
+
17
+ def add_route_to_routes_file
18
+ # Mount the engine at the bottom of the routes file in the host application.
19
+ inject_into_file 'config/routes.rb', before: /\nend\s*\Z/ do
20
+ "\n mount RailsUrlShortener::Engine, at: '/'"
21
+ end
22
+ end
23
+
8
24
  def copy
9
25
  copy_file 'initializer.rb', 'config/initializers/rails_url_shortener.rb'
10
26
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsUrlShortener
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.0'
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_url_shortener
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - a-chacon
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-20 00:00:00.000000000 Z
10
+ date: 2025-10-20 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: browser
@@ -74,9 +74,9 @@ licenses:
74
74
  - GPL-3.0
75
75
  metadata:
76
76
  bug_tracker_uri: https://www.github.com/a-chacon/rails-url-shortener/issues
77
- changelog_uri: https://www.github.com/a-chacon/rails-url-shortener/releases/tag/v0.5.0
77
+ changelog_uri: https://www.github.com/a-chacon/rails-url-shortener/releases/tag/v0.6.0
78
78
  documentation_uri: https://github.com/a-chacon/rails-url-shortener/blob/main/README.md
79
- source_code_uri: https://github.com/a-chacon/rails-url-shortener/tree/v0.5.0
79
+ source_code_uri: https://github.com/a-chacon/rails-url-shortener/tree/v0.6.0
80
80
  rubygems_mfa_required: 'true'
81
81
  rdoc_options: []
82
82
  require_paths: