Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Use __dir__ instead of __FILE__ in newgem.gemspec template #6503

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/bundler/templates/newgem/newgem.gemspec.tt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<%- if RUBY_VERSION < "2.0.0" -%>
# coding: utf-8

<%- end -%>
lib = File.expand_path("../lib", __FILE__)
<%- else -%>
lib = File.expand_path("lib", __dir__)
<%- end -%>
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "<%= config[:namespaced_path] %>/version"

Expand Down
4 changes: 4 additions & 0 deletions lib/bundler/templates/newgem/test/test_helper.rb.tt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<%- if RUBY_VERSION < "2.0.0" -%>
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
<%- else -%>
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
<%- end -%>
require "<%= config[:namespaced_path] %>"

require "minitest/autorun"