Sha256: 68bc8925104ba68bfab1880bfd97cf1754aefb8e4883666805ea793a3979b3ee

Contents?: true

Size: 689 Bytes

Versions: 9

Compression:

Stored size: 689 Bytes

Contents

require 'dply/lock'
require 'dply/strategy'
require 'dply/config'
require 'dply/tasks'

module Dply
  module Cli
    class Ctl

      def run(command)
        case command
        when :start, :stop, :reopen_logs
          config
          lock.acquire
          Dir.chdir("current") { tasks.send command.to_sym }
        when :reload
          lock.acquire
          strategy.reload
        end
      end

      def strategy
        @strategy ||= Strategy.load(config, {})
      end

      def config
        @config ||= Config.new.to_struct
      end

      def lock
        @lock ||= Lock.new
      end

      def tasks
        @tasks ||= ::Dply::Tasks.new
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dply-0.2.19 lib/dply/cli/ctl.rb
dply-0.2.18 lib/dply/cli/ctl.rb
dply-0.2.17 lib/dply/cli/ctl.rb
dply-0.2.16 lib/dply/cli/ctl.rb
dply-0.2.15 lib/dply/cli/ctl.rb
dply-0.2.14 lib/dply/cli/ctl.rb
dply-0.2.13 lib/dply/cli/ctl.rb
dply-0.2.11 lib/dply/cli/ctl.rb
dply-0.2.10 lib/dply/cli/ctl.rb