easy_orderable 0.1.0
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +87 -0
- data/Rakefile +25 -0
- data/lib/easy_orderable/assorter.rb +28 -0
- data/lib/easy_orderable/base.rb +17 -0
- data/lib/easy_orderable/engine.rb +17 -0
- data/lib/easy_orderable/joiner.rb +34 -0
- data/lib/easy_orderable/order_arguments_transformer.rb +22 -0
- data/lib/easy_orderable/parser.rb +23 -0
- data/lib/easy_orderable/version.rb +3 -0
- data/lib/easy_orderable.rb +5 -0
- data/lib/tasks/orderable_tasks.rake +4 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/booking.rb +3 -0
- data/spec/dummy/app/models/request.rb +3 -0
- data/spec/dummy/app/models/user.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +36 -0
- data/spec/dummy/bin/update +31 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config/application.rb +30 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +61 -0
- data/spec/dummy/config/environments/production.rb +94 -0
- data/spec/dummy/config/environments/test.rb +46 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +34 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20181213104420_create_users.rb +9 -0
- data/spec/dummy/db/migrate/20181213104543_create_bookings.rb +10 -0
- data/spec/dummy/db/migrate/20181213104620_create_requests.rb +10 -0
- data/spec/dummy/db/schema.rb +37 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +2106 -0
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/easy_orderable/base_spec.rb +84 -0
- data/spec/factories/booking.rb +3 -0
- data/spec/factories/request.rb +3 -0
- data/spec/factories/user.rb +3 -0
- data/spec/rails_helper.rb +7 -0
- data/spec/spec_helper.rb +8 -0
- metadata +249 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b8a4f7e80bf010be7f63cb3abe11932fb6ed8089
|
4
|
+
data.tar.gz: 15635b6bcece75b05c0107c2a8004787cab26eed
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c4e477d87c2761a4563d957ac2ac9c5cd66747b20b9e4b8ccc4da84727e90f290745452aaa8f3361503f33cc8d3c6847946dce3f2d573a7c7ac3a434d53a3bed
|
7
|
+
data.tar.gz: 451218c1355be0b9682331f5ae9b641fb53f081918bca309c9357e46da3bc5dfc2d297a026f15b033cf26d388f145ac076ac4fc0f83819eded25b8d90d6939dc
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2018 Filip Pavic
|
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,87 @@
|
|
1
|
+
# EasyOrderable
|
2
|
+
Easy ordering of Active Record objects
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
```ruby
|
6
|
+
class User < ApplicationRecord
|
7
|
+
has_many :bookings
|
8
|
+
has_many :requests
|
9
|
+
end
|
10
|
+
|
11
|
+
class Booking < ApplicationRecord
|
12
|
+
belongs_to :user
|
13
|
+
end
|
14
|
+
|
15
|
+
class Request < ApplicationRecord
|
16
|
+
belongs_to :renter, class_name: 'User', foreign_key: :user_id
|
17
|
+
end
|
18
|
+
|
19
|
+
#<User id: 1, first_name: 'A'>
|
20
|
+
#<User id: 2, first_name: 'B'>
|
21
|
+
#<User id: 3, first_name: 'C'>
|
22
|
+
```
|
23
|
+
|
24
|
+
### Sort by column name asc
|
25
|
+
```ruby
|
26
|
+
>> User.assort('first_name')
|
27
|
+
=> [#<User first_name: 'A'>, #<User first_name: 'B'>, #<User first_name: 'B'>]
|
28
|
+
```
|
29
|
+
|
30
|
+
### Sort by column name desc
|
31
|
+
```ruby
|
32
|
+
>> User.assort('-first_name')
|
33
|
+
=> [#<User first_name: 'C'>, #<User first_name: 'B'>, #<User first_name: 'A'>]
|
34
|
+
```
|
35
|
+
|
36
|
+
### Sort by joined column name
|
37
|
+
```ruby
|
38
|
+
>> Booking.assort('-user.first_name')
|
39
|
+
```
|
40
|
+
|
41
|
+
### Sort by joined column name when associations name is custom
|
42
|
+
```ruby
|
43
|
+
>> Request.assort('-user.first_name', user: :renter)
|
44
|
+
```
|
45
|
+
|
46
|
+
### Sort by multiple params
|
47
|
+
```ruby
|
48
|
+
>> Booking.assort('-user.first_name,slot_places')
|
49
|
+
```
|
50
|
+
|
51
|
+
### You can use it from rails controller to handle json api compliant sort requests
|
52
|
+
```ruby
|
53
|
+
class UsersController < ApplicationController
|
54
|
+
def index
|
55
|
+
@users = User.assort(order_param)
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def order_param
|
61
|
+
params[:order]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
```
|
65
|
+
|
66
|
+
## Installation
|
67
|
+
Add this line to your application's Gemfile:
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
gem 'easy_orderable'
|
71
|
+
```
|
72
|
+
|
73
|
+
And then execute:
|
74
|
+
```bash
|
75
|
+
$ bundle
|
76
|
+
```
|
77
|
+
|
78
|
+
Or install it yourself as:
|
79
|
+
```bash
|
80
|
+
$ gem install easy_orderable
|
81
|
+
```
|
82
|
+
|
83
|
+
## Contributing
|
84
|
+
Contribution directions go here.
|
85
|
+
|
86
|
+
## License
|
87
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'EasyOrderable'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'bundler/gem_tasks'
|
18
|
+
|
19
|
+
require 'rspec/core'
|
20
|
+
require 'rspec/core/rake_task'
|
21
|
+
|
22
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
23
|
+
RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
|
24
|
+
|
25
|
+
task default: :spec
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module EasyOrderable
|
2
|
+
class Assorter
|
3
|
+
def initialize(relation, args, custom_association_names)
|
4
|
+
@relation = relation
|
5
|
+
@args = args
|
6
|
+
@custom_association_names = custom_association_names
|
7
|
+
end
|
8
|
+
|
9
|
+
def call
|
10
|
+
joined_relation.order(*order_args)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
attr_reader :relation, :args, :custom_association_names
|
16
|
+
|
17
|
+
def joined_relation
|
18
|
+
Joiner.new(relation, args, custom_association_names).call
|
19
|
+
end
|
20
|
+
|
21
|
+
def order_args
|
22
|
+
OrderArgumentsTransformer.new(args).call
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'easy_orderable/joiner'
|
28
|
+
require 'easy_orderable/order_arguments_transformer'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module EasyOrderable
|
2
|
+
module Base
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
class_methods do
|
6
|
+
def assort(arg, custom_association_names=nil)
|
7
|
+
return all unless arg
|
8
|
+
|
9
|
+
parsed_args = Parser.new(arg.delete(' ')).call
|
10
|
+
Assorter.new(self, parsed_args, custom_association_names).call
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'easy_orderable/assorter'
|
17
|
+
require 'easy_orderable/parser'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'easy_orderable/base'
|
2
|
+
module EasyOrderable
|
3
|
+
class Engine < ::Rails::Engine
|
4
|
+
config.generators do |g|
|
5
|
+
g.test_framework :rspec
|
6
|
+
g.factory_bot dir: 'spec/factories'
|
7
|
+
g.assets false
|
8
|
+
g.helper false
|
9
|
+
end
|
10
|
+
|
11
|
+
initializer 'easy_orderable.insert_assort_into_active_record' do |_app|
|
12
|
+
ActiveSupport.on_load :active_record do
|
13
|
+
include EasyOrderable::Base
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module EasyOrderable
|
2
|
+
class Joiner
|
3
|
+
def initialize(relation, args, custom_association_names)
|
4
|
+
@relation = relation
|
5
|
+
@args = args
|
6
|
+
@custom_association_names = custom_association_names
|
7
|
+
end
|
8
|
+
|
9
|
+
def call
|
10
|
+
association_names.present? ? relation.joins(*association_names) : relation
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
attr_reader :relation, :args, :custom_association_names
|
16
|
+
|
17
|
+
def association_names
|
18
|
+
table_names.map do |name|
|
19
|
+
if custom_association_names && custom_association_names.keys.include?(name.to_sym)
|
20
|
+
custom_association_names[name.to_sym].to_sym
|
21
|
+
else
|
22
|
+
name.to_sym
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def table_names
|
28
|
+
args
|
29
|
+
.keys
|
30
|
+
.select{ |e| e.include?('.') }
|
31
|
+
.map { |e| e.split('.').first }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module EasyOrderable
|
2
|
+
class OrderArgumentsTransformer
|
3
|
+
def initialize(args)
|
4
|
+
@args = args
|
5
|
+
end
|
6
|
+
|
7
|
+
def call
|
8
|
+
args.to_a.map do |e|
|
9
|
+
if e.first.include?('.')
|
10
|
+
table_name, column_name = e.first.split('.')
|
11
|
+
"#{table_name.pluralize}.#{column_name} #{e.second}"
|
12
|
+
else
|
13
|
+
"#{e.first} #{e.second}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
attr_reader :args
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module EasyOrderable
|
2
|
+
class Parser
|
3
|
+
def initialize(arg)
|
4
|
+
@arg = arg
|
5
|
+
end
|
6
|
+
|
7
|
+
def call
|
8
|
+
elems = arg.split(',')
|
9
|
+
|
10
|
+
elems.each_with_object({}) do |e, memo|
|
11
|
+
if e.start_with?('-')
|
12
|
+
memo[e[1..-1]] = :desc
|
13
|
+
else
|
14
|
+
memo[e] = :asc
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :arg
|
22
|
+
end
|
23
|
+
end
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
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. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require rails-ujs
|
14
|
+
//= require activestorage
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
+
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
3
|
+
//
|
4
|
+
//= require action_cable
|
5
|
+
//= require_self
|
6
|
+
//= require_tree ./channels
|
7
|
+
|
8
|
+
(function() {
|
9
|
+
this.App || (this.App = {});
|
10
|
+
|
11
|
+
App.cable = ActionCable.createConsumer();
|
12
|
+
|
13
|
+
}).call(this);
|
@@ -0,0 +1,15 @@
|
|
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 other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
9
|
+
<%= javascript_include_tag 'application' %>
|
10
|
+
</head>
|
11
|
+
|
12
|
+
<body>
|
13
|
+
<%= yield %>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
data/spec/dummy/bin/rake
ADDED
@@ -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
|
data/spec/dummy/bin/yarn
ADDED
@@ -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
|
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
|
@@ -0,0 +1,30 @@
|
|
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_view/railtie"
|
12
|
+
require "action_cable/engine"
|
13
|
+
require "sprockets/railtie"
|
14
|
+
# require "rails/test_unit/railtie"
|
15
|
+
|
16
|
+
Bundler.require(*Rails.groups)
|
17
|
+
require "easy_orderable"
|
18
|
+
|
19
|
+
module Dummy
|
20
|
+
class Application < Rails::Application
|
21
|
+
# Initialize configuration defaults for originally generated Rails version.
|
22
|
+
config.load_defaults 5.2
|
23
|
+
|
24
|
+
# Settings in config/environments/* take precedence over those specified here.
|
25
|
+
# Application configuration can go into files in config/initializers
|
26
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
27
|
+
# the framework and any gems in your application.
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -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
|
+
#
|
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
|