Class: BuildTool::Server
- Inherits:
-
Object
- Object
- BuildTool::Server
- Defined in:
- lib/build-tool/server.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
The host this repository is hosted.
-
#name ⇒ Object
readonly
Repository name.
-
#path ⇒ Object
The relative path on the server.
-
#protocol ⇒ Object
The protocol used to access the repository.
-
#sshkey ⇒ Object
A ssh key associated with this server.
Instance Method Summary collapse
-
#initialize(name) ⇒ Server
constructor
Create a repository.
- #to_s ⇒ Object
- #url ⇒ Object
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
#host ⇒ Object
The host this repository is hosted
6 7 8 |
# File 'lib/build-tool/server.rb', line 6 def host @host end |
#name ⇒ Object (readonly)
Repository name
9 10 11 |
# File 'lib/build-tool/server.rb', line 9 def name @name end |
#path ⇒ Object
The relative path on the server
12 13 14 |
# File 'lib/build-tool/server.rb', line 12 def path @path end |
#protocol ⇒ Object
The protocol used to access the repository
15 16 17 |
# File 'lib/build-tool/server.rb', line 15 def protocol @protocol end |
#sshkey ⇒ Object
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_s ⇒ Object
43 44 45 |
# File 'lib/build-tool/server.rb', line 43 def to_s "Server: #{url}" end |
#url ⇒ Object
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 |