friendly_id 4.0.0.rc2 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -20,7 +20,7 @@ instead of:
20
20
  FriendlyId offers many advanced features, including: slug history and
21
21
  versioning, i18n, scoped slugs, reserved words, and custom slug generators.
22
22
 
23
- FriendlyId is compatible with Active Record **3.0** and **3.1**.
23
+ FriendlyId is compatible with Active Record **3.0**, **3.1** and **3.2**
24
24
 
25
25
  ## Version 4.x
26
26
 
@@ -46,7 +46,7 @@ which compiles the top-level RDocs into one outlined document.
46
46
 
47
47
  cd my_app
48
48
 
49
- gem "friendly_id", "~> 4.0.0.beta14"
49
+ gem "friendly_id", "~> 4.0.0"
50
50
 
51
51
  rails generate scaffold user name:string slug:string
52
52
 
@@ -36,7 +36,7 @@ EOM
36
36
  NOTE: FriendlyId 4.x breaks compatibility with 3.x. If you're upgrading
37
37
  from 3.x, please see this document:
38
38
 
39
- https://github.com/norman/friendly_id/blob/4.0.0/WhatsNew.md
39
+ http://rubydoc.info/github/norman/friendly_id/master/file/WhatsNew.md
40
40
 
41
41
  EOM
42
42
 
@@ -13,8 +13,9 @@ platform :ruby do
13
13
  gem "sqlite3", "~> 1.3.4"
14
14
  end
15
15
 
16
- gem "activerecord", "~> 3.1.1"
16
+ gem "ffaker"
17
+ gem "activerecord", "~> 3.1.3"
17
18
  gem "minitest", "~> 2.4.0"
18
19
  gem "mocha", "~> 0.9.12"
19
- gem "railties", "~> 3.1.1"
20
+ gem "railties", "~> 3.1.3"
20
21
  gem "rake"
@@ -0,0 +1,21 @@
1
+ source :rubygems
2
+
3
+ # platform :jruby do
4
+ # gem "activerecord-jdbc-adapter", :git => "https://github.com/nicksieger/activerecord-jdbc-adapter.git"
5
+ # gem "activerecord-jdbcmysql-adapter"
6
+ # gem "activerecord-jdbcpostgresql-adapter"
7
+ # gem "activerecord-jdbcsqlite3-adapter"
8
+ # end
9
+
10
+ platform :ruby do
11
+ gem "mysql2", "~> 0.3.6"
12
+ gem "pg", "~> 0.11.0"
13
+ gem "sqlite3", "~> 1.3.4"
14
+ end
15
+
16
+ gem "ffaker"
17
+ gem "activerecord", "~> 3.2.0.rc1"
18
+ gem "minitest", "~> 2.4.0"
19
+ gem "mocha", "~> 0.9.12"
20
+ gem "railties", "~> 3.2.0.rc1"
21
+ gem "rake"
@@ -45,7 +45,7 @@ with numeric ids:
45
45
  module FriendlyId
46
46
 
47
47
  # The current version.
48
- VERSION = "4.0.0.rc2"
48
+ VERSION = "4.0.0"
49
49
 
50
50
  @mutex = Mutex.new
51
51
 
@@ -75,7 +75,9 @@ method.
75
75
  def build_slug
76
76
  return unless should_generate_new_friendly_id?
77
77
  # Allow reversion back to a previously used slug
78
- slugs.where(:slug => friendly_id).delete_all
78
+ relation = slugs.where(:slug => friendly_id)
79
+ result = relation.select("id").lock(true).all
80
+ relation.delete_all unless result.empty?
79
81
  slugs.build :slug => friendly_id
80
82
  end
81
83
 
@@ -0,0 +1,45 @@
1
+ ENV["DB"] = "postgres"
2
+
3
+ require "thread"
4
+ require File.expand_path("../../../helper", __FILE__)
5
+ require "active_record/locking/fatalistic"
6
+
7
+ ActiveRecord::Migration.tap do |m|
8
+ m.drop_table "things"
9
+ m.create_table("things") do |t|
10
+ t.string :name
11
+ t.string :slug
12
+ end
13
+ m.add_index :things, :slug, :unique => true
14
+ end
15
+
16
+ class Thing < ActiveRecord::Base
17
+ extend FriendlyId
18
+ friendly_id :name, :use => :slugged
19
+ end
20
+
21
+ $things = 10.times.map do
22
+ Thing.new :name => "a b c"
23
+ end
24
+
25
+ $mutex = Mutex.new
26
+
27
+ def save_thing
28
+ thing = $mutex.synchronize do
29
+ $things.pop
30
+ end
31
+ if thing.nil? then return end
32
+ Thing.lock do
33
+ thing.save!
34
+ print "#{thing.friendly_id}\n"
35
+ end
36
+ true
37
+ end
38
+
39
+ 2.times.map do
40
+ Thread.new do
41
+ while true do
42
+ break unless save_thing
43
+ end
44
+ end
45
+ end.map(&:value)
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friendly_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.rc2
5
- prerelease: 6
4
+ version: 4.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Norman Clarke
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-20 00:00:00.000000000 Z
12
+ date: 2011-12-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70113010960640 !ruby/object:Gem::Requirement
16
+ requirement: &70322990492320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70113010960640
24
+ version_requirements: *70322990492320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activerecord
27
- requirement: &70113010958920 !ruby/object:Gem::Requirement
27
+ requirement: &70322990491640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70113010958920
35
+ version_requirements: *70322990491640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sqlite3
38
- requirement: &70113010957760 !ruby/object:Gem::Requirement
38
+ requirement: &70322990490880 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.3.4
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70113010957760
46
+ version_requirements: *70322990490880
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: minitest
49
- requirement: &70113010956880 !ruby/object:Gem::Requirement
49
+ requirement: &70322990489960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.4.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70113010956880
57
+ version_requirements: *70322990489960
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: mocha
60
- requirement: &70113010955680 !ruby/object:Gem::Requirement
60
+ requirement: &70322990489120 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.9.12
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70113010955680
68
+ version_requirements: *70322990489120
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ffaker
71
- requirement: &70113010954720 !ruby/object:Gem::Requirement
71
+ requirement: &70322990487800 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.8.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70113010954720
79
+ version_requirements: *70322990487800
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: maruku
82
- requirement: &70113010953400 !ruby/object:Gem::Requirement
82
+ requirement: &70322990507280 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.6.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70113010953400
90
+ version_requirements: *70322990507280
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: yard
93
- requirement: &70113010952800 !ruby/object:Gem::Requirement
93
+ requirement: &70322990506220 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.7.2
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70113010952800
101
+ version_requirements: *70322990506220
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: i18n
104
- requirement: &70113010952100 !ruby/object:Gem::Requirement
104
+ requirement: &70322990504860 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 0.6.0
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70113010952100
112
+ version_requirements: *70322990504860
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: simplecov
115
- requirement: &70113010951100 !ruby/object:Gem::Requirement
115
+ requirement: &70322990503800 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70113010951100
123
+ version_requirements: *70322990503800
124
124
  description: ! 'FriendlyId is the "Swiss Army bulldozer" of slugging and permalink
125
125
  plugins for
126
126
 
@@ -150,6 +150,7 @@ files:
150
150
  - friendly_id.gemspec
151
151
  - gemfiles/Gemfile.rails-3.0.rb
152
152
  - gemfiles/Gemfile.rails-3.1.rb
153
+ - gemfiles/Gemfile.rails-3.2.rb
153
154
  - lib/friendly_id.rb
154
155
  - lib/friendly_id/base.rb
155
156
  - lib/friendly_id/configuration.rb
@@ -167,6 +168,9 @@ files:
167
168
  - test/base_test.rb
168
169
  - test/compatibility/ancestry/Gemfile
169
170
  - test/compatibility/ancestry/ancestry_test.rb
171
+ - test/compatibility/threading/Gemfile
172
+ - test/compatibility/threading/Gemfile.lock
173
+ - test/compatibility/threading/threading.rb
170
174
  - test/configuration_test.rb
171
175
  - test/core_test.rb
172
176
  - test/databases.yml
@@ -189,7 +193,7 @@ post_install_message: ! 'NOTE: FriendlyId 4.x breaks compatibility with 3.x. If
189
193
  from 3.x, please see this document:
190
194
 
191
195
 
192
- https://github.com/norman/friendly_id/blob/4.0.0/WhatsNew.md
196
+ http://rubydoc.info/github/norman/friendly_id/master/file/WhatsNew.md
193
197
 
194
198
 
195
199
  '
@@ -205,9 +209,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
209
  required_rubygems_version: !ruby/object:Gem::Requirement
206
210
  none: false
207
211
  requirements:
208
- - - ! '>'
212
+ - - ! '>='
209
213
  - !ruby/object:Gem::Version
210
- version: 1.3.1
214
+ version: '0'
211
215
  requirements: []
212
216
  rubyforge_project: friendly_id
213
217
  rubygems_version: 1.8.10