Class: BuildTool::VCS::GitRemote
- Inherits:
-
Object
- Object
- BuildTool::VCS::GitRemote
- Defined in:
- lib/build-tool/vcs/git.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
The name for the remote.
-
#path ⇒ Object
The path for the remote.
-
#push_path ⇒ Object
The path to push to for the remote.
-
#push_server ⇒ Object
The hostname to push to for the remote.
-
#server ⇒ Object
The hostname for the remote.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(name) ⇒ GitRemote
constructor
A new instance of GitRemote.
-
#push_url ⇒ Object
Returns the pushUrl configured or nil if not configured.
- #url ⇒ Object
Constructor Details
#initialize(name) ⇒ GitRemote
Returns a new instance of GitRemote.
57 58 59 60 |
# File 'lib/build-tool/vcs/git.rb', line 57 def initialize( name ) self.name = name @user = nil end |
Instance Attribute Details
#name ⇒ Object
The name for the remote
41 42 43 |
# File 'lib/build-tool/vcs/git.rb', line 41 def name @name end |
#path ⇒ Object
The path for the remote
47 48 49 |
# File 'lib/build-tool/vcs/git.rb', line 47 def path @path end |
#push_path ⇒ Object
The path to push to for the remote
53 54 55 |
# File 'lib/build-tool/vcs/git.rb', line 53 def push_path @push_path end |
#push_server ⇒ Object
The hostname to push to for the remote
50 51 52 |
# File 'lib/build-tool/vcs/git.rb', line 50 def push_server @push_server end |
#server ⇒ Object
The hostname for the remote
44 45 46 |
# File 'lib/build-tool/vcs/git.rb', line 44 def server @server end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
55 56 57 |
# File 'lib/build-tool/vcs/git.rb', line 55 def user @user end |
Instance Method Details
#push_url ⇒ Object
Returns the pushUrl configured or nil if not configured.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/build-tool/vcs/git.rb', line 87 def push_url if !push_server return nil end if !push_server.host raise ConfigurationError, "No host specified for server #{push_server.name}" end url = push_server.host if push_server.path url = "#{url}/#{push_server.path}" end if user url = "#{user}@#{url}" end if push_server.protocol url = "#{push_server.protocol}://#{url}" end if path url = "#{url}/#{path}" end url end |
#url ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/build-tool/vcs/git.rb', line 62 def url if !server raise ConfigurationError, "No server specified for remote #{name}" end if !server.host raise ConfigurationError, "No host specified for server #{server.name}" end url = server.host if server.path url = "#{url}/#{server.path}" end if user url = "#{user}@#{url}" end if server.protocol url = "#{server.protocol}://#{url}" end if path url = "#{url}/#{path}" end url end |