Skip to content

Commit 5810940

Browse files
committed
Added addressable gem for better URI handling
Signed-off-by: Markus Grobelin <[email protected]>
1 parent 1c5f420 commit 5810940

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2')
1212
gem 'json', '< 2.0'
1313
end
1414

15+
gem 'addressable', '~> 2.5'
16+
1517
group :test do
1618
gem 'bundler', '~> 1.11'
1719
gem 'minitest', '~> 5.8'

lib/train.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def self.parse_uri(string)
117117
u = Addressable::URI.parse(string)
118118
# A use-case we want to catch is parsing empty URIs with a schema
119119
# e.g. mock://. To do this, we match it manually and fake the hostname
120-
if u.scheme and (u.host.nil? or u.host.empty?) and u.path.empty?
120+
if u.scheme && (u.host.nil? || u.host.empty?) && u.path.empty?
121121
case string
122122
when %r{^([a-z]+)://$}
123123
string += 'dummy'

train.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
2525

2626
spec.required_ruby_version = '>= 2.0'
2727

28+
spec.add_dependency 'addressable', '~> 2.5'
2829
spec.add_dependency 'json', '>= 1.8', '< 3.0'
2930
# chef-client < 12.4.1 require mixlib-shellout-2.0.1
3031
spec.add_dependency 'mixlib-shellout', '~> 2.0'

0 commit comments

Comments
 (0)