friendly_id 2.2.5 → 2.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +13 -0
- data/{MIT-LICENSE → LICENSE} +0 -0
- data/README.rdoc +5 -5
- data/Rakefile +31 -42
- data/extras/README.txt +3 -0
- data/extras/template-gem.rb +26 -0
- data/extras/template-plugin.rb +28 -0
- data/lib/friendly_id.rb +2 -2
- data/lib/friendly_id/non_sluggable_class_methods.rb +5 -4
- data/lib/friendly_id/sluggable_class_methods.rb +1 -1
- data/lib/friendly_id/sluggable_instance_methods.rb +34 -18
- data/lib/friendly_id/tasks.rb +2 -2
- data/lib/friendly_id/version.rb +1 -1
- data/test/cached_slug_test.rb +0 -3
- data/test/custom_slug_normalizer_test.rb +9 -11
- data/test/non_slugged_test.rb +5 -7
- data/test/scoped_model_test.rb +18 -10
- data/test/slug_test.rb +2 -3
- data/test/slugged_model_test.rb +39 -33
- data/test/sti_test.rb +2 -4
- data/test/support/database.yml.postgres +6 -0
- data/test/support/database.yml.sqlite3 +2 -0
- data/test/support/models.rb +45 -0
- data/test/tasks_test.rb +5 -6
- data/test/test_helper.rb +85 -19
- metadata +23 -50
- data/test/contest.rb +0 -94
- data/test/models/book.rb +0 -2
- data/test/models/city.rb +0 -4
- data/test/models/country.rb +0 -4
- data/test/models/district.rb +0 -3
- data/test/models/event.rb +0 -3
- data/test/models/legacy_thing.rb +0 -4
- data/test/models/novel.rb +0 -3
- data/test/models/person.rb +0 -6
- data/test/models/post.rb +0 -6
- data/test/models/thing.rb +0 -6
- data/test/models/user.rb +0 -3
- data/test/schema.rb +0 -70
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: friendly_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.6
|
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-12-10 00:00:00 -03:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -35,17 +35,7 @@ dependencies:
|
|
35
35
|
version: 2.2.3
|
36
36
|
version:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
39
|
-
type: :development
|
40
|
-
version_requirement:
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
requirements:
|
43
|
-
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 1.5.2
|
46
|
-
version:
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: sqlite3-ruby
|
38
|
+
name: contest
|
49
39
|
type: :development
|
50
40
|
version_requirement:
|
51
41
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -54,17 +44,7 @@ dependencies:
|
|
54
44
|
- !ruby/object:Gem::Version
|
55
45
|
version: "0"
|
56
46
|
version:
|
57
|
-
-
|
58
|
-
name: hoe
|
59
|
-
type: :development
|
60
|
-
version_requirement:
|
61
|
-
version_requirements: !ruby/object:Gem::Requirement
|
62
|
-
requirements:
|
63
|
-
- - ">="
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: 2.3.3
|
66
|
-
version:
|
67
|
-
description: A comprehensive slugging and pretty-URL plugin for Rails apps using ActiveRecord.
|
47
|
+
description: " FriendlyId is the \"Swiss Army bulldozer\" of slugging and permalink\n plugins for Ruby on Rails. It allows you to create pretty URL\xE2\x80\x99s\n and work with human-friendly strings as if they were numeric ids for\n ActiveRecord models.\n"
|
68
48
|
email:
|
69
49
|
- norman@njclarke.com
|
70
50
|
- adrian@mugnolo.com
|
@@ -74,19 +54,9 @@ executables: []
|
|
74
54
|
extensions: []
|
75
55
|
|
76
56
|
extra_rdoc_files:
|
77
|
-
- History.txt
|
78
57
|
- README.rdoc
|
79
|
-
files:
|
80
58
|
- History.txt
|
81
|
-
|
82
|
-
- README.rdoc
|
83
|
-
- Rakefile
|
84
|
-
- generators/friendly_id/friendly_id_generator.rb
|
85
|
-
- generators/friendly_id/templates/create_slugs.rb
|
86
|
-
- generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb
|
87
|
-
- generators/friendly_id_20_upgrade/templates/upgrade_friendly_id_to_20.rb
|
88
|
-
- init.rb
|
89
|
-
- lib/friendly_id.rb
|
59
|
+
files:
|
90
60
|
- lib/friendly_id/helpers.rb
|
91
61
|
- lib/friendly_id/non_sluggable_class_methods.rb
|
92
62
|
- lib/friendly_id/non_sluggable_instance_methods.rb
|
@@ -95,32 +65,35 @@ files:
|
|
95
65
|
- lib/friendly_id/sluggable_instance_methods.rb
|
96
66
|
- lib/friendly_id/tasks.rb
|
97
67
|
- lib/friendly_id/version.rb
|
98
|
-
- lib/
|
68
|
+
- lib/friendly_id.rb
|
99
69
|
- lib/tasks/friendly_id.rb
|
70
|
+
- lib/tasks/friendly_id.rake
|
71
|
+
- init.rb
|
72
|
+
- README.rdoc
|
73
|
+
- History.txt
|
74
|
+
- LICENSE
|
75
|
+
- Rakefile
|
76
|
+
- generators/friendly_id/friendly_id_generator.rb
|
77
|
+
- generators/friendly_id/templates/create_slugs.rb
|
78
|
+
- generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb
|
79
|
+
- generators/friendly_id_20_upgrade/templates/upgrade_friendly_id_to_20.rb
|
100
80
|
- test/cached_slug_test.rb
|
101
|
-
- test/contest.rb
|
102
81
|
- test/custom_slug_normalizer_test.rb
|
103
|
-
- test/models/book.rb
|
104
|
-
- test/models/city.rb
|
105
|
-
- test/models/country.rb
|
106
|
-
- test/models/district.rb
|
107
|
-
- test/models/event.rb
|
108
|
-
- test/models/legacy_thing.rb
|
109
|
-
- test/models/novel.rb
|
110
|
-
- test/models/person.rb
|
111
|
-
- test/models/post.rb
|
112
|
-
- test/models/thing.rb
|
113
|
-
- test/models/user.rb
|
114
82
|
- test/non_slugged_test.rb
|
115
|
-
- test/schema.rb
|
116
83
|
- test/scoped_model_test.rb
|
117
84
|
- test/slug_test.rb
|
118
85
|
- test/slugged_model_test.rb
|
119
86
|
- test/sti_test.rb
|
87
|
+
- test/support/database.yml.postgres
|
88
|
+
- test/support/database.yml.sqlite3
|
89
|
+
- test/support/models.rb
|
120
90
|
- test/tasks_test.rb
|
121
91
|
- test/test_helper.rb
|
92
|
+
- extras/README.txt
|
93
|
+
- extras/template-gem.rb
|
94
|
+
- extras/template-plugin.rb
|
122
95
|
has_rdoc: true
|
123
|
-
homepage: http://
|
96
|
+
homepage: http://rdoc.info/projects/norman/friendly_id
|
124
97
|
licenses: []
|
125
98
|
|
126
99
|
post_install_message: |+
|
data/test/contest.rb
DELETED
@@ -1,94 +0,0 @@
|
|
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/models/book.rb
DELETED
data/test/models/city.rb
DELETED
data/test/models/country.rb
DELETED
data/test/models/district.rb
DELETED
data/test/models/event.rb
DELETED
data/test/models/legacy_thing.rb
DELETED
data/test/models/novel.rb
DELETED
data/test/models/person.rb
DELETED
data/test/models/post.rb
DELETED
data/test/models/thing.rb
DELETED
data/test/models/user.rb
DELETED
data/test/schema.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
ActiveRecord::Schema.define(:version => 1) do
|
4
|
-
|
5
|
-
create_table "legacy_table", :force => true do |t|
|
6
|
-
t.column "name", :string
|
7
|
-
end
|
8
|
-
|
9
|
-
create_table "books", :force => true do |t|
|
10
|
-
t.column "title", "string"
|
11
|
-
t.column "type", "text"
|
12
|
-
end
|
13
|
-
|
14
|
-
create_table "things", :force => true do |t|
|
15
|
-
t.column "name", "string"
|
16
|
-
end
|
17
|
-
|
18
|
-
create_table "posts", :force => true do |t|
|
19
|
-
t.column "title", "string"
|
20
|
-
t.column "content", "text"
|
21
|
-
t.column "published", "boolean", :default => false
|
22
|
-
t.column "created_at", "datetime"
|
23
|
-
t.column "updated_at", "datetime"
|
24
|
-
end
|
25
|
-
|
26
|
-
create_table "users", :force => true do |t|
|
27
|
-
t.column "login", "string"
|
28
|
-
t.column "email", "string"
|
29
|
-
t.column "created_at", "datetime"
|
30
|
-
t.column "updated_at", "datetime"
|
31
|
-
end
|
32
|
-
|
33
|
-
create_table "people", :force => true do |t|
|
34
|
-
t.column "name", "string"
|
35
|
-
t.column "country_id", "integer"
|
36
|
-
end
|
37
|
-
|
38
|
-
create_table "countries", :force => true do |t|
|
39
|
-
t.column "name", "string"
|
40
|
-
end
|
41
|
-
|
42
|
-
create_table "events", :force => true do |t|
|
43
|
-
t.column "name", "string"
|
44
|
-
t.column "event_date", "datetime"
|
45
|
-
end
|
46
|
-
|
47
|
-
create_table "cities", :force => true do |t|
|
48
|
-
t.column "name", "string"
|
49
|
-
t.column "population", "integer"
|
50
|
-
t.column "my_slug", "string"
|
51
|
-
end
|
52
|
-
|
53
|
-
create_table "districts", :force => true do |t|
|
54
|
-
t.column "name", "string"
|
55
|
-
t.column "cached_slug", "string"
|
56
|
-
end
|
57
|
-
|
58
|
-
create_table "slugs", :force => true do |t|
|
59
|
-
t.column "name", "string"
|
60
|
-
t.column "sluggable_id", "integer"
|
61
|
-
t.column "sequence", "integer", :null => false, :default => 1
|
62
|
-
t.column "sluggable_type", "string", :limit => 40
|
63
|
-
t.column "scope", "string", :limit => 40
|
64
|
-
t.column "created_at", "datetime"
|
65
|
-
end
|
66
|
-
|
67
|
-
add_index "slugs", ["sluggable_id"], :name => "index_slugs_on_sluggable_id"
|
68
|
-
add_index "slugs", ["name", "sluggable_type", "scope", "sequence"], :name => "index_slugs_on_n_s_s_and_s", :unique => true
|
69
|
-
|
70
|
-
end
|