Sha256: 99ec438684f835f297c95a0279f95f12f55e3ef0790d5b04f7a8204398fc2329

Contents?: true

Size: 497 Bytes

Versions: 10

Compression:

Stored size: 497 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

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

    private

      attr_reader :path

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cp8_cli-9.1.1 lib/cp8_cli/repo.rb
cp8_cli-9.1.0 lib/cp8_cli/repo.rb
cp8_cli-9.0.3 lib/cp8_cli/repo.rb
cp8_cli-9.0.2 lib/cp8_cli/repo.rb
cp8_cli-9.0.1 lib/cp8_cli/repo.rb
cp8_cli-9.0.0 lib/cp8_cli/repo.rb
cp8_cli-8.2.1 lib/cp8_cli/repo.rb
cp8_cli-8.2.0 lib/cp8_cli/repo.rb
cp8_cli-8.1.0 lib/cp8_cli/repo.rb
cp8_cli-8.0.1 lib/cp8_cli/repo.rb