Sha256: 89f3e849a4a82f4d23be835486b8563b4d76301f44e3d0bad64883e2ad38348e

Contents?: true

Size: 1.49 KB

Versions: 19

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

require 'avm/eac_rails_base1/instance'
require 'eac_cli/runner'

module Avm
  module EacRailsBase1
    module RunnerWith
      module Bundle
        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::Instance::DEFAULT_RAILS_ENVIRONMENT
          end
        end

        def bundle_command
          rails_instance.bundle(*bundle_args).envvar('RAILS_ENV', rails_environment)
        end

        def bundle_run
          infov 'Bundle arguments', ::Shellwords.join(bundle_args)
          infov 'Rails environment', rails_environment
          bundle_command.system!
        end

        def default_rails_environment
          self.class.default_rails_environment
        end

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

        def rails_environment
          parsed.environment.presence || default_rails_environment
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
avm-tools-0.87.1 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.87.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.86.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.85.1 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.85.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.84.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.83.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.82.1 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.82.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.81.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.80.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.79.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.78.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.77.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.76.1 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.76.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.75.1 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.75.0 lib/avm/eac_rails_base1/runner_with/bundle.rb
avm-tools-0.74.1 lib/avm/eac_rails_base1/runner_with/bundle.rb