Skip to content

Commit 696a74c

Browse files
author
Matthew Loberg
committed
Fix FileMover
Both Publish and Unpublish take in the relative path as the argument, so prepending the root directory won't give you the correct path to the file. Just prepend the root directory to the target path.
1 parent d20fb11 commit 696a74c

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

lib/jekyll-compose/file_mover.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def move_file
3333

3434
private
3535
def from
36-
file_path(movement.from)
36+
movement.from
3737
end
3838

3939
def to

spec/publish_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
let(:drafts_dir) { Pathname.new source_dir('site', '_drafts') }
7878
let(:posts_dir) { Pathname.new source_dir('site', '_posts') }
7979

80+
let(:args) { ["site/_drafts/#{draft_to_publish}"] }
81+
8082
before(:each) do
8183
File.open(config, 'w') do |f|
8284
f.write(%{
@@ -101,6 +103,8 @@
101103
let(:drafts_dir) { Pathname.new source_dir('site', '_drafts') }
102104
let(:posts_dir) { Pathname.new source_dir('site', '_posts') }
103105

106+
let(:args) { ["site/_drafts/#{draft_to_publish}"] }
107+
104108
it 'should use source directory set by command line option' do
105109
expect(post_path).not_to exist
106110
expect(draft_path).to exist

spec/unpublish_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
let(:drafts_dir) { Pathname.new(source_dir('site', '_drafts')) }
6363
let(:posts_dir) { Pathname.new(source_dir('site', '_posts')) }
6464

65+
let(:args) { ["site/_posts/#{post_filename}"] }
66+
6567
before(:each) do
6668
File.open(config, 'w') do |f|
6769
f.write(%{
@@ -87,6 +89,8 @@
8789
let(:drafts_dir) { Pathname.new(source_dir('site', '_drafts')) }
8890
let(:posts_dir) { Pathname.new(source_dir('site', '_posts')) }
8991

92+
let(:args) { ["site/_posts/#{post_filename}"] }
93+
9094
it 'should use source directory set by command line option' do
9195
expect(post_path).to exist
9296
expect(draft_path).not_to exist

0 commit comments

Comments
 (0)