permalink 2.0.0 → 2.1.0

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
- SHA1:
3
- metadata.gz: f06ab000bf6cd401528119d1204c00ab69bef315
4
- data.tar.gz: a5849ef5070c956a7e75c43107beebec5313a631
2
+ SHA256:
3
+ metadata.gz: b59f20670f6bcfbd6b204ad5e23aefcce7abf477b6b574d165d87e892e9b6afc
4
+ data.tar.gz: dfdee1e9df89d3d11e9d9240811c00a4307abf1a22accc6346e992b092326225
5
5
  SHA512:
6
- metadata.gz: 669627b51b923cc660c53f0022eeef03b516364beef51f4358366b1df99872a52518255d33699351cae1cd1acd79e120846469b894298b6c63a25e7f8fe49f02
7
- data.tar.gz: e15ce00042b5d16d54e4ede403ccb27452f7a6f0e5892d935a38acfc71a2b03d86a42cd02ddf65877e39eb5a72f0f47a143e277974f7dac1ac53de7b1c1e7465
6
+ metadata.gz: 79d9f75edc2fd001ffe2cc4544ba5bd0fbc38a7a842641f5d656136961233aa926a72e9ad2e5d387641e354d5b4dd919f92567289d84a137644ed7edab782857
7
+ data.tar.gz: '080cb2da608b09403a9e4aae8d42f1465a0cb33b3902aadf2f4747c50c72bd21bd361f91dc1abce55503df7d5488d5332099e20cc9755938ae54f8a5045cd9a3'
@@ -0,0 +1,3 @@
1
+ ---
2
+ github: [fnando]
3
+ custom: ["https://www.paypal.me/nandovieira/🍕"]
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  pkg
2
2
  *.lock
3
+ coverage
@@ -0,0 +1,13 @@
1
+ ---
2
+ inherit_gem:
3
+ rubocop-fnando: .rubocop.yml
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.7
7
+ NewCops: enable
8
+
9
+ Metrics/MethodLength:
10
+ Enabled: false
11
+
12
+ Metrics/ClassLength:
13
+ Enabled: false
@@ -1,8 +1,7 @@
1
1
  cache: bundler
2
2
  sudo: false
3
3
  rvm:
4
- - '2.0'
5
- - '2.1'
6
- - '2.3.0'
4
+ - "2.7.1"
5
+ - "2.6.5"
7
6
  notifications:
8
7
  email: false
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
  gemspec
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Permalink
2
2
 
3
- [![Code Climate](https://codeclimate.com/github/fnando/permalink.png)](https://codeclimate.com/github/fnando/permalink)
3
+ [![Code Climate](https://codeclimate.com/github/fnando/permalink.svg)](https://codeclimate.com/github/fnando/permalink)
4
4
  [![Build Status](https://travis-ci.org/fnando/permalink.svg)](https://travis-ci.org/fnando/permalink)
5
- [![Gem](https://img.shields.io/gem/v/permalink.svg)](https://rubygems.org/permalink)
6
- [![Gem](https://img.shields.io/gem/dt/permalink.svg)](https://rubygems.org/permalink)
5
+ [![Gem](https://img.shields.io/gem/v/permalink.svg)](https://rubygems.org/gems/permalink)
6
+ [![Gem](https://img.shields.io/gem/dt/permalink.svg)](https://rubygems.org/gems/permalink)
7
7
 
8
8
  ## Installation
9
9
 
@@ -11,7 +11,8 @@
11
11
 
12
12
  ## Usage
13
13
 
14
- Add the method call `permalink` to your model. Your model should have a `permalink` attribute.
14
+ Add the method call `permalink` to your model. Your model should have a
15
+ `permalink` attribute.
15
16
 
16
17
  ```ruby
17
18
  class Page < ActiveRecord::Base
@@ -27,9 +28,12 @@ class page < ActiveRecord::Base
27
28
  end
28
29
  ```
29
30
 
30
- If you don't want to use `permalink`, you can call `Permalink.generate("some text")` string method and manage the permalink process by yourself.
31
+ If you don't want to use `permalink`, you can call
32
+ `Permalink.generate("some text")` string method and manage the permalink process
33
+ by yourself.
31
34
 
32
- Permalinks are not unique by default. `permalink` overrides `to_param` as following:
35
+ Permalinks are not unique by default. `permalink` overrides `to_param` as
36
+ following:
33
37
 
34
38
  ```ruby
35
39
  def to_param
@@ -45,7 +49,9 @@ class Page < ActiveRecord::Base
45
49
  end
46
50
  ```
47
51
 
48
- The above settings will generate something link `100-some-title-page`. By overriding `to_param` method you don't have to change a thing on your app routes.
52
+ The above settings will generate something link `100-some-title-page`. By
53
+ overriding `to_param` method you don't have to change a thing on your app
54
+ routes.
49
55
 
50
56
  If you want to generate unique permalink, use the `:unique` option:
51
57
 
@@ -55,7 +61,8 @@ class Page < ActiveRecord::Base
55
61
  end
56
62
  ```
57
63
 
58
- The permalink can be tied to a given scope. Let's say you want to have unique permalinks by user. Just set the `:scope` option.
64
+ The permalink can be tied to a given scope. Let's say you want to have unique
65
+ permalinks by user. Just set the `:scope` option.
59
66
 
60
67
  ```ruby
61
68
  class Page < ActiveRecord::Base
@@ -73,9 +80,13 @@ another_page = another_user.pages.create(title: 'Hello')
73
80
  another_page.permalink #=> hello
74
81
  ```
75
82
 
76
- The permalink is generated using `ActiveSupport::Multibyte::Chars` class; this means that characters will properly replaced from `áéíó` to `aeio`, for instance.
83
+ The permalink is generated using `ActiveSupport::Multibyte::Chars` class; this
84
+ means that characters will properly replaced from `áéíó` to `aeio`, for
85
+ instance.
77
86
 
78
- The permalink is created when `before_validation` callback is evaluated. This plugin also tries to generate a permalink when `before_save` callback is evaluated and the instance has no permalink set.
87
+ The permalink is created when `before_validation` callback is evaluated. This
88
+ plugin also tries to generate a permalink when `before_save` callback is
89
+ evaluated and the instance has no permalink set.
79
90
 
80
91
  You can force the permalink generation by setting the `:force` option.
81
92
 
@@ -89,8 +100,19 @@ end
89
100
 
90
101
  Copyright (c) 2011-2015 Nando Vieira, released under the MIT license
91
102
 
92
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
93
-
94
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
95
-
96
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
103
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
104
+ this software and associated documentation files (the "Software"), to deal in
105
+ the Software without restriction, including without limitation the rights to
106
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
107
+ the Software, and to permit persons to whom the Software is furnished to do so,
108
+ subject to the following conditions:
109
+
110
+ The above copyright notice and this permission notice shall be included in all
111
+ copies or substantial portions of the Software.
112
+
113
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
114
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
115
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
116
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
117
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
118
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rake/testtask"
5
+ require "rubocop/rake_task"
3
6
 
4
7
  Rake::TestTask.new(:test) do |t|
5
8
  t.libs << "test"
@@ -7,4 +10,6 @@ Rake::TestTask.new(:test) do |t|
7
10
  t.warning = false
8
11
  end
9
12
 
10
- task default: :test
13
+ RuboCop::RakeTask.new
14
+
15
+ task default: %i[test rubocop]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "active_record"
2
4
  require "permalink/active_record"
3
5
  require "permalink/normalizations/contraction"
@@ -15,12 +17,12 @@ module Permalink
15
17
  Normalizations::NonAlphanumeric,
16
18
  Normalizations::MultipleDashes,
17
19
  Normalizations::LeadingTrailingDashes
18
- ]
20
+ ].freeze
19
21
 
20
22
  DEFAULT_OPTIONS = {
21
23
  normalizations: DEFAULT_NORMALIZATIONS,
22
24
  separator: "-"
23
- }
25
+ }.freeze
24
26
 
25
27
  def self.generate(input, options = DEFAULT_OPTIONS)
26
28
  options = DEFAULT_OPTIONS.merge(options)
@@ -33,4 +35,4 @@ module Permalink
33
35
  end
34
36
  end
35
37
 
36
- ActiveRecord::Base.send(:include, Permalink::ActiveRecord)
38
+ ActiveRecord::Base.include Permalink::ActiveRecord
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Permalink
2
4
  module ActiveRecord
3
5
  def self.included(base)
@@ -16,14 +18,14 @@ module Permalink
16
18
  def permalink(from_column, options = {})
17
19
  include InstanceMethods
18
20
 
19
- options = options.reverse_merge({
20
- to_param: [:id, :permalink],
21
+ options = options.reverse_merge(
22
+ to_param: %i[id permalink],
21
23
  to: :permalink,
22
24
  unique: false,
23
25
  force: false,
24
26
  separator: "-",
25
27
  normalizations: Permalink::DEFAULT_NORMALIZATIONS
26
- })
28
+ )
27
29
 
28
30
  self.permalink_options = {
29
31
  from_column_name: from_column,
@@ -45,14 +47,12 @@ module Permalink
45
47
  def to_param
46
48
  to_param_option = permalink_options[:to_param]
47
49
 
48
- to_param_option.compact.map {|name|
50
+ to_param_option.compact.map do |name|
49
51
  respond_to?(name) ? public_send(name).to_s : name.to_s
50
- }.reject(&:blank?).join(permalink_options[:separator])
52
+ end.reject(&:blank?).join(permalink_options[:separator])
51
53
  end
52
54
 
53
- private
54
-
55
- def next_available_permalink(permalink)
55
+ private def next_available_permalink(permalink)
56
56
  unique_permalink = permalink
57
57
  scope = build_scope_for_permalink
58
58
 
@@ -60,7 +60,9 @@ module Permalink
60
60
  suffix = 2
61
61
 
62
62
  while scope.where(to_permalink_name => unique_permalink).first
63
- unique_permalink = [permalink, suffix].join(permalink_options[:separator])
63
+ unique_permalink =
64
+ [permalink, suffix].join(permalink_options[:separator])
65
+
64
66
  suffix += 1
65
67
  end
66
68
  end
@@ -68,42 +70,53 @@ module Permalink
68
70
  unique_permalink
69
71
  end
70
72
 
71
- def build_scope_for_permalink
73
+ private def build_scope_for_permalink
72
74
  search_scope = permalink_options[:scope]
73
75
  scope = self.class.unscoped
74
- scope = scope.where(search_scope => public_send(search_scope)) if search_scope
76
+
77
+ if search_scope
78
+ scope = scope.where(search_scope => public_send(search_scope))
79
+ end
80
+
75
81
  scope
76
82
  end
77
83
 
78
- def from_permalink_name
84
+ private def from_permalink_name
79
85
  permalink_options[:from_column_name]
80
86
  end
81
87
 
82
- def to_permalink_name
88
+ private def to_permalink_name
83
89
  permalink_options[:to_column_name]
84
90
  end
85
91
 
86
- def from_permalink_value
92
+ private def from_permalink_value
87
93
  read_attribute(from_permalink_name)
88
94
  end
89
95
 
90
- def to_permalink_value
96
+ private def to_permalink_value
91
97
  read_attribute(to_permalink_name)
92
98
  end
93
99
 
94
- def update_permalink?
100
+ private def update_permalink?
95
101
  changes[from_permalink_name] &&
96
102
  (permalink_options[:force] || to_permalink_value.blank?)
97
103
  end
98
104
 
99
- def create_permalink
105
+ private def create_permalink
106
+ return unless update_permalink?
107
+
108
+ permalink = Permalink.generate(
109
+ from_permalink_value.to_s,
110
+ permalink_generator_options
111
+ )
112
+
100
113
  write_attribute(
101
114
  to_permalink_name,
102
- next_available_permalink(Permalink.generate(from_permalink_value.to_s, permalink_generator_options))
103
- ) if update_permalink?
115
+ next_available_permalink(permalink)
116
+ )
104
117
  end
105
118
 
106
- def permalink_generator_options
119
+ private def permalink_generator_options
107
120
  {
108
121
  separator: permalink_options[:separator],
109
122
  normalizations: permalink_options[:normalizations]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Permalink
2
4
  module Normalizations
3
5
  module Contraction
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Permalink
2
4
  module Normalizations
3
5
  module Downcase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Permalink
2
4
  module Normalizations
3
5
  module LeadingTrailingDashes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Permalink
2
4
  module Normalizations
3
5
  module MultipleDashes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Permalink
2
4
  module Normalizations
3
5
  module NonAlphanumeric
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Permalink
2
4
  module Normalizations
3
5
  module Transliteration
4
6
  def self.call(input, _options = nil)
5
- ActiveSupport::Multibyte::Chars.new(input)
6
- .normalize(:kd)
7
+ input
8
+ .unicode_normalize(:nfkd)
7
9
  .gsub(/[^\x00-\x7F]/, "")
8
10
  .to_s
9
11
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Permalink
2
4
  module Version
3
5
  MAJOR = 2
4
- MINOR = 0
6
+ MINOR = 1
5
7
  PATCH = 0
6
8
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
9
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "./lib/permalink/version"
2
4
 
3
5
  Gem::Specification.new do |s|
@@ -10,14 +12,20 @@ Gem::Specification.new do |s|
10
12
  s.summary = "Generate permalink attributes on ActiveModel/ActiveRecord"
11
13
  s.description = s.summary
12
14
  s.license = "MIT"
15
+ s.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
13
16
 
14
17
  s.files = `git ls-files`.split("\n")
15
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
- s.executables = `git ls-files -- bin/*`.split("\n").map {|f| File.basename(f) }
19
+ s.executables = `git ls-files -- bin/*`
20
+ .split("\n")
21
+ .map {|f| File.basename(f) }
17
22
  s.require_paths = ["lib"]
18
23
 
19
24
  s.add_dependency "activerecord"
20
- s.add_development_dependency "sqlite3"
21
25
  s.add_development_dependency "minitest-utils"
22
26
  s.add_development_dependency "rake"
27
+ s.add_development_dependency "rubocop"
28
+ s.add_development_dependency "rubocop-fnando"
29
+ s.add_development_dependency "simplecov"
30
+ s.add_development_dependency "sqlite3"
23
31
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class ActiveRecordTest < Minitest::Test
@@ -123,7 +125,7 @@ class ActiveRecordTest < Minitest::Test
123
125
  model.permalink :title, force: true
124
126
 
125
127
  record = model.create(title: "Some nice post")
126
- record.update_attributes title: "Awesome post"
128
+ record.update title: "Awesome post"
127
129
 
128
130
  assert_equal "awesome-post", record.permalink
129
131
  end
@@ -133,7 +135,7 @@ class ActiveRecordTest < Minitest::Test
133
135
 
134
136
  record = model.create(title: "Some nice post")
135
137
 
136
- record.update_attributes title: "Awesome post"
138
+ record.update title: "Awesome post"
137
139
  assert_equal "awesome-post", record.permalink
138
140
 
139
141
  record = model.create(title: "Awesome post")
@@ -144,7 +146,7 @@ class ActiveRecordTest < Minitest::Test
144
146
  model.permalink :title, force: true, unique: true
145
147
 
146
148
  record = model.create(title: "Some nice post")
147
- record.update_attributes description: "some description"
149
+ record.update description: "some description"
148
150
 
149
151
  assert_equal "some-nice-post", record.permalink
150
152
  end
@@ -164,7 +166,8 @@ class ActiveRecordTest < Minitest::Test
164
166
  end
165
167
 
166
168
  test "uses custom normalization" do
167
- model.permalink :title, normalizations: [->(input, options) { input.to_s.reverse }]
169
+ model.permalink :title,
170
+ normalizations: [->(input, _options) { input.to_s.reverse }]
168
171
  record = model.create(title: "Some nice post")
169
172
 
170
173
  assert_equal "Some nice post".reverse, record.permalink
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class NormalizationsTest < Minitest::Test
@@ -7,7 +9,8 @@ class NormalizationsTest < Minitest::Test
7
9
  end
8
10
 
9
11
  test "applies transliteration" do
10
- assert_equal "aeiou", Permalink::Normalizations::Transliteration.call("áéíóú")
12
+ assert_equal "aeiou",
13
+ Permalink::Normalizations::Transliteration.call("áéíóú")
11
14
  end
12
15
 
13
16
  test "applies downcasing" do
@@ -15,22 +18,31 @@ class NormalizationsTest < Minitest::Test
15
18
  end
16
19
 
17
20
  test "applies lead/trailing dashes replacement" do
18
- assert_equal "test", Permalink::Normalizations::LeadingTrailingDashes.call("-test-")
21
+ permalink = Permalink::Normalizations::LeadingTrailingDashes.call("-test-")
22
+ assert_equal "test", permalink
19
23
  end
20
24
 
21
25
  test "applies multiple dashes replacement" do
22
- assert_equal "nice-permalink", Permalink::Normalizations::MultipleDashes.call("nice----permalink")
26
+ permalink =
27
+ Permalink::Normalizations::MultipleDashes.call("nice----permalink")
28
+ assert_equal "nice-permalink", permalink
23
29
  end
24
30
 
25
31
  test "applies multiple dashes replacement with custom separator" do
26
- assert_equal "nice_permalink", Permalink::Normalizations::MultipleDashes.call("nice----permalink", separator: "_")
32
+ permalink = Permalink::Normalizations::MultipleDashes
33
+ .call("nice----permalink", separator: "_")
34
+ assert_equal "nice_permalink", permalink
27
35
  end
28
36
 
29
37
  test "applies non-alphanumeric replacement" do
30
- assert_equal "nice-permalink-", Permalink::Normalizations::NonAlphanumeric.call("nice-permalink!")
38
+ permalink =
39
+ Permalink::Normalizations::NonAlphanumeric.call("nice-permalink!")
40
+ assert_equal "nice-permalink-", permalink
31
41
  end
32
42
 
33
43
  test "applies non-alphanumeric replacement with custom separator" do
34
- assert_equal "nice_permalink_", Permalink::Normalizations::NonAlphanumeric.call("nice-permalink!", separator: "_")
44
+ permalink = Permalink::Normalizations::NonAlphanumeric
45
+ .call("nice-permalink!", separator: "_")
46
+ assert_equal "nice_permalink_", permalink
35
47
  end
36
48
  end
@@ -1,15 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class PermalinkTest < Minitest::Test
4
6
  {
5
- 'This IS a Tripped out title!!.!1 (well/ not really)' => 'this-is-a-tripped-out-title-1-well-not-really',
6
- '////// meph1sto r0x ! \\\\\\' => 'meph1sto-r0x',
7
- 'āčēģīķļņū' => 'acegiklnu',
8
- '中文測試 chinese text' => 'chinese-text',
9
- 'some-)()()-ExtRa!/// .data==?> to \/\/test' => 'some-extra-data-to-test',
10
- 'http://simplesideias.com.br/tags/' => 'http-simplesideias-com-br-tags',
11
- "Don't Repeat Yourself (DRY)" => 'dont-repeat-yourself-dry',
12
- "Text\nwith\nline\n\n\tbreaks" => 'text-with-line-breaks',
7
+ "This IS a Tripped out title!!.!1 (well/ not really)" => "this-is-a-tripped-out-title-1-well-not-really", # rubocop:disable Layout/LineLength
8
+ '////// meph1sto r0x ! \\\\\\' => "meph1sto-r0x",
9
+ "āčēģīķļņū" => "acegiklnu",
10
+ "中文測試 chinese text" => "chinese-text",
11
+ 'some-)()()-ExtRa!/// .data==?> to \/\/test' => "some-extra-data-to-test",
12
+ "http://simplesideias.com.br/tags/" => "http-simplesideias-com-br-tags",
13
+ "Don't Repeat Yourself (DRY)" => "dont-repeat-yourself-dry",
14
+ "Text\nwith\nline\n\n\tbreaks" => "text-with-line-breaks",
13
15
  "can't do it" => "cant-do-it",
14
16
  "i'm a dog" => "im-a-dog"
15
17
  }.each do |from, to|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Post < ActiveRecord::Base
2
4
  belongs_to :user
3
5
  end
@@ -1,4 +1,6 @@
1
- ActiveRecord::Schema.define(:version => 0) do
1
+ # frozen_string_literal: true
2
+
3
+ ActiveRecord::Schema.define(version: 0) do
2
4
  create_table :posts do |t|
3
5
  t.string :title, :permalink, :description, :slug
4
6
  t.belongs_to :user
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class User < ActiveRecord::Base
2
4
  has_many :posts
3
5
  end
@@ -1,3 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
1
6
  require "bundler/setup"
2
7
  require "permalink"
3
8
 
@@ -10,4 +15,3 @@ ActiveRecord::Base
10
15
  load("support/schema.rb")
11
16
  require "support/user"
12
17
  require "support/post"
13
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: permalink
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-27 00:00:00.000000000 Z
11
+ date: 2020-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: sqlite3
28
+ name: minitest-utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: minitest-utils
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,49 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: rubocop
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'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-fnando
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
57
99
  requirement: !ruby/object:Gem::Requirement
58
100
  requirements:
59
101
  - - ">="
@@ -73,7 +115,9 @@ executables: []
73
115
  extensions: []
74
116
  extra_rdoc_files: []
75
117
  files:
118
+ - ".github/FUNDING.yml"
76
119
  - ".gitignore"
120
+ - ".rubocop.yml"
77
121
  - ".travis.yml"
78
122
  - Gemfile
79
123
  - README.md
@@ -99,7 +143,7 @@ homepage: http://rubygems.org/gems/permalink
99
143
  licenses:
100
144
  - MIT
101
145
  metadata: {}
102
- post_install_message:
146
+ post_install_message:
103
147
  rdoc_options: []
104
148
  require_paths:
105
149
  - lib
@@ -107,16 +151,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
151
  requirements:
108
152
  - - ">="
109
153
  - !ruby/object:Gem::Version
110
- version: '0'
154
+ version: 2.5.0
111
155
  required_rubygems_version: !ruby/object:Gem::Requirement
112
156
  requirements:
113
157
  - - ">="
114
158
  - !ruby/object:Gem::Version
115
159
  version: '0'
116
160
  requirements: []
117
- rubyforge_project:
118
- rubygems_version: 2.5.1
119
- signing_key:
161
+ rubygems_version: 3.1.2
162
+ signing_key:
120
163
  specification_version: 4
121
164
  summary: Generate permalink attributes on ActiveModel/ActiveRecord
122
165
  test_files: