Skip to content

Commit

Permalink
Added addressable gem for better URI handling
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Grobelin <grobi@koppzu.de>
  • Loading branch information
mgrobelin committed Aug 24, 2018
1 parent 1c5f420 commit 5810940
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2')
gem 'json', '< 2.0'
end

gem 'addressable', '~> 2.5'

group :test do
gem 'bundler', '~> 1.11'
gem 'minitest', '~> 5.8'
Expand Down
2 changes: 1 addition & 1 deletion lib/train.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def self.parse_uri(string)
u = Addressable::URI.parse(string)
# A use-case we want to catch is parsing empty URIs with a schema
# e.g. mock://. To do this, we match it manually and fake the hostname
if u.scheme and (u.host.nil? or u.host.empty?) and u.path.empty?
if u.scheme && (u.host.nil? || u.host.empty?) && u.path.empty?
case string
when %r{^([a-z]+)://$}
string += 'dummy'
Expand Down
1 change: 1 addition & 0 deletions train.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = '>= 2.0'

spec.add_dependency 'addressable', '~> 2.5'
spec.add_dependency 'json', '>= 1.8', '< 3.0'
# chef-client < 12.4.1 require mixlib-shellout-2.0.1
spec.add_dependency 'mixlib-shellout', '~> 2.0'
Expand Down

0 comments on commit 5810940

Please sign in to comment.