Sha256: 53b3cc2545c182595dd745390ed6b27cbc66b5cc7aa71ce86ece2d1bed35a218

Contents?: true

Size: 1003 Bytes

Versions: 5

Compression:

Stored size: 1003 Bytes

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

    end # class Server


end # module BuildTool

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
build-tool-0.4.6 lib/build-tool/server.rb
build-tool-0.4.5 lib/build-tool/server.rb
build-tool-0.4.4 lib/build-tool/server.rb
build-tool-0.4.3 lib/build-tool/server.rb
build-tool-0.4.2 lib/build-tool/server.rb