Class: Cp8Cli::Repo
- Inherits:
-
Object
- Object
- Cp8Cli::Repo
- Defined in:
- lib/cp8_cli/repo.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path) ⇒ Repo
constructor
A new instance of Repo.
- #name ⇒ Object
- #url ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(path) ⇒ Repo
Returns a new instance of Repo.
8 9 10 |
# File 'lib/cp8_cli/repo.rb', line 8 def initialize(path) @path = path end |
Class Method Details
.current ⇒ Object
3 4 5 6 |
# File 'lib/cp8_cli/repo.rb', line 3 def self.current path = Command.read("git config --get remote.origin.url").match(/github.com[:\/](\S+\/\S+)\.git/)[1] new(path) end |
Instance Method Details
#name ⇒ Object
16 17 18 |
# File 'lib/cp8_cli/repo.rb', line 16 def name path.split('/').last end |
#url ⇒ Object
20 21 22 |
# File 'lib/cp8_cli/repo.rb', line 20 def url "https://github.com/#{user}/#{name}" end |
#user ⇒ Object
12 13 14 |
# File 'lib/cp8_cli/repo.rb', line 12 def user path.split('/').first end |