slugged 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -12,3 +12,4 @@ pkg
12
12
  *.gem
13
13
  coverage
14
14
  metrics/*
15
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ ---
2
+ language: ruby
3
+ rvm:
4
+ - 1.8.7
5
+ - 1.9.2
6
+ - 1.9.3
7
+ # - jruby-18mode
8
+ # - jruby-19mode
9
+ - ree
10
+ env:
11
+ - RAILS_VERSION=""
12
+ - RAILS_VERSION="~>3.2.0"
13
+ - RAILS_VERSION="~>3.1.0"
14
+ - RAILS_VERSION="~>3.0.0"
15
+ notifications:
16
+ email:
17
+ - sutto@sutto.net
data/Gemfile CHANGED
@@ -1,3 +1,12 @@
1
1
  source :gemcutter
2
2
 
3
+ # Allow testing multiple versions with Travis.
4
+ rails_version = ENV['RAILS_VERSION']
5
+ if rails_version && rails_version.length > 0
6
+ puts "Testing Rails Version = #{rails_version}"
7
+ # Override the specific versions
8
+ gem 'activesupport', rails_version
9
+ gem 'activerecord', rails_version
10
+ end
11
+
3
12
  gemspec
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Slugged #
1
+ # Slugged [![Build Status](https://secure.travis-ci.org/sutto/slugged.png?branch=master)](http://travis-ci.org/sutto/slugged)
2
2
 
3
3
  ## About ###
4
4
 
@@ -98,7 +98,7 @@ Generates a slug if not already present.
98
98
  When found via Model.find\_using\_slug, it will return try
99
99
  if there is a better slug available. Intended for use in redirects etc.
100
100
 
101
- ## Working on Slugged ##
101
+ ## Working on Slugged
102
102
 
103
103
  To run tests, simply do the following:
104
104
 
@@ -107,13 +107,13 @@ To run tests, simply do the following:
107
107
 
108
108
  And it's ready!
109
109
 
110
- ## Contributors ##
110
+ ## Contributors
111
111
 
112
112
  Thanks to the following who contributed functionality / bug fixes:
113
113
 
114
114
  * [Matt Pruitt](http://github.com/guitsaru)
115
115
 
116
- ## Note on Patches/Pull Requests ##
116
+ ## Note on Patches/Pull Requests
117
117
 
118
118
  * Fork the project.
119
119
  * Make your feature addition or bug fix.
@@ -121,6 +121,6 @@ Thanks to the following who contributed functionality / bug fixes:
121
121
  * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
122
122
  * Send me a pull request. Bonus points for topic branches.
123
123
 
124
- ## Copyright ##
124
+ ## Copyright
125
125
 
126
126
  Copyright (c) 2010 Darcy Laycock. See LICENSE for details.
data/Rakefile CHANGED
@@ -9,66 +9,6 @@ end
9
9
 
10
10
  task :default => :test
11
11
 
12
- begin
13
- require 'rcov/rcovtask'
14
- Rcov::RcovTask.new do |test|
15
- test.libs << 'test'
16
- test.pattern = 'test/**/*_test.rb'
17
- test.verbose = true
18
- test.rcov_opts << '--exclude /gems/,/Library/,/usr/,lib/tasks,.bundle,config,/lib/rspec/,/lib/rspec-'
19
- test.output_dir = "metrics/coverage"
20
- end
21
- rescue LoadError
22
- task :rcov do
23
- abort "Rcov isn't installed, please run via bundle exec after bundle installing"
24
- end
25
- end
26
-
27
- task :metrics => [:rcov, :saikuro, :reek, :flay, :flog, :roodi]
28
-
29
- task :flog do
30
- system "flog lib"
31
- end
32
-
33
- task :saikuro do
34
- system "rm -rf metrics/saikuro && mkdir -p metrics/saikuro && saikuro -c -t -i lib/ -y 0 -w 11 -e 16 -o metrics/saikuro/"
35
- end
36
-
37
- begin
38
- require 'flay'
39
- require 'flay_task'
40
- FlayTask.new
41
- rescue LoadError
42
- task :flay do
43
- abort "Flay isn't installed, please run via bundle exec after bundle installing"
44
- end
45
- end
46
-
47
- begin
48
- require 'reek/rake/task'
49
- Reek::Rake::Task.new do |t|
50
- t.fail_on_error = true
51
- t.verbose = false
52
- t.source_files = 'lib/**/*.rb'
53
- end
54
- rescue LoadError
55
- task :reek do
56
- abort "Reek isn't installed, please run via bundle exec after bundle installing"
57
- end
58
- end
59
-
60
- begin
61
- require 'roodi'
62
- require 'roodi_task'
63
- RoodiTask.new do |t|
64
- t.verbose = false
65
- end
66
- rescue LoadError
67
- task :roodi do
68
- abort "Roodi isn't installed, please run via bundle exec after bundle installing"
69
- end
70
- end
71
-
72
12
  require 'rdoc/task'
73
13
  Rake::RDocTask.new do |rdoc|
74
14
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
data/lib/slugged/slug.rb CHANGED
@@ -31,7 +31,12 @@ module Slugged
31
31
  scope = Slugged.key_for_scope(record)
32
32
  # Clear slug history in this scope before recording the new slug
33
33
  for_slug(scope, slug).delete_all
34
- create :scope => scope, :record_id => record.id, :slug => slug.to_s
34
+ new.tap do |history|
35
+ history.scope = scope
36
+ history.record_id = record.id
37
+ history.slug = slug.to_s
38
+ history.save
39
+ end
35
40
  end
36
41
 
37
42
  def self.remove_history_for(record)
@@ -1,8 +1,8 @@
1
1
  module Slugged
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 0
5
- PATCH = 1
4
+ MINOR = 1
5
+ PATCH = 0
6
6
  STRING = [MAJOR, MINOR, PATCH].join(".")
7
7
  end
8
8
 
data/slugged.gemspec CHANGED
@@ -4,41 +4,30 @@ $:.push File.expand_path("../lib", __FILE__)
4
4
  require 'slugged/version'
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{slugged}
8
- s.version = Slugged::VERSION
9
-
7
+ s.name = "slugged"
8
+ s.version = Slugged::VERSION
10
9
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Darcy Laycock"]
12
- s.date = %q{2011-01-01}
13
- s.description = %q{Super simple slugs for ActiveRecord 3.0 and higher, with support for slug history}
14
- s.email = %q{sutto@sutto.net}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.md"
18
- ]
19
- s.files = `git ls-files`.split("\n")
20
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
- s.require_paths = ["lib"]
10
+ s.authors = ["Darcy Laycock"]
11
+ s.date = %q{2011-01-01}
12
+ s.description = %q{Super simple slugs for ActiveRecord 3.0 and higher, with support for slug history}
13
+ s.email = %q{sutto@sutto.net}
14
+ s.extra_rdoc_files = ["LICENSE", "README.md"]
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.require_paths = ["lib"]
18
+ s.homepage = %q{http://github.com/Sutto/slugged}
19
+ s.rdoc_options = ["--charset=UTF-8"]
20
+ s.summary = %q{Super simple slugs for ActiveRecord 3.0 and higher, with support for slug history}
22
21
 
23
- s.homepage = %q{http://github.com/Sutto/slugged}
24
- s.rdoc_options = ["--charset=UTF-8"]
25
- s.summary = %q{Super simple slugs for ActiveRecord 3.0 and higher, with support for slug history}
22
+ s.add_runtime_dependency "activerecord", "~> 3.0"
23
+ s.add_runtime_dependency "activesupport", "~> 3.0"
24
+ s.add_runtime_dependency "uuid"
26
25
 
27
- s.add_runtime_dependency(%q<activerecord>, ["~> 3"])
28
- s.add_runtime_dependency(%q<activesupport>, ["~> 3"])
29
- s.add_runtime_dependency(%q<uuid>, [">= 0"])
30
- s.add_development_dependency(%q<shoulda>, [">= 0"])
31
- s.add_development_dependency(%q<reversible_data>, [">= 0"])
32
- s.add_development_dependency(%q<sqlite3-ruby>)
33
- s.add_development_dependency(%q<redgreen>) if RUBY_VERSION < "1.9"
34
- s.add_development_dependency(%q<rcov>)
35
- s.add_development_dependency(%q<reek>)
36
- s.add_development_dependency(%q<roodi>)
37
- s.add_development_dependency(%q<flay>)
38
- s.add_development_dependency(%q<flog>)
39
- s.add_development_dependency(%q<Saikuro>)
40
- s.add_development_dependency(%q<ruby-debug>)
41
- s.add_development_dependency(%q<rdoc>)
42
- s.add_development_dependency(%q<rake>, '> 0.9')
26
+ s.add_development_dependency "shoulda"
27
+ s.add_development_dependency "reversible_data"
28
+ s.add_development_dependency "sqlite3-ruby"
29
+ s.add_development_dependency "redgreen"
30
+ s.add_development_dependency "rake"
31
+ s.add_development_dependency "rdoc"
43
32
  end
44
33
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slugged
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 0
9
8
  - 1
10
- version: 1.0.1
9
+ - 0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Darcy Laycock
@@ -25,10 +25,11 @@ dependencies:
25
25
  requirements:
26
26
  - - ~>
27
27
  - !ruby/object:Gem::Version
28
- hash: 5
28
+ hash: 7
29
29
  segments:
30
30
  - 3
31
- version: "3"
31
+ - 0
32
+ version: "3.0"
32
33
  type: :runtime
33
34
  version_requirements: *id001
34
35
  - !ruby/object:Gem::Dependency
@@ -39,10 +40,11 @@ dependencies:
39
40
  requirements:
40
41
  - - ~>
41
42
  - !ruby/object:Gem::Version
42
- hash: 5
43
+ hash: 7
43
44
  segments:
44
45
  - 3
45
- version: "3"
46
+ - 0
47
+ version: "3.0"
46
48
  type: :runtime
47
49
  version_requirements: *id002
48
50
  - !ruby/object:Gem::Dependency
@@ -116,7 +118,7 @@ dependencies:
116
118
  type: :development
117
119
  version_requirements: *id007
118
120
  - !ruby/object:Gem::Dependency
119
- name: rcov
121
+ name: rake
120
122
  prerelease: false
121
123
  requirement: &id008 !ruby/object:Gem::Requirement
122
124
  none: false
@@ -130,7 +132,7 @@ dependencies:
130
132
  type: :development
131
133
  version_requirements: *id008
132
134
  - !ruby/object:Gem::Dependency
133
- name: reek
135
+ name: rdoc
134
136
  prerelease: false
135
137
  requirement: &id009 !ruby/object:Gem::Requirement
136
138
  none: false
@@ -143,105 +145,6 @@ dependencies:
143
145
  version: "0"
144
146
  type: :development
145
147
  version_requirements: *id009
146
- - !ruby/object:Gem::Dependency
147
- name: roodi
148
- prerelease: false
149
- requirement: &id010 !ruby/object:Gem::Requirement
150
- none: false
151
- requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- hash: 3
155
- segments:
156
- - 0
157
- version: "0"
158
- type: :development
159
- version_requirements: *id010
160
- - !ruby/object:Gem::Dependency
161
- name: flay
162
- prerelease: false
163
- requirement: &id011 !ruby/object:Gem::Requirement
164
- none: false
165
- requirements:
166
- - - ">="
167
- - !ruby/object:Gem::Version
168
- hash: 3
169
- segments:
170
- - 0
171
- version: "0"
172
- type: :development
173
- version_requirements: *id011
174
- - !ruby/object:Gem::Dependency
175
- name: flog
176
- prerelease: false
177
- requirement: &id012 !ruby/object:Gem::Requirement
178
- none: false
179
- requirements:
180
- - - ">="
181
- - !ruby/object:Gem::Version
182
- hash: 3
183
- segments:
184
- - 0
185
- version: "0"
186
- type: :development
187
- version_requirements: *id012
188
- - !ruby/object:Gem::Dependency
189
- name: Saikuro
190
- prerelease: false
191
- requirement: &id013 !ruby/object:Gem::Requirement
192
- none: false
193
- requirements:
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- hash: 3
197
- segments:
198
- - 0
199
- version: "0"
200
- type: :development
201
- version_requirements: *id013
202
- - !ruby/object:Gem::Dependency
203
- name: ruby-debug
204
- prerelease: false
205
- requirement: &id014 !ruby/object:Gem::Requirement
206
- none: false
207
- requirements:
208
- - - ">="
209
- - !ruby/object:Gem::Version
210
- hash: 3
211
- segments:
212
- - 0
213
- version: "0"
214
- type: :development
215
- version_requirements: *id014
216
- - !ruby/object:Gem::Dependency
217
- name: rdoc
218
- prerelease: false
219
- requirement: &id015 !ruby/object:Gem::Requirement
220
- none: false
221
- requirements:
222
- - - ">="
223
- - !ruby/object:Gem::Version
224
- hash: 3
225
- segments:
226
- - 0
227
- version: "0"
228
- type: :development
229
- version_requirements: *id015
230
- - !ruby/object:Gem::Dependency
231
- name: rake
232
- prerelease: false
233
- requirement: &id016 !ruby/object:Gem::Requirement
234
- none: false
235
- requirements:
236
- - - ">"
237
- - !ruby/object:Gem::Version
238
- hash: 25
239
- segments:
240
- - 0
241
- - 9
242
- version: "0.9"
243
- type: :development
244
- version_requirements: *id016
245
148
  description: Super simple slugs for ActiveRecord 3.0 and higher, with support for slug history
246
149
  email: sutto@sutto.net
247
150
  executables: []
@@ -255,8 +158,8 @@ files:
255
158
  - .document
256
159
  - .gitignore
257
160
  - .rvmrc
161
+ - .travis.yml
258
162
  - Gemfile
259
- - Gemfile.lock
260
163
  - LICENSE
261
164
  - README.md
262
165
  - Rakefile
@@ -312,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
312
215
  requirements: []
313
216
 
314
217
  rubyforge_project:
315
- rubygems_version: 1.8.10
218
+ rubygems_version: 1.8.21
316
219
  signing_key:
317
220
  specification_version: 3
318
221
  summary: Super simple slugs for ActiveRecord 3.0 and higher, with support for slug history
data/Gemfile.lock DELETED
@@ -1,90 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- slugged (1.0.0)
5
- activerecord (~> 3)
6
- activesupport (~> 3)
7
- uuid
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- Saikuro (1.1.0)
13
- activemodel (3.1.1)
14
- activesupport (= 3.1.1)
15
- builder (~> 3.0.0)
16
- i18n (~> 0.6)
17
- activerecord (3.1.1)
18
- activemodel (= 3.1.1)
19
- activesupport (= 3.1.1)
20
- arel (~> 2.2.1)
21
- tzinfo (~> 0.3.29)
22
- activesupport (3.1.1)
23
- multi_json (~> 1.0)
24
- arel (2.2.1)
25
- builder (3.0.0)
26
- columnize (0.3.4)
27
- flay (1.4.3)
28
- ruby_parser (~> 2.0)
29
- sexp_processor (~> 3.0)
30
- flog (2.5.3)
31
- ruby_parser (~> 2.0)
32
- sexp_processor (~> 3.0)
33
- i18n (0.6.0)
34
- json (1.6.1)
35
- linecache (0.46)
36
- rbx-require-relative (> 0.0.4)
37
- macaddr (1.4.0)
38
- systemu (~> 2.2.0)
39
- multi_json (1.0.3)
40
- rake (0.9.2)
41
- rbx-require-relative (0.0.5)
42
- rcov (0.9.11)
43
- rdoc (3.10)
44
- json (~> 1.4)
45
- redgreen (1.2.2)
46
- reek (1.2.8)
47
- ruby2ruby (~> 1.2)
48
- ruby_parser (~> 2.0)
49
- sexp_processor (~> 3.0)
50
- reversible_data (0.1.0)
51
- roodi (2.1.0)
52
- ruby_parser
53
- ruby-debug (0.10.4)
54
- columnize (>= 0.1)
55
- ruby-debug-base (~> 0.10.4.0)
56
- ruby-debug-base (0.10.4)
57
- linecache (>= 0.3)
58
- ruby2ruby (1.3.1)
59
- ruby_parser (~> 2.0)
60
- sexp_processor (~> 3.0)
61
- ruby_parser (2.3.1)
62
- sexp_processor (~> 3.0)
63
- sexp_processor (3.0.7)
64
- shoulda (2.11.3)
65
- sqlite3 (1.3.4)
66
- sqlite3-ruby (1.3.3)
67
- sqlite3 (>= 1.3.3)
68
- systemu (2.2.0)
69
- tzinfo (0.3.30)
70
- uuid (2.3.4)
71
- macaddr (~> 1.0)
72
-
73
- PLATFORMS
74
- ruby
75
-
76
- DEPENDENCIES
77
- Saikuro
78
- flay
79
- flog
80
- rake (> 0.9)
81
- rcov
82
- rdoc
83
- redgreen
84
- reek
85
- reversible_data
86
- roodi
87
- ruby-debug
88
- shoulda
89
- slugged!
90
- sqlite3-ruby