slim_validation 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +2 -0
  3. data/.coveralls.yml +1 -0
  4. data/.gitignore +8 -0
  5. data/.travis.yml +23 -0
  6. data/Gemfile +14 -0
  7. data/Gemfile.lock +155 -0
  8. data/MIT-LICENSE +20 -0
  9. data/README.md +78 -0
  10. data/Rakefile +4 -0
  11. data/lib/slim_validation/version.rb +3 -0
  12. data/lib/slim_validation.rb +16 -0
  13. data/lib/tasks/slim_validation_tasks.rake +4 -0
  14. data/slim_validation.gemspec +32 -0
  15. data/spec/dummy/README.rdoc +28 -0
  16. data/spec/dummy/Rakefile +6 -0
  17. data/spec/dummy/app/assets/images/.keep +0 -0
  18. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  19. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  20. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  21. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  22. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  23. data/spec/dummy/app/mailers/.keep +0 -0
  24. data/spec/dummy/app/models/.keep +0 -0
  25. data/spec/dummy/app/models/concerns/.keep +0 -0
  26. data/spec/dummy/app/models/entry.rb +41 -0
  27. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  28. data/spec/dummy/bin/bundle +3 -0
  29. data/spec/dummy/bin/rails +4 -0
  30. data/spec/dummy/bin/rake +4 -0
  31. data/spec/dummy/config/application.rb +37 -0
  32. data/spec/dummy/config/boot.rb +5 -0
  33. data/spec/dummy/config/database.def.yml +25 -0
  34. data/spec/dummy/config/environment.rb +5 -0
  35. data/spec/dummy/config/environments/development.rb +29 -0
  36. data/spec/dummy/config/environments/production.rb +80 -0
  37. data/spec/dummy/config/environments/test.rb +36 -0
  38. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  40. data/spec/dummy/config/initializers/inflections.rb +16 -0
  41. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  42. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  43. data/spec/dummy/config/initializers/session_store.rb +3 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy/config/locales/en.yml +23 -0
  46. data/spec/dummy/config/routes.rb +56 -0
  47. data/spec/dummy/config.ru +4 -0
  48. data/spec/dummy/db/migrate/20150710020313_create_entries.rb +14 -0
  49. data/spec/dummy/db/schema.rb +27 -0
  50. data/spec/dummy/lib/assets/.keep +0 -0
  51. data/spec/dummy/log/.keep +0 -0
  52. data/spec/dummy/public/404.html +58 -0
  53. data/spec/dummy/public/422.html +58 -0
  54. data/spec/dummy/public/500.html +57 -0
  55. data/spec/dummy/public/favicon.ico +0 -0
  56. data/spec/factories/entries.rb +5 -0
  57. data/spec/models/entry_spec.rb +65 -0
  58. data/spec/rails_helper.rb +60 -0
  59. data/spec/spec_helper.rb +95 -0
  60. metadata +63 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dacf869556e9e6d653597e818b63610b599c2e84
4
- data.tar.gz: ef80d9c1747d312543e7bb209aa83e46fa9d928a
3
+ metadata.gz: 688db431528d6795e1a0efb837cf04a7f84993f4
4
+ data.tar.gz: 4eef5249a02405b8d099912eddb1dcb0075741d6
5
5
  SHA512:
6
- metadata.gz: 47a22279cba2eca4507893a507d7886d2efc28a9dc30e252312afd1fa99b9e9128ed2caf3a6f75c9f6d845f90a31f7d317c106b1a81d680f3d51e6e2cd6bf43f
7
- data.tar.gz: 4c27e422d06d6a6fc0cb23f01966e731046942e47369c6e97606009905f8ddd472909726abf6a570a397d09108224a4379503a0407c2bbc67e44fee68fad10de
6
+ metadata.gz: b352e7c36192e7685d6a0fc4b32bead5c63b96996e4254ab7816e57ee40838d41c002229cc8dac770c225426c1d6d0109a26250277d8f90d233b0c7e742f80da
7
+ data.tar.gz: 1ae6817df54e8102766a5268ffd00848c3a3d484c2b12812a550e689d0c52c82f2a8c9beafa5b036e1e31883a66d7e3d32d8e573c15e5a9c941987c777430bff
data/.codeclimate.yml ADDED
@@ -0,0 +1,2 @@
1
+ languages:
2
+ Ruby: true
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db/*.sqlite3
5
+ spec/dummy/db/*.sqlite3-journal
6
+ spec/dummy/log/*.log
7
+ spec/dummy/tmp/
8
+ spec/dummy/.sass-cache
data/.travis.yml ADDED
@@ -0,0 +1,23 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
4
+ - 2.2.2
5
+ env:
6
+ - DB=sqlite
7
+ before_install:
8
+ - gem install bundler -v 1.10.3
9
+ install:
10
+ - bundle install
11
+ cache:
12
+ directories:
13
+ - vendor/bundle
14
+ before_script:
15
+ - cp spec/dummy/config/database.def.yml spec/dummy/config/database.yml
16
+ script:
17
+ - cd spec/dummy
18
+ - bundle install
19
+ - bundle exec rake db:create RAILS_ENV=test
20
+ - bundle exec rake db:migrate RAILS_ENV=test
21
+ - bundle exec rake db:test:prepare
22
+ - cd ../../
23
+ - bundle exec rake
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in slim_validation.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use debugger
14
+ # gem 'debugger'
data/Gemfile.lock ADDED
@@ -0,0 +1,155 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ slim_validation (0.0.1)
5
+ rails (~> 4.0)
6
+ slim
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (4.0.13)
12
+ actionpack (= 4.0.13)
13
+ mail (~> 2.5, >= 2.5.4)
14
+ actionpack (4.0.13)
15
+ activesupport (= 4.0.13)
16
+ builder (~> 3.1.0)
17
+ erubis (~> 2.7.0)
18
+ rack (~> 1.5.2)
19
+ rack-test (~> 0.6.2)
20
+ activemodel (4.0.13)
21
+ activesupport (= 4.0.13)
22
+ builder (~> 3.1.0)
23
+ activerecord (4.0.13)
24
+ activemodel (= 4.0.13)
25
+ activerecord-deprecated_finders (~> 1.0.2)
26
+ activesupport (= 4.0.13)
27
+ arel (~> 4.0.0)
28
+ activerecord-deprecated_finders (1.0.4)
29
+ activesupport (4.0.13)
30
+ i18n (~> 0.6, >= 0.6.9)
31
+ minitest (~> 4.2)
32
+ multi_json (~> 1.3)
33
+ thread_safe (~> 0.1)
34
+ tzinfo (~> 0.3.37)
35
+ arel (4.0.2)
36
+ builder (3.1.4)
37
+ coveralls (0.8.2)
38
+ json (~> 1.8)
39
+ rest-client (>= 1.6.8, < 2)
40
+ simplecov (~> 0.10.0)
41
+ term-ansicolor (~> 1.3)
42
+ thor (~> 0.19.1)
43
+ diff-lcs (1.2.5)
44
+ docile (1.1.5)
45
+ domain_name (0.5.24)
46
+ unf (>= 0.0.5, < 1.0.0)
47
+ erubis (2.7.0)
48
+ factory_girl (4.5.0)
49
+ activesupport (>= 3.0.0)
50
+ factory_girl_rails (4.5.0)
51
+ factory_girl (~> 4.5.0)
52
+ railties (>= 3.0.0)
53
+ http-cookie (1.0.2)
54
+ domain_name (~> 0.5)
55
+ i18n (0.7.0)
56
+ json (1.8.3)
57
+ mail (2.6.3)
58
+ mime-types (>= 1.16, < 3)
59
+ mime-types (2.6.1)
60
+ mini_portile (0.6.2)
61
+ minitest (4.7.5)
62
+ multi_json (1.11.2)
63
+ netrc (0.10.3)
64
+ nokogiri (1.6.6.2)
65
+ mini_portile (~> 0.6.0)
66
+ rack (1.5.5)
67
+ rack-test (0.6.3)
68
+ rack (>= 1.0)
69
+ rails (4.0.13)
70
+ actionmailer (= 4.0.13)
71
+ actionpack (= 4.0.13)
72
+ activerecord (= 4.0.13)
73
+ activesupport (= 4.0.13)
74
+ bundler (>= 1.3.0, < 2.0)
75
+ railties (= 4.0.13)
76
+ sprockets-rails (~> 2.0)
77
+ railties (4.0.13)
78
+ actionpack (= 4.0.13)
79
+ activesupport (= 4.0.13)
80
+ rake (>= 0.8.7)
81
+ thor (>= 0.18.1, < 2.0)
82
+ rake (10.4.2)
83
+ rb-readline (0.5.3)
84
+ rest-client (1.8.0)
85
+ http-cookie (>= 1.0.2, < 2.0)
86
+ mime-types (>= 1.16, < 3.0)
87
+ netrc (~> 0.7)
88
+ rspec (3.3.0)
89
+ rspec-core (~> 3.3.0)
90
+ rspec-expectations (~> 3.3.0)
91
+ rspec-mocks (~> 3.3.0)
92
+ rspec-core (3.3.1)
93
+ rspec-support (~> 3.3.0)
94
+ rspec-expectations (3.3.0)
95
+ diff-lcs (>= 1.2.0, < 2.0)
96
+ rspec-support (~> 3.3.0)
97
+ rspec-html-matchers (0.7.0)
98
+ nokogiri (~> 1)
99
+ rspec (~> 3)
100
+ rspec-mocks (3.3.1)
101
+ diff-lcs (>= 1.2.0, < 2.0)
102
+ rspec-support (~> 3.3.0)
103
+ rspec-rails (3.3.2)
104
+ actionpack (>= 3.0, < 4.3)
105
+ activesupport (>= 3.0, < 4.3)
106
+ railties (>= 3.0, < 4.3)
107
+ rspec-core (~> 3.3.0)
108
+ rspec-expectations (~> 3.3.0)
109
+ rspec-mocks (~> 3.3.0)
110
+ rspec-support (~> 3.3.0)
111
+ rspec-support (3.3.0)
112
+ simplecov (0.10.0)
113
+ docile (~> 1.1.0)
114
+ json (~> 1.8)
115
+ simplecov-html (~> 0.10.0)
116
+ simplecov-html (0.10.0)
117
+ slim (3.0.6)
118
+ temple (~> 0.7.3)
119
+ tilt (>= 1.3.3, < 2.1)
120
+ sprockets (3.2.0)
121
+ rack (~> 1.0)
122
+ sprockets-rails (2.3.2)
123
+ actionpack (>= 3.0)
124
+ activesupport (>= 3.0)
125
+ sprockets (>= 2.8, < 4.0)
126
+ sqlite3 (1.3.10)
127
+ temple (0.7.6)
128
+ term-ansicolor (1.3.2)
129
+ tins (~> 1.0)
130
+ thor (0.19.1)
131
+ thread_safe (0.3.5)
132
+ tilt (2.0.1)
133
+ tins (1.5.4)
134
+ tzinfo (0.3.44)
135
+ unf (0.1.4)
136
+ unf_ext
137
+ unf_ext (0.0.7.1)
138
+
139
+ PLATFORMS
140
+ ruby
141
+
142
+ DEPENDENCIES
143
+ bundler (~> 1.10)
144
+ coveralls
145
+ factory_girl_rails
146
+ rake (~> 10.0)
147
+ rb-readline
148
+ rspec
149
+ rspec-html-matchers
150
+ rspec-rails
151
+ slim_validation!
152
+ sqlite3
153
+
154
+ BUNDLED WITH
155
+ 1.10.3
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 mmmpa
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,78 @@
1
+ [![Build Status](https://travis-ci.org/mmmpa/slim_validation.svg)](https://travis-ci.org/mmmpa/slim_validation)
2
+ [![Coverage Status](https://coveralls.io/repos/mmmpa/slim_validation/badge.svg?branch=master)](https://coveralls.io/r/mmmpa/slim_validation?branch=master)
3
+ [![Code Climate](https://codeclimate.com/github/mmmpa/slim_validation/badges/gpa.svg)](https://codeclimate.com/github/mmmpa/slim_validation)
4
+
5
+
6
+ # SlimValidation
7
+
8
+ `ActiveModel`や`ActiveRecord`用の`EachValidator`です。[slim-template/slim](https://github.com/slim-template/slim)のフォーマットにしたがってるか確認します。
9
+
10
+ `render`の成功をもってvalidとしているので、レンダリング結果をそのまま他のカラムに挿入出来ます。
11
+
12
+ ```rb
13
+ class Entry < ActiveRecord::Base
14
+ validates :slim,
15
+ slim: {
16
+ to: :html
17
+ }
18
+ end
19
+ ```
20
+
21
+ ```rb
22
+ entry = Entry.new(slim: "h1 title\np catch copy")
23
+
24
+ entry.valid?
25
+ => true
26
+
27
+ entry.html
28
+ => "<h1>title</h1><p>catch copy</p>"
29
+ ```
30
+
31
+ ```rb
32
+ entry = Entry.new(slim: " h1 title\np catch copy")
33
+
34
+ entry.valid?
35
+ => false
36
+
37
+ entry.html
38
+ => nil
39
+ ```
40
+
41
+ # Installation
42
+
43
+ ```rb
44
+ gem 'slim_validation'
45
+ ```
46
+
47
+ ```
48
+ bundle install
49
+ ```
50
+
51
+ # Usage
52
+
53
+ |option|value||
54
+ |---|---|---|
55
+ |to|Procかattribute_name|レンダリング結果の挿入先、処理方法|
56
+ |options|Hash|Slim::Template.newにわたされるoptions|
57
+ |scope|:recordか任意のオブジェクト|slimのrender時に使う変数などの参照先|
58
+
59
+ ```rb
60
+ validates :slim_proc,
61
+ slim: {
62
+ options: {pretty: false},
63
+ to: ->(record, result) {
64
+ record.html = result
65
+ },
66
+ allow_blank: true
67
+ }
68
+ ```
69
+
70
+ ```rb
71
+ validates :slim_scope,
72
+ slim: {
73
+ options: {pretty: false},
74
+ to: :html,
75
+ scope: :record,
76
+ allow_blank: true
77
+ }
78
+ ```
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+ task :default => :spec
4
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,3 @@
1
+ module SlimValidation
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,16 @@
1
+ module SlimValidation
2
+ end
3
+
4
+ require 'slim'
5
+
6
+ class SlimValidator < ActiveModel::EachValidator
7
+ def validate_each(record, attr_name, value)
8
+ result = Slim::Template.new(options[:options]) { value }.render(options[:scope] == :record ? record : options[:scope])
9
+ rescue
10
+ record.errors.add(attr_name, :invalid_slim, options)
11
+ ensure
12
+ if (to = options[:to]).present?
13
+ to.is_a?(Proc) ? to.(record, result) : record[to] = result
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :slim_validation do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,32 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "slim_validation/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "slim_validation"
9
+ spec.version = SlimValidation::VERSION
10
+ spec.authors = ["mmmpa"]
11
+ spec.email = ["mmmpa.mmmpa@gmail.com"]
12
+ spec.homepage = "http://mmmpa.net"
13
+ spec.summary = "slim-template format validation."
14
+ spec.description = "slim-template format validation."
15
+
16
+ spec.files = `git ls-files`.split("\n")
17
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+ spec.add_dependency "rails", "~> 4.0"
21
+ spec.add_dependency "slim"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.10"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "sqlite3"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "rspec-rails"
28
+ spec.add_development_dependency "rspec-html-matchers"
29
+ spec.add_development_dependency "factory_girl_rails"
30
+ spec.add_development_dependency "coveralls"
31
+ spec.add_development_dependency "rb-readline"
32
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
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
+
6
+ Dummy::Application.load_tasks
File without changes
@@ -0,0 +1,13 @@
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_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
+ */
@@ -0,0 +1,5 @@
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
File without changes
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,41 @@
1
+ class Entry < ActiveRecord::Base
2
+ validates :slim,
3
+ slim: {
4
+ allow_blank: true
5
+ }
6
+
7
+ validates :slim_no_options,
8
+ slim: {
9
+ to: :html,
10
+ allow_blank: true
11
+ }
12
+
13
+ validates :slim_proc,
14
+ slim: {
15
+ options: {pretty: false},
16
+ to: ->(record, result) {
17
+ record.html = result
18
+ },
19
+ allow_blank: true
20
+ }
21
+
22
+ validates :slim_attribute,
23
+ slim: {
24
+ options: {pretty: false},
25
+ to: :html,
26
+ allow_blank: true
27
+ }
28
+
29
+ validates :slim_scope,
30
+ slim: {
31
+ options: {pretty: false},
32
+ to: :html,
33
+ scope: :record,
34
+ allow_blank: true
35
+ }
36
+
37
+ def initialize(*)
38
+ super
39
+ @local_value = 'local value'
40
+ end
41
+ end
@@ -0,0 +1,14 @@
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
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,37 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "sprockets/railtie"
8
+ # require "rails/test_unit/railtie"
9
+
10
+ Bundler.require(*Rails.groups)
11
+ require "slim_validation"
12
+
13
+ module Dummy
14
+ class Application < Rails::Application
15
+ # Settings in config/environments/* take precedence over those specified here.
16
+ # Application configuration should go into files in config/initializers
17
+ # -- all .rb files in that directory are automatically loaded.
18
+
19
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
20
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
21
+ # config.time_zone = 'Central Time (US & Canada)'
22
+
23
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
24
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
25
+ # config.i18n.default_locale = :de
26
+ config.generators do |g|
27
+ g.assets false
28
+ g.helper false
29
+ g.view false
30
+
31
+ g.test_framework :rspec, fixtures: true, view_specs: false, helper_specs: false, routing_specs:
32
+ false, controller_specs: true, request_specs: true
33
+ g.fixture_replacement :factory_girl, dir: 'spec/factories'
34
+ end
35
+ end
36
+ end
37
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -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,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Dummy::Application.initialize!
@@ -0,0 +1,29 @@
1
+ Dummy::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