Sha256: ae67a9f5c8d7a038a8a39d0067da5a96efe3ecd45cdb6988a949dd97a2f54d70

Contents?: true

Size: 443 Bytes

Versions: 6

Compression:

Stored size: 443 Bytes

Contents

module Cp8Cli
  class Repo
    def self.current
      path = Command.read("git config --get remote.origin.url").match(/github.com[:\/](\S+\/\S+)\.git/)[1]
      new(path)
    end

    def initialize(path)
      @path = path
    end

    def user
      path.split('/').first
    end

    def name
      path.split('/').last
    end

    def url
      "https://github.com/#{user}/#{name}"
    end

    private

      attr_reader :path
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cp8_cli-4.2.1 lib/cp8_cli/repo.rb
cp8_cli-4.2.0 lib/cp8_cli/repo.rb
cp8_cli-4.1.3 lib/cp8_cli/repo.rb
cp8_cli-4.1.2 lib/cp8_cli/repo.rb
cp8_cli-4.1.1 lib/cp8_cli/repo.rb
cp8_cli-4.1.0 lib/cp8_cli/repo.rb