Sha256: 017acf7bae4f2f84bbee23b6d7eea53785cfa0ab00e623db6a20382b48cbc70f

Contents?: true

Size: 870 Bytes

Versions: 2

Compression:

Stored size: 870 Bytes

Contents

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

module Taketo
  module Constructs
    class Server < BaseConstruct
      class CommandNotFoundError < StandardError; end

      attr_reader :environment_variables, :commands
      attr_accessor :host, :port, :username, :default_location, :environment
      
      def initialize(name)
        super
        @environment_variables = {}
        @commands = Taketo::Support::NamedNodesCollection.new
      end

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

      def append_command(command)
        @commands << command
      end

      def find_command(name)
        @commands.find_by_name(name)
      end

      def environment=(environment)
        env(:RAILS_ENV => environment.name.to_s)
        @environment = environment
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
taketo-0.0.4 lib/taketo/constructs/server.rb
taketo-0.0.3 lib/taketo/constructs/server.rb