Sha256: 5691bf810a54e17aa3cc9b277f8d55a12d060eea3d0b8abc543c4e0d78f3c326

Contents?: true

Size: 992 Bytes

Versions: 1

Compression:

Stored size: 992 Bytes

Contents

require 'taketo/constructs/base_construct'
require 'taketo/constructs/command'
require 'taketo/support'

module Taketo
  module Constructs

    class Server < BaseConstruct
      attr_reader :environment_variables
      attr_accessor :host, :port, :username, :default_location, :default_command, :global_alias, :identity_file

      has_nodes :commands, :command

      def initialize(name)
        super
        @environment_variables = {}
      end

      def env(env_variables)
        @environment_variables.merge!(env_variables)
      end

      def parent=(parent)
        super
        env(:RAILS_ENV => parent.rails_env) if parent.respond_to?(:rails_env)
      end

      def global_alias=(alias_name)
        @global_alias = alias_name.to_s
      end

      def default_command
        if defined? @default_command
          find_command(@default_command) || Command.explicit_command(@default_command)
        else
          Command.default
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
taketo-0.2.0 lib/taketo/constructs/server.rb