slugs 4.0.0.3 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +5 -5
  4. data/Rakefile +1 -3
  5. data/lib/slugs/extensions/action_dispatch/optimized_url_helper.rb +6 -6
  6. data/lib/slugs/slug.rb +1 -1
  7. data/lib/slugs/version.rb +1 -1
  8. metadata +13 -127
  9. data/test/dummy/Rakefile +0 -5
  10. data/test/dummy/app/assets/javascripts/application.js +0 -13
  11. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  12. data/test/dummy/app/controllers/application_controller.rb +0 -5
  13. data/test/dummy/app/helpers/application_helper.rb +0 -2
  14. data/test/dummy/app/models/category.rb +0 -7
  15. data/test/dummy/app/models/domain.rb +0 -2
  16. data/test/dummy/app/models/product.rb +0 -8
  17. data/test/dummy/app/models/shop.rb +0 -5
  18. data/test/dummy/app/models/user.rb +0 -5
  19. data/test/dummy/app/views/layouts/application.html.erb +0 -12
  20. data/test/dummy/bin/bundle +0 -4
  21. data/test/dummy/bin/rails +0 -5
  22. data/test/dummy/bin/rake +0 -5
  23. data/test/dummy/bin/setup +0 -30
  24. data/test/dummy/config.ru +0 -4
  25. data/test/dummy/config/application.rb +0 -25
  26. data/test/dummy/config/boot.rb +0 -5
  27. data/test/dummy/config/database.yml +0 -10
  28. data/test/dummy/config/database.yml.travis +0 -3
  29. data/test/dummy/config/environment.rb +0 -5
  30. data/test/dummy/config/environments/development.rb +0 -41
  31. data/test/dummy/config/environments/production.rb +0 -79
  32. data/test/dummy/config/environments/test.rb +0 -42
  33. data/test/dummy/config/initializers/assets.rb +0 -11
  34. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  35. data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  36. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  37. data/test/dummy/config/initializers/inflections.rb +0 -16
  38. data/test/dummy/config/initializers/mime_types.rb +0 -4
  39. data/test/dummy/config/initializers/session_store.rb +0 -3
  40. data/test/dummy/config/initializers/slugs.rb +0 -7
  41. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  42. data/test/dummy/config/locales/en.yml +0 -23
  43. data/test/dummy/config/routes.rb +0 -5
  44. data/test/dummy/config/secrets.yml +0 -22
  45. data/test/dummy/db/migrate/20161016174020_create_users.rb +0 -11
  46. data/test/dummy/db/migrate/20161016174126_create_shops.rb +0 -10
  47. data/test/dummy/db/migrate/20161016174202_create_products.rb +0 -12
  48. data/test/dummy/db/migrate/20161016174225_create_categories.rb +0 -11
  49. data/test/dummy/db/migrate/20161124162802_create_slugs.rb +0 -15
  50. data/test/dummy/db/migrate/20161208062832_create_domains.rb +0 -8
  51. data/test/dummy/db/schema.rb +0 -68
  52. data/test/dummy/log/development.log +0 -726
  53. data/test/dummy/log/test.log +0 -5870
  54. data/test/dummy/public/404.html +0 -61
  55. data/test/dummy/public/422.html +0 -61
  56. data/test/dummy/public/500.html +0 -60
  57. data/test/dummy/public/favicon.ico +0 -0
  58. data/test/generator_test.rb +0 -18
  59. data/test/record_test.rb +0 -71
  60. data/test/route_test.rb +0 -17
  61. data/test/task_test.rb +0 -17
  62. data/test/test_helper.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4740d4cba888010bd06b6aa8401b04d76f4c7a2e
4
- data.tar.gz: eeec56ac69741a763d559624e977e3eb9de139ae
3
+ metadata.gz: 117adb9a8f904b6f9c445f33a3c20ae4661feb03
4
+ data.tar.gz: 28573d11f1769e675bad247169010b6aea917b4a
5
5
  SHA512:
6
- metadata.gz: 3e6f3463710e728c614debd945951e5ec97ccb57836f84408279fc60031c23bc6ed460497ee676c36578de53ec9abe351e4f78edac7a7b9d9ed3274e624c8deb
7
- data.tar.gz: 296c469abf2463094106a78bc93a871abd8a7324f8f3f8c0cfd022e4658a3146f7de44781aae911415d046c925a7a15a5879c424fe9a2893370ad558621afd3c
6
+ metadata.gz: 5e1fa4cd6cc8c57d30aa3e32ea14ae3c5209c79f67426f93c02ea31d327fa248c42298103e165acd0da20a87925c52b2bc2b91df0175c5cef13c081d90263ad0
7
+ data.tar.gz: 8822560da34532d188c404fb8e9fc72a632a5e6d55f5a18219903ec3d151ec21530d5d0a4a8193289c505ccceb7b68ed8132ccf428bb876f2c76a0c0a18132ca
@@ -1,4 +1,4 @@
1
- Copyright 2016 Mathías Montossi
1
+ Copyright 2017 Museways
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/slugs.svg)](http://badge.fury.io/rb/slugs)
2
- [![Code Climate](https://codeclimate.com/github/mmontossi/slugs/badges/gpa.svg)](https://codeclimate.com/github/mmontossi/slugs)
3
- [![Build Status](https://travis-ci.org/mmontossi/slugs.svg)](https://travis-ci.org/mmontossi/slugs)
4
- [![Dependency Status](https://gemnasium.com/mmontossi/slugs.svg)](https://gemnasium.com/mmontossi/slugs)
2
+ [![Code Climate](https://codeclimate.com/github/museways/slugs/badges/gpa.svg)](https://codeclimate.com/github/museways/slugs)
3
+ [![Build Status](https://travis-ci.org/museways/slugs.svg)](https://travis-ci.org/museways/slugs)
4
+ [![Dependency Status](https://gemnasium.com/museways/slugs.svg)](https://gemnasium.com/museways/slugs)
5
5
 
6
6
  # Slugs
7
7
 
@@ -124,11 +124,11 @@ product_path product
124
124
 
125
125
  Any issue, pull request, comment of any kind is more than welcome!
126
126
 
127
- I will mainly ensure compatibility to PostgreSQL, AWS, Redis, Elasticsearch, FreeBSD and Memcached
127
+ I will mainly ensure compatibility to Rails, AWS, PostgreSQL, Redis, Elasticsearch and FreeBSD
128
128
 
129
129
  ## Credits
130
130
 
131
- This gem is maintained and funded by [mmontossi](https://github.com/mmontossi).
131
+ This gem is maintained and funded by [museways](https://github.com/museways).
132
132
 
133
133
  ## License
134
134
 
data/Rakefile CHANGED
@@ -4,16 +4,14 @@ rescue LoadError
4
4
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
5
  end
6
6
 
7
- Bundler::GemHelper.install_tasks
7
+ require 'bundler/gem_tasks'
8
8
 
9
9
  require 'rake/testtask'
10
10
 
11
11
  Rake::TestTask.new(:test) do |t|
12
- t.libs << 'lib'
13
12
  t.libs << 'test'
14
13
  t.pattern = 'test/**/*_test.rb'
15
14
  t.verbose = false
16
- t.warning = false
17
15
  end
18
16
 
19
17
  task default: :test
@@ -4,14 +4,14 @@ module Slugs
4
4
  module OptimizedUrlHelper
5
5
  extend ActiveSupport::Concern
6
6
 
7
- private
8
-
9
7
  def parameterize_args(args)
10
- parameterized_args = args.map do |arg|
11
- Slugs.parameterize arg, @options
12
- end
13
8
  params = {}
14
- @required_parts.zip(parameterized_args) { |k,v| params[k] = v }
9
+ @arg_size.times { |i|
10
+ key = @required_parts[i]
11
+ value = Slugs.parameterize(args[i], @options)
12
+ yield key if value.nil? || value.empty?
13
+ params[key] = value
14
+ }
15
15
  params
16
16
  end
17
17
 
@@ -3,7 +3,7 @@ module Slugs
3
3
 
4
4
  belongs_to :sluggable, polymorphic: true
5
5
 
6
- validates_presence_of :sluggable, :value
6
+ validates_presence_of :value
7
7
 
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  module Slugs
2
2
 
3
- VERSION = '4.0.0.3'
3
+ VERSION = '5.1.0'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,52 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slugs
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.3
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mmontossi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-14 00:00:00.000000000 Z
11
+ date: 2017-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 4.2.0
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: 4.3.0
19
+ version: '5.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 4.2.0
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: 4.3.0
26
+ version: '5.1'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: pg
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: '0.18'
33
+ version: '0.21'
40
34
  type: :development
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
38
  - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: '0.18'
40
+ version: '0.21'
47
41
  description: Manages slugs for records with minimal efford in rails.
48
42
  email:
49
- - mmontossi@gmail.com
43
+ - hi@museways.com
50
44
  executables: []
51
45
  extensions: []
52
46
  extra_rdoc_files: []
@@ -68,61 +62,7 @@ files:
68
62
  - lib/slugs/slug.rb
69
63
  - lib/slugs/version.rb
70
64
  - lib/tasks/slugs.rake
71
- - test/dummy/Rakefile
72
- - test/dummy/app/assets/javascripts/application.js
73
- - test/dummy/app/assets/stylesheets/application.css
74
- - test/dummy/app/controllers/application_controller.rb
75
- - test/dummy/app/helpers/application_helper.rb
76
- - test/dummy/app/models/category.rb
77
- - test/dummy/app/models/domain.rb
78
- - test/dummy/app/models/product.rb
79
- - test/dummy/app/models/shop.rb
80
- - test/dummy/app/models/user.rb
81
- - test/dummy/app/views/layouts/application.html.erb
82
- - test/dummy/bin/bundle
83
- - test/dummy/bin/rails
84
- - test/dummy/bin/rake
85
- - test/dummy/bin/setup
86
- - test/dummy/config.ru
87
- - test/dummy/config/application.rb
88
- - test/dummy/config/boot.rb
89
- - test/dummy/config/database.yml
90
- - test/dummy/config/database.yml.travis
91
- - test/dummy/config/environment.rb
92
- - test/dummy/config/environments/development.rb
93
- - test/dummy/config/environments/production.rb
94
- - test/dummy/config/environments/test.rb
95
- - test/dummy/config/initializers/assets.rb
96
- - test/dummy/config/initializers/backtrace_silencers.rb
97
- - test/dummy/config/initializers/cookies_serializer.rb
98
- - test/dummy/config/initializers/filter_parameter_logging.rb
99
- - test/dummy/config/initializers/inflections.rb
100
- - test/dummy/config/initializers/mime_types.rb
101
- - test/dummy/config/initializers/session_store.rb
102
- - test/dummy/config/initializers/slugs.rb
103
- - test/dummy/config/initializers/wrap_parameters.rb
104
- - test/dummy/config/locales/en.yml
105
- - test/dummy/config/routes.rb
106
- - test/dummy/config/secrets.yml
107
- - test/dummy/db/migrate/20161016174020_create_users.rb
108
- - test/dummy/db/migrate/20161016174126_create_shops.rb
109
- - test/dummy/db/migrate/20161016174202_create_products.rb
110
- - test/dummy/db/migrate/20161016174225_create_categories.rb
111
- - test/dummy/db/migrate/20161124162802_create_slugs.rb
112
- - test/dummy/db/migrate/20161208062832_create_domains.rb
113
- - test/dummy/db/schema.rb
114
- - test/dummy/log/development.log
115
- - test/dummy/log/test.log
116
- - test/dummy/public/404.html
117
- - test/dummy/public/422.html
118
- - test/dummy/public/500.html
119
- - test/dummy/public/favicon.ico
120
- - test/generator_test.rb
121
- - test/record_test.rb
122
- - test/route_test.rb
123
- - test/task_test.rb
124
- - test/test_helper.rb
125
- homepage: https://github.com/mmontossi/slugs
65
+ homepage: https://github.com/museways/slugs
126
66
  licenses:
127
67
  - MIT
128
68
  metadata: {}
@@ -134,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
74
  requirements:
135
75
  - - ">="
136
76
  - !ruby/object:Gem::Version
137
- version: 2.0.0
77
+ version: '0'
138
78
  required_rubygems_version: !ruby/object:Gem::Requirement
139
79
  requirements:
140
80
  - - ">="
@@ -142,62 +82,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
82
  version: '0'
143
83
  requirements: []
144
84
  rubyforge_project:
145
- rubygems_version: 2.5.1
85
+ rubygems_version: 2.6.13
146
86
  signing_key:
147
87
  specification_version: 4
148
88
  summary: Slugs for rails.
149
- test_files:
150
- - test/dummy/app/assets/javascripts/application.js
151
- - test/dummy/app/assets/stylesheets/application.css
152
- - test/dummy/app/controllers/application_controller.rb
153
- - test/dummy/app/helpers/application_helper.rb
154
- - test/dummy/app/models/category.rb
155
- - test/dummy/app/models/domain.rb
156
- - test/dummy/app/models/product.rb
157
- - test/dummy/app/models/shop.rb
158
- - test/dummy/app/models/user.rb
159
- - test/dummy/app/views/layouts/application.html.erb
160
- - test/dummy/bin/bundle
161
- - test/dummy/bin/rails
162
- - test/dummy/bin/rake
163
- - test/dummy/bin/setup
164
- - test/dummy/config/application.rb
165
- - test/dummy/config/boot.rb
166
- - test/dummy/config/database.yml
167
- - test/dummy/config/database.yml.travis
168
- - test/dummy/config/environment.rb
169
- - test/dummy/config/environments/development.rb
170
- - test/dummy/config/environments/production.rb
171
- - test/dummy/config/environments/test.rb
172
- - test/dummy/config/initializers/assets.rb
173
- - test/dummy/config/initializers/backtrace_silencers.rb
174
- - test/dummy/config/initializers/cookies_serializer.rb
175
- - test/dummy/config/initializers/filter_parameter_logging.rb
176
- - test/dummy/config/initializers/inflections.rb
177
- - test/dummy/config/initializers/mime_types.rb
178
- - test/dummy/config/initializers/session_store.rb
179
- - test/dummy/config/initializers/slugs.rb
180
- - test/dummy/config/initializers/wrap_parameters.rb
181
- - test/dummy/config/locales/en.yml
182
- - test/dummy/config/routes.rb
183
- - test/dummy/config/secrets.yml
184
- - test/dummy/config.ru
185
- - test/dummy/db/migrate/20161016174020_create_users.rb
186
- - test/dummy/db/migrate/20161016174126_create_shops.rb
187
- - test/dummy/db/migrate/20161016174202_create_products.rb
188
- - test/dummy/db/migrate/20161016174225_create_categories.rb
189
- - test/dummy/db/migrate/20161124162802_create_slugs.rb
190
- - test/dummy/db/migrate/20161208062832_create_domains.rb
191
- - test/dummy/db/schema.rb
192
- - test/dummy/log/development.log
193
- - test/dummy/log/test.log
194
- - test/dummy/public/404.html
195
- - test/dummy/public/422.html
196
- - test/dummy/public/500.html
197
- - test/dummy/public/favicon.ico
198
- - test/dummy/Rakefile
199
- - test/generator_test.rb
200
- - test/record_test.rb
201
- - test/route_test.rb
202
- - test/task_test.rb
203
- - test/test_helper.rb
89
+ test_files: []
@@ -1,5 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
- Rails.application.load_tasks
@@ -1,13 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,7 +0,0 @@
1
- class Category < ActiveRecord::Base
2
-
3
- belongs_to :shop
4
-
5
- has_slug :name, scope: :shop_id
6
-
7
- end
@@ -1,2 +0,0 @@
1
- class Domain < ActiveRecord::Base
2
- end
@@ -1,8 +0,0 @@
1
- class Product < ActiveRecord::Base
2
-
3
- belongs_to :shop
4
- belongs_to :category
5
-
6
- has_slug :name, scope: %i(shop_id category_id)
7
-
8
- end
@@ -1,5 +0,0 @@
1
- class Shop < ActiveRecord::Base
2
-
3
- has_slug :name
4
-
5
- end
@@ -1,5 +0,0 @@
1
- class User < ActiveRecord::Base
2
-
3
- has_slug :first_name, :last_name
4
-
5
- end
@@ -1,12 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
- <%= yield %>
11
- </body>
12
- </html>
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
4
- load Gem.bin_path('bundler', 'bundle')
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- APP_PATH = File.expand_path('../../config/application', __FILE__)
4
- require_relative '../config/boot'
5
- require 'rails/commands'
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative '../config/boot'
4
- require 'rake'
5
- Rake.application.run
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'pathname'
4
-
5
- # path to your application root.
6
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
7
-
8
- Dir.chdir APP_ROOT do
9
- # This script is a starting point to setup your application.
10
- # Add necessary setup steps to this file:
11
-
12
- puts '== Installing dependencies =='
13
- system 'gem install bundler --conservative'
14
- system 'bundle check || bundle install'
15
-
16
- # puts "\n== Copying sample files =="
17
- # unless File.exist?('config/database.yml')
18
- # system 'cp config/database.yml.sample config/database.yml'
19
- # end
20
-
21
- puts "\n== Preparing database =="
22
- system 'bin/rake db:setup'
23
-
24
- puts "\n== Removing old logs and tempfiles =="
25
- system 'rm -f log/*'
26
- system 'rm -rf tmp/cache'
27
-
28
- puts "\n== Restarting application server =="
29
- system 'touch tmp/restart.txt'
30
- end