Sha256: 04267698c68e99348f972a8c508a6b4b9d4177c164f4098ecb08bfc6c627f606

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

module BuildTool

    class Server

        # The host this repository is hosted
        attr_accessor :host

        # Repository name
        attr_reader   :name

        # The relative path on the server
        attr_accessor :path

        # The protocol used to access the repository
        attr_accessor :protocol

        # A ssh key associated with this server
        attr_accessor :sshkey

        # Create a repository
        def initialize(name)
            if name.nil?
                raise StandardError, "The server name has to be set"
            end
            @name = name
        end

        def url
            if !host
                raise ConfigurationError, "No host specified for server #{name}"
            end

            url = host
            if protocol
                url = "#{protocol}://#{url}"
            end
            if path
                url = "#{url}/#{path}"
            end
            url
        end

        def to_s
            "Server: #{url}"
        end

    end # class Server


end # module BuildTool

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
build-tool-0.5.7 lib/build-tool/server.rb
build-tool-0.5.6 lib/build-tool/server.rb
build-tool-0.5.5 lib/build-tool/server.rb
build-tool-0.5.4 lib/build-tool/server.rb
build-tool-0.5.3 lib/build-tool/server.rb
build-tool-0.5.2 lib/build-tool/server.rb
build-tool-0.5.1 lib/build-tool/server.rb
build-tool-0.5.0 lib/build-tool/server.rb