Class: BuildTool::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/build-tool/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Server

Create a repository



21
22
23
24
25
26
# File 'lib/build-tool/server.rb', line 21

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

Instance Attribute Details

#hostObject

The host this repository is hosted



6
7
8
# File 'lib/build-tool/server.rb', line 6

def host
  @host
end

#nameObject (readonly)

Repository name



9
10
11
# File 'lib/build-tool/server.rb', line 9

def name
  @name
end

#pathObject

The relative path on the server



12
13
14
# File 'lib/build-tool/server.rb', line 12

def path
  @path
end

#protocolObject

The protocol used to access the repository



15
16
17
# File 'lib/build-tool/server.rb', line 15

def protocol
  @protocol
end

#sshkeyObject

A ssh key associated with this server



18
19
20
# File 'lib/build-tool/server.rb', line 18

def sshkey
  @sshkey
end

Instance Method Details

#to_sObject



43
44
45
# File 'lib/build-tool/server.rb', line 43

def to_s
    "Server: #{url}"
end

#urlObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/build-tool/server.rb', line 28

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