Sha256: 845c48192b7ef276ff9560b912b818948a6b0f0c9e9b35086532b89da8d10c22

Contents?: true

Size: 503 Bytes

Versions: 1

Compression:

Stored size: 503 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 shorthand
      "#{user}/#{name}"
    end

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

    private

      attr_reader :path

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cp8_cli-8.0.0 lib/cp8_cli/repo.rb