populate-me 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -107,7 +107,7 @@ module PopulateMe
107
107
  ACCENTS_TO =
108
108
  "AAAAAAaaaaaaAaAaAaCcCcCcCcCcDdDdDdEEEEeeeeEeEeEeEeEeGgGgGgGgHhHhIIIIiiiiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnNnnNnOOOOOOooooooOoOoOoRrRrRrSsSsSsSssT"
109
109
  def auto_slug
110
- s = self.to_label.tr(ACCENTS_FROM,ACCENTS_TO).tr(' .,;:?!/\'"()[]{}<>','-').gsub(/&/, 'and')
110
+ s = self.to_label.tr(ACCENTS_FROM,ACCENTS_TO).tr(' .,;:?!/\'"()[]{}<>','-').gsub(/&/, 'and').gsub(/-+/,'-').gsub(/(^-|-$)/,'')
111
111
  defined?(::Rack::Utils) ? ::Rack::Utils.escape(s) : s
112
112
  end
113
113
  def to_slug; @doc[model.slug_column]||self.auto_slug; end
data/populate-me.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'populate-me'
3
- s.version = "0.0.14"
3
+ s.version = "0.0.15"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "ALPHA !!! Populate Me is relatively complete but simple CMS"
6
6
  s.description = "ALPHA !!! Populate Me is relatively complete but simple CMS. It includes a Rack middleware for putting in your Rack stack, and a bespoke MongoDB ODM. But Populate Me is not really finished yet."
@@ -1,8 +1,10 @@
1
+ # encoding: utf-8
1
2
  Encoding.default_internal = Encoding.default_external = Encoding::UTF_8 if RUBY_VERSION >= '1.9.0'
2
3
 
3
4
  require 'rubygems'
4
5
  require 'bacon'
5
6
  require 'mongo'
7
+ require 'rack/utils'
6
8
  $:.unshift './lib'
7
9
  require 'populate_me/mongo'
8
10
 
@@ -226,6 +228,12 @@ describe "PopulateMe::Mongo::Mutation" do
226
228
  end
227
229
  end
228
230
 
231
+ describe '#auto_slug' do
232
+ it 'Should build a url friendly slug based on #to_label' do
233
+ FeatureBox.new({'header'=>"Así es la vida by Daniel Bär & Mickaël ? (100%)"}).auto_slug.should=='Asi-es-la-vida-by-Daniel-Bar-and-Mickael-100%25'
234
+ end
235
+ end
236
+
229
237
  # #default_doc
230
238
  # #id
231
239
  # #[]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: populate-me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-16 00:00:00.000000000 Z
12
+ date: 2013-07-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack-golem