Skip to content

Commit

Permalink
Use require_relative instead of File.expand_path and `$LOAD_PATH.…
Browse files Browse the repository at this point in the history
…unshift` (#280)

It also can prevent some errors with requiring not proper version from specs
(but globally installed one).
  • Loading branch information
AlexWayfer authored Jul 11, 2023
1 parent 1aa3469 commit ae92a9c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ task default: :spec

desc 'Dump type definitions from docs to YAML'
task :dump_type_attributes do
require File.expand_path('lib/telegram/bot', __dir__)
require_relative 'lib/telegram/bot'
require 'nokogiri'
require 'open-uri'
require 'yaml'
Expand Down
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
require 'bundler/setup'
require 'pry'

require File.expand_path('../lib/telegram/bot', __dir__)
require_relative '../lib/telegram/bot'

Pry.start
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true

require 'dotenv/load'
require 'telegram/bot'
require_relative '../lib/telegram/bot'
5 changes: 1 addition & 4 deletions telegram-bot-ruby.gemspec
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# frozen_string_literal: true

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'telegram/bot/version'
require_relative 'lib/telegram/bot/version'

Gem::Specification.new do |spec|
spec.name = 'telegram-bot-ruby'
Expand Down

0 comments on commit ae92a9c

Please sign in to comment.