norman-friendly_id 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Manifest.txt +1 -0
- data/README.rdoc +14 -1
- data/Rakefile +1 -2
- data/friendly_id.gemspec +10 -13
- data/lib/friendly_id/version.rb +1 -1
- data/lib/friendly_id.rb +1 -1
- data/test/contest.rb +94 -0
- data/test/test_helper.rb +1 -1
- metadata +8 -17
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
@@ -242,7 +242,9 @@ discouraged:
|
|
242
242
|
|
243
243
|
== Setting it up
|
244
244
|
|
245
|
-
|
245
|
+
The current release works with Rails 2.2 and above, and is compatible with
|
246
|
+
Ruby 1.8 and 1.9. If you need support for Rails 2.0 - 2.1, you need to install
|
247
|
+
an older version of FriendlyId. Here's how to set it up.
|
246
248
|
|
247
249
|
1) Install the Gem:
|
248
250
|
|
@@ -279,6 +281,17 @@ The default is to remove dead slugs older than 45 days, but is configurable:
|
|
279
281
|
|
280
282
|
rake:friendly_id:remove_old_slugs MODEL=MyModelName DAYS=60
|
281
283
|
|
284
|
+
== Installing an older version
|
285
|
+
|
286
|
+
If you are still on Rails 2.1 or lower, please install version 2.0.4:
|
287
|
+
|
288
|
+
gem install friendly_id --version 2.0.4
|
289
|
+
|
290
|
+
Note that this version depends on the Unicode gem, which doesn't compile on
|
291
|
+
Windows and is incompatible with Ruby 1.9. It also can't be installed on
|
292
|
+
Heroku. If these are problems, you'll need to update your application to Rails
|
293
|
+
2.2 or higher and use the current release of FriendlyId.
|
294
|
+
|
282
295
|
== Upgrading from an older version
|
283
296
|
|
284
297
|
If you installed an older version of FriendlyId and want to upgrade to 2.0.x,
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'lib/friendly_id/version'
|
|
4
4
|
$hoe = Hoe.new("friendly_id", FriendlyId::Version::STRING) do |p|
|
5
5
|
p.rubyforge_name = "friendly-id"
|
6
6
|
p.author = ['Norman Clarke', 'Adrian Mugnolo', 'Emilio Tagua']
|
7
|
-
p.email = ['norman@
|
7
|
+
p.email = ['norman@rubysouth.com', 'adrian@rubysouth.com', 'miloops@gmail.com']
|
8
8
|
p.summary = "A comprehensive slugging and pretty-URL plugin for ActiveRecord."
|
9
9
|
p.description = 'A comprehensive slugging and pretty-URL plugin for ActiveRecord.'
|
10
10
|
p.url = 'http://friendly-id.rubyforge.org/'
|
@@ -12,7 +12,6 @@ $hoe = Hoe.new("friendly_id", FriendlyId::Version::STRING) do |p|
|
|
12
12
|
p.extra_deps << ['activerecord', '>= 2.0.0']
|
13
13
|
p.extra_deps << ['activesupport', '>= 2.0.0']
|
14
14
|
p.extra_dev_deps << ['newgem', ">= #{::Newgem::VERSION}"]
|
15
|
-
p.extra_dev_deps << ['Shoulda', ">= 1.2.0"]
|
16
15
|
p.extra_dev_deps << ['sqlite3-ruby']
|
17
16
|
p.remote_rdoc_dir = ""
|
18
17
|
end
|
data/friendly_id.gemspec
CHANGED
@@ -2,47 +2,44 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{friendly_id}
|
5
|
-
s.version = "2.1.
|
5
|
+
s.version = "2.1.2"
|
6
|
+
|
6
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
7
8
|
s.authors = ["Norman Clarke", "Adrian Mugnolo", "Emilio Tagua"]
|
8
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-05-21}
|
9
10
|
s.description = %q{A comprehensive slugging and pretty-URL plugin for ActiveRecord.}
|
10
|
-
s.email = ["norman@
|
11
|
+
s.email = ["norman@rubysouth.com", "adrian@rubysouth.com", "miloops@gmail.com"]
|
11
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
|
12
|
-
s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "config/website.yml", "friendly_id.gemspec", "generators/friendly_id/friendly_id_generator.rb", "generators/friendly_id/templates/create_slugs.rb", "generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb", "generators/friendly_id_20_upgrade/templates/upgrade_friendly_id_to_20.rb", "init.rb", "lib/friendly_id.rb", "lib/friendly_id/helpers.rb", "lib/friendly_id/non_sluggable_class_methods.rb", "lib/friendly_id/non_sluggable_instance_methods.rb", "lib/friendly_id/slug.rb", "lib/friendly_id/sluggable_class_methods.rb", "lib/friendly_id/sluggable_instance_methods.rb", "lib/friendly_id/version.rb", "lib/tasks/friendly_id.rake", "lib/tasks/friendly_id.rb", "test/custom_slug_normalizer_test.rb", "test/models/book.rb", "test/models/country.rb", "test/models/novel.rb", "test/models/person.rb", "test/models/post.rb", "test/models/thing.rb", "test/models/user.rb", "test/non_slugged_test.rb", "test/schema.rb", "test/scoped_model_test.rb", "test/slug_test.rb", "test/slugged_model_test.rb", "test/sti_test.rb", "test/test_helper.rb"]
|
13
|
-
s.has_rdoc = true
|
13
|
+
s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "config/website.yml", "friendly_id.gemspec", "generators/friendly_id/friendly_id_generator.rb", "generators/friendly_id/templates/create_slugs.rb", "generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb", "generators/friendly_id_20_upgrade/templates/upgrade_friendly_id_to_20.rb", "init.rb", "lib/friendly_id.rb", "lib/friendly_id/helpers.rb", "lib/friendly_id/non_sluggable_class_methods.rb", "lib/friendly_id/non_sluggable_instance_methods.rb", "lib/friendly_id/slug.rb", "lib/friendly_id/sluggable_class_methods.rb", "lib/friendly_id/sluggable_instance_methods.rb", "lib/friendly_id/version.rb", "lib/tasks/friendly_id.rake", "lib/tasks/friendly_id.rb", "test/contest.rb", "test/custom_slug_normalizer_test.rb", "test/models/book.rb", "test/models/country.rb", "test/models/novel.rb", "test/models/person.rb", "test/models/post.rb", "test/models/thing.rb", "test/models/user.rb", "test/non_slugged_test.rb", "test/schema.rb", "test/scoped_model_test.rb", "test/slug_test.rb", "test/slugged_model_test.rb", "test/sti_test.rb", "test/test_helper.rb"]
|
14
14
|
s.homepage = %q{http://friendly-id.rubyforge.org/}
|
15
15
|
s.rdoc_options = ["--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{friendly-id}
|
18
|
-
s.rubygems_version = %q{1.3.
|
18
|
+
s.rubygems_version = %q{1.3.3}
|
19
19
|
s.summary = %q{A comprehensive slugging and pretty-URL plugin for ActiveRecord.}
|
20
20
|
s.test_files = ["test/custom_slug_normalizer_test.rb", "test/non_slugged_test.rb", "test/scoped_model_test.rb", "test/slug_test.rb", "test/slugged_model_test.rb", "test/sti_test.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
-
s.specification_version =
|
24
|
+
s.specification_version = 3
|
25
25
|
|
26
26
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
27
|
s.add_runtime_dependency(%q<activerecord>, [">= 2.0.0"])
|
28
28
|
s.add_runtime_dependency(%q<activesupport>, [">= 2.0.0"])
|
29
|
-
s.add_development_dependency(%q<newgem>, [">= 1.
|
30
|
-
s.add_development_dependency(%q<Shoulda>, [">= 1.2.0"])
|
29
|
+
s.add_development_dependency(%q<newgem>, [">= 1.4.1"])
|
31
30
|
s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
|
32
31
|
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
|
33
32
|
else
|
34
33
|
s.add_dependency(%q<activerecord>, [">= 2.0.0"])
|
35
34
|
s.add_dependency(%q<activesupport>, [">= 2.0.0"])
|
36
|
-
s.add_dependency(%q<newgem>, [">= 1.
|
37
|
-
s.add_dependency(%q<Shoulda>, [">= 1.2.0"])
|
35
|
+
s.add_dependency(%q<newgem>, [">= 1.4.1"])
|
38
36
|
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
39
37
|
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
40
38
|
end
|
41
39
|
else
|
42
40
|
s.add_dependency(%q<activerecord>, [">= 2.0.0"])
|
43
41
|
s.add_dependency(%q<activesupport>, [">= 2.0.0"])
|
44
|
-
s.add_dependency(%q<newgem>, [">= 1.
|
45
|
-
s.add_dependency(%q<Shoulda>, [">= 1.2.0"])
|
42
|
+
s.add_dependency(%q<newgem>, [">= 1.4.1"])
|
46
43
|
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
47
44
|
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
48
45
|
end
|
data/lib/friendly_id/version.rb
CHANGED
data/lib/friendly_id.rb
CHANGED
data/test/contest.rb
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
# License
|
2
|
+
# -------
|
3
|
+
#
|
4
|
+
# Contest is copyright (c) 2009 Damian Janowski and Michel Martens for
|
5
|
+
# Citrusbyte
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person
|
8
|
+
# obtaining a copy of this software and associated documentation
|
9
|
+
# files (the "Software"), to deal in the Software without
|
10
|
+
# restriction, including without limitation the rights to use,
|
11
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the
|
13
|
+
# Software is furnished to do so, subject to the following
|
14
|
+
# conditions:
|
15
|
+
#
|
16
|
+
# The above copyright notice and this permission notice shall be
|
17
|
+
# included in all copies or substantial portions of the Software.
|
18
|
+
#
|
19
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
21
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
22
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
23
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
24
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
25
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
26
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
27
|
+
require "test/unit"
|
28
|
+
|
29
|
+
# Test::Unit loads a default test if the suite is empty, whose purpose is to
|
30
|
+
# fail. Since having empty contexts is a common practice, we decided to
|
31
|
+
# overwrite TestSuite#empty? in order to allow them. Having a failure when no
|
32
|
+
# tests have been defined seems counter-intuitive.
|
33
|
+
class Test::Unit::TestSuite
|
34
|
+
def empty?
|
35
|
+
false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Contest adds +teardown+, +test+ and +context+ as class methods, and the
|
40
|
+
# instance methods +setup+ and +teardown+ now iterate on the corresponding
|
41
|
+
# blocks. Note that all setup and teardown blocks must be defined with the
|
42
|
+
# block syntax. Adding setup or teardown instance methods defeats the purpose
|
43
|
+
# of this library.
|
44
|
+
class Test::Unit::TestCase
|
45
|
+
def self.setup(&block)
|
46
|
+
define_method :setup do
|
47
|
+
super(&block)
|
48
|
+
instance_eval(&block)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.teardown(&block)
|
53
|
+
define_method :teardown do
|
54
|
+
instance_eval(&block)
|
55
|
+
super(&block)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.context(name, &block)
|
60
|
+
subclass = Class.new(self)
|
61
|
+
remove_tests(subclass)
|
62
|
+
subclass.class_eval(&block)
|
63
|
+
const_set(context_name(name), subclass)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.test(name, &block)
|
67
|
+
define_method(test_name(name), &block)
|
68
|
+
end
|
69
|
+
|
70
|
+
class << self
|
71
|
+
alias_method :should, :test
|
72
|
+
alias_method :describe, :context
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def self.context_name(name)
|
78
|
+
"Test#{sanitize_name(name).gsub(/(^| )(\w)/) { $2.upcase }}".to_sym
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.test_name(name)
|
82
|
+
"test_#{sanitize_name(name).gsub(/\s+/,'_')}".to_sym
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.sanitize_name(name)
|
86
|
+
name.gsub(/\W+/, ' ').strip
|
87
|
+
end
|
88
|
+
|
89
|
+
def self.remove_tests(subclass)
|
90
|
+
subclass.public_instance_methods.grep(/^test_/).each do |meth|
|
91
|
+
subclass.send(:undef_method, meth.to_sym)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -4,7 +4,7 @@ $KCODE = 'UTF8' if RUBY_VERSION < '1.9'
|
|
4
4
|
$VERBOSE = false
|
5
5
|
require 'rubygems'
|
6
6
|
require 'test/unit'
|
7
|
-
require '
|
7
|
+
require 'contest'
|
8
8
|
# You can use "rake test AR_VERSION=2.0.5" to test against 2.0.5, for example.
|
9
9
|
# The default is to use the latest installed ActiveRecord.
|
10
10
|
if ENV["AR_VERSION"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: norman-friendly_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Norman Clarke
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-
|
14
|
+
date: 2009-05-21 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -42,17 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.
|
46
|
-
version:
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: Shoulda
|
49
|
-
type: :development
|
50
|
-
version_requirement:
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 1.2.0
|
45
|
+
version: 1.4.1
|
56
46
|
version:
|
57
47
|
- !ruby/object:Gem::Dependency
|
58
48
|
name: sqlite3-ruby
|
@@ -76,8 +66,8 @@ dependencies:
|
|
76
66
|
version:
|
77
67
|
description: A comprehensive slugging and pretty-URL plugin for ActiveRecord.
|
78
68
|
email:
|
79
|
-
- norman@
|
80
|
-
- adrian@
|
69
|
+
- norman@rubysouth.com
|
70
|
+
- adrian@rubysouth.com
|
81
71
|
- miloops@gmail.com
|
82
72
|
executables: []
|
83
73
|
|
@@ -110,6 +100,7 @@ files:
|
|
110
100
|
- lib/friendly_id/version.rb
|
111
101
|
- lib/tasks/friendly_id.rake
|
112
102
|
- lib/tasks/friendly_id.rb
|
103
|
+
- test/contest.rb
|
113
104
|
- test/custom_slug_normalizer_test.rb
|
114
105
|
- test/models/book.rb
|
115
106
|
- test/models/country.rb
|
@@ -125,7 +116,7 @@ files:
|
|
125
116
|
- test/slugged_model_test.rb
|
126
117
|
- test/sti_test.rb
|
127
118
|
- test/test_helper.rb
|
128
|
-
has_rdoc:
|
119
|
+
has_rdoc: false
|
129
120
|
homepage: http://friendly-id.rubyforge.org/
|
130
121
|
post_install_message:
|
131
122
|
rdoc_options:
|
@@ -150,7 +141,7 @@ requirements: []
|
|
150
141
|
rubyforge_project: friendly-id
|
151
142
|
rubygems_version: 1.2.0
|
152
143
|
signing_key:
|
153
|
-
specification_version:
|
144
|
+
specification_version: 3
|
154
145
|
summary: A comprehensive slugging and pretty-URL plugin for ActiveRecord.
|
155
146
|
test_files:
|
156
147
|
- test/custom_slug_normalizer_test.rb
|