licensee 9.9.4 → 9.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b85ef478c3f4eee0b055871998df44b7ac925d4cf558b12257e4ece69dffb605
4
- data.tar.gz: 605cc902e7c2ff5dce082c200a12f0758577757dc1c23f3b601aa1a033bce055
3
+ metadata.gz: fa1cf2d146414880f019c339c2803443db7d63eb2568f7807079aac27a7aec98
4
+ data.tar.gz: a6243b9cc4b9068090023c70c89a5ea0253580575b534da0c00deaa799441bb5
5
5
  SHA512:
6
- metadata.gz: e570922e52f88998432deea4760a3414aa583406cfdb77e156e474c076e82c6314edb2934caeb515d9c24217e6a06ab70909bef3898ff69fc03dd6c55ae99aa5
7
- data.tar.gz: 970c89d645d161d59380c02934485bff1108fa0d31289975da3f8f87103949e18b1b12eb584291477170a530e833465339887d99a042b605f705a27ab3082512
6
+ metadata.gz: cff2872a3d87b3c708ac2585dc41b64dd665008064303ec66a3501ec5160dbc87b5e78a4128921d5a95e3e7eb160ecc625d3d12f0fad36b05b59fa577088581b
7
+ data.tar.gz: 96466e4da40eb17a01625110f236c40cc90cb99b2e39c7057f2867721c77c565ba16cf08d4c4b02c799d1675a11c765e0dd313c761e273354b19fa8cb0fa1528
@@ -49,7 +49,7 @@ class LicenseeCLI < Thor
49
49
  next unless matched_file.is_a? Licensee::ProjectFiles::LicenseFile
50
50
  next if matched_file.confidence == 100
51
51
 
52
- licenses = licenses_by_similiarity(matched_file)
52
+ licenses = licenses_by_similarity(matched_file)
53
53
  next if licenses.empty?
54
54
  say ' Closest non-matching licenses:'
55
55
  rows = licenses[0...3].map do |license, similarity|
@@ -89,15 +89,15 @@ class LicenseeCLI < Thor
89
89
  end
90
90
  end
91
91
 
92
- def licenses_by_similiarity(matched_file)
92
+ def licenses_by_similarity(matched_file)
93
93
  matcher = Licensee::Matchers::Dice.new(matched_file)
94
94
  potential_licenses = Licensee.licenses(hidden: true).select(&:wordset)
95
95
  matcher.instance_variable_set('@potential_licenses', potential_licenses)
96
- matcher.licenses_by_similiarity
96
+ matcher.licenses_by_similarity
97
97
  end
98
98
 
99
99
  def closest_license_key(matched_file)
100
- licenses = licenses_by_similiarity(matched_file)
100
+ licenses = licenses_by_similarity(matched_file)
101
101
  licenses.first.first.key unless licenses.empty?
102
102
  end
103
103
  end
@@ -51,5 +51,9 @@ module Licensee
51
51
  key.sub('fullname', 'full name').capitalize
52
52
  end
53
53
  alias to_s label
54
+
55
+ def raw_text
56
+ "[#{key}]"
57
+ end
54
58
  end
55
59
  end
@@ -1,7 +1,7 @@
1
1
  module Licensee
2
2
  module ProjectFiles
3
3
  class ReadmeFile < Licensee::ProjectFiles::LicenseFile
4
- EXTENSIONS = %w[md markdown mdown txt rdoc].freeze
4
+ EXTENSIONS = %w[md markdown mdown txt rdoc rst].freeze
5
5
  SCORES = {
6
6
  /\AREADME\z/i => 1.0,
7
7
  /\AREADME\.(#{Regexp.union(EXTENSIONS).source})\z/i => 0.9
@@ -11,7 +11,7 @@ module Licensee
11
11
  UNDERLINE_REGEX = /\n[-=]+/m
12
12
  CONTENT_REGEX = /^
13
13
  (?: # Header lookbehind
14
- [\#=]+\s#{TITLE_REGEX} # Start of hashes or rdoc header
14
+ [\#=]+\s#{TITLE_REGEX}\s*[\#=]* # Start of hashes or rdoc header
15
15
  |
16
16
  #{TITLE_REGEX}#{UNDERLINE_REGEX} # Start of underlined header
17
17
  )$
@@ -1,3 +1,3 @@
1
1
  module Licensee
2
- VERSION = '9.9.4'.freeze
2
+ VERSION = '9.10.0'.freeze
3
3
  end
@@ -79,6 +79,11 @@ RSpec.describe Licensee::LicenseField do
79
79
  expect(field.to_s).to eql('Foo')
80
80
  end
81
81
 
82
+ it 'returns the raw text' do
83
+ field = described_class.new('fullname')
84
+ expect(field.raw_text).to eql('[fullname]')
85
+ end
86
+
82
87
  context 'spec_helper' do
83
88
  it 'substitutes all fields' do
84
89
  expected = described_class.keys.sort
@@ -12,6 +12,7 @@ RSpec.describe Licensee::ProjectFiles::ReadmeFile do
12
12
  'readme.txt' => 0.9,
13
13
  'readme.mdown' => 0.9,
14
14
  'readme.rdoc' => 0.9,
15
+ 'readme.rst' => 0.9,
15
16
  'LICENSE' => 0.0
16
17
  }.each do |filename, expected_score|
17
18
  context "with a file named #{filename}" do
@@ -107,6 +108,14 @@ RSpec.describe Licensee::ProjectFiles::ReadmeFile do
107
108
  end
108
109
  end
109
110
 
111
+ context 'With trailing hashes' do
112
+ let(:content) { "## License ##\n\nhello world" }
113
+
114
+ it 'returns the license' do
115
+ expect(license).to eql('hello world')
116
+ end
117
+ end
118
+
110
119
  context 'Rdoc' do
111
120
  let(:content) { "== License:\n\nhello world" }
112
121
 
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: 9.9.4
4
+ version: 9.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-25 00:00:00.000000000 Z
11
+ date: 2018-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv