yamls 0.2.1 → 0.2.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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +25 -0
- data/README.md +22 -1
- data/example/rails-demo/.gitignore +33 -0
- data/example/rails-demo/.ruby-version +1 -0
- data/example/rails-demo/Gemfile +43 -0
- data/example/rails-demo/README.md +24 -0
- data/example/rails-demo/Rakefile +6 -0
- data/example/rails-demo/app/channels/application_cable/channel.rb +4 -0
- data/example/rails-demo/app/channels/application_cable/connection.rb +4 -0
- data/example/rails-demo/app/controllers/application_controller.rb +2 -0
- data/example/rails-demo/app/controllers/books_controller.rb +48 -0
- data/example/rails-demo/app/controllers/concerns/.keep +0 -0
- data/example/rails-demo/app/jobs/application_job.rb +7 -0
- data/example/rails-demo/app/mailers/application_mailer.rb +4 -0
- data/example/rails-demo/app/models/application_record.rb +3 -0
- data/example/rails-demo/app/models/book.rb +2 -0
- data/example/rails-demo/app/models/concerns/.keep +0 -0
- data/example/rails-demo/app/parameters/column.yml +5 -0
- data/example/rails-demo/app/views/layouts/mailer.html.erb +13 -0
- data/example/rails-demo/app/views/layouts/mailer.text.erb +1 -0
- data/example/rails-demo/bin/bundle +114 -0
- data/example/rails-demo/bin/rails +9 -0
- data/example/rails-demo/bin/rake +9 -0
- data/example/rails-demo/bin/setup +33 -0
- data/example/rails-demo/bin/spring +17 -0
- data/example/rails-demo/config/application.rb +37 -0
- data/example/rails-demo/config/boot.rb +4 -0
- data/example/rails-demo/config/cable.yml +10 -0
- data/example/rails-demo/config/credentials.yml.enc +1 -0
- data/example/rails-demo/config/database.yml +25 -0
- data/example/rails-demo/config/environment.rb +5 -0
- data/example/rails-demo/config/environments/development.rb +52 -0
- data/example/rails-demo/config/environments/production.rb +105 -0
- data/example/rails-demo/config/environments/test.rb +49 -0
- data/example/rails-demo/config/initializers/application_controller_renderer.rb +8 -0
- data/example/rails-demo/config/initializers/backtrace_silencers.rb +7 -0
- data/example/rails-demo/config/initializers/cors.rb +16 -0
- data/example/rails-demo/config/initializers/filter_parameter_logging.rb +4 -0
- data/example/rails-demo/config/initializers/inflections.rb +16 -0
- data/example/rails-demo/config/initializers/mime_types.rb +4 -0
- data/example/rails-demo/config/initializers/wrap_parameters.rb +14 -0
- data/example/rails-demo/config/locales/en.yml +33 -0
- data/example/rails-demo/config/puma.rb +38 -0
- data/example/rails-demo/config/routes.rb +5 -0
- data/example/rails-demo/config/spring.rb +6 -0
- data/example/rails-demo/config/storage.yml +34 -0
- data/example/rails-demo/config.ru +5 -0
- data/example/rails-demo/db/migrate/20211101020803_create_books.rb +11 -0
- data/example/rails-demo/db/schema.rb +31 -0
- data/example/rails-demo/db/seeds.rb +7 -0
- data/example/rails-demo/lib/tasks/.keep +0 -0
- data/example/rails-demo/log/.keep +0 -0
- data/example/rails-demo/public/robots.txt +1 -0
- data/example/rails-demo/storage/.keep +0 -0
- data/example/rails-demo/test/channels/application_cable/connection_test.rb +11 -0
- data/example/rails-demo/test/controllers/.keep +0 -0
- data/example/rails-demo/test/controllers/books_controller_test.rb +38 -0
- data/example/rails-demo/test/fixtures/.keep +0 -0
- data/example/rails-demo/test/fixtures/books.yml +11 -0
- data/example/rails-demo/test/fixtures/files/.keep +0 -0
- data/example/rails-demo/test/models/.keep +0 -0
- data/example/rails-demo/test/models/book_test.rb +7 -0
- data/example/rails-demo/test/test_helper.rb +13 -0
- data/example/rails-demo/tmp/.keep +0 -0
- data/example/rails-demo/tmp/pids/.keep +0 -0
- data/lib/yamls/support/parameters.rb +12 -0
- data/lib/yamls/version.rb +1 -1
- metadata +64 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 95135382a783cffc3c5095e2d464749065409c9f5aa06fe1e10b49aaf1ab22d3
|
|
4
|
+
data.tar.gz: '0618a4f351da6238b969b8919fbf65a906d1de9f5c63cce51b4d89a00ff70e31'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c8f84381f2d76891a2a4c3e62cd52b5a441ee5dc23f5ed4253dabc30469fa73fd3926940a88694f188b44c3fef27e05c673c176ad52709017b5af54ac7590ec
|
|
7
|
+
data.tar.gz: 12692960dc0e66af945b5576a1fb5620ffbbfa81c040e4a1859d0383f0ca7c41ee64f0380f3feabc0efb4f3a7be09a67286781021c181015ca9bd2b550de463c
|
data/.circleci/config.yml
CHANGED
|
@@ -70,6 +70,28 @@ jobs:
|
|
|
70
70
|
name: Run test
|
|
71
71
|
command: cd example/rails6.0.0 && bundle exec rake test
|
|
72
72
|
|
|
73
|
+
test_rails_demo:
|
|
74
|
+
docker:
|
|
75
|
+
- image: cimg/ruby:3.0.2-node
|
|
76
|
+
executor: ruby/default
|
|
77
|
+
steps:
|
|
78
|
+
- checkout
|
|
79
|
+
- run:
|
|
80
|
+
name: Install dependencies
|
|
81
|
+
command: sudo apt-get update -y && sudo apt-get install -y libsqlite3-dev
|
|
82
|
+
- run:
|
|
83
|
+
name: Which bundler?
|
|
84
|
+
command: bundle -v
|
|
85
|
+
- run:
|
|
86
|
+
name: Bundle install
|
|
87
|
+
command: cd example/rails-demo && bundle install --path vendor/bundle
|
|
88
|
+
- run:
|
|
89
|
+
name: Setup db
|
|
90
|
+
command: cd example/rails-demo && bundle exec rails db:migrate
|
|
91
|
+
- run:
|
|
92
|
+
name: Run test
|
|
93
|
+
command: cd example/rails-demo && bundle exec rake test
|
|
94
|
+
|
|
73
95
|
# Invoke jobs via workflows
|
|
74
96
|
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
|
|
75
97
|
workflows:
|
|
@@ -83,3 +105,6 @@ workflows:
|
|
|
83
105
|
- test_rails6_0_0:
|
|
84
106
|
requires:
|
|
85
107
|
- build
|
|
108
|
+
- test_rails_demo:
|
|
109
|
+
requires:
|
|
110
|
+
- build
|
data/README.md
CHANGED
|
@@ -105,6 +105,27 @@ book:
|
|
|
105
105
|
# set columns
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
+
Define method:
|
|
109
|
+
|
|
110
|
+
```ruby
|
|
111
|
+
class BooksController < ApplicationController
|
|
112
|
+
include Yamls::Support::Parameters
|
|
113
|
+
|
|
114
|
+
def action_name_1
|
|
115
|
+
params = book_action_name_1_params # {controller_name.singularize}_{action_name}_params
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def action_name_2
|
|
119
|
+
params = book_action_name_2_params
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def action_name_3
|
|
123
|
+
params = book_action_name_3_params
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
|
|
108
129
|
### Initialize configuration
|
|
109
130
|
|
|
110
131
|
1) If you want to specify a file:
|
|
@@ -158,7 +179,7 @@ In controller:
|
|
|
158
179
|
Yamls::Parameters.new(
|
|
159
180
|
params,
|
|
160
181
|
required: :book,
|
|
161
|
-
nested: %i[main nested1
|
|
182
|
+
nested: %i[main nested1 nested2 nested3]
|
|
162
183
|
)
|
|
163
184
|
|
|
164
185
|
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-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
|
+
/db/*.sqlite3-*
|
|
14
|
+
|
|
15
|
+
# Ignore all logfiles and tempfiles.
|
|
16
|
+
/log/*
|
|
17
|
+
/tmp/*
|
|
18
|
+
!/log/.keep
|
|
19
|
+
!/tmp/.keep
|
|
20
|
+
|
|
21
|
+
# Ignore pidfiles, but keep the directory.
|
|
22
|
+
/tmp/pids/*
|
|
23
|
+
!/tmp/pids/
|
|
24
|
+
!/tmp/pids/.keep
|
|
25
|
+
|
|
26
|
+
# Ignore uploaded files in development.
|
|
27
|
+
/storage/*
|
|
28
|
+
!/storage/.keep
|
|
29
|
+
.byebug_history
|
|
30
|
+
|
|
31
|
+
# Ignore master key for decrypting credentials and more.
|
|
32
|
+
/config/master.key
|
|
33
|
+
/vendor/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.0.2
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
3
|
+
|
|
4
|
+
ruby '3.0.2'
|
|
5
|
+
|
|
6
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
|
|
7
|
+
gem 'rails', '~> 6.0.4', '>= 6.0.4.1'
|
|
8
|
+
# Use sqlite3 as the database for Active Record
|
|
9
|
+
gem 'sqlite3', '~> 1.4'
|
|
10
|
+
# Use Puma as the app server
|
|
11
|
+
gem 'puma', '~> 4.1'
|
|
12
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
|
13
|
+
# gem 'jbuilder', '~> 2.7'
|
|
14
|
+
# Use Redis adapter to run Action Cable in production
|
|
15
|
+
# gem 'redis', '~> 4.0'
|
|
16
|
+
# Use Active Model has_secure_password
|
|
17
|
+
# gem 'bcrypt', '~> 3.1.7'
|
|
18
|
+
|
|
19
|
+
# Use Active Storage variant
|
|
20
|
+
# gem 'image_processing', '~> 1.2'
|
|
21
|
+
|
|
22
|
+
# Reduces boot times through caching; required in config/boot.rb
|
|
23
|
+
gem 'bootsnap', '>= 1.4.2', require: false
|
|
24
|
+
|
|
25
|
+
gem 'yamls', path: "../../"
|
|
26
|
+
|
|
27
|
+
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
|
|
28
|
+
# gem 'rack-cors'
|
|
29
|
+
|
|
30
|
+
group :development, :test do
|
|
31
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
|
32
|
+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
group :development do
|
|
36
|
+
gem 'listen', '~> 3.2'
|
|
37
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
|
38
|
+
gem 'spring'
|
|
39
|
+
gem 'spring-watcher-listen', '~> 2.0.0'
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
|
43
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
* ...
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
class BooksController < ApplicationController
|
|
2
|
+
before_action :set_book, only: [:show, :update, :destroy]
|
|
3
|
+
|
|
4
|
+
include Yamls::Support::Parameters
|
|
5
|
+
|
|
6
|
+
# GET /books
|
|
7
|
+
def index
|
|
8
|
+
@books = Book.all
|
|
9
|
+
|
|
10
|
+
render json: @books
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /books/1
|
|
14
|
+
def show
|
|
15
|
+
render json: @book
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# POST /books
|
|
19
|
+
def create
|
|
20
|
+
@book = Book.new(book_create_params)
|
|
21
|
+
|
|
22
|
+
if @book.save
|
|
23
|
+
render json: @book, status: :created, location: @book
|
|
24
|
+
else
|
|
25
|
+
render json: @book.errors, status: :unprocessable_entity
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# PATCH/PUT /books/1
|
|
30
|
+
def update
|
|
31
|
+
if @book.update(book_update_params)
|
|
32
|
+
render json: @book
|
|
33
|
+
else
|
|
34
|
+
render json: @book.errors, status: :unprocessable_entity
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# DELETE /books/1
|
|
39
|
+
def destroy
|
|
40
|
+
@book.destroy
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
45
|
+
def set_book
|
|
46
|
+
@book = Book.find(params[:id])
|
|
47
|
+
end
|
|
48
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
|
4
|
+
|
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
|
7
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= yield %>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "rubygems"
|
|
12
|
+
|
|
13
|
+
m = Module.new do
|
|
14
|
+
module_function
|
|
15
|
+
|
|
16
|
+
def invoked_as_script?
|
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def env_var_version
|
|
21
|
+
ENV["BUNDLER_VERSION"]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def cli_arg_version
|
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
|
27
|
+
bundler_version = nil
|
|
28
|
+
update_index = nil
|
|
29
|
+
ARGV.each_with_index do |a, i|
|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
|
31
|
+
bundler_version = a
|
|
32
|
+
end
|
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
|
34
|
+
bundler_version = $1
|
|
35
|
+
update_index = i
|
|
36
|
+
end
|
|
37
|
+
bundler_version
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def gemfile
|
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
|
43
|
+
|
|
44
|
+
File.expand_path("../../Gemfile", __FILE__)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def lockfile
|
|
48
|
+
lockfile =
|
|
49
|
+
case File.basename(gemfile)
|
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
|
51
|
+
else "#{gemfile}.lock"
|
|
52
|
+
end
|
|
53
|
+
File.expand_path(lockfile)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def lockfile_version
|
|
57
|
+
return unless File.file?(lockfile)
|
|
58
|
+
lockfile_contents = File.read(lockfile)
|
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
|
60
|
+
Regexp.last_match(1)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def bundler_version
|
|
64
|
+
@bundler_version ||=
|
|
65
|
+
env_var_version || cli_arg_version ||
|
|
66
|
+
lockfile_version
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def bundler_requirement
|
|
70
|
+
return "#{Gem::Requirement.default}.a" unless bundler_version
|
|
71
|
+
|
|
72
|
+
bundler_gem_version = Gem::Version.new(bundler_version)
|
|
73
|
+
|
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
|
75
|
+
|
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
|
77
|
+
|
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
|
79
|
+
|
|
80
|
+
requirement
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def load_bundler!
|
|
84
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
|
85
|
+
|
|
86
|
+
activate_bundler
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def activate_bundler
|
|
90
|
+
gem_error = activation_error_handling do
|
|
91
|
+
gem "bundler", bundler_requirement
|
|
92
|
+
end
|
|
93
|
+
return if gem_error.nil?
|
|
94
|
+
require_error = activation_error_handling do
|
|
95
|
+
require "bundler/version"
|
|
96
|
+
end
|
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
|
99
|
+
exit 42
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def activation_error_handling
|
|
103
|
+
yield
|
|
104
|
+
nil
|
|
105
|
+
rescue StandardError, LoadError => e
|
|
106
|
+
e
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
m.load_bundler!
|
|
111
|
+
|
|
112
|
+
if m.invoked_as_script?
|
|
113
|
+
load Gem.bin_path("bundler", "bundle")
|
|
114
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
begin
|
|
3
|
+
load File.expand_path('../spring', __FILE__)
|
|
4
|
+
rescue LoadError => e
|
|
5
|
+
raise unless e.message.include?('spring')
|
|
6
|
+
end
|
|
7
|
+
APP_PATH = File.expand_path('../config/application', __dir__)
|
|
8
|
+
require_relative '../config/boot'
|
|
9
|
+
require 'rails/commands'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
|
|
4
|
+
# path to your application root.
|
|
5
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
|
6
|
+
|
|
7
|
+
def system!(*args)
|
|
8
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
FileUtils.chdir APP_ROOT do
|
|
12
|
+
# This script is a way to setup or update your development environment automatically.
|
|
13
|
+
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
|
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
|
+
# puts "\n== Copying sample files =="
|
|
21
|
+
# unless File.exist?('config/database.yml')
|
|
22
|
+
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
|
23
|
+
# end
|
|
24
|
+
|
|
25
|
+
puts "\n== Preparing database =="
|
|
26
|
+
system! 'bin/rails db:prepare'
|
|
27
|
+
|
|
28
|
+
puts "\n== Removing old logs and tempfiles =="
|
|
29
|
+
system! 'bin/rails log:clear tmp:clear'
|
|
30
|
+
|
|
31
|
+
puts "\n== Restarting application server =="
|
|
32
|
+
system! 'bin/rails restart'
|
|
33
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# This file loads Spring without using Bundler, in order to be fast.
|
|
4
|
+
# It gets overwritten when you run the `spring binstub` command.
|
|
5
|
+
|
|
6
|
+
unless defined?(Spring)
|
|
7
|
+
require 'rubygems'
|
|
8
|
+
require 'bundler'
|
|
9
|
+
|
|
10
|
+
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
|
|
11
|
+
spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
|
|
12
|
+
if spring
|
|
13
|
+
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
|
|
14
|
+
gem 'spring', spring.version
|
|
15
|
+
require 'spring/binstub'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require_relative 'boot'
|
|
2
|
+
|
|
3
|
+
require "rails"
|
|
4
|
+
# Pick the frameworks you want:
|
|
5
|
+
require "active_model/railtie"
|
|
6
|
+
require "active_job/railtie"
|
|
7
|
+
require "active_record/railtie"
|
|
8
|
+
require "active_storage/engine"
|
|
9
|
+
require "action_controller/railtie"
|
|
10
|
+
require "action_mailer/railtie"
|
|
11
|
+
require "action_mailbox/engine"
|
|
12
|
+
require "action_text/engine"
|
|
13
|
+
require "action_view/railtie"
|
|
14
|
+
require "action_cable/engine"
|
|
15
|
+
# require "sprockets/railtie"
|
|
16
|
+
require "rails/test_unit/railtie"
|
|
17
|
+
|
|
18
|
+
# Require the gems listed in Gemfile, including any gems
|
|
19
|
+
# you've limited to :test, :development, or :production.
|
|
20
|
+
Bundler.require(*Rails.groups)
|
|
21
|
+
|
|
22
|
+
module RailsSupportDemo
|
|
23
|
+
class Application < Rails::Application
|
|
24
|
+
# Initialize configuration defaults for originally generated Rails version.
|
|
25
|
+
config.load_defaults 6.0
|
|
26
|
+
|
|
27
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
28
|
+
# Application configuration can go into files in config/initializers
|
|
29
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
|
30
|
+
# the framework and any gems in your application.
|
|
31
|
+
|
|
32
|
+
# Only loads a smaller set of middleware suitable for API only apps.
|
|
33
|
+
# Middleware like session, flash, cookies can be added back manually.
|
|
34
|
+
# Skip views, helpers and assets when generating a new resource.
|
|
35
|
+
config.api_only = true
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
iH8496fvDOgSwax7Z15ibgxaa/zc8/FGgWhFkeUumoiO3M/3rabdJ5qOhdRllRssV1MLRu2oZZBpq8htElZVgI3HMQPep85rxh3x5sM8WOP22n4hNcQYsKnJpzsnM9WHIGim+nRctBlCSXgyi5duV/tClwTWQhfL5rRdlzODJrvLZioaeC6UPPQqnbUq3D3hNO/Q01cBW0JL7HLo2aD56WZ7LuturxLHfXrXcHmbgY371CPehtrMYjOP3WCL6YuFvlw5/YSDYi/dWywgEdlVr/kzYoe0NI/J+vV1mkYQJ0iBS/o31Vkrqy0aJPzwQWceCYJcLEZSAck4UE8l8yG6hOOkjNTqESVxdVSbP33gLO3QEYjNMGlpO9h6pXTjAbq0vsT3SQaukG0od5z1cL7e0lwdlXbKuieVhX/w--Iz56Qk4Axt1aBrGh--C2BeSCS5wWeIhJ5k64OWag==
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# SQLite. Versions 3.8.0 and up are supported.
|
|
2
|
+
# gem install sqlite3
|
|
3
|
+
#
|
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
|
5
|
+
# gem 'sqlite3'
|
|
6
|
+
#
|
|
7
|
+
default: &default
|
|
8
|
+
adapter: sqlite3
|
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
|
10
|
+
timeout: 5000
|
|
11
|
+
|
|
12
|
+
development:
|
|
13
|
+
<<: *default
|
|
14
|
+
database: db/development.sqlite3
|
|
15
|
+
|
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
|
17
|
+
# re-generated from your development database when you run "rake".
|
|
18
|
+
# Do not set this db to the same as development or production.
|
|
19
|
+
test:
|
|
20
|
+
<<: *default
|
|
21
|
+
database: db/test.sqlite3
|
|
22
|
+
|
|
23
|
+
production:
|
|
24
|
+
<<: *default
|
|
25
|
+
database: db/production.sqlite3
|
|
@@ -0,0 +1,52 @@
|
|
|
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.cache_store = :memory_store
|
|
19
|
+
config.public_file_server.headers = {
|
|
20
|
+
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
|
21
|
+
}
|
|
22
|
+
else
|
|
23
|
+
config.action_controller.perform_caching = false
|
|
24
|
+
|
|
25
|
+
config.cache_store = :null_store
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
|
29
|
+
config.active_storage.service = :local
|
|
30
|
+
|
|
31
|
+
# Don't care if the mailer can't send.
|
|
32
|
+
config.action_mailer.raise_delivery_errors = false
|
|
33
|
+
|
|
34
|
+
config.action_mailer.perform_caching = false
|
|
35
|
+
|
|
36
|
+
# Print deprecation notices to the Rails logger.
|
|
37
|
+
config.active_support.deprecation = :log
|
|
38
|
+
|
|
39
|
+
# Raise an error on page load if there are pending migrations.
|
|
40
|
+
config.active_record.migration_error = :page_load
|
|
41
|
+
|
|
42
|
+
# Highlight code that triggered database queries in logs.
|
|
43
|
+
config.active_record.verbose_query_logs = true
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Raises error for missing translations.
|
|
47
|
+
# config.action_view.raise_on_missing_translations = true
|
|
48
|
+
|
|
49
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
|
50
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
|
51
|
+
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
|
52
|
+
end
|