Skip to content

Commit 4403d7a

Browse files
DirtyFjekyllbot
authored andcommitted
Define path with __dir__ (#161)
Merge pull request 161
1 parent bc5ab9b commit 4403d7a

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

jekyll-redirect-from.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding: utf-8
22

3-
lib = File.expand_path("../lib", __FILE__)
3+
lib = File.expand_path("lib", __dir__)
44
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
55
require "jekyll-redirect-from/version"
66

lib/jekyll-redirect-from/layout.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module JekyllRedirectFrom
44
class Layout < Jekyll::Layout
55
def initialize(site)
66
@site = site
7-
@base = File.dirname(__FILE__)
7+
@base = __dir__
88
@name = "redirect.html"
99
@path = File.expand_path(@name, @base)
1010
@relative_path = "_layouts/redirect.html"

spec/jekyll_redirect_from/layout_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
end
1111

1212
it "exposes the path" do
13-
expected = File.expand_path "../../lib/jekyll-redirect-from/redirect.html", File.dirname(__FILE__)
13+
expected = File.expand_path "../../lib/jekyll-redirect-from/redirect.html", __dir__
1414
expect(subject.path).to eql(expected)
1515
end
1616

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
end
2121

2222
def fixtures_path
23-
Pathname.new(__FILE__).parent.join("fixtures")
23+
Pathname.new(__dir__).join("fixtures")
2424
end
2525

2626
def dest_path

0 commit comments

Comments
 (0)