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 =
'1.2.0'
Class Method Summary
collapse
Class Method Details
.contributor_link(contributor) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/dropcaster/contributors.rb', line 25
def contributor_link(contributor)
if contributor.type == 'Anonymous'
contributor.name.tr('[]', '()')
else
begin
"[#{@octokit.user(contributor.login).name}](#{contributor.html_url})"
rescue
contributor.login
end
end
end
|
.contributor_summary(contributor) ⇒ Object
20
21
22
23
|
# File 'lib/dropcaster/contributors.rb', line 20
def contributor_summary(contributor)
contributions = contributor.contributions
"#{contributor_link(contributor)} (#{contributions} contribution#{contributions == 1 ? '' : 's'})"
end
|
.contributors ⇒ Object
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
|