Skip to content

Commit 205d328

Browse files
committed
Added link to license
1 parent 21dd4df commit 205d328

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

bin/build-index-with-github.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
COPY_REPO_PROPERTIES.each do |prop|
3939
library[prop] = github[prop]
4040
end
41+
unless github[:license].nil?
42+
library[:license] ||= github[:license][:spdx_id]
43+
end
4144
end
4245

4346
library[:versions].each do |version|

lib/helpers.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ def link_to_category(category)
5555
link_to(category, :href => "/categories/#{category.keyize}")
5656
end
5757

58+
def link_to_license(license)
59+
if license.nil?
60+
"Unknown"
61+
else
62+
link_to(license, :href => "https://choosealicense.com/licenses/#{license.downcase}/")
63+
end
64+
end
65+
5866
def pretty_list(list)
5967
if list.nil?
6068
"<i>Unknown</i>"

views/show.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<dt>Github</dt> <dd><%== link_to(library[:github]) %></dd>
1313
<% end %>
1414
<dt>Category</dt> <dd><%== link_to_category(library[:category]) %></dd>
15+
<dt>License</dt> <dd><%== link_to_license(library[:license]) %></dd>
1516
<dt>Library Type</dt> <dd><%== pretty_list(library[:types]) %></dd>
1617
<dt>Architectures</dt> <dd><%== pretty_list(library[:architectures]) %></dd>
1718
</dl>

0 commit comments

Comments
 (0)