stringex 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -2
- data/lib/stringex/acts_as_url.rb +9 -10
- data/stringex.gemspec +8 -11
- metadata +10 -29
data/Rakefile
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'rake'
|
4
4
|
require 'rake/testtask'
|
5
5
|
require 'rdoc/task'
|
6
|
-
require 'stringex/version'
|
7
6
|
|
8
7
|
begin
|
9
8
|
require 'jeweler'
|
@@ -213,7 +212,6 @@ begin
|
|
213
212
|
}
|
214
213
|
gem.rdoc_options = %w{--main README.rdoc --charset utf-8 --line-numbers}
|
215
214
|
gem.extra_rdoc_files = %w{MIT-LICENSE README.rdoc}
|
216
|
-
gem.version = Stringex::Version::STRING
|
217
215
|
end
|
218
216
|
|
219
217
|
Jeweler::RubygemsDotOrgTasks.new
|
data/lib/stringex/acts_as_url.rb
CHANGED
@@ -45,18 +45,17 @@ module Stringex
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def handle_duplicate_urls!(instance)
|
48
|
-
|
49
|
-
base_url = instance.instance_variable_get("@acts_as_url_base_url")
|
48
|
+
return if allow_duplicates
|
50
49
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
instance.send :write_attribute, url_attribute, "#{base_url}#{separator}#{n}"
|
50
|
+
base_url = instance.instance_variable_get("@acts_as_url_base_url")
|
51
|
+
url_owners = instance.class.unscoped.find(:all, :conditions => get_conditions!(instance))
|
52
|
+
if url_owners.any?{|owner| owner.send(url_attribute) == base_url}
|
53
|
+
separator = duplicate_count_separator
|
54
|
+
n = 1
|
55
|
+
while url_owners.any?{|owner| owner.send(url_attribute) == "#{base_url}#{separator}#{n}"}
|
56
|
+
n = n.succ
|
59
57
|
end
|
58
|
+
instance.send :write_attribute, url_attribute, "#{base_url}#{separator}#{n}"
|
60
59
|
end
|
61
60
|
end
|
62
61
|
end
|
data/stringex.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "stringex"
|
8
|
-
s.version = "1.5.
|
8
|
+
s.version = "1.5.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Russell Norris"]
|
12
|
-
s.date = "2012-11-
|
12
|
+
s.date = "2012-11-30"
|
13
13
|
s.description = "Some [hopefully] useful extensions to Ruby's String class. Stringex is made up of three libraries: ActsAsUrl [permalink solution with better character translation], Unidecoder [Unicode to ASCII transliteration], and StringExtensions [miscellaneous helper methods for the String class]."
|
14
14
|
s.email = "rsl@luckysneaks.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -218,27 +218,24 @@ Gem::Specification.new do |s|
|
|
218
218
|
s.specification_version = 3
|
219
219
|
|
220
220
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
221
|
-
s.add_runtime_dependency(%q<stringex>, [">= 0"])
|
222
221
|
s.add_development_dependency(%q<activerecord>, [">= 0"])
|
223
|
-
s.add_development_dependency(%q<jeweler>, ["
|
222
|
+
s.add_development_dependency(%q<jeweler>, ["= 1.8.4"])
|
224
223
|
s.add_development_dependency(%q<RedCloth>, [">= 0"])
|
225
224
|
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
226
|
-
s.add_development_dependency(%q<travis-lint>, ["
|
225
|
+
s.add_development_dependency(%q<travis-lint>, ["= 1.4.0"])
|
227
226
|
else
|
228
|
-
s.add_dependency(%q<stringex>, [">= 0"])
|
229
227
|
s.add_dependency(%q<activerecord>, [">= 0"])
|
230
|
-
s.add_dependency(%q<jeweler>, ["
|
228
|
+
s.add_dependency(%q<jeweler>, ["= 1.8.4"])
|
231
229
|
s.add_dependency(%q<RedCloth>, [">= 0"])
|
232
230
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
233
|
-
s.add_dependency(%q<travis-lint>, ["
|
231
|
+
s.add_dependency(%q<travis-lint>, ["= 1.4.0"])
|
234
232
|
end
|
235
233
|
else
|
236
|
-
s.add_dependency(%q<stringex>, [">= 0"])
|
237
234
|
s.add_dependency(%q<activerecord>, [">= 0"])
|
238
|
-
s.add_dependency(%q<jeweler>, ["
|
235
|
+
s.add_dependency(%q<jeweler>, ["= 1.8.4"])
|
239
236
|
s.add_dependency(%q<RedCloth>, [">= 0"])
|
240
237
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
241
|
-
s.add_dependency(%q<travis-lint>, ["
|
238
|
+
s.add_dependency(%q<travis-lint>, ["= 1.4.0"])
|
242
239
|
end
|
243
240
|
end
|
244
241
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stringex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: stringex
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
14
|
- !ruby/object:Gem::Dependency
|
31
15
|
name: activerecord
|
32
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -48,17 +32,17 @@ dependencies:
|
|
48
32
|
requirement: !ruby/object:Gem::Requirement
|
49
33
|
none: false
|
50
34
|
requirements:
|
51
|
-
- -
|
35
|
+
- - '='
|
52
36
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
37
|
+
version: 1.8.4
|
54
38
|
type: :development
|
55
39
|
prerelease: false
|
56
40
|
version_requirements: !ruby/object:Gem::Requirement
|
57
41
|
none: false
|
58
42
|
requirements:
|
59
|
-
- -
|
43
|
+
- - '='
|
60
44
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
45
|
+
version: 1.8.4
|
62
46
|
- !ruby/object:Gem::Dependency
|
63
47
|
name: RedCloth
|
64
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,17 +80,17 @@ dependencies:
|
|
96
80
|
requirement: !ruby/object:Gem::Requirement
|
97
81
|
none: false
|
98
82
|
requirements:
|
99
|
-
- -
|
83
|
+
- - '='
|
100
84
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
85
|
+
version: 1.4.0
|
102
86
|
type: :development
|
103
87
|
prerelease: false
|
104
88
|
version_requirements: !ruby/object:Gem::Requirement
|
105
89
|
none: false
|
106
90
|
requirements:
|
107
|
-
- -
|
91
|
+
- - '='
|
108
92
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
93
|
+
version: 1.4.0
|
110
94
|
description: ! 'Some [hopefully] useful extensions to Ruby''s String class. Stringex
|
111
95
|
is made up of three libraries: ActsAsUrl [permalink solution with better character
|
112
96
|
translation], Unidecoder [Unicode to ASCII transliteration], and StringExtensions
|
@@ -327,9 +311,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
327
311
|
- - ! '>='
|
328
312
|
- !ruby/object:Gem::Version
|
329
313
|
version: '0'
|
330
|
-
segments:
|
331
|
-
- 0
|
332
|
-
hash: -2172347514117989172
|
333
314
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
334
315
|
none: false
|
335
316
|
requirements:
|