Module: Dropcaster

Defined in:
lib/dropcaster.rb,
lib/dropcaster/item.rb,
lib/dropcaster/errors.rb,
lib/dropcaster/channel.rb,
lib/dropcaster/logging.rb,
lib/dropcaster/version.rb,
lib/dropcaster/contributors.rb,
lib/dropcaster/log_formatter.rb,
lib/dropcaster/channel_file_locator.rb

Defined Under Namespace

Modules: Logging Classes: AmbiguousSourcesError, Channel, ChannelFileLocator, ConfigurationError, Item, LogFormatter, MissingAttributeError, TemplateNotFoundError

Constant Summary collapse

CHANNEL_YML =
'channel.yml'
VERSION =
'0.0.8'

Class Method Summary collapse

Class Method Details



24
25
26
27
28
29
30
# File 'lib/dropcaster/contributors.rb', line 24

def contributor_link(contributor)
  if contributor.type == 'Anonymous'
    contributor.name.tr('[]', '()')
  else
    "[#{@octokit.user(contributor.).name}](#{contributor.html_url})"
  end
end

.contributor_summary(contributor) ⇒ Object



20
21
22
# File 'lib/dropcaster/contributors.rb', line 20

def contributor_summary(contributor)
  "#{contributor_link(contributor)} (#{contributor.contributions} contributions)"
end

.contributorsObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dropcaster/contributors.rb', line 7

def contributors
  @octokit ||= if ENV.include?('GH_TOKEN')
                 Octokit::Client.new(access_token: ENV['GH_TOKEN'])
               else
                 Octokit::Client.new
               end

  @octokit.contributors('nerab/dropcaster', true).
    sort { |x, y| y.contributions <=> x.contributions }.
    map { |c| "* #{contributor_summary(c)}" }.
    join("\n")
end