Sha256: 02f40c0b62ecacc08ce5be171ce0ff1d21aafec49f075121d6f1762e2a2eff50

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require 'avm/eac_rails_base1/instances/base'
require 'eac_cli/runner'

module Avm
  module EacRailsBase1
    module RunnerWith
      module RailsEnvironment
        DEFAULT_RAILS_ENVIRONMENT_CONSTANT = 'DEFAULT_RAILS_ENVIRONMENT'

        common_concern do
          include ::EacCli::Runner

          runner_definition do
            arg_opt '-e', '--environment', 'Specifies the environment for the runner to operate ' \
                                           '(test/development/production). Default: "development".'
          end
        end

        module ClassMethods
          def default_rails_environment
            const_get(DEFAULT_RAILS_ENVIRONMENT_CONSTANT)
          rescue ::NameError
            ::Avm::EacRailsBase1::Instances::Base::DEFAULT_RAILS_ENVIRONMENT
          end
        end

        def default_rails_environment
          self.class.default_rails_environment
        end

        def rails_environment
          parsed.environment.presence || default_rails_environment
        end

        def rails_instance
          if respond_to?(:runner_context)
            runner_context.call(:instance)
          else
            context(:instance)
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
avm-eac_rails_base1-0.10.2 lib/avm/eac_rails_base1/runner_with/rails_environment.rb
eac_tools-0.97.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb
avm-eac_rails_base1-0.10.1 lib/avm/eac_rails_base1/runner_with/rails_environment.rb
eac_tools-0.96.2 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb
eac_tools-0.84.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb
eac_tools-0.83.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb
eac_tools-0.82.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb
eac_tools-0.81.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb
avm-eac_rails_base1-0.10.0 lib/avm/eac_rails_base1/runner_with/rails_environment.rb
eac_tools-0.80.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb