stepper_motor 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/install_generator.rb +6 -0
- data/lib/stepper_motor/railtie.rb +3 -33
- data/lib/stepper_motor/version.rb +1 -1
- data/lib/stepper_motor.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 375de8ed8ab1ea1229ad1a8a99a2b0aeb3a0a0fd9b4397abcc2ba9c73968dac5
|
4
|
+
data.tar.gz: acae28d6c2f058991f0a1a50b5b22a73fb54954309a74d8f8de73a6ce6da9597
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecb52e4b5b8160aefa6764a7b1f7275410f5337a4d09672c9a1ea9b729a2b0f2fc1f667c3a253187e8ac96b535a00cf3d9b7e83f7fbc4b6220e9ddfee7dbdb1a
|
7
|
+
data.tar.gz: c6a28cdcd8935c4369c79ca34b0cdcf0b59066a818bd8da7c08e5f5b0435cfd462fb0de27030963abd484db8ef3897bd3cdf078058f6559f24151cba1c04fb99
|
@@ -1,22 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module StepperMotor
|
4
|
-
|
5
|
-
ActiveRecord::NoDatabaseError,
|
6
|
-
ActiveRecord::StatementInvalid,
|
7
|
-
ActiveRecord::ConnectionNotEstablished
|
8
|
-
]
|
9
|
-
|
10
|
-
class Railtie < Rails::Railtie
|
4
|
+
class Railtie < ::Rails::Railtie
|
11
5
|
rake_tasks do
|
12
|
-
|
13
|
-
if defined?(Rails) && Rails.respond_to?(:application)
|
14
|
-
if Rails.application.config.eager_load
|
15
|
-
ActiveSupport.run_load_hooks(:before_eager_load, Rails.application)
|
16
|
-
Rails.application.config.eager_load_namespaces.each(&:eager_load!)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
6
|
+
# none for now
|
20
7
|
end
|
21
8
|
|
22
9
|
generators do
|
@@ -26,24 +13,7 @@ module StepperMotor
|
|
26
13
|
# The `to_prepare` block which is executed once in production
|
27
14
|
# and before each request in development.
|
28
15
|
config.to_prepare do
|
29
|
-
|
30
|
-
_config_from_rails = Rails.application.config.try(:gouda)
|
31
|
-
# if config_from_rails
|
32
|
-
# StepperMotor.config.scheduling_mode = config_from_rails[:scheduling_mode]
|
33
|
-
# end
|
34
|
-
else
|
35
|
-
# Set default configuration
|
36
|
-
end
|
37
|
-
|
38
|
-
begin
|
39
|
-
# Perform any tasks which touch the database here
|
40
|
-
rescue *StepperMotor::UNINITIALISED_DATABASE_EXCEPTIONS
|
41
|
-
# Do nothing. On a freshly checked-out Rails app, running even unrelated Rails tasks
|
42
|
-
# (such as asset compilation) - or, more importantly, initial db:create -
|
43
|
-
# will cause a NoDatabaseError, as this is a chicken-and-egg problem. That error
|
44
|
-
# is safe to ignore in this instance - we should let the outer task proceed,
|
45
|
-
# because if there is no database we should allow it to get created.
|
46
|
-
end
|
16
|
+
# none for now
|
47
17
|
end
|
48
18
|
end
|
49
19
|
end
|
data/lib/stepper_motor.rb
CHANGED
@@ -18,5 +18,7 @@ module StepperMotor
|
|
18
18
|
autoload :CyclicScheduler, File.dirname(__FILE__) + "/stepper_motor/cyclic_scheduler.rb"
|
19
19
|
autoload :TestHelper, File.dirname(__FILE__) + "/stepper_motor/test_helper.rb"
|
20
20
|
|
21
|
+
require_relative "stepper_motor/railtie" if defined?(Rails::Railtie)
|
22
|
+
|
21
23
|
mattr_accessor :scheduler, default: ForwardScheduler.new
|
22
24
|
end
|