sequel_sluggable 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/README.rdoc +3 -3
- data/Rakefile +4 -25
- data/lib/sequel_sluggable/rspec_helper.rb +24 -0
- data/lib/{version.rb → sequel_sluggable/version.rb} +1 -1
- metadata +14 -17
- data/.document +0 -5
- data/.gitignore +0 -22
- data/lib/sluggable_rspec_helper.rb +0 -23
- data/sequel_sluggable.gemspec +0 -66
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 0.0.6, 2010-05-02
|
2
|
+
* Make Rakefile and gemspec sane
|
3
|
+
* Fix the strucutre of the gem
|
4
|
+
* Update RSpecHleper to work with the latest code.
|
5
|
+
You now need to use require 'sequel_sluggable/rspec_helper' and the name of
|
6
|
+
the helper module changed to Sequel::Plugins::Sluggable::RSpecHelper.
|
7
|
+
|
1
8
|
== 0.0.5, 2010-03-04
|
2
9
|
* Allow to generate slug before the before_save + doc update
|
3
10
|
* Slug is generated only before_create and when it's not set manually
|
data/README.rdoc
CHANGED
@@ -89,7 +89,7 @@ If you provide _:sluggator_ Proc or Symbol the sluggator will be called:
|
|
89
89
|
OR
|
90
90
|
|
91
91
|
class MyModel < Sequel::Model
|
92
|
-
plugin :sluggable
|
92
|
+
plugin :sluggable, :source => :name, :sluggator => :my_to_slug
|
93
93
|
end
|
94
94
|
|
95
95
|
If you don't provide _:sluggator_ sequel_sluggable will try to use
|
@@ -106,8 +106,8 @@ it will be used:
|
|
106
106
|
|
107
107
|
If you don't define <b>Model#to_slug</b> or *:sluggator* sequel_sluggable
|
108
108
|
will use it's own default implementation which does following:
|
109
|
-
|
110
|
-
|
109
|
+
|
110
|
+
'value_of_the_source_column'.chomp.downcase.gsub(/[^a-z0-9]+/,'-')
|
111
111
|
|
112
112
|
= Note on Patches/Pull Requests
|
113
113
|
|
data/Rakefile
CHANGED
@@ -1,29 +1,9 @@
|
|
1
1
|
require 'rake'
|
2
|
-
|
3
|
-
# Load this library's version information
|
4
|
-
require File.expand_path('../lib/version', __FILE__)
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'jeweler'
|
8
|
-
Jeweler::Tasks.new do |gem|
|
9
|
-
gem.version = Sequel::Plugins::Sluggable::VERSION
|
10
|
-
gem.name = "sequel_sluggable"
|
11
|
-
gem.summary = "Sequel plugin which provides Slug functionality for model."
|
12
|
-
gem.description = gem.summary
|
13
|
-
gem.email = "pavel.kunc@gmail.com"
|
14
|
-
gem.homepage = "http://github.com/pk/sequel_sluggable"
|
15
|
-
gem.authors = ["Pavel Kunc"]
|
16
|
-
gem.add_dependency "sequel", ">= 3.0.0"
|
17
|
-
gem.add_development_dependency "sqlite3-ruby"
|
18
|
-
gem.add_development_dependency "rspec"
|
19
|
-
gem.add_development_dependency "yard"
|
20
|
-
end
|
21
|
-
rescue LoadError
|
22
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
23
|
-
end
|
24
|
-
|
2
|
+
require 'spec'
|
25
3
|
require 'spec/rake/spectask'
|
4
|
+
|
26
5
|
Spec::Rake::SpecTask.new(:spec) do |spec|
|
6
|
+
spec.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
|
27
7
|
spec.libs << 'lib' << 'spec'
|
28
8
|
spec.spec_files = FileList['spec/**/*_spec.rb']
|
29
9
|
end
|
@@ -34,8 +14,7 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
34
14
|
spec.rcov = true
|
35
15
|
end
|
36
16
|
|
37
|
-
|
38
|
-
|
17
|
+
desc 'Default: run spec examples'
|
39
18
|
task :default => :spec
|
40
19
|
|
41
20
|
begin
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sequel::Plugins::Sluggable::RSpecHelper
|
2
|
+
def it_should_behave_like_sluggable(klass)
|
3
|
+
it "should have slug when created" do
|
4
|
+
model = klass.make(klass.sluggable_options[:source] => 'Test String')
|
5
|
+
model.slug.should eql 'test-string'
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should not update slug by default when #{klass.sluggable_options[:source]} is updated" do
|
9
|
+
model = klass.make(klass.sluggable_options[:source] => 'Test String')
|
10
|
+
model.update(klass.sluggable_options[:source] => 'Test String Two')
|
11
|
+
model.send(klass.sluggable_options[:target]).should eql 'test-string'
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should find #{klass} by it's ID" do
|
15
|
+
model = klass.make(klass.sluggable_options[:source] => 'Test String')
|
16
|
+
klass.find_by_pk_or_slug(model.id).should eql model
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should find #{klass} by it's slug" do
|
20
|
+
model = klass.make(klass.sluggable_options[:source] => 'Test String')
|
21
|
+
klass.find_by_pk_or_slug('test-string').should eql model
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Pavel Kunc
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-05-02 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -74,29 +74,27 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
|
76
76
|
extra_rdoc_files:
|
77
|
-
- LICENSE
|
78
77
|
- README.rdoc
|
79
|
-
files:
|
80
|
-
- .document
|
81
|
-
- .gitignore
|
82
|
-
- CHANGELOG
|
83
78
|
- LICENSE
|
84
|
-
-
|
79
|
+
- CHANGELOG
|
80
|
+
files:
|
85
81
|
- Rakefile
|
82
|
+
- lib/sequel_sluggable/rspec_helper.rb
|
83
|
+
- lib/sequel_sluggable/version.rb
|
86
84
|
- lib/sequel_sluggable.rb
|
87
|
-
- lib/sluggable_rspec_helper.rb
|
88
|
-
- lib/version.rb
|
89
|
-
- sequel_sluggable.gemspec
|
90
85
|
- spec/sequel_sluggable_spec.rb
|
91
86
|
- spec/spec.opts
|
92
87
|
- spec/spec_helper.rb
|
88
|
+
- README.rdoc
|
89
|
+
- LICENSE
|
90
|
+
- CHANGELOG
|
93
91
|
has_rdoc: true
|
94
92
|
homepage: http://github.com/pk/sequel_sluggable
|
95
93
|
licenses: []
|
96
94
|
|
97
95
|
post_install_message:
|
98
|
-
rdoc_options:
|
99
|
-
|
96
|
+
rdoc_options: []
|
97
|
+
|
100
98
|
require_paths:
|
101
99
|
- lib
|
102
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -120,6 +118,5 @@ rubygems_version: 1.3.6
|
|
120
118
|
signing_key:
|
121
119
|
specification_version: 3
|
122
120
|
summary: Sequel plugin which provides Slug functionality for model.
|
123
|
-
test_files:
|
124
|
-
|
125
|
-
- spec/spec_helper.rb
|
121
|
+
test_files: []
|
122
|
+
|
data/.document
DELETED
data/.gitignore
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
module Sequel::Plugins::Sluggable::SluggableRSpecHelper
|
2
|
-
def it_should_behave_like_sluggable(klass)
|
3
|
-
it "should have slug when created" do
|
4
|
-
model = klass.make(klass.slug_source_column => 'Test String')
|
5
|
-
model.slug.should eql 'test-string'
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should update slug when #{klass.slug_source_column} is updated" do
|
9
|
-
model = klass.make(klass.slug_source_column => 'Test String')
|
10
|
-
lambda { model.update(klass.slug_source_column => 'Test String Two') }.should change(model,:slug).to('test-string-two')
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should find #{klass} by it's ID" do
|
14
|
-
model = klass.make(klass.slug_source_column => 'Test String')
|
15
|
-
klass.find_by_id_or_slug(model.id).should eql model
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should find #{klass} by it's slug" do
|
19
|
-
model = klass.make(klass.slug_source_column => 'Test String')
|
20
|
-
klass.find_by_id_or_slug('test-string').should eql model
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/sequel_sluggable.gemspec
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{sequel_sluggable}
|
8
|
-
s.version = "0.0.5"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Pavel Kunc"]
|
12
|
-
s.date = %q{2010-03-04}
|
13
|
-
s.description = %q{Sequel plugin which provides Slug functionality for model.}
|
14
|
-
s.email = %q{pavel.kunc@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"CHANGELOG",
|
23
|
-
"LICENSE",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"lib/sequel_sluggable.rb",
|
27
|
-
"lib/sluggable_rspec_helper.rb",
|
28
|
-
"lib/version.rb",
|
29
|
-
"sequel_sluggable.gemspec",
|
30
|
-
"spec/sequel_sluggable_spec.rb",
|
31
|
-
"spec/spec.opts",
|
32
|
-
"spec/spec_helper.rb"
|
33
|
-
]
|
34
|
-
s.homepage = %q{http://github.com/pk/sequel_sluggable}
|
35
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
36
|
-
s.require_paths = ["lib"]
|
37
|
-
s.rubygems_version = %q{1.3.6}
|
38
|
-
s.summary = %q{Sequel plugin which provides Slug functionality for model.}
|
39
|
-
s.test_files = [
|
40
|
-
"spec/sequel_sluggable_spec.rb",
|
41
|
-
"spec/spec_helper.rb"
|
42
|
-
]
|
43
|
-
|
44
|
-
if s.respond_to? :specification_version then
|
45
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
|
-
s.specification_version = 3
|
47
|
-
|
48
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
49
|
-
s.add_runtime_dependency(%q<sequel>, [">= 3.0.0"])
|
50
|
-
s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
|
51
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
52
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
53
|
-
else
|
54
|
-
s.add_dependency(%q<sequel>, [">= 3.0.0"])
|
55
|
-
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
56
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
57
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
58
|
-
end
|
59
|
-
else
|
60
|
-
s.add_dependency(%q<sequel>, [">= 3.0.0"])
|
61
|
-
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
62
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
63
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|