Class: GithubPivotalFlow::Project
- Defined in:
- lib/github_pivotal_flow/project.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#name ⇒ Object
Returns the value of attribute name.
-
#owner ⇒ Object
Returns the value of attribute owner.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(*args) ⇒ Project
constructor
A new instance of Project.
- #name_with_owner ⇒ Object
Constructor Details
#initialize(*args) ⇒ Project
Returns a new instance of Project.
16 17 18 19 20 21 |
# File 'lib/github_pivotal_flow/project.rb', line 16 def initialize(*args) super self.name = self.name.tr(' ', '-') self.host ||= 'github.com' self.host = host.sub(/^ssh\./i, '') if 'ssh.github.com' == host.downcase end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host
2 3 4 |
# File 'lib/github_pivotal_flow/project.rb', line 2 def host @host end |
#name ⇒ Object
Returns the value of attribute name
2 3 4 |
# File 'lib/github_pivotal_flow/project.rb', line 2 def name @name end |
#owner ⇒ Object
Returns the value of attribute owner
2 3 4 |
# File 'lib/github_pivotal_flow/project.rb', line 2 def owner @owner end |
Class Method Details
.from_url(url) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/github_pivotal_flow/project.rb', line 3 def self.from_url(url) if (matchdata = /^git@([a-z0-9\._-]+):([a-z0-9_-]+)\/([a-z0-9_-]+)(\.git)?$/.match(url.strip)) host = matchdata[1] owner = matchdata[2] name = matchdata[3] else url = URI(url) if !url.is_a?(URI) _, owner, name = url.path.split('/', 4) host = url.host end self.new(owner, name.sub(/\.git$/, ''), host) end |