Sha256: 80ad6aee6ccba15749b068afed8be5e21dbbc137bc56727cb41f9fab04a096a4

Contents?: true

Size: 865 Bytes

Versions: 2

Compression:

Stored size: 865 Bytes

Contents

# encoding: utf-8

require 'octokit'

module Napkin
  class CLI < Thor
    class Github < Thor
      include Thor::Actions

      desc 'teams ORG USER', 'grab the ORG USER\'s team list'
      def teams(org, user)
        teams = client.organization_teams(org).map do |team|
          next if team[:slug].include?('owners') || team[:permission] == 'pull' || !client.team_member?(team[:id], user)
          team[:slug]
        end.compact

        say teams.join(',')
        teams
      end

      desc 'commit_author REPO COMMIT', 'grab the COMMIT details from REPO'
      def commit_author(repo, commit)
        author = client.commit(repo, commit)[:author][:login]
        say author
        author
      end

      private

      def client
        Octokit::Client.new(
          :access_token => ENV['GITHUB_ACCESS_TOKEN']
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
napkin-0.0.6 lib/napkin/cli/github.rb
napkin-0.0.5 lib/napkin/cli/github.rb