licensee 8.3.0 → 8.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 164aba2b0d79240f86c450f08efcad11696c1689
4
- data.tar.gz: ba886506d15fde0a96c1ef386a9479c81dd19110
3
+ metadata.gz: 3b3f800aaf46c58f74814dc25a5f9121985b619c
4
+ data.tar.gz: fbe2299058f5b7108e1f05462ced09f24cd9c13e
5
5
  SHA512:
6
- metadata.gz: 13be7b5f7eaa4f0bdba46022128506680a50dd340a17b13a0ad0ee0629bdc8953521e47686c3c74b9ac2cd14e135da91945dae447f9905579a1af6e5559f939a
7
- data.tar.gz: 2bb3cadf3a5d0ce3b61d39d33e9faac916626eb1bb3da52c3649a90e574e9ab9dbf686071ddf64390b8605e845cc4ea0a660c71d3c4f7c6e7e420b2bf1194fca
6
+ metadata.gz: 841d87d6848ec806dd1ecf8d557c67f2e1f7cfbf76f9dbe5175cf2363efed2e1b6f373db9831990c0884d19bdea9e2bd826b4e493169c4b71bf66a3c137a85f5
7
+ data.tar.gz: 624464f0ccbd8bac06df571a31bdc8be1996a426b041ac1064f88d2aee3b57b52b9d6eb567bcce244a68bfa5c08a5f157c40360545e26c0916dcf55e1bab1a5e
@@ -76,9 +76,10 @@ module Licensee
76
76
  @path ||= File.expand_path "#{@key}.txt", Licensee::License.license_dir
77
77
  end
78
78
 
79
- # License metadata from YAML front matter
79
+ # License metadata from YAML front matter with defaults merged in
80
80
  def meta
81
- @meta ||= if parts && parts[1]
81
+ @meta ||= begin
82
+ return YAML_DEFAULTS unless parts && parts[1]
82
83
  meta = if YAML.respond_to? :safe_load
83
84
  YAML.safe_load(parts[1])
84
85
  else
@@ -90,11 +91,11 @@ module Licensee
90
91
 
91
92
  # Returns the human-readable license name
92
93
  def name
93
- meta.nil? ? key.capitalize : meta['title']
94
+ meta['title'] ? meta['title'] : key.capitalize
94
95
  end
95
96
 
96
97
  def nickname
97
- meta['nickname'] if meta
98
+ meta['nickname']
98
99
  end
99
100
 
100
101
  def name_without_version
@@ -102,14 +103,11 @@ module Licensee
102
103
  end
103
104
 
104
105
  def featured?
105
- return YAML_DEFAULTS['featured'] unless meta
106
106
  meta['featured']
107
107
  end
108
108
  alias featured featured?
109
109
 
110
110
  def hidden?
111
- return true if PSEUDO_LICENSES.include?(key)
112
- return YAML_DEFAULTS['hidden'] unless meta
113
111
  meta['hidden']
114
112
  end
115
113
 
@@ -1,3 +1,3 @@
1
1
  module Licensee
2
- VERSION = '8.3.0'.freeze
2
+ VERSION = '8.3.1'.freeze
3
3
  end
@@ -106,7 +106,11 @@ class TestLicenseeLicense < Minitest::Test
106
106
  license = Licensee::License.new('other')
107
107
  assert_equal nil, license.content
108
108
  assert_equal 'Other', license.name
109
+ assert license.hidden?
109
110
  refute license.featured?
111
+ Licensee::License::YAML_DEFAULTS.each do |key, value|
112
+ assert_equal value, license.meta[key]
113
+ end
110
114
  end
111
115
 
112
116
  should 'know the license hash' do
@@ -90,12 +90,14 @@ class TestLicenseeProject < Minitest::Test
90
90
 
91
91
  should 'detect the BSD 2-clause license without title' do
92
92
  verify_license_file fixture_path(
93
- 'bsd-2-clause-without-title/bsd-2-clause.txt')
93
+ 'bsd-2-clause-without-title/bsd-2-clause.txt'
94
+ )
94
95
  end
95
96
 
96
97
  should 'detect the BSD 3-Clause license without title' do
97
98
  verify_license_file fixture_path(
98
- 'bsd-3-clause-without-title/bsd-3-clause.txt')
99
+ 'bsd-3-clause-without-title/bsd-3-clause.txt'
100
+ )
99
101
  end
100
102
 
101
103
  should 'detect the ISC license without title' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: licensee
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.3.0
4
+ version: 8.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-05 00:00:00.000000000 Z
11
+ date: 2016-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  version: '0'
256
256
  requirements: []
257
257
  rubyforge_project:
258
- rubygems_version: 2.6.4
258
+ rubygems_version: 2.6.6
259
259
  signing_key:
260
260
  specification_version: 4
261
261
  summary: A Ruby Gem to detect open source project licenses