comfy_bootstrap_form 4.0.0.beta1 → 4.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +12 -0
  3. data/.travis.yml +14 -0
  4. data/CONTRIBUTING.md +40 -0
  5. data/Gemfile +14 -0
  6. data/{MIT-LICENSE → LICENSE.md} +1 -1
  7. data/README.md +130 -495
  8. data/Rakefile +5 -15
  9. data/bootstrap_form.gemspec +25 -0
  10. data/demo/README.md +18 -0
  11. data/demo/Rakefile +6 -0
  12. data/demo/app/controllers/application_controller.rb +2 -0
  13. data/demo/app/controllers/bootstrap_controller.rb +12 -0
  14. data/demo/app/models/application_record.rb +3 -0
  15. data/demo/app/models/user.rb +3 -0
  16. data/demo/app/views/bootstrap/form.html.erb +82 -0
  17. data/demo/app/views/layouts/application.html.erb +43 -0
  18. data/demo/bin/bundle +3 -0
  19. data/{test/dummy → demo}/bin/rails +1 -1
  20. data/{test/dummy → demo}/bin/rake +0 -0
  21. data/demo/bin/setup +36 -0
  22. data/demo/bin/update +31 -0
  23. data/demo/bin/yarn +11 -0
  24. data/{test/dummy → demo}/config.ru +2 -1
  25. data/demo/config/application.rb +24 -0
  26. data/demo/config/boot.rb +5 -0
  27. data/{test/dummy → demo}/config/database.yml +8 -12
  28. data/demo/config/environment.rb +5 -0
  29. data/demo/config/environments/development.rb +60 -0
  30. data/{test/dummy → demo}/config/environments/test.rb +15 -20
  31. data/demo/config/initializers/application_controller_renderer.rb +8 -0
  32. data/demo/config/initializers/assets.rb +14 -0
  33. data/{test/dummy → demo}/config/initializers/backtrace_silencers.rb +0 -0
  34. data/demo/config/initializers/cookies_serializer.rb +5 -0
  35. data/{test/dummy → demo}/config/initializers/filter_parameter_logging.rb +0 -0
  36. data/{test/dummy → demo}/config/initializers/inflections.rb +0 -0
  37. data/{test/dummy → demo}/config/initializers/mime_types.rb +0 -1
  38. data/{test/dummy → demo}/config/initializers/wrap_parameters.rb +2 -2
  39. data/{test/dummy → demo}/config/locales/en.yml +10 -0
  40. data/demo/config/puma.rb +56 -0
  41. data/{test/dummy → demo}/config/routes.rb +2 -0
  42. data/demo/config/spring.rb +6 -0
  43. data/demo/config/storage.yml +35 -0
  44. data/demo/db/schema.rb +11 -0
  45. data/{test/dummy/public/favicon.ico → demo/log/.keep} +0 -0
  46. data/demo/package.json +5 -0
  47. data/demo/public/favicon.ico +0 -0
  48. data/lib/bootstrap_form.rb +2 -2
  49. data/lib/bootstrap_form/form_builder.rb +367 -346
  50. data/lib/bootstrap_form/version.rb +1 -1
  51. data/lib/bootstrap_form/view_helper.rb +33 -0
  52. data/lib/comfy_bootstrap_form.rb +1 -1
  53. data/test/bootstrap_form/fields_test.rb +304 -0
  54. data/test/bootstrap_form/fields_with_errors_test.rb +109 -0
  55. data/test/bootstrap_form/form_builder_test.rb +49 -0
  56. data/test/bootstrap_form/horizontal_form_test.rb +159 -0
  57. data/test/bootstrap_form/inline_form_test.rb +68 -0
  58. data/test/bootstrap_form/input_group_test.rb +53 -0
  59. data/test/bootstrap_form/radios_and_checkboxes_test.rb +208 -0
  60. data/test/bootstrap_form/submit_test.rb +59 -0
  61. data/test/bootstrap_form/view_helpers_test.rb +99 -0
  62. data/test/gemfiles/5.2.gemfile +13 -0
  63. data/test/test_helper.rb +31 -69
  64. metadata +71 -258
  65. data/app/assets/stylesheets/rails_bootstrap_forms.css +0 -10
  66. data/lib/bootstrap_form/aliasing.rb +0 -35
  67. data/lib/bootstrap_form/helper.rb +0 -36
  68. data/lib/bootstrap_form/helpers/bootstrap.rb +0 -94
  69. data/lib/bootstrap_form/helpers/nested_form.rb +0 -33
  70. data/test/bootstrap_checkbox_test.rb +0 -144
  71. data/test/bootstrap_fields_test.rb +0 -152
  72. data/test/bootstrap_form_group_test.rb +0 -313
  73. data/test/bootstrap_form_test.rb +0 -276
  74. data/test/bootstrap_other_components_test.rb +0 -86
  75. data/test/bootstrap_radio_button_test.rb +0 -124
  76. data/test/bootstrap_selects_test.rb +0 -160
  77. data/test/dummy/Gemfile +0 -45
  78. data/test/dummy/Gemfile.lock +0 -120
  79. data/test/dummy/README.rdoc +0 -28
  80. data/test/dummy/Rakefile +0 -10
  81. data/test/dummy/app/assets/javascripts/application.js +0 -16
  82. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  83. data/test/dummy/app/controllers/application_controller.rb +0 -5
  84. data/test/dummy/app/helpers/application_helper.rb +0 -2
  85. data/test/dummy/app/models/address.rb +0 -3
  86. data/test/dummy/app/models/faux_user.rb +0 -9
  87. data/test/dummy/app/models/super_user.rb +0 -2
  88. data/test/dummy/app/models/user.rb +0 -9
  89. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  90. data/test/dummy/bin/bundle +0 -3
  91. data/test/dummy/config/application.rb +0 -23
  92. data/test/dummy/config/boot.rb +0 -4
  93. data/test/dummy/config/environment.rb +0 -5
  94. data/test/dummy/config/environments/development.rb +0 -29
  95. data/test/dummy/config/environments/production.rb +0 -80
  96. data/test/dummy/config/initializers/generic_migration.rb +0 -6
  97. data/test/dummy/config/initializers/secret_token.rb +0 -12
  98. data/test/dummy/config/initializers/session_store.rb +0 -3
  99. data/test/dummy/db/migrate/20130703191909_create_users.rb +0 -13
  100. data/test/dummy/db/migrate/20130703191937_create_addresses.rb +0 -13
  101. data/test/dummy/db/migrate/20130912171202_add_preferences_to_user.rb +0 -5
  102. data/test/dummy/db/migrate/20140327190145_add_terms_to_user.rb +0 -5
  103. data/test/dummy/db/migrate/20140922133133_add_type_to_users.rb +0 -5
  104. data/test/dummy/db/schema.rb +0 -38
  105. data/test/dummy/db/seeds.rb +0 -7
  106. data/test/dummy/db/test.sqlite3 +0 -0
  107. data/test/dummy/log/test.log +0 -18394
  108. data/test/dummy/public/404.html +0 -58
  109. data/test/dummy/public/422.html +0 -58
  110. data/test/dummy/public/500.html +0 -57
  111. data/test/dummy/public/robots.txt +0 -5
  112. data/test/dummy/test/fixtures/addresses.yml +0 -15
  113. data/test/dummy/test/fixtures/users.yml +0 -15
  114. data/test/dummy/test/models/address_test.rb +0 -7
  115. data/test/dummy/test/models/user_test.rb +0 -7
  116. data/test/dummy/test/test_helper.rb +0 -15
  117. data/test/special_form_class_models_test.rb +0 -43
data/Rakefile CHANGED
@@ -1,37 +1,27 @@
1
- #!/usr/bin/env rake
2
1
  begin
3
2
  require 'bundler/setup'
4
3
  rescue LoadError
5
4
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
5
  end
7
- begin
8
- require 'rdoc/task'
9
- rescue LoadError
10
- require 'rdoc/rdoc'
11
- require 'rake/rdoctask'
12
- RDoc::Task = Rake::RDocTask
13
- end
6
+
7
+ require 'rdoc/task'
14
8
 
15
9
  RDoc::Task.new(:rdoc) do |rdoc|
16
10
  rdoc.rdoc_dir = 'rdoc'
17
11
  rdoc.title = 'BootstrapForm'
18
12
  rdoc.options << '--line-numbers'
19
- rdoc.rdoc_files.include('README.rdoc')
13
+ rdoc.rdoc_files.include('README.md')
20
14
  rdoc.rdoc_files.include('lib/**/*.rb')
21
15
  end
22
16
 
23
-
24
-
25
- Bundler::GemHelper.install_tasks
17
+ require 'bundler/gem_tasks'
26
18
 
27
19
  require 'rake/testtask'
28
20
 
29
21
  Rake::TestTask.new(:test) do |t|
30
- t.libs << 'lib'
31
22
  t.libs << 'test'
32
23
  t.pattern = 'test/**/*_test.rb'
33
24
  t.verbose = false
34
25
  end
35
26
 
36
-
37
- task :default => :test
27
+ task default: :test
@@ -0,0 +1,25 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require "bootstrap_form/version"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "comfy_bootstrap_form"
8
+ s.version = BootstrapForm::VERSION
9
+ s.authors = ["Oleg Khabarov", "Stephen Potenza"]
10
+ s.email = ["oleg@khabarov.ca"]
11
+ s.homepage = "https://github.com/comfy/comfy-bootstrap-form"
12
+ s.summary = "Rails form builder that makes it easy to style forms using "\
13
+ "Bootstrap 4"
14
+ s.description = "bootstrap_form is a rails form builder that makes it super "\
15
+ "easy to create beautiful-looking forms using Bootstrap 4"
16
+ s.license = "MIT"
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.bindir = "exe"
20
+ s.require_paths = ["lib"]
21
+
22
+ s.required_ruby_version = ">= 2.2.2"
23
+
24
+ s.add_dependency "rails", ">= 5.2.rc1"
25
+ end
@@ -0,0 +1,18 @@
1
+ # DEMO APP (Rails 5.2)
2
+
3
+ ### Usage
4
+
5
+ - `rake db:schema:load`
6
+ - `rails s`
7
+ - Navigate to http://localhost:3000
8
+ - Start changing stuff in [/demo/app/views/bootstrap/form.html.erb](/demo/app/views/bootstrap/form.html.erb)
9
+
10
+ ### Following files were added or changed:
11
+
12
+ - db/schema.rb
13
+ - config/{application, routes, boot}.rb
14
+ - config/environments/{development, test}.rb
15
+ - app/models/user.rb
16
+ - app/controllers/bootstrap_controller.rb
17
+ - app/views/layouts/application.html.erb
18
+ - app/views/bootstrap/form.html.erb
@@ -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_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,12 @@
1
+ class BootstrapController < ApplicationController
2
+
3
+ def form
4
+ @user = User.new(test: "Lorem ipsum")
5
+
6
+ @user_with_error = User.new
7
+ @user_with_error.errors.add(:email)
8
+ @user_with_error.errors.add(:terms)
9
+ @user_with_error.errors.add(:test)
10
+ end
11
+
12
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,3 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ end
@@ -0,0 +1,82 @@
1
+ <h3>Horizontal Form</h3>
2
+
3
+ <%= bootstrap_form_with model: @user, url: "/", bootstrap: {layout: :horizontal} do |form| %>
4
+ <%= form.email_field :email, placeholder: "Enter Email", bootstrap: {label: {text: "Email address"}, help: "We'll never share your email with anyone else"} %>
5
+ <%= form.email_field :email, bootstrap: {prepend: "Prepend", append: "Append"} %>
6
+ <%= form.check_box :terms, bootstrap: {help: "You better check this"} %>
7
+ <%= form.collection_radio_buttons :test, ["1", "2", "3"], :to_s, :to_s, bootstrap: {help: "help text"} %>
8
+ <%= form.text_field :test, bootstrap: {label: {hide: true}} %>
9
+ <%= form.collection_check_boxes :test, ["11", "22", "33"], :to_s, :to_s, bootstrap: {help: "help text", inline: true, label: {hide: true}} %>
10
+ <%= form.form_group bootstrap: {label: {text: "Lorem", class: "lorem pt-0"}} do %>
11
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
12
+ tempor incididunt ut labore et dolore magna aliqua.
13
+ <% end %>
14
+ <%= form.primary "Smash That Button" do %>
15
+ <a href="/" class="btn btn-link">Unsubcribe</a>
16
+ <% end %>
17
+ <% end %>
18
+
19
+ <h3>Inline Form</h3>
20
+
21
+ <%= bootstrap_form_with model: @user, url: "/", bootstrap: {layout: :inline} do |form| %>
22
+ <%= form.email_field :email, placeholder: "Enter Email" %>
23
+ <%= form.password_field :password, placeholder: "Password", bootstrap: {label: {hide: true}, prepend: "???", append: "???"} %>
24
+ <%= form.check_box :terms %>
25
+ <%= form.form_group do %>
26
+ Lorem
27
+ <% end %>
28
+ <%= form.primary "Submit" do %>
29
+ <a href="/" class="btn btn-link">Cancel</a>
30
+ <% end %>
31
+ <% end %>
32
+
33
+ <h3>Simple Form</h3>
34
+
35
+ <%= bootstrap_form_with model: @user, url: "/" do |form| %>
36
+ <%= form.email_field :email, placeholder: "Enter Email", bootstrap: {label: {text: "Email address"}, help: "We'll never share your email with anyone else"} %>
37
+ <%= form.password_field :password, placeholder: "Password"%>
38
+ <%= form.select :select_value, ["option A", "option B"] %>
39
+ <%= form.text_area :test, bootstrap: {label: {text: "Text Area"}} %>
40
+ <%= form.file_field :test, bootstrap: {label: {text: "File Field"}} %>
41
+ <%= form.plaintext :test, bootstrap: {label: {text: "Plain Text"}} %>
42
+ <%= form.check_box :terms, bootstrap: {label: {text: "Agree to Terms"}} %>
43
+ <%= form.form_group do %>
44
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
45
+ tempor incididunt ut labore et dolore magna aliqua.
46
+ <% end %>
47
+ <%= form.submit %>
48
+ <% end %>
49
+
50
+ <h3>Checkboxes and Radio buttons</h3>
51
+
52
+ <% @user.test = "c" %>
53
+ <%= bootstrap_form_with model: @user, url: "/" do |form| %>
54
+ <%= form.collection_radio_buttons :test, [["a", "Label A"], ["b", "Label B"]], :first, :second %>
55
+ <%= form.collection_check_boxes :test, [["e", "Label E"], ["f", "Label F"]], :first, :second, bootstrap: {help: "help text"} %>
56
+ <%= form.collection_radio_buttons :test, ["u", "v", "w"], :to_s, :to_s, bootstrap: {inline: true, label: {text: "Custom Label"}} %>
57
+ <%= form.collection_check_boxes :test, ["x", "y", "z"], :to_s, :to_s, bootstrap: {inline: true, help: "help text", label: {hide: true}} %>
58
+ <% end %>
59
+
60
+ <h3>Input Group</h3>
61
+
62
+ <%= bootstrap_form_with model: @user, url: "/" do |form| %>
63
+ <%= form.email_field :email, placeholder: "Enter Email", bootstrap: {prepend: "Prepend", append: "Append"} %>
64
+ <% prepend_button = capture do %>
65
+ <button class="btn btn-success">Go</button>
66
+ <% end %>
67
+ <% append_button = capture do %>
68
+ <button class="btn btn-danger">Stop</button>
69
+ <% end %>
70
+ <%= form.email_field :email, placeholder: "Enter Email", bootstrap: {label: {hide: true}, prepend: {html: prepend_button}, append: {html: append_button}} %>
71
+ <% end %>
72
+
73
+ <h3>Horizontal Form With Errors</h3>
74
+
75
+ <%= bootstrap_form_with model: @user_with_error, url: "/", bootstrap: {layout: :horizontal} do |form| %>
76
+ <%= form.email_field :email, placeholder: "Enter Email", bootstrap: {label: {text: "Email address"}, help: "We'll never share your email with anyone else"} %>
77
+ <%= form.email_field :email, placeholder: "Enter Email", bootstrap: {help: "Help me!", prepend: "Prepend", append: "Append"} %>
78
+ <%= form.check_box :terms, bootstrap: {help: "help text"}%>
79
+ <%= form.collection_radio_buttons :test, ["a", "b", "c"], :to_s, :to_s, bootstrap: {help: "help text"} %>
80
+ <%= form.collection_check_boxes :test, ["x", "y", "z"], :to_s, :to_s, bootstrap: {inline: true, help: "help text"} %>
81
+ <%= form.submit %>
82
+ <% end %>
@@ -0,0 +1,43 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <!-- Required meta tags -->
5
+ <meta charset="utf-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7
+
8
+ <!-- Bootstrap CSS -->
9
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
10
+
11
+ <style type="text/css">
12
+ form {
13
+ padding: 1.5em;
14
+ border: .2rem solid #f7f7f9;
15
+ margin-bottom: 2em;
16
+ }
17
+
18
+ /*
19
+ Due to how Bootstrap renders inline checkboxes with errors we have to add this
20
+ See: https://github.com/twbs/bootstrap/issues/25540
21
+ */
22
+ .invalid-feedback {
23
+ display: block;
24
+ }
25
+
26
+ </style>
27
+
28
+ <title>Hello, world!</title>
29
+ <%= csrf_meta_tags %>
30
+ </head>
31
+
32
+ <body>
33
+ <div class="container">
34
+ <%= yield %>
35
+ </div>
36
+
37
+ <!-- Optional JavaScript -->
38
+ <!-- jQuery first, then Popper.js, then Bootstrap JS -->
39
+ <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
40
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
41
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
42
+ </body>
43
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
File without changes
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ # This script is a starting point to setup your application.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
23
+ # puts "\n== Copying sample files =="
24
+ # unless File.exist?('config/database.yml')
25
+ # cp 'config/database.yml.sample', 'config/database.yml'
26
+ # end
27
+
28
+ puts "\n== Preparing database =="
29
+ system! 'bin/rails db:setup'
30
+
31
+ puts "\n== Removing old logs and tempfiles =="
32
+ system! 'bin/rails log:clear tmp:clear'
33
+
34
+ puts "\n== Restarting application server =="
35
+ system! 'bin/rails restart'
36
+ end
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ # This script is a way to update your development environment automatically.
14
+ # Add necessary update steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
23
+ puts "\n== Updating database =="
24
+ system! 'bin/rails db:migrate'
25
+
26
+ puts "\n== Removing old logs and tempfiles =="
27
+ system! 'bin/rails log:clear tmp:clear'
28
+
29
+ puts "\n== Restarting application server =="
30
+ system! 'bin/rails restart'
31
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
+ begin
5
+ exec "yarnpkg #{ARGV.join(' ')}"
6
+ rescue Errno::ENOENT
7
+ $stderr.puts "Yarn executable was not detected in the system."
8
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9
+ exit 1
10
+ end
11
+ end
@@ -1,4 +1,5 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require_relative 'config/environment'
4
+
4
5
  run Rails.application
@@ -0,0 +1,24 @@
1
+ require_relative 'boot'
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require "bootstrap_form"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Initialize configuration defaults for originally generated Rails version.
11
+
12
+ if config.respond_to?(:load_defaults)
13
+ config.load_defaults [Rails::VERSION::MAJOR, Rails::VERSION::MINOR].join(".")
14
+ end
15
+
16
+ if config.respond_to?(:secret_key_base)
17
+ config.secret_key_base = "ignore"
18
+ end
19
+
20
+ # Settings in config/environments/* take precedence over those specified here.
21
+ # Application configuration should go into files in config/initializers
22
+ # -- all .rb files in that directory are automatically loaded.
23
+ end
24
+ end
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __dir__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../lib', __dir__)
@@ -3,23 +3,19 @@
3
3
  #
4
4
  # Ensure the SQLite 3 gem is defined in your Gemfile
5
5
  # gem 'sqlite3'
6
- development:
6
+ #
7
+ default: &default
7
8
  adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
10
  timeout: 5000
11
11
 
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
12
16
  # Warning: The database defined as "test" will be erased and
13
17
  # re-generated from your development database when you run "rake".
14
18
  # Do not set this db to the same as development or production.
15
19
  test:
16
- adapter: sqlite3
20
+ <<: *default
17
21
  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_relative 'application'
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,60 @@
1
+ Rails.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.
13
+ config.consider_all_requests_local = true
14
+
15
+ # Enable/disable caching. By default caching is disabled.
16
+ # Run rails dev:cache to toggle caching.
17
+ if Rails.root.join('tmp/caching-dev.txt').exist?
18
+ config.action_controller.perform_caching = true
19
+
20
+ config.cache_store = :memory_store
21
+ config.public_file_server.headers = {
22
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
23
+ }
24
+ else
25
+ config.action_controller.perform_caching = false
26
+
27
+ config.cache_store = :null_store
28
+ end
29
+
30
+ # Store uploaded files on the local file system (see config/storage.yml for options)
31
+ if config.respond_to?(:active_storage)
32
+ config.active_storage.service = :local
33
+ end
34
+
35
+ # Don't care if the mailer can't send.
36
+ config.action_mailer.raise_delivery_errors = false
37
+
38
+ config.action_mailer.perform_caching = false
39
+
40
+ # Print deprecation notices to the Rails logger.
41
+ config.active_support.deprecation = :log
42
+
43
+ # Raise an error on page load if there are pending migrations.
44
+ config.active_record.migration_error = :page_load
45
+
46
+ # Debug mode disables concatenation and preprocessing of assets.
47
+ # This option may cause significant delays in view rendering with a large
48
+ # number of complex assets.
49
+ config.assets.debug = true
50
+
51
+ # Suppress logger output for asset requests.
52
+ config.assets.quiet = true
53
+
54
+ # Raises error for missing translations
55
+ # config.action_view.raise_on_missing_translations = true
56
+
57
+ # Use an evented file watcher to asynchronously detect changes in source code,
58
+ # routes, locales, etc. This feature depends on the listen gem.
59
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
60
+ end