foobara-rails-command-connector 0.1.3 → 0.1.4
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 +4 -0
- data/lib/foobara/rails/routes.rb +7 -2
- 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: 9d6f556bf7ef7e787d345c3a35965a1663a679f06ee6fc685f038cf9202593b0
|
|
4
|
+
data.tar.gz: 63d2e03b42f8c1f221ad98e3d18a2601c7bd04f87238f128e9be0bfc07262ce0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ae9acfdf941631908e8124ff8e2782614cb1be36e44cc3a4a7c033bc80feffc758fa01a8ef4575b881a12c448b45b6863539a16b8851a1f20c30989eb2861e8
|
|
7
|
+
data.tar.gz: 6ba333b97fd1912e69f7db554aeb87ff5e3d5c4e9e38436cbe935a10f86aba16f19dbf0b8e431b58a8af10efd39b257319de60c1e08d1438725dd15f0d5a4e56
|
data/CHANGELOG.md
CHANGED
data/lib/foobara/rails/routes.rb
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
ActionDispatch::Routing::Mapper.class_eval do
|
|
2
2
|
define_method :command do |*args, **opts, &block|
|
|
3
|
-
|
|
3
|
+
rails_config = Rails.application.config
|
|
4
|
+
|
|
5
|
+
command_connector = if rails_config.respond_to?(:foobara_command_connector)
|
|
6
|
+
rails_config.foobara_command_connector
|
|
7
|
+
end
|
|
4
8
|
|
|
5
9
|
unless command_connector
|
|
6
10
|
require "foobara/rails_command_connector"
|
|
7
11
|
command_connector = Foobara::CommandConnectors::RailsCommandConnector.new
|
|
12
|
+
|
|
8
13
|
# Ensure the connector is attached to config even if install! was skipped
|
|
9
14
|
# (e.g., if installation was already done by a previous connector)
|
|
10
15
|
# We check again in case install! attached a different instance (shouldn't happen, but safe)
|
|
11
|
-
command_connector.attach_to_rails_application_config! if
|
|
16
|
+
command_connector.attach_to_rails_application_config! if rails_config.foobara_command_connector.nil?
|
|
12
17
|
end
|
|
13
18
|
|
|
14
19
|
command_connector.connect(*args, **opts, &block)
|