Skip to content

Commit

Permalink
[FIXED] Replace toml parser with tomlrb
Browse files Browse the repository at this point in the history
The toml gem depends on an old version of parslet, which can cause
conflicts if license_finder is included in a Gemfile. On the other hand,
tomlrb has no extra dependencies and seems more maintained.
  • Loading branch information
mvz committed Mar 22, 2020
1 parent 5791439 commit 8b9b34b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/license_finder/package_managers/dep.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'toml'
require 'tomlrb'

module LicenseFinder
class Dep < PackageManager
Expand All @@ -9,7 +9,7 @@ def possible_package_paths
end

def current_packages
toml = TOML.load_file(detected_package_path)
toml = Tomlrb.load_file(detected_package_path)
projects = toml['projects']

return [] if projects.nil?
Expand Down
2 changes: 1 addition & 1 deletion license_finder.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Gem::Specification.new do |s|
s.add_dependency 'bundler'
s.add_dependency 'rubyzip', '>=1', '<3'
s.add_dependency 'thor', '~> 1.0.1'
s.add_dependency 'toml', '0.2.0'
s.add_dependency 'tomlrb', '~> 1.3.0'
s.add_dependency 'with_env', '1.1.0'
s.add_dependency 'xml-simple', '~> 1.1.5'

Expand Down
2 changes: 1 addition & 1 deletion spec/lib/license_finder/package_managers/dep_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module LicenseFinder

context 'the package does not have any projects in its toml' do
before do
allow(TOML).to receive(:load_file).and_return({})
allow(Tomlrb).to receive(:load_file).and_return({})
end

it 'should return an empty array' do
Expand Down

0 comments on commit 8b9b34b

Please sign in to comment.