Skip to content

Commit

Permalink
Implement symlink command
Browse files Browse the repository at this point in the history
  • Loading branch information
amatsuda committed Oct 8, 2013
1 parent 285f8fc commit 590accb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/rfd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@ def touch(filename)
ls
end

# Create a symlink to the current file or directory.
def symlink(name)
FileUtils.ln_s current_item.path, name
ls
end

# Current page is the first page?
def first_page?
current_page == 0
Expand Down
9 changes: 9 additions & 0 deletions spec/controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,15 @@ def (@rfd.main).maxy
end
end

describe '#symlink' do
before do
controller.find 'dir1'
controller.symlink 'aaa'
end
subject { File }
it { should be_symlink File.join(tmpdir, 'aaa') }
end

describe '#first_page? and #last_page?' do
context 'When on the first page' do
it { should be_first_page }
Expand Down

0 comments on commit 590accb

Please sign in to comment.