Module: Bidi2pdfRails::TestHelpers::EnvironmentHelper
- Defined in:
- lib/bidi2pdf_rails/test_helpers/environment_helper.rb
Instance Method Summary collapse
-
#environment_ci? ⇒ Boolean
Checks if the current environment is a CI environment.
-
#environment_codespaces? ⇒ Boolean
Checks if the current environment is a GitHub Codespaces environment.
-
#environment_container? ⇒ Boolean
Checks if the current environment is a containerized environment.
-
#environment_local? ⇒ Boolean
Checks if the current environment is a local environment.
-
#environment_type ⇒ Symbol
Determines the current environment type based on environment variables and context.
-
#environment_type?(type) ⇒ Boolean
Checks if the current environment matches the given type.
-
#inside_container? ⇒ Boolean
Checks if the code is running inside a Docker container.
Instance Method Details
#environment_ci? ⇒ Boolean
Checks if the current environment is a CI environment.
35 36 37 |
# File 'lib/bidi2pdf_rails/test_helpers/environment_helper.rb', line 35 def environment_ci? environment_type? :ci end |
#environment_codespaces? ⇒ Boolean
Checks if the current environment is a GitHub Codespaces environment.
41 42 43 |
# File 'lib/bidi2pdf_rails/test_helpers/environment_helper.rb', line 41 def environment_codespaces? environment_type? :codespaces end |
#environment_container? ⇒ Boolean
Checks if the current environment is a containerized environment.
47 48 49 |
# File 'lib/bidi2pdf_rails/test_helpers/environment_helper.rb', line 47 def environment_container? environment_type? :container end |
#environment_local? ⇒ Boolean
Checks if the current environment is a local environment.
53 54 55 |
# File 'lib/bidi2pdf_rails/test_helpers/environment_helper.rb', line 53 def environment_local? environment_type? :local end |
#environment_type ⇒ Symbol
Determines the current environment type based on environment variables and context.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bidi2pdf_rails/test_helpers/environment_helper.rb', line 14 def environment_type if ENV["CI"] :ci elsif ENV["CODESPACES"] && ENV["CODESPACES"] == "true" :codespaces elsif inside_container? :container else :local end end |
#environment_type?(type) ⇒ Boolean
Checks if the current environment matches the given type.
29 30 31 |
# File 'lib/bidi2pdf_rails/test_helpers/environment_helper.rb', line 29 def environment_type?(type) environment_type == type end |
#inside_container? ⇒ Boolean
Checks if the code is running inside a Docker container.
8 9 10 |
# File 'lib/bidi2pdf_rails/test_helpers/environment_helper.rb', line 8 def inside_container? File.exist?("/.dockerenv") end |