pseudocephalopod 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +82 -0
- data/Rakefile +2 -2
- data/lib/pseudocephalopod/active_record_methods.rb +1 -1
- data/lib/pseudocephalopod/memory_cache.rb +4 -0
- data/lib/pseudocephalopod/scopes.rb +1 -1
- data/lib/pseudocephalopod/version.rb +2 -2
- data/pseudocephalopod.gemspec +10 -8
- data/test/helper.rb +1 -0
- data/test/is_sluggable_test.rb +8 -0
- metadata +13 -13
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ree@pseudocephalopod --create
|
data/Gemfile
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
source :gemcutter
|
2
2
|
|
3
3
|
# Setup gems
|
4
|
-
gem "activerecord", "= 3.0.0
|
5
|
-
gem "mongoid", ">= 2.0.0.beta"
|
4
|
+
gem "activerecord", "= 3.0.0"
|
6
5
|
gem "reversible_data"
|
7
6
|
gem "uuid"
|
8
7
|
gem "sqlite3-ruby", :require => "sqlite3"
|
@@ -17,3 +16,5 @@ gem "flog", :require => nil
|
|
17
16
|
gem "rake", :require => nil
|
18
17
|
gem "Saikuro", :require => nil
|
19
18
|
gem "jeweler", :require => nil
|
19
|
+
|
20
|
+
gem 'ruby-debug', :require => nil
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
Saikuro (1.1.0)
|
5
|
+
activemodel (3.0.0)
|
6
|
+
activesupport (= 3.0.0)
|
7
|
+
builder (~> 2.1.2)
|
8
|
+
i18n (~> 0.4.1)
|
9
|
+
activerecord (3.0.0)
|
10
|
+
activemodel (= 3.0.0)
|
11
|
+
activesupport (= 3.0.0)
|
12
|
+
arel (~> 1.0.0)
|
13
|
+
tzinfo (~> 0.3.23)
|
14
|
+
activesupport (3.0.0)
|
15
|
+
arel (1.0.1)
|
16
|
+
activesupport (~> 3.0.0)
|
17
|
+
builder (2.1.2)
|
18
|
+
columnize (0.3.1)
|
19
|
+
flay (1.4.1)
|
20
|
+
ruby_parser (~> 2.0)
|
21
|
+
sexp_processor (~> 3.0)
|
22
|
+
flog (2.5.0)
|
23
|
+
ruby_parser (~> 2.0)
|
24
|
+
sexp_processor (~> 3.0)
|
25
|
+
gemcutter (0.6.1)
|
26
|
+
git (1.2.5)
|
27
|
+
i18n (0.4.1)
|
28
|
+
jeweler (1.4.0)
|
29
|
+
gemcutter (>= 0.1.0)
|
30
|
+
git (>= 1.2.5)
|
31
|
+
rubyforge (>= 2.0.0)
|
32
|
+
json_pure (1.4.6)
|
33
|
+
linecache (0.43)
|
34
|
+
macaddr (1.0.0)
|
35
|
+
rake (0.8.7)
|
36
|
+
rcov (0.9.9)
|
37
|
+
redgreen (1.2.2)
|
38
|
+
reek (1.2.8)
|
39
|
+
ruby2ruby (~> 1.2)
|
40
|
+
ruby_parser (~> 2.0)
|
41
|
+
sexp_processor (~> 3.0)
|
42
|
+
reversible_data (0.1.0)
|
43
|
+
roodi (2.1.0)
|
44
|
+
ruby_parser
|
45
|
+
ruby-debug (0.10.3)
|
46
|
+
columnize (>= 0.1)
|
47
|
+
ruby-debug-base (~> 0.10.3.0)
|
48
|
+
ruby-debug-base (0.10.3)
|
49
|
+
linecache (>= 0.3)
|
50
|
+
ruby2ruby (1.2.5)
|
51
|
+
ruby_parser (~> 2.0)
|
52
|
+
sexp_processor (~> 3.0)
|
53
|
+
ruby_parser (2.0.5)
|
54
|
+
sexp_processor (~> 3.0)
|
55
|
+
rubyforge (2.0.4)
|
56
|
+
json_pure (>= 1.1.7)
|
57
|
+
sexp_processor (3.0.5)
|
58
|
+
shoulda (2.11.3)
|
59
|
+
sqlite3-ruby (1.3.1)
|
60
|
+
tzinfo (0.3.23)
|
61
|
+
uuid (2.3.1)
|
62
|
+
macaddr (~> 1.0)
|
63
|
+
|
64
|
+
PLATFORMS
|
65
|
+
ruby
|
66
|
+
|
67
|
+
DEPENDENCIES
|
68
|
+
Saikuro
|
69
|
+
activerecord (= 3.0.0)
|
70
|
+
flay
|
71
|
+
flog
|
72
|
+
jeweler
|
73
|
+
rake
|
74
|
+
rcov
|
75
|
+
redgreen
|
76
|
+
reek
|
77
|
+
reversible_data
|
78
|
+
roodi
|
79
|
+
ruby-debug
|
80
|
+
shoulda
|
81
|
+
sqlite3-ruby
|
82
|
+
uuid
|
data/Rakefile
CHANGED
@@ -17,8 +17,8 @@ begin
|
|
17
17
|
gem.email = "sutto@sutto.net"
|
18
18
|
gem.homepage = "http://github.com/Sutto/pseudocephalopod"
|
19
19
|
gem.authors = ["Darcy Laycock"]
|
20
|
-
gem.add_dependency "activerecord",
|
21
|
-
gem.add_dependency "activesupport", "
|
20
|
+
gem.add_dependency "activerecord", "~> 3.0.0"
|
21
|
+
gem.add_dependency "activesupport", "~> 3.0.0"
|
22
22
|
gem.add_dependency "uuid"
|
23
23
|
gem.add_development_dependency "shoulda", ">= 0"
|
24
24
|
gem.add_development_dependency "reversible_data"
|
@@ -1,4 +1,8 @@
|
|
1
1
|
module Pseudocephalopod
|
2
|
+
# Implements a simple cache store that uses the
|
3
|
+
# current processes memory. This makes is primarily
|
4
|
+
# used for testing purposes in the situations where
|
5
|
+
# caching is used.
|
2
6
|
class MemoryCache
|
3
7
|
|
4
8
|
def self.write(key, value, options = {})
|
@@ -6,7 +6,7 @@ module Pseudocephalopod
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def other_than(record)
|
9
|
-
record.new_record? ?
|
9
|
+
record.new_record? ? scoped : where("#{quoted_table_name}.#{connection.quote_column_name(:id)} != ?", record.id)
|
10
10
|
end
|
11
11
|
|
12
12
|
end
|
data/pseudocephalopod.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pseudocephalopod}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Darcy Laycock"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-19}
|
13
13
|
s.description = %q{Super simple slugs for ActiveRecord 3.0 and higher, with support for slug history}
|
14
14
|
s.email = %q{sutto@sutto.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -19,7 +19,9 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
|
+
".rvmrc",
|
22
23
|
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
23
25
|
"LICENSE",
|
24
26
|
"README.md",
|
25
27
|
"Rakefile",
|
@@ -65,21 +67,21 @@ Gem::Specification.new do |s|
|
|
65
67
|
s.specification_version = 3
|
66
68
|
|
67
69
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
68
|
-
s.add_runtime_dependency(%q<activerecord>, ["
|
69
|
-
s.add_runtime_dependency(%q<activesupport>, ["
|
70
|
+
s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.0"])
|
71
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.0"])
|
70
72
|
s.add_runtime_dependency(%q<uuid>, [">= 0"])
|
71
73
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
72
74
|
s.add_development_dependency(%q<reversible_data>, [">= 0"])
|
73
75
|
else
|
74
|
-
s.add_dependency(%q<activerecord>, ["
|
75
|
-
s.add_dependency(%q<activesupport>, ["
|
76
|
+
s.add_dependency(%q<activerecord>, ["~> 3.0.0"])
|
77
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
|
76
78
|
s.add_dependency(%q<uuid>, [">= 0"])
|
77
79
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
78
80
|
s.add_dependency(%q<reversible_data>, [">= 0"])
|
79
81
|
end
|
80
82
|
else
|
81
|
-
s.add_dependency(%q<activerecord>, ["
|
82
|
-
s.add_dependency(%q<activesupport>, ["
|
83
|
+
s.add_dependency(%q<activerecord>, ["~> 3.0.0"])
|
84
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
|
83
85
|
s.add_dependency(%q<uuid>, [">= 0"])
|
84
86
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
85
87
|
s.add_dependency(%q<reversible_data>, [">= 0"])
|
data/test/helper.rb
CHANGED
data/test/is_sluggable_test.rb
CHANGED
@@ -72,6 +72,14 @@ class IsSluggableTest < Test::Unit::TestCase
|
|
72
72
|
assert User.find_using_slug(user.id).has_better_slug?
|
73
73
|
end
|
74
74
|
|
75
|
+
should 'not keep a users slug when updating themselves' do
|
76
|
+
user = User.create :name => "bob is awesome"
|
77
|
+
assert_equal "bob-is-awesome", user.to_param
|
78
|
+
assert !user.new_record?
|
79
|
+
user.update_attributes! :name => "BOB-is-AWESOME"
|
80
|
+
assert_equal "bob-is-awesome", user.to_param
|
81
|
+
end
|
82
|
+
|
75
83
|
end
|
76
84
|
|
77
85
|
context 'with slug syncing disabled' do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pseudocephalopod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Darcy Laycock
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-19 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -25,15 +25,14 @@ dependencies:
|
|
25
25
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 7
|
31
31
|
segments:
|
32
32
|
- 3
|
33
33
|
- 0
|
34
34
|
- 0
|
35
|
-
|
36
|
-
version: 3.0.0.beta2
|
35
|
+
version: 3.0.0
|
37
36
|
requirement: *id001
|
38
37
|
- !ruby/object:Gem::Dependency
|
39
38
|
prerelease: false
|
@@ -42,15 +41,14 @@ dependencies:
|
|
42
41
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
43
42
|
none: false
|
44
43
|
requirements:
|
45
|
-
- -
|
44
|
+
- - ~>
|
46
45
|
- !ruby/object:Gem::Version
|
47
|
-
hash:
|
46
|
+
hash: 7
|
48
47
|
segments:
|
49
48
|
- 3
|
50
49
|
- 0
|
51
50
|
- 0
|
52
|
-
|
53
|
-
version: 3.0.0.beta2
|
51
|
+
version: 3.0.0
|
54
52
|
requirement: *id002
|
55
53
|
- !ruby/object:Gem::Dependency
|
56
54
|
prerelease: false
|
@@ -106,7 +104,9 @@ extra_rdoc_files:
|
|
106
104
|
files:
|
107
105
|
- .document
|
108
106
|
- .gitignore
|
107
|
+
- .rvmrc
|
109
108
|
- Gemfile
|
109
|
+
- Gemfile.lock
|
110
110
|
- LICENSE
|
111
111
|
- README.md
|
112
112
|
- Rakefile
|