acts_more_seo 1.0.1 → 1.1.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
  SHA1:
3
- metadata.gz: ec83478368dca721770a10e86ecd5ad7b3edc435
4
- data.tar.gz: 76b21902f51b84a7f75566883e4379eabf9aea67
3
+ metadata.gz: 6f9639f8b54d0a9ef3ee6a3fd1a77b6eec205a03
4
+ data.tar.gz: 5596ab3b67ee722a89c058e5a256137dd6819b9d
5
5
  SHA512:
6
- metadata.gz: ba75ecff765b0cb7abeeaa5f60dd500cbe1b5d0434c3724bf6e51358d6f3ee67e12bc906dbf91c6ff428f64311643348b0787b78771bbabf3ae811fc9f791218
7
- data.tar.gz: 845c40e90b86a9bc997bf6fb8364b2c062af19cf07a24f21bee58a29c06141114a7e07bfecdc73d6fd459b6945af46f9e9a8e7e5211a8fe706c9b8f2caa101d7
6
+ metadata.gz: 9c05ed6cda9bbcfcf3fe8231c2596b940fc95fa26d72e81ca398950b99b7b95b5fe501f1e3908679f209b6f7365aa13cffe9dc37d4eed6ed889d7b39ca0d2015
7
+ data.tar.gz: 2b95457cd9b6c75a6d5948d87c7eb676e48a724acce6a2cf43d2bed44b8d53a912bc710a457dbf21a4f16a05cb640c235b27cca038717afe8707b93f43616469
data/CHANGELOG.rdoc CHANGED
@@ -33,3 +33,6 @@ Backward compatibility improvements
33
33
  = Version 1.0.1
34
34
  * Polish letters conversion fix
35
35
  * Removed trim and trim! methods from string
36
+ = Version 1.1.0
37
+ * Update for default to_param AR behaviour - if use_id set to false - to_param won't include it
38
+ * Removed unused string methods
data/Manifest CHANGED
@@ -12,6 +12,5 @@ lib/generators/acts_more_seo/templates/create_seo_history_migration.rb
12
12
  lib/seo_finder.rb
13
13
  lib/seo_formatter.rb
14
14
  lib/seo_history.rb
15
- lib/string_ext.rb
16
15
  spec/acts_more_seo_spec.rb
17
16
  spec/spec_helper.rb
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('acts_more_seo', '1.0.1') do |p|
6
+ Echoe.new('acts_more_seo', '1.1.0') do |p|
7
7
  p.description = "Gem makes your ActiveRecord models more SEO friendly. Changes URL to look way better"
8
8
  p.url = "https://github.com/mensfeld/Acts-more-SEO"
9
9
  p.author = "Maciej Mensfeld"
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "acts_more_seo"
5
- s.version = "1.0.1"
5
+ s.version = "1.1.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Maciej Mensfeld"]
9
- s.date = "2013-09-17"
9
+ s.date = "2013-11-06"
10
10
  s.description = "Gem makes your ActiveRecord models more SEO friendly. Changes URL to look way better"
11
11
  s.email = "maciej@mensfeld.pl"
12
- s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.md", "lib/acts_more_seo.rb", "lib/generators/acts_more_seo/install_generator.rb", "lib/generators/acts_more_seo/templates/create_seo_history_migration.rb", "lib/seo_finder.rb", "lib/seo_formatter.rb", "lib/seo_history.rb", "lib/string_ext.rb"]
13
- s.files = ["CHANGELOG.rdoc", "Gemfile", "MIT-LICENSE", "Manifest", "README.md", "Rakefile", "acts_more_seo.gemspec", "init.rb", "lib/acts_more_seo.rb", "lib/generators/acts_more_seo/install_generator.rb", "lib/generators/acts_more_seo/templates/create_seo_history_migration.rb", "lib/seo_finder.rb", "lib/seo_formatter.rb", "lib/seo_history.rb", "lib/string_ext.rb", "spec/acts_more_seo_spec.rb", "spec/spec_helper.rb"]
12
+ s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.md", "lib/acts_more_seo.rb", "lib/generators/acts_more_seo/install_generator.rb", "lib/generators/acts_more_seo/templates/create_seo_history_migration.rb", "lib/seo_finder.rb", "lib/seo_formatter.rb", "lib/seo_history.rb"]
13
+ s.files = ["CHANGELOG.rdoc", "Gemfile", "MIT-LICENSE", "Manifest", "README.md", "Rakefile", "acts_more_seo.gemspec", "init.rb", "lib/acts_more_seo.rb", "lib/generators/acts_more_seo/install_generator.rb", "lib/generators/acts_more_seo/templates/create_seo_history_migration.rb", "lib/seo_finder.rb", "lib/seo_formatter.rb", "lib/seo_history.rb", "spec/acts_more_seo_spec.rb", "spec/spec_helper.rb"]
14
14
  s.homepage = "https://github.com/mensfeld/Acts-more-SEO"
15
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Acts_more_seo", "--main", "README.md"]
15
+ s.rdoc_options = ["--line-numbers", "--title", "Acts_more_seo", "--main", "README.md"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = "acts_more_seo"
18
18
  s.rubygems_version = "2.0.0"
data/lib/acts_more_seo.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  require "babosa"
2
- require "string_ext"
3
2
  require "seo_formatter"
4
3
  require "seo_finder"
5
4
  require "seo_history"
5
+ require "string_ext"
6
6
 
7
7
  module Acts
8
8
  module MoreSeo
@@ -63,13 +63,14 @@ module Acts
63
63
 
64
64
  # Overwrite default to_param - should return nice url
65
65
  def to_param
66
- self.to_url
66
+ self.seo_use_id ? self.to_url : self.to_seo
67
67
  end
68
68
 
69
69
  # Lets return nice and smooth url
70
70
  def to_url
71
71
  Acts::MoreSeo::SeoFormatter.new(self).to_url
72
72
  end
73
+
73
74
  # Alias
74
75
  def url
75
76
  to_url
@@ -57,6 +57,11 @@ describe CoolElement do
57
57
  subject.find_by_seo("134534dass").should eql(nil)
58
58
  lambda { subject.find_by_seo!("134534dass") }.should raise_error(ActiveRecord::RecordNotFound)
59
59
  end
60
+
61
+ it "should have to_param with id" do
62
+ a = subject.create(:name => 'bla bla bla')
63
+ subject.find_by_seo(a.id).to_param.to_i.should eql(a.id)
64
+ end
60
65
  end
61
66
 
62
67
  context "when there is no name" do
@@ -180,6 +185,13 @@ describe BestElement do
180
185
  a.seo_url.should eql("#{a.id}")
181
186
  end
182
187
  end
188
+
189
+ context "when we have a class which has use_id => false" do
190
+ it "should not to_param with id" do
191
+ a = subject.create(:name => 'bla bla bla')
192
+ subject.find_by_seo(a.id).to_param.to_i.should eql 0
193
+ end
194
+ end
183
195
  end
184
196
 
185
197
  context "when there are all the params" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_more_seo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-17 00:00:00.000000000 Z
11
+ date: 2013-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: babosa
@@ -66,7 +66,6 @@ extra_rdoc_files:
66
66
  - lib/seo_finder.rb
67
67
  - lib/seo_formatter.rb
68
68
  - lib/seo_history.rb
69
- - lib/string_ext.rb
70
69
  files:
71
70
  - CHANGELOG.rdoc
72
71
  - Gemfile
@@ -82,7 +81,6 @@ files:
82
81
  - lib/seo_finder.rb
83
82
  - lib/seo_formatter.rb
84
83
  - lib/seo_history.rb
85
- - lib/string_ext.rb
86
84
  - spec/acts_more_seo_spec.rb
87
85
  - spec/spec_helper.rb
88
86
  homepage: https://github.com/mensfeld/Acts-more-SEO
@@ -91,7 +89,6 @@ metadata: {}
91
89
  post_install_message:
92
90
  rdoc_options:
93
91
  - --line-numbers
94
- - --inline-source
95
92
  - --title
96
93
  - Acts_more_seo
97
94
  - --main
data/lib/string_ext.rb DELETED
@@ -1,30 +0,0 @@
1
- # coding: utf-8
2
-
3
- # Required string extensions
4
-
5
- class String
6
- # Removes any "not url friendly" stuff and returns "pure" url
7
- def to_url
8
- temp = self.to_slug.transliterate.to_s.downcase
9
- temp.gsub!(/[^a-zA-Z 0-9]/, "")
10
- temp.gsub!(/\s/,'-')
11
- temp.gsub!(/\-+$/,'')
12
- temp.gsub!(/^\-+/,'')
13
- temp.gsub!(/\-{2,}/, '-')
14
- temp
15
- end
16
-
17
- def to_url!
18
- self.replace self.to_url
19
- end
20
-
21
- # Change new line to html <br/>
22
- def nl2br
23
- self.gsub("\n\r","<br>").gsub("\r", "").gsub("\n", "<br />")
24
- end
25
-
26
- def nl2br!
27
- self.replace self.nl2br
28
- end
29
-
30
- end