forest_admin_rails 1.11.2 → 1.11.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cac184ae74ecdcf9bfd0258b3a772fbff7e22167604bd5a0670bdc55140bfea9
4
- data.tar.gz: 50ac70c1b20a71eb3effbeb489110595e88bf756d46259d2a0a057b6ce597974
3
+ metadata.gz: 794baa61d7f50615c03c5c0778a4951598ea94fc6b952de518ee12ff7aa23444
4
+ data.tar.gz: 8633b3f585ee7634226eb9d284b92a6b751bc51331b88b10cb244cc93a6d0efb
5
5
  SHA512:
6
- metadata.gz: f0953460813047117d11bfe81cda3ff767e09546114bb3c48c3a33182520a982780255ec9486d118bd5353b2f4d96aaae58bb353d659af8cfa6ade1e256ae0fa
7
- data.tar.gz: 3d4030425a3eaf38c0b47932a3ac7c76ea563e666fa8206359ae2676fcb4a2469b9e8947d3f35ffdb67fc1559d5323a4a1878d988bbc884b0ccc40f0741099d4
6
+ metadata.gz: 3e23b9d315b9214d8be0c1200b0860b69a84ecfcaff67b9ba714168b041f6b2807ba324ab06db0e9420efa151c4861fab4b027732b2099cb86972167886c81ef
7
+ data.tar.gz: 3400939489cc713ba0a7e97b21b3bb2a2020278b15f7318be1bcbb2bd0a07b266f4fa4f185c5783404e26e8fe236b52c4ef350d949d5bf64b809d63583e63cc2
@@ -38,7 +38,7 @@ module ForestAdminRails
38
38
  end
39
39
 
40
40
  def load_configuration
41
- return unless defined?(::Rails::Server)
41
+ return unless running_web_server?
42
42
  return unless File.exist?(Rails.root.join('app', 'lib', 'forest_admin_rails', 'create_agent.rb'))
43
43
 
44
44
  # force eager loading models
@@ -56,6 +56,19 @@ module ForestAdminRails
56
56
  sse.run if ForestAdminRails.config[:instant_cache_refresh]
57
57
  end
58
58
 
59
+ def running_web_server?
60
+ return true if defined?(::Rails::Server)
61
+
62
+ # check if a web server is running with the given command line arguments
63
+ server_commands = %w[puma unicorn thin passenger rackup]
64
+ return true if server_commands.any? { |cmd| ARGV.any? { |arg| arg.include?(cmd) } }
65
+
66
+ # check if running via common server executables
67
+ return true if $PROGRAM_NAME.match?(/puma|unicorn|thin|passenger/)
68
+
69
+ false
70
+ end
71
+
59
72
  def load_cors
60
73
  config.middleware.insert_before 0, Rack::Cors do
61
74
  allow do
@@ -1,3 +1,3 @@
1
1
  module ForestAdminRails
2
- VERSION = "1.11.2"
2
+ VERSION = "1.11.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.2
4
+ version: 1.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu