From f1a02b8afaf268b4179c5c03340481ff4792ee94 Mon Sep 17 00:00:00 2001 From: Jacob Buys Date: Sun, 21 Aug 2011 22:22:23 +0200 Subject: [PATCH] Added support for linking non-dotfiles. --- lib/homesick.rb | 2 +- spec/homesick_spec.rb | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/homesick.rb b/lib/homesick.rb index afe98f4..fd7a050 100644 --- a/lib/homesick.rb +++ b/lib/homesick.rb @@ -83,7 +83,7 @@ class Homesick < Thor check_castle_existance(name, "symlink") inside castle_dir(name) do - files = Pathname.glob('.*').reject{|a| [".",".."].include?(a.to_s)} + files = Pathname.glob('{.*,*}').reject{|a| [".",".."].include?(a.to_s)} files.each do |path| absolute_path = path.expand_path diff --git a/spec/homesick_spec.rb b/spec/homesick_spec.rb index 0680735..758b4d5 100644 --- a/spec/homesick_spec.rb +++ b/spec/homesick_spec.rb @@ -81,16 +81,24 @@ describe "homesick" do end describe "symlink" do - context "for dotfiles" do - it "links dotfiles from a castle to the home folder" do - castle = given_castle("glencairn") - dotfile = castle.file(".some_dotfile") + let(:castle) { given_castle("glencairn") } - homesick.symlink("glencairn") + it "links dotfiles from a castle to the home folder" do + dotfile = castle.file(".some_dotfile") - @user_dir.join(".some_dotfile").readlink.should == dotfile - end + homesick.symlink("glencairn") + + @user_dir.join(".some_dotfile").readlink.should == dotfile end + + it "links non-dotfiles from a castle to the home folder" do + dotfile = castle.file("bin") + + homesick.symlink("glencairn") + + @user_dir.join("bin").readlink.should == dotfile + end + end describe "list" do