ruby-clock 1.0.0 → 2.0.0.beta1
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/CHANGELOG.md +14 -0
- data/README.md +12 -11
- data/example-rails-app/.gitattributes +9 -0
- data/example-rails-app/.gitignore +35 -0
- data/example-rails-app/.ruby-version +1 -0
- data/example-rails-app/Clockfile +19 -0
- data/example-rails-app/Gemfile +74 -0
- data/example-rails-app/README.md +12 -0
- data/example-rails-app/Rakefile +6 -0
- data/example-rails-app/app/assets/config/manifest.js +4 -0
- data/example-rails-app/app/assets/images/.keep +0 -0
- data/example-rails-app/app/assets/stylesheets/application.css +15 -0
- data/example-rails-app/app/channels/application_cable/channel.rb +4 -0
- data/example-rails-app/app/channels/application_cable/connection.rb +4 -0
- data/example-rails-app/app/controllers/application_controller.rb +2 -0
- data/example-rails-app/app/controllers/concerns/.keep +0 -0
- data/example-rails-app/app/helpers/application_helper.rb +2 -0
- data/example-rails-app/app/javascript/application.js +3 -0
- data/example-rails-app/app/javascript/controllers/application.js +9 -0
- data/example-rails-app/app/javascript/controllers/hello_controller.js +7 -0
- data/example-rails-app/app/javascript/controllers/index.js +11 -0
- data/example-rails-app/app/jobs/application_job.rb +7 -0
- data/example-rails-app/app/mailers/application_mailer.rb +4 -0
- data/example-rails-app/app/models/application_record.rb +3 -0
- data/example-rails-app/app/models/concerns/.keep +0 -0
- data/example-rails-app/app/models/example.rb +2 -0
- data/example-rails-app/app/views/layouts/application.html.erb +16 -0
- data/example-rails-app/app/views/layouts/mailer.html.erb +13 -0
- data/example-rails-app/app/views/layouts/mailer.text.erb +1 -0
- data/example-rails-app/bin/bundle +114 -0
- data/example-rails-app/bin/importmap +4 -0
- data/example-rails-app/bin/rails +4 -0
- data/example-rails-app/bin/rake +4 -0
- data/example-rails-app/bin/setup +33 -0
- data/example-rails-app/config/application.rb +22 -0
- data/example-rails-app/config/boot.rb +4 -0
- data/example-rails-app/config/cable.yml +11 -0
- data/example-rails-app/config/credentials.yml.enc +1 -0
- data/example-rails-app/config/database.yml +25 -0
- data/example-rails-app/config/environment.rb +5 -0
- data/example-rails-app/config/environments/development.rb +70 -0
- data/example-rails-app/config/environments/production.rb +93 -0
- data/example-rails-app/config/environments/test.rb +60 -0
- data/example-rails-app/config/importmap.rb +7 -0
- data/example-rails-app/config/initializers/assets.rb +12 -0
- data/example-rails-app/config/initializers/content_security_policy.rb +25 -0
- data/example-rails-app/config/initializers/filter_parameter_logging.rb +8 -0
- data/example-rails-app/config/initializers/inflections.rb +16 -0
- data/example-rails-app/config/initializers/permissions_policy.rb +11 -0
- data/example-rails-app/config/locales/en.yml +33 -0
- data/example-rails-app/config/puma.rb +43 -0
- data/example-rails-app/config/routes.rb +6 -0
- data/example-rails-app/config/storage.yml +34 -0
- data/example-rails-app/config.ru +6 -0
- data/example-rails-app/db/migrate/20221001175928_create_examples.rb +8 -0
- data/example-rails-app/db/schema.rb +19 -0
- data/example-rails-app/db/seeds.rb +7 -0
- data/example-rails-app/lib/assets/.keep +0 -0
- data/example-rails-app/lib/tasks/.keep +0 -0
- data/example-rails-app/log/.keep +0 -0
- data/example-rails-app/public/404.html +67 -0
- data/example-rails-app/public/422.html +67 -0
- data/example-rails-app/public/500.html +66 -0
- data/example-rails-app/public/apple-touch-icon-precomposed.png +0 -0
- data/example-rails-app/public/apple-touch-icon.png +0 -0
- data/example-rails-app/public/favicon.ico +0 -0
- data/example-rails-app/public/robots.txt +1 -0
- data/example-rails-app/storage/.keep +0 -0
- data/example-rails-app/test/application_system_test_case.rb +5 -0
- data/example-rails-app/test/channels/application_cable/connection_test.rb +11 -0
- data/example-rails-app/test/controllers/.keep +0 -0
- data/example-rails-app/test/fixtures/files/.keep +0 -0
- data/example-rails-app/test/helpers/.keep +0 -0
- data/example-rails-app/test/integration/.keep +0 -0
- data/example-rails-app/test/mailers/.keep +0 -0
- data/example-rails-app/test/models/.keep +0 -0
- data/example-rails-app/test/system/.keep +0 -0
- data/example-rails-app/test/test_helper.rb +13 -0
- data/example-rails-app/tmp/.keep +0 -0
- data/example-rails-app/tmp/pids/.keep +0 -0
- data/example-rails-app/tmp/storage/.keep +0 -0
- data/example-rails-app/vendor/.keep +0 -0
- data/example-rails-app/vendor/javascript/.keep +0 -0
- data/exe/clock +6 -0
- data/lib/ruby-clock/version.rb +1 -1
- metadata +86 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 567b66555b094f4c722a3340b9cc5ca99abab18918033ed972dc8c65ce242b18
|
4
|
+
data.tar.gz: 2c9a42194dcd969623b04b1bfc21eb327cdd225322703a488f87fa1819a9302c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cdd8a85ec8f8de256486f027639c9d4c341131eb7dc88d519baf249733c7c655f72af923b8c8914b51d405f09a24cd9aa17efc4fc96cf807dcacdd74b024878
|
7
|
+
data.tar.gz: e655dce4688f88154bac50957fb321f11e07dc7d40ee5fc679a25d0e0a8feff097016ac7df128e77f4eaccae5e3fa817caa76d5a300bee364e48999bd4c0ea50
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## 2.0.0.beta1
|
2
|
+
|
3
|
+
* The way the [rails app reloader](https://guides.rubyonrails.org/threading_and_code_execution.html)
|
4
|
+
is implemented is now compatible with both rails 6 and 7
|
5
|
+
* The setup for rails is now less complicated
|
6
|
+
|
7
|
+
### Migrating from ruby-clock version 1 to version 2
|
8
|
+
|
9
|
+
* There is no longer a need to have a binstub in rails. You can delete bin/clock from your app.
|
10
|
+
* The invocations (in Procfile, or wherever else you start ruby-clock) should change from
|
11
|
+
bundle exec rails runner bin/clock
|
12
|
+
to
|
13
|
+
bundle exec clock
|
14
|
+
|
1
15
|
## 1.0.0
|
2
16
|
|
3
17
|
* make terrapin and posix-spawn gems optional
|
data/README.md
CHANGED
@@ -4,6 +4,10 @@ ruby-clock is a [job scheduler](https://en.wikipedia.org/wiki/Job_scheduler),
|
|
4
4
|
known by heroku as a [clock process](https://devcenter.heroku.com/articles/scheduled-jobs-custom-clock-processes).
|
5
5
|
In many cases it can replace the use of cron.
|
6
6
|
|
7
|
+
Why another ruby scheduler project? See
|
8
|
+
[this feature matrix of the space](https://docs.google.com/spreadsheets/d/148VMKY9iyOyUASYytSGiUJKvH0-O5Ri-3Cwr3S6DRPU/edit?usp=sharing).
|
9
|
+
Feel free to leave a comment with suggestions for changes or additions.
|
10
|
+
|
7
11
|
This gem is very small with very few lines of code. For all its scheduling capabilities,
|
8
12
|
it relies on the venerable [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler/).
|
9
13
|
rufus-scheduler
|
@@ -63,13 +67,9 @@ This will ignore Clockfile and only read jobs from clocks/MyClockfile:
|
|
63
67
|
|
64
68
|
### Rails
|
65
69
|
|
66
|
-
Install the `clock` binstub and commit to your repo.
|
67
|
-
|
68
|
-
bundle binstubs ruby-clock
|
69
|
-
|
70
70
|
To run your clock process in your app's environment:
|
71
71
|
|
72
|
-
bundle exec
|
72
|
+
bundle exec clock
|
73
73
|
|
74
74
|
To get smarter database connection management (such as in the case of a database restart or upgrade,
|
75
75
|
and maybe other benefits) and code reloading in dev (app code, not the code in Clockfile itself),
|
@@ -78,6 +78,7 @@ jobs are automatically wrapped in the
|
|
78
78
|
This [may incur a performance impact for certain jobs](https://github.com/rails/rails/issues/43504),
|
79
79
|
I'm still exploring this.
|
80
80
|
|
81
|
+
|
81
82
|
#### ActiveRecord Query Cache
|
82
83
|
|
83
84
|
You may wish to
|
@@ -107,7 +108,7 @@ schedule.every('5 minutes') do
|
|
107
108
|
Add this line to your Procfile
|
108
109
|
|
109
110
|
```
|
110
|
-
clock: bundle exec
|
111
|
+
clock: bundle exec clock
|
111
112
|
```
|
112
113
|
|
113
114
|
You might have a main clock for general scheduled jobs, and then standalone ones
|
@@ -116,9 +117,9 @@ for that work more precisely. Here, maybe the main clock needs a 2GB instance,
|
|
116
117
|
and the others each need 1GB all to themselves:
|
117
118
|
|
118
119
|
```
|
119
|
-
clock: bundle exec
|
120
|
-
thing_checker: bundle exec
|
121
|
-
thing_reporter: bundle exec
|
120
|
+
clock: bundle exec clock
|
121
|
+
thing_checker: bundle exec clock clocks/thing_checker.rb
|
122
|
+
thing_reporter: bundle exec clock clocks/thing_reporter.rb
|
122
123
|
```
|
123
124
|
|
124
125
|
Because of this feature, do I regret using "Clockfile" instead of, say, "clock.rb"? Maybe.
|
@@ -191,8 +192,8 @@ Until this is figured out, if you are concerned about jobs exiting inelegantly,
|
|
191
192
|
you may want to run your shell jobs in their own separate clock process.
|
192
193
|
|
193
194
|
```
|
194
|
-
bundle exec
|
195
|
-
bundle exec
|
195
|
+
bundle exec clock clocks/main_jobs.rb
|
196
|
+
bundle exec clock clocks/shell_jobs.rb
|
196
197
|
```
|
197
198
|
|
198
199
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
|
2
|
+
|
3
|
+
# Mark the database schema as having been generated.
|
4
|
+
db/schema.rb linguist-generated
|
5
|
+
|
6
|
+
# Mark any vendored files as having been vendored.
|
7
|
+
vendor/* linguist-vendored
|
8
|
+
|
9
|
+
Clockfile linguist-language=Ruby
|
@@ -0,0 +1,35 @@
|
|
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-*
|
13
|
+
|
14
|
+
# Ignore all logfiles and tempfiles.
|
15
|
+
/log/*
|
16
|
+
/tmp/*
|
17
|
+
!/log/.keep
|
18
|
+
!/tmp/.keep
|
19
|
+
|
20
|
+
# Ignore pidfiles, but keep the directory.
|
21
|
+
/tmp/pids/*
|
22
|
+
!/tmp/pids/
|
23
|
+
!/tmp/pids/.keep
|
24
|
+
|
25
|
+
# Ignore uploaded files in development.
|
26
|
+
/storage/*
|
27
|
+
!/storage/.keep
|
28
|
+
/tmp/storage/*
|
29
|
+
!/tmp/storage/
|
30
|
+
!/tmp/storage/.keep
|
31
|
+
|
32
|
+
/public/assets
|
33
|
+
|
34
|
+
# Ignore master key for decrypting credentials and more.
|
35
|
+
/config/master.key
|
@@ -0,0 +1 @@
|
|
1
|
+
2.7.5
|
@@ -0,0 +1,19 @@
|
|
1
|
+
def schedule.on_error(job, error)
|
2
|
+
puts "An error has occurred: #{error.class}: #{error.message}"
|
3
|
+
end
|
4
|
+
|
5
|
+
schedule.every('2 seconds') do
|
6
|
+
puts "hello from a ruby-clock job"
|
7
|
+
end
|
8
|
+
|
9
|
+
schedule.every('2 seconds') do
|
10
|
+
shell 'say hello'
|
11
|
+
end
|
12
|
+
|
13
|
+
schedule.every('2 seconds') do
|
14
|
+
puts Example.count
|
15
|
+
end
|
16
|
+
|
17
|
+
schedule.every('2 seconds') do
|
18
|
+
raise "An error."
|
19
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
+
|
4
|
+
ruby "2.7.5"
|
5
|
+
|
6
|
+
gem 'ruby-clock', path: '../'
|
7
|
+
|
8
|
+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
9
|
+
gem "rails", "~> 7.0.4"
|
10
|
+
|
11
|
+
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
|
12
|
+
gem "sprockets-rails"
|
13
|
+
|
14
|
+
# Use sqlite3 as the database for Active Record
|
15
|
+
gem "sqlite3", "~> 1.4"
|
16
|
+
|
17
|
+
# Use the Puma web server [https://github.com/puma/puma]
|
18
|
+
gem "puma", "~> 5.0"
|
19
|
+
|
20
|
+
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
|
21
|
+
gem "importmap-rails"
|
22
|
+
|
23
|
+
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
24
|
+
gem "turbo-rails"
|
25
|
+
|
26
|
+
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
27
|
+
gem "stimulus-rails"
|
28
|
+
|
29
|
+
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
30
|
+
gem "jbuilder"
|
31
|
+
|
32
|
+
# Use Redis adapter to run Action Cable in production
|
33
|
+
gem "redis", "~> 4.0"
|
34
|
+
|
35
|
+
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
|
36
|
+
# gem "kredis"
|
37
|
+
|
38
|
+
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
39
|
+
# gem "bcrypt", "~> 3.1.7"
|
40
|
+
|
41
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
42
|
+
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
|
43
|
+
|
44
|
+
# Reduces boot times through caching; required in config/boot.rb
|
45
|
+
gem "bootsnap", require: false
|
46
|
+
|
47
|
+
# Use Sass to process CSS
|
48
|
+
# gem "sassc-rails"
|
49
|
+
|
50
|
+
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
51
|
+
# gem "image_processing", "~> 1.2"
|
52
|
+
|
53
|
+
group :development, :test do
|
54
|
+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
55
|
+
gem "debug", platforms: %i[ mri mingw x64_mingw ]
|
56
|
+
end
|
57
|
+
|
58
|
+
group :development do
|
59
|
+
# Use console on exceptions pages [https://github.com/rails/web-console]
|
60
|
+
gem "web-console"
|
61
|
+
|
62
|
+
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
|
63
|
+
# gem "rack-mini-profiler"
|
64
|
+
|
65
|
+
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
|
66
|
+
# gem "spring"
|
67
|
+
end
|
68
|
+
|
69
|
+
group :test do
|
70
|
+
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
71
|
+
gem "capybara"
|
72
|
+
gem "selenium-webdriver"
|
73
|
+
gem "webdrivers"
|
74
|
+
end
|
File without changes
|
@@ -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, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
|
6
|
+
* 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
|
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
|
+
*/
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// Import and register all your controllers from the importmap under controllers/*
|
2
|
+
|
3
|
+
import { application } from "controllers/application"
|
4
|
+
|
5
|
+
// Eager load all controllers defined in the import map under controllers/**/*_controller
|
6
|
+
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
|
7
|
+
eagerLoadControllersFrom("controllers", application)
|
8
|
+
|
9
|
+
// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
|
10
|
+
// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
|
11
|
+
// lazyLoadControllersFrom("controllers", application)
|
@@ -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,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>ExampleRailsApp</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
<%= csp_meta_tag %>
|
8
|
+
|
9
|
+
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
10
|
+
<%= javascript_importmap_tags %>
|
11
|
+
</head>
|
12
|
+
|
13
|
+
<body>
|
14
|
+
<%= yield %>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -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_requirement
|
64
|
+
@bundler_requirement ||=
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
bundler_requirement_for(lockfile_version)
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement_for(version)
|
70
|
+
return "#{Gem::Requirement.default}.a" unless version
|
71
|
+
|
72
|
+
bundler_gem_version = Gem::Version.new(version)
|
73
|
+
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
75
|
+
|
76
|
+
return requirement unless Gem.rubygems_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,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 set up or update your development environment automatically.
|
13
|
+
# This script is idempotent, so that you can run it at any time 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,22 @@
|
|
1
|
+
require_relative "boot"
|
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(*Rails.groups)
|
8
|
+
|
9
|
+
module ExampleRailsApp
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Initialize configuration defaults for originally generated Rails version.
|
12
|
+
config.load_defaults 7.0
|
13
|
+
|
14
|
+
# Configuration for the application, engines, and railties goes here.
|
15
|
+
#
|
16
|
+
# These settings can be overridden in specific environments using the files
|
17
|
+
# in config/environments, which are processed later.
|
18
|
+
#
|
19
|
+
# config.time_zone = "Central Time (US & Canada)"
|
20
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
SUeItw76O+krjjUEzhI/V0tSeoE8BSzYxQMsAvDgUVJ9Ofv/rwaQfjbkeLjLDm15q60803jwv2eU+UoEMJ01BmZhoeG8SB0NMucI6QQ7oRjRRpSZlNFMtyqPO1+VmT9YQVJOYikd6mqA2OxsUxg1UwtLCwRih3B1Jzc6IHrAlSMOf4PkkVkysNIAdLdPklk0fRnZb7Pymw9ZtCfIJpl5X7N9i55SmiRXFyFsBqQjiqi95lo5TT9T+Creao7AEJdG+AidvH7uKaXrnYAm6YMOKENt83Ftq4EAgcjAv/0KToShBnHT9NOYvGUzWcjRSwi+o+85fe16Zg+6m/nUMb+YJDrtmRDObpun/zULdBRlNoNwe3w77Ld4g8xNrKwVdLaCeC49JcbJuAgqX/O3I0RyttM547uXN3z5b2og--kgDFGgjnLuMH/lju--8TR64Qsjme3WmkaMriCwHA==
|
@@ -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
|