to_slug_param 1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.keep +0 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +91 -0
- data/Rakefile +1 -0
- data/config/locales/yandex_translit.rb +97 -0
- data/lib/to_slug_param/string.rb +81 -0
- data/lib/to_slug_param/symbol.rb +17 -0
- data/lib/to_slug_param.rb +20 -0
- data/spec/dummy_app/.gitignore +16 -0
- data/spec/dummy_app/.rspec +1 -0
- data/spec/dummy_app/Gemfile +8 -0
- data/spec/dummy_app/README.md +14 -0
- data/spec/dummy_app/Rakefile +6 -0
- data/spec/dummy_app/app/assets/images/.keep +0 -0
- data/spec/dummy_app/app/assets/javascripts/application.js +16 -0
- data/spec/dummy_app/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy_app/app/controllers/application_controller.rb +5 -0
- data/spec/dummy_app/app/controllers/concerns/.keep +0 -0
- data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
- data/spec/dummy_app/app/mailers/.keep +0 -0
- data/spec/dummy_app/app/models/.keep +0 -0
- data/spec/dummy_app/app/models/concerns/.keep +0 -0
- data/spec/dummy_app/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy_app/bin/bundle +3 -0
- data/spec/dummy_app/bin/rails +4 -0
- data/spec/dummy_app/bin/rake +4 -0
- data/spec/dummy_app/config/application.rb +25 -0
- data/spec/dummy_app/config/boot.rb +4 -0
- data/spec/dummy_app/config/database.yml +25 -0
- data/spec/dummy_app/config/environment.rb +5 -0
- data/spec/dummy_app/config/environments/development.rb +29 -0
- data/spec/dummy_app/config/environments/production.rb +80 -0
- data/spec/dummy_app/config/environments/test.rb +36 -0
- data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy_app/config/initializers/inflections.rb +16 -0
- data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
- data/spec/dummy_app/config/initializers/secret_token.rb +12 -0
- data/spec/dummy_app/config/initializers/session_store.rb +3 -0
- data/spec/dummy_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy_app/config/locales/en.yml +23 -0
- data/spec/dummy_app/config/routes.rb +56 -0
- data/spec/dummy_app/config.ru +4 -0
- data/spec/dummy_app/db/schema.rb +16 -0
- data/spec/dummy_app/db/seeds.rb +7 -0
- data/spec/dummy_app/lib/assets/.keep +0 -0
- data/spec/dummy_app/lib/tasks/.keep +0 -0
- data/spec/dummy_app/log/.keep +0 -0
- data/spec/dummy_app/public/404.html +58 -0
- data/spec/dummy_app/public/422.html +58 -0
- data/spec/dummy_app/public/500.html +57 -0
- data/spec/dummy_app/public/favicon.ico +0 -0
- data/spec/dummy_app/public/robots.txt +5 -0
- data/spec/dummy_app/spec/helpers/string.rb +155 -0
- data/spec/dummy_app/spec/spec_helper.rb +17 -0
- data/spec/dummy_app/test/controllers/.keep +0 -0
- data/spec/dummy_app/test/fixtures/.keep +0 -0
- data/spec/dummy_app/test/helpers/.keep +0 -0
- data/spec/dummy_app/test/integration/.keep +0 -0
- data/spec/dummy_app/test/mailers/.keep +0 -0
- data/spec/dummy_app/test/models/.keep +0 -0
- data/spec/dummy_app/test/test_helper.rb +15 -0
- data/spec/dummy_app/vendor/assets/javascripts/.keep +0 -0
- data/spec/dummy_app/vendor/assets/stylesheets/.keep +0 -0
- data/to_slug_param.gemspec +29 -0
- metadata +223 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f6d5f3779a49d050bdfd8d7acf006394b0466170
|
4
|
+
data.tar.gz: 99dbaa222ad987d333b0a1b5e06af4814319784f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 90e3f63eb644e74a8b40634138a31f49cbaa109c1685b77a117c46e96cf2e4ae839a8cb7c916d9368fd1c0a3ce1b7456e63a5640dae7c4dea50d0438abe5867b
|
7
|
+
data.tar.gz: 5bfcb5e8adcbcb4d942503b9029264e6e709519ce8919c2e89c136f76fe44cdb090886b500a4a3695d740081e8236cbd03b85520e8625c9e7f1bea5c1a5134ed
|
data/.gitignore
ADDED
data/.keep
ADDED
File without changes
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Ilya N. Zykin
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
### ToSlugParam
|
2
|
+
|
3
|
+
Convert strings and symbols to slug param
|
4
|
+
|
5
|
+
Transliteration + Parameterization for slugs building
|
6
|
+
|
7
|
+
#### Install
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "to_slug_param", "~> 1.2"
|
11
|
+
```
|
12
|
+
|
13
|
+
<a href="http://rubygems.org/gems/to_slug_param">RubyGems/to_slug_param</a>
|
14
|
+
|
15
|
+
#### Using
|
16
|
+
|
17
|
+
For russian transliteration by default
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
I18n.enforce_available_locales = true
|
21
|
+
|
22
|
+
module DummyApp
|
23
|
+
class Application < Rails::Application
|
24
|
+
config.i18n.default_locale = :ru
|
25
|
+
end
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
"Привет Мир! Hello world!".to_slug_param
|
31
|
+
# => "privet-mir-hello-world"
|
32
|
+
|
33
|
+
String.to_slug_param("Привет Мир! Hello world!")
|
34
|
+
# => "privet-mir-hello-world"
|
35
|
+
```
|
36
|
+
|
37
|
+
Be carefully with file extension
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
"Документ.doc".to_slug_param
|
41
|
+
# => "dokument-doc"
|
42
|
+
```
|
43
|
+
|
44
|
+
For filenames:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
"/доки/dir/тест/документ.doc".slugged_filename #=> "dokument.doc"
|
48
|
+
String.slugged_filename("/доки/dir/тест/документ.doc") #=> "dokument.doc"
|
49
|
+
```
|
50
|
+
|
51
|
+
For full file path:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
"/доки/dir/тест/документ.doc".slugged_filepath #=> "/доки/dir/тест/dokument.doc"
|
55
|
+
String.slugged_filepath("/доки/dir/тест/документ.doc") #=> "/доки/dir/тест/dokument.doc"
|
56
|
+
```
|
57
|
+
|
58
|
+
Params
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
"Документ.doc".to_slug_param(locale: :ru) # => "dokument-doc"
|
62
|
+
"Документ.doc".to_slug_param(locale: :en) # => "doc"
|
63
|
+
```
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
"Документ.doc".to_slug_param(sep: '_', locale: :ru) # => "dokument_doc"
|
67
|
+
"Документ.doc".to_slug_param(sep: '_', locale: :en) # => "doc"
|
68
|
+
```
|
69
|
+
|
70
|
+
### MIT-LICENSE
|
71
|
+
|
72
|
+
##### Copyright (c) 2013-2014 [Ilya N.Zykin]
|
73
|
+
|
74
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
75
|
+
a copy of this software and associated documentation files (the
|
76
|
+
"Software"), to deal in the Software without restriction, including
|
77
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
78
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
79
|
+
permit persons to whom the Software is furnished to do so, subject to
|
80
|
+
the following conditions:
|
81
|
+
|
82
|
+
The above copyright notice and this permission notice shall be
|
83
|
+
included in all copies or substantial portions of the Software.
|
84
|
+
|
85
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
88
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
89
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
90
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
91
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Russian for Yandex. Based on:
|
4
|
+
# (c) Yaroslav Markin, Julian "julik" Tarkhanov and Co
|
5
|
+
# https://github.com/yaroslav/russian/blob/master/lib/russian/transliteration.rb
|
6
|
+
|
7
|
+
module RailsI18n
|
8
|
+
module Transliteration
|
9
|
+
module Russian
|
10
|
+
class << self
|
11
|
+
def rule
|
12
|
+
lambda do |string|
|
13
|
+
chars = string.scan(%r{#{multi_keys.join '|'}|\w|.})
|
14
|
+
|
15
|
+
result = ""
|
16
|
+
|
17
|
+
chars.each_with_index do |char, index|
|
18
|
+
if upper.has_key?(char) && lower.has_key?(chars[index+1])
|
19
|
+
# combined case
|
20
|
+
result << upper[char].downcase.capitalize
|
21
|
+
elsif upper.has_key?(char)
|
22
|
+
result << upper[char]
|
23
|
+
elsif lower.has_key?(char)
|
24
|
+
result << lower[char]
|
25
|
+
else
|
26
|
+
result << char
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
result
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
# use instance variables instead of constants to prevent warnings
|
37
|
+
# on re-evaling after I18n.reload!
|
38
|
+
|
39
|
+
def upper
|
40
|
+
@upper ||= begin
|
41
|
+
upper_single = {
|
42
|
+
"Ё"=>"E","Э"=>"E","Ю"=>"YU","Я"=>"YA",
|
43
|
+
"Ж"=>"ZH","Х"=>"KH","Й"=>"J",
|
44
|
+
"Ц"=>"TS","Ш"=>"SH","Щ"=>"SCH","Ь"=>"","Ъ"=>"",
|
45
|
+
|
46
|
+
"Ґ"=>"G","Є"=>"E","Ї"=>"YI","І"=>"I",
|
47
|
+
"А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
|
48
|
+
"Д"=>"D","Е"=>"E","З"=>"Z","И"=>"I",
|
49
|
+
"К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
|
50
|
+
"О"=>"O","П"=>"P","Р"=>"R","С"=>"S",
|
51
|
+
"Т"=>"T","У"=>"U","Ф"=>"F","Ч"=>"CH","Ы"=>"Y"
|
52
|
+
}
|
53
|
+
|
54
|
+
(upper_single.merge(upper_multi)).freeze
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def lower
|
59
|
+
@lower ||= begin
|
60
|
+
lower_single = {
|
61
|
+
"ё"=>"e","э"=>"e","ю"=>"yu","я"=>"ya",
|
62
|
+
"ж"=>"zh","х"=>"kh","й"=>"j",
|
63
|
+
"ц"=>"ts","ш"=>"sh","щ"=>"sch","ь"=>"","ъ"=>"",
|
64
|
+
|
65
|
+
"і"=>"i","ґ"=>"g","№"=>"#",
|
66
|
+
"ї"=>"yi","а"=>"a","б"=>"b",
|
67
|
+
"в"=>"v","г"=>"g","д"=>"d","е"=>"e",
|
68
|
+
"з"=>"z","и"=>"i","к"=>"k","л"=>"l",
|
69
|
+
"м"=>"m","н"=>"n","о"=>"o","п"=>"p",
|
70
|
+
"р"=>"r", "с"=>"s","т"=>"t","у"=>"u",
|
71
|
+
"ф"=>"f","ч"=>"ch","ы"=>"y"
|
72
|
+
}
|
73
|
+
|
74
|
+
(lower_single.merge(lower_multi)).freeze
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def upper_multi
|
79
|
+
@upper_multi ||= { "ЬЕ"=>"IE", "ЬЁ"=>"IE" }
|
80
|
+
end
|
81
|
+
|
82
|
+
def lower_multi
|
83
|
+
@lower_multi ||= { "ье"=>"ie", "ьё"=>"ie" }
|
84
|
+
end
|
85
|
+
|
86
|
+
def multi_keys
|
87
|
+
@multi_keys ||= (lower_multi.merge(upper_multi)).keys.sort_by {|s| s.length}.reverse.freeze
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
{ :ru => {
|
95
|
+
:i18n => {
|
96
|
+
:transliterate => {
|
97
|
+
:rule => RailsI18n::Transliteration::Russian.rule }}}}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
class String
|
2
|
+
def to_slug_param opts = {}
|
3
|
+
self.class.to_smart_slug_param(self, opts)
|
4
|
+
end
|
5
|
+
|
6
|
+
def to_slug_param_base opts = {}
|
7
|
+
self.class.to_slug_param_base(self, opts)
|
8
|
+
end
|
9
|
+
|
10
|
+
def slugged_filename opts = {}
|
11
|
+
self.class.slugged_filename(self, opts)
|
12
|
+
end
|
13
|
+
|
14
|
+
def slugged_filepath opts = {}
|
15
|
+
self.class.slugged_filepath(self, opts)
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_smart_slug_param opts = {}
|
19
|
+
self.class.to_smart_slug_param(self, opts)
|
20
|
+
end
|
21
|
+
|
22
|
+
# -----------------------------------
|
23
|
+
# Self methods
|
24
|
+
# -----------------------------------
|
25
|
+
class << self
|
26
|
+
def to_slug_param str, opts = {}
|
27
|
+
to_smart_slug_param(str, opts)
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_slug_param_base str, opts = {}
|
31
|
+
sep = opts.delete(:sep) || '-'
|
32
|
+
str = str.gsub(/\-{2,}/, '-').mb_chars
|
33
|
+
str = I18n::transliterate(str, opts)
|
34
|
+
str = ToSlugParam::basic_parameterize(sep, opts)
|
35
|
+
ToSlugParam::parameterize(sep, opts)
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_smart_slug_param str, opts = {}
|
39
|
+
tolerance = opts.delete(:tolerance) || 75
|
40
|
+
|
41
|
+
x = str.to_slug_param_base
|
42
|
+
y = str.to_url
|
43
|
+
|
44
|
+
ratio = (x.size.to_f/y.size.to_f)
|
45
|
+
|
46
|
+
# x=0.0/y=0.0 => NaN
|
47
|
+
return '' if ratio.nan?
|
48
|
+
# x=1.0/y=0.0 => Infinite
|
49
|
+
return x if ratio.infinite?
|
50
|
+
# x=0.0/y=1.0 => 0.0
|
51
|
+
return y if ratio.zero?
|
52
|
+
# ((x=5.0/y=3.0)*100).to_i => 166 => x
|
53
|
+
# ((x=3.0/y=5.0)*100).to_i => 60 => y
|
54
|
+
(ratio*100).to_i > tolerance ? x : y
|
55
|
+
end
|
56
|
+
|
57
|
+
def file_ext file_name, opts = {}
|
58
|
+
File.extname(file_name)[1..-1].to_s.to_slug_param_base opts
|
59
|
+
end
|
60
|
+
|
61
|
+
def file_name name, opts = {}
|
62
|
+
name = File.basename name
|
63
|
+
ext = File.extname name
|
64
|
+
File.basename(name, ext).to_s.to_slug_param_base opts
|
65
|
+
end
|
66
|
+
|
67
|
+
def slugged_filename name, opts = {}
|
68
|
+
name = File.basename name
|
69
|
+
fname = self.file_name name, opts
|
70
|
+
ext = self.file_ext name, opts
|
71
|
+
|
72
|
+
return fname if ext.blank?
|
73
|
+
[fname, ext].join('.')
|
74
|
+
end
|
75
|
+
|
76
|
+
def slugged_filepath file_full_path, opts = {}
|
77
|
+
fname = slugged_filename file_full_path, opts
|
78
|
+
file_full_path.split('/')[0...-1].push(fname).join '/'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Symbol
|
2
|
+
def to_slug_param opts = {}
|
3
|
+
String.to_slug_param(self.to_s, opts)
|
4
|
+
end
|
5
|
+
|
6
|
+
def to_slug_param_base opts = {}
|
7
|
+
String.to_slug_param_base(self.to_s, opts)
|
8
|
+
end
|
9
|
+
|
10
|
+
def slugged_filename opts = {}
|
11
|
+
String.slugged_filename(self.to_s, opts)
|
12
|
+
end
|
13
|
+
|
14
|
+
def slugged_filepath opts = {}
|
15
|
+
String.slugged_file(self.to_s, opts)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails-i18n'
|
2
|
+
require 'stringex_lite'
|
3
|
+
require 'to_slug_param/string'
|
4
|
+
require 'to_slug_param/symbol'
|
5
|
+
|
6
|
+
module ToSlugParam
|
7
|
+
class Engine < Rails::Engine; end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def basic_parameterize(str, sep)
|
11
|
+
str.gsub('_', sep).gsub('-', sep)
|
12
|
+
end
|
13
|
+
|
14
|
+
def parameterize(str, sep)
|
15
|
+
Rails::VERSION::MAJOR > 4 ? \
|
16
|
+
str.parameterize(separator: sep) : \
|
17
|
+
str.parameterize(sep)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
/db/*.sqlite3-journal
|
13
|
+
|
14
|
+
# Ignore all logfiles and tempfiles.
|
15
|
+
/log/*.log
|
16
|
+
/tmp
|
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
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 vendor/assets/javascripts of plugins, if any, 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/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
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 vendor/assets/stylesheets of plugins, if any, 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 top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>DummyApp</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
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# Require the gems listed in Gemfile, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(:default, Rails.env)
|
8
|
+
|
9
|
+
I18n.enforce_available_locales = true
|
10
|
+
|
11
|
+
module DummyApp
|
12
|
+
class Application < Rails::Application
|
13
|
+
# Settings in config/environments/* take precedence over those specified here.
|
14
|
+
# Application configuration should go into files in config/initializers
|
15
|
+
# -- all .rb files in that directory are automatically loaded.
|
16
|
+
|
17
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
18
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
19
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
20
|
+
|
21
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
22
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
23
|
+
config.i18n.default_locale = :ru
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
development:
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/development.sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
13
|
+
# re-generated from your development database when you run "rake".
|
14
|
+
# Do not set this db to the same as development or production.
|
15
|
+
test:
|
16
|
+
adapter: sqlite3
|
17
|
+
database: db/test.sqlite3
|
18
|
+
pool: 5
|
19
|
+
timeout: 5000
|
20
|
+
|
21
|
+
production:
|
22
|
+
adapter: sqlite3
|
23
|
+
database: db/production.sqlite3
|
24
|
+
pool: 5
|
25
|
+
timeout: 5000
|
@@ -0,0 +1,29 @@
|
|
1
|
+
DummyApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
end
|