Class: Hookers::Changelog::Project
- Inherits:
-
Object
- Object
- Hookers::Changelog::Project
- Defined in:
- lib/hookers/changelog/project.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#uri ⇒ Object
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
- #commit_uri(id) ⇒ Object
-
#initialize(name, uri) ⇒ Project
constructor
A new instance of Project.
Constructor Details
#initialize(name, uri) ⇒ Project
Returns a new instance of Project.
8 9 10 11 |
# File 'lib/hookers/changelog/project.rb', line 8 def initialize(name, uri) self.name = name self.uri = uri end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/hookers/changelog/project.rb', line 6 def name @name end |
#uri ⇒ Object
Returns the value of attribute uri.
6 7 8 |
# File 'lib/hookers/changelog/project.rb', line 6 def uri @uri end |
Class Method Details
.discover ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hookers/changelog/project.rb', line 17 def self.discover remote_uri = %x[git remote -v].split(/\n/).first.split(/\s+/).at(1) return nil if remote_uri.nil? remote_uri.gsub!(/(git@|git:\/\/)/, "https://") remote_uri.gsub!(/:(?!\/\/)/, "/") remote_uri.gsub!(/\.git$/, "") name = remote_uri.split(/\//).at(-1) new(name, remote_uri) end |
Instance Method Details
#commit_uri(id) ⇒ Object
13 14 15 |
# File 'lib/hookers/changelog/project.rb', line 13 def commit_uri(id) "#{self.uri}/commit/#{id}" end |