rails_url_shortener 0.2.9 → 0.2.10
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/README.md +1 -1
- data/app/models/rails_url_shortener/ipgeo.rb +23 -0
- data/app/models/rails_url_shortener/url.rb +18 -0
- data/app/models/rails_url_shortener/visit.rb +23 -0
- data/lib/generators/rails_url_shortener/templates/initializer.rb +1 -1
- data/lib/rails_url_shortener/version.rb +1 -1
- data/lib/rails_url_shortener.rb +8 -0
- data/lib/tasks/auto_annotate_models.rake +59 -0
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2eae8996ec1ecb9a6edf015f801174ba561d47a67f5898f516d8c37d4c10118
|
4
|
+
data.tar.gz: 4070d28713ebdf08bf96068f4a10c1ee2369c77568a8fb0a11ea8b206e1f0521
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1d74a3df31a9b3a1eaa9eba0d2387ca1b2d572f40147ae12321172a093e998af28e63bdf8b8a6ab10416843a0c7e3a2574abe37ba5603b5086d0b8e5214eb8c
|
7
|
+
data.tar.gz: ccb01b9e625ee0f2a3a38992a978cade1e05b0fc8e0144e12e93e1a3c95ff59c7683d2cd20d66c3238e5a88d90432377b880c9bbf8ee6f31b69a8ebad0be791d
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ RailsUrlShortener is a small rails engine that provide your app with short URLs
|
|
4
4
|
|
5
5
|
Why give your data to a third party app if you can do it by yourself?
|
6
6
|
|
7
|
-
You can see a **demo project** of what you can do with this engine [HERE](https://
|
7
|
+
You can see a **demo project** of what you can do with this engine [HERE](https://s.a-chacon.com/).
|
8
8
|
|
9
9
|
## Key features
|
10
10
|
|
@@ -1,5 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# == Schema Information
|
4
|
+
#
|
5
|
+
# Table name: rails_url_shortener_ipgeos
|
6
|
+
#
|
7
|
+
# id :integer not null, primary key
|
8
|
+
# as :string
|
9
|
+
# city :string
|
10
|
+
# country :string
|
11
|
+
# country_code :string
|
12
|
+
# hosting :boolean
|
13
|
+
# ip :string
|
14
|
+
# isp :string
|
15
|
+
# lat :string
|
16
|
+
# lon :string
|
17
|
+
# mobile :boolean
|
18
|
+
# org :string
|
19
|
+
# proxy :boolean
|
20
|
+
# region :string
|
21
|
+
# region_name :string
|
22
|
+
# timezone :string
|
23
|
+
# created_at :datetime not null
|
24
|
+
# updated_at :datetime not null
|
25
|
+
#
|
3
26
|
module RailsUrlShortener
|
4
27
|
class Ipgeo < ApplicationRecord
|
5
28
|
has_many :visits, dependent: :nullify
|
@@ -1,5 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# == Schema Information
|
4
|
+
#
|
5
|
+
# Table name: rails_url_shortener_urls
|
6
|
+
#
|
7
|
+
# id :integer not null, primary key
|
8
|
+
# category :string
|
9
|
+
# expires_at :datetime
|
10
|
+
# key :string(10) not null
|
11
|
+
# owner_type :string
|
12
|
+
# url :text not null
|
13
|
+
# created_at :datetime not null
|
14
|
+
# updated_at :datetime not null
|
15
|
+
# owner_id :integer
|
16
|
+
#
|
17
|
+
# Indexes
|
18
|
+
#
|
19
|
+
# index_rails_url_shortener_urls_on_owner (owner_type,owner_id)
|
20
|
+
#
|
3
21
|
module RailsUrlShortener
|
4
22
|
class Url < ApplicationRecord
|
5
23
|
# variables
|
@@ -1,5 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# == Schema Information
|
4
|
+
#
|
5
|
+
# Table name: rails_url_shortener_visits
|
6
|
+
#
|
7
|
+
# id :integer not null, primary key
|
8
|
+
# bot :boolean
|
9
|
+
# browser :string
|
10
|
+
# browser_version :string
|
11
|
+
# ip :string
|
12
|
+
# meta :text
|
13
|
+
# platform :string
|
14
|
+
# platform_version :string
|
15
|
+
# user_agent :string
|
16
|
+
# created_at :datetime not null
|
17
|
+
# updated_at :datetime not null
|
18
|
+
# ipgeo_id :integer
|
19
|
+
# url_id :integer
|
20
|
+
#
|
21
|
+
# Indexes
|
22
|
+
#
|
23
|
+
# index_rails_url_shortener_visits_on_ipgeo_id (ipgeo_id)
|
24
|
+
# index_rails_url_shortener_visits_on_url_id (url_id)
|
25
|
+
#
|
3
26
|
module RailsUrlShortener
|
4
27
|
require 'json'
|
5
28
|
class Visit < ApplicationRecord
|
@@ -10,5 +10,5 @@ RailsUrlShortener.host = ENV['HOST'] || 'localhost:3000' # the host used for the
|
|
10
10
|
RailsUrlShortener.default_redirect = '/' # where the users are redirect if the link is not found.
|
11
11
|
RailsUrlShortener.charset = CHARSETS[:alphanumcase] # used for generate the keys, better long.
|
12
12
|
RailsUrlShortener.key_length = 6 # Key length for random generator
|
13
|
-
RailsUrlShortener.minimum_key_length = 3 #
|
13
|
+
RailsUrlShortener.minimum_key_length = 3 # minimum permited for a key
|
14
14
|
RailsUrlShortener.save_bots_visits = false # if save bots visits
|
data/lib/rails_url_shortener.rb
CHANGED
@@ -44,3 +44,11 @@ end
|
|
44
44
|
ActiveSupport.on_load(:active_record) do
|
45
45
|
extend RailsUrlShortener::Model
|
46
46
|
end
|
47
|
+
|
48
|
+
ActiveSupport.on_load(:action_view) do
|
49
|
+
prepend RailsUrlShortener::UrlsHelper
|
50
|
+
end
|
51
|
+
|
52
|
+
ActiveSupport.on_load(:action_controller_base) do
|
53
|
+
prepend RailsUrlShortener::UrlsHelper
|
54
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# NOTE: only doing this in development as some production environments (Heroku)
|
2
|
+
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
|
3
|
+
# NOTE: to have a dev-mode tool do its thing in production.
|
4
|
+
if Rails.env.development?
|
5
|
+
require 'annotate'
|
6
|
+
task :set_annotation_options do
|
7
|
+
# You can override any of these by setting an environment variable of the
|
8
|
+
# same name.
|
9
|
+
Annotate.set_defaults(
|
10
|
+
'active_admin' => 'false',
|
11
|
+
'additional_file_patterns' => [],
|
12
|
+
'routes' => 'false',
|
13
|
+
'models' => 'true',
|
14
|
+
'position_in_routes' => 'before',
|
15
|
+
'position_in_class' => 'before',
|
16
|
+
'position_in_test' => 'before',
|
17
|
+
'position_in_fixture' => 'before',
|
18
|
+
'position_in_factory' => 'before',
|
19
|
+
'position_in_serializer' => 'before',
|
20
|
+
'show_foreign_keys' => 'true',
|
21
|
+
'show_complete_foreign_keys' => 'false',
|
22
|
+
'show_indexes' => 'true',
|
23
|
+
'simple_indexes' => 'false',
|
24
|
+
'model_dir' => 'app/models',
|
25
|
+
'root_dir' => '',
|
26
|
+
'include_version' => 'false',
|
27
|
+
'require' => '',
|
28
|
+
'exclude_tests' => 'false',
|
29
|
+
'exclude_fixtures' => 'false',
|
30
|
+
'exclude_factories' => 'false',
|
31
|
+
'exclude_serializers' => 'false',
|
32
|
+
'exclude_scaffolds' => 'true',
|
33
|
+
'exclude_controllers' => 'true',
|
34
|
+
'exclude_helpers' => 'true',
|
35
|
+
'exclude_sti_subclasses' => 'false',
|
36
|
+
'ignore_model_sub_dir' => 'false',
|
37
|
+
'ignore_columns' => nil,
|
38
|
+
'ignore_routes' => nil,
|
39
|
+
'ignore_unknown_models' => 'false',
|
40
|
+
'hide_limit_column_types' => 'integer,bigint,boolean',
|
41
|
+
'hide_default_column_types' => 'json,jsonb,hstore',
|
42
|
+
'skip_on_db_migrate' => 'false',
|
43
|
+
'format_bare' => 'true',
|
44
|
+
'format_rdoc' => 'false',
|
45
|
+
'format_yard' => 'false',
|
46
|
+
'format_markdown' => 'false',
|
47
|
+
'sort' => 'false',
|
48
|
+
'force' => 'false',
|
49
|
+
'frozen' => 'false',
|
50
|
+
'classified_sort' => 'true',
|
51
|
+
'trace' => 'false',
|
52
|
+
'wrapper_open' => nil,
|
53
|
+
'wrapper_close' => nil,
|
54
|
+
'with_comment' => 'true'
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
Annotate.load_tasks
|
59
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_url_shortener
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- a-chacon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser
|
@@ -52,9 +52,10 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 5.1.0
|
55
|
-
description:
|
56
|
-
|
57
|
-
|
55
|
+
description: RailsUrlShortener is a lightweight Rails engine that enables easy creation
|
56
|
+
and management of short URLs within your project. Similar to bitly.com, it condenses
|
57
|
+
long links into short, user-friendly addresses. Enhance your app's functionality
|
58
|
+
with this simple yet powerful URL shortening solution.
|
58
59
|
email:
|
59
60
|
- andres.ch@protonmail.com
|
60
61
|
executables: []
|
@@ -82,14 +83,15 @@ files:
|
|
82
83
|
- lib/rails_url_shortener/engine.rb
|
83
84
|
- lib/rails_url_shortener/model.rb
|
84
85
|
- lib/rails_url_shortener/version.rb
|
86
|
+
- lib/tasks/auto_annotate_models.rake
|
85
87
|
homepage: https://www.github.com/a-chacon/rails-url-shortener
|
86
88
|
licenses:
|
87
89
|
- GPL-3.0
|
88
90
|
metadata:
|
89
91
|
bug_tracker_uri: https://www.github.com/a-chacon/rails-url-shortener/issues
|
90
|
-
changelog_uri: https://www.github.com/a-chacon/rails-url-shortener/releases/tag/v0.2.
|
92
|
+
changelog_uri: https://www.github.com/a-chacon/rails-url-shortener/releases/tag/v0.2.10
|
91
93
|
documentation_uri: https://github.com/a-chacon/rails-url-shortener/blob/main/README.md
|
92
|
-
source_code_uri: https://github.com/a-chacon/rails-url-shortener/tree/v0.2.
|
94
|
+
source_code_uri: https://github.com/a-chacon/rails-url-shortener/tree/v0.2.10
|
93
95
|
rubygems_mfa_required: 'true'
|
94
96
|
post_install_message:
|
95
97
|
rdoc_options: []
|
@@ -106,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
108
|
- !ruby/object:Gem::Version
|
107
109
|
version: 1.8.11
|
108
110
|
requirements: []
|
109
|
-
rubygems_version: 3.4.
|
111
|
+
rubygems_version: 3.4.16
|
110
112
|
signing_key:
|
111
113
|
specification_version: 4
|
112
114
|
summary: Rails url shortener engine.
|