Sha256: df0b3b78d7116a6f8829853cbf35fb826c52f23544d8a3b8d47f15c5bcfe48ee

Contents?: true

Size: 593 Bytes

Versions: 4

Compression:

Stored size: 593 Bytes

Contents

module WhoAmI
  module Function
    class SetupEnvironment
      include ProcParty

      def initialize(config, root)
        @config = config
        @root = root
      end

      def call
        approach = @config.load_environment_approach

        if approach == :rake
          rake(@config.load_environment_rake_task)
        elsif approach == :manual
          ConnectToDatabase.new(@config, @root).call
          LoadInitializers.new(@config, @root).call
        end
      end

      private

      def rake(task_name)
        Rake::Task[task_name].invoke
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
who_am_i-0.0.6 lib/who_am_i/function/setup_environment.rb
who_am_i-0.0.5 lib/who_am_i/function/setup_environment.rb
who_am_i-0.0.4 lib/who_am_i/function/setup_environment.rb
who_am_i-0.0.3 lib/who_am_i/function/setup_environment.rb