Sha256: dcd04c3cc153c83e233caf0e9361f5480c213dac24a2e3851858b74b9b9a2d8b

Contents?: true

Size: 571 Bytes

Versions: 6

Compression:

Stored size: 571 Bytes

Contents

require "active_support/core_ext/string"

module Cp8Cli
  class CurrentUser
    include Github::Api::Client

    def initials
      Command.error("Please configure your git user.name using git config user.name Jane Doe") unless git_user_name
      git_user_name.parameterize(separator: " ").split.map(&:first).join
    end

    def github_login
      github_user.login
    end

    private

      def git_user_name
        @_git_user_name ||= Command.read("git config user.name")
      end

      def github_user
        @_github_user ||= client.user
      end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cp8_cli-9.1.1 lib/cp8_cli/current_user.rb
cp8_cli-9.1.0 lib/cp8_cli/current_user.rb
cp8_cli-9.0.3 lib/cp8_cli/current_user.rb
cp8_cli-9.0.2 lib/cp8_cli/current_user.rb
cp8_cli-9.0.1 lib/cp8_cli/current_user.rb
cp8_cli-9.0.0 lib/cp8_cli/current_user.rb