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.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 2.1.2 2009-05-21
2
+
3
+ * 2 minor enhancements:
4
+ * Non-slugged models now validate the friendly_id on save as well as create (Joe Van Dyk).
5
+ * Replaced Shoulda with Contest.
6
+
1
7
  == 2.1.1 2009-03-25
2
8
 
3
9
  * 2 minor enhancements:
data/Manifest.txt CHANGED
@@ -20,6 +20,7 @@ lib/friendly_id/sluggable_instance_methods.rb
20
20
  lib/friendly_id/version.rb
21
21
  lib/tasks/friendly_id.rake
22
22
  lib/tasks/friendly_id.rb
23
+ test/contest.rb
23
24
  test/custom_slug_normalizer_test.rb
24
25
  test/models/book.rb
25
26
  test/models/country.rb
data/README.rdoc CHANGED
@@ -242,7 +242,9 @@ discouraged:
242
242
 
243
243
  == Setting it up
244
244
 
245
- FriendlyId currently works with Rails 2.0.0 - 2.3.0. Here's how to set it up.
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@randomba.org', 'adrian@randomba.org', 'miloops@gmail.com']
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.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-03-25}
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@randomba.org", "adrian@randomba.org", "miloops@gmail.com"]
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.1}
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 = 2
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.2.3"])
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.2.3"])
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.2.3"])
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.rb CHANGED
@@ -76,7 +76,7 @@ module FriendlyId
76
76
  require 'friendly_id/non_sluggable_instance_methods'
77
77
  extend NonSluggableClassMethods
78
78
  include NonSluggableInstanceMethods
79
- validate_on_create :validate_friendly_id
79
+ validate :validate_friendly_id
80
80
  end
81
81
  end
82
82
 
@@ -2,7 +2,7 @@ module FriendlyId #:nodoc:
2
2
  module Version #:nodoc:
3
3
  MAJOR = 2
4
4
  MINOR = 1
5
- TINY = 1
5
+ TINY = 2
6
6
  STRING = [MAJOR, MINOR, TINY].join('.')
7
7
  end
8
8
  end
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 'shoulda'
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: friendly_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Norman Clarke
@@ -32,7 +32,7 @@ cert_chain:
32
32
  h7fbBRfStxI=
33
33
  -----END CERTIFICATE-----
34
34
 
35
- date: 2009-03-25 00:00:00 -03:00
35
+ date: 2009-05-21 00:00:00 -03:00
36
36
  default_executable:
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
@@ -63,17 +63,7 @@ dependencies:
63
63
  requirements:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
- version: 1.2.3
67
- version:
68
- - !ruby/object:Gem::Dependency
69
- name: Shoulda
70
- type: :development
71
- version_requirement:
72
- version_requirements: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: 1.2.0
66
+ version: 1.4.1
77
67
  version:
78
68
  - !ruby/object:Gem::Dependency
79
69
  name: sqlite3-ruby
@@ -97,8 +87,8 @@ dependencies:
97
87
  version:
98
88
  description: A comprehensive slugging and pretty-URL plugin for ActiveRecord.
99
89
  email:
100
- - norman@randomba.org
101
- - adrian@randomba.org
90
+ - norman@rubysouth.com
91
+ - adrian@rubysouth.com
102
92
  - miloops@gmail.com
103
93
  executables: []
104
94
 
@@ -131,6 +121,7 @@ files:
131
121
  - lib/friendly_id/version.rb
132
122
  - lib/tasks/friendly_id.rake
133
123
  - lib/tasks/friendly_id.rb
124
+ - test/contest.rb
134
125
  - test/custom_slug_normalizer_test.rb
135
126
  - test/models/book.rb
136
127
  - test/models/country.rb
@@ -148,6 +139,8 @@ files:
148
139
  - test/test_helper.rb
149
140
  has_rdoc: true
150
141
  homepage: http://friendly-id.rubyforge.org/
142
+ licenses: []
143
+
151
144
  post_install_message:
152
145
  rdoc_options:
153
146
  - --main
@@ -169,9 +162,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
162
  requirements: []
170
163
 
171
164
  rubyforge_project: friendly-id
172
- rubygems_version: 1.3.1
165
+ rubygems_version: 1.3.3
173
166
  signing_key:
174
- specification_version: 2
167
+ specification_version: 3
175
168
  summary: A comprehensive slugging and pretty-URL plugin for ActiveRecord.
176
169
  test_files:
177
170
  - test/custom_slug_normalizer_test.rb
metadata.gz.sig CHANGED
Binary file