Sha256: 6019628b60e02c08d8504aab6d1b69ab6795548a81ddb0715768355e51058031

Contents?: true

Size: 1017 Bytes

Versions: 3

Compression:

Stored size: 1017 Bytes

Contents

require 'guard/rack'

module Guard
  class Rack < Plugin
    class Command
      attr_reader :options

      def initialize(options = {})
        @options = options
      end

      def build
        cmd = [options[:cmd]]

        cmd << configuration
        cmd << environment
        cmd << host
        cmd << port
        cmd << daemon
        cmd << debug
        cmd << server

        cmd.flatten.compact
      end

      private

      def configuration
        [options[:config]]
      end

      def daemon
        return unless options[:daemon]

        ['--daemonize']
      end

      def debug
        return unless options[:debugger]

        ['--debug']
      end

      def environment
        ['--env', options[:environment].to_s]
      end

      def host
        ['--host', options[:host]]
      end

      def port
        ['--port', options[:port].to_s]
      end

      def server
        return unless options[:server]

        ['--server', options[:server].to_s]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
guard-rack-2.2.1 lib/guard/rack/command.rb
guard-rack-2.2.0 lib/guard/rack/command.rb
guard-rack-2.1.1 lib/guard/rack/command.rb