Merge remote-tracking branch 'upstream/master' into rubocop-fixes

Conflicts:
	lib/homesick.rb
This commit is contained in:
Nicolas McCurdy
2014-01-21 22:37:48 -05:00
4 changed files with 21 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
language: ruby language: ruby
rvm: rvm:
- 2.1.0
- 2.0.0 - 2.0.0
- 1.9.3 - 1.9.3

View File

@@ -156,6 +156,7 @@ Homesick is tested on the following Ruby versions:
* 1.9.3 * 1.9.3
* 2.0.0 * 2.0.0
* 2.1.0
## Note on Patches/Pull Requests ## Note on Patches/Pull Requests

View File

@@ -20,6 +20,8 @@ class Homesick < Thor
map '-v' => :version map '-v' => :version
map '--version' => :version map '--version' => :version
# Retain a mapped version of the symlink command for compatibility.
map 'symlink' => :link
def initialize(args = [], options = {}, config = {}) def initialize(args = [], options = {}, config = {})
super super
@@ -117,11 +119,11 @@ class Homesick < Thor
end end
end end
desc 'symlink CASTLE', 'Symlinks all dotfiles from the specified castle' desc 'link CASTLE', 'Symlinks all dotfiles from the specified castle'
method_option :force, method_option :force,
default: false, default: false,
desc: 'Overwrite existing conflicting symlinks without prompting.' desc: 'Overwrite existing conflicting symlinks without prompting.'
def symlink(name = DEFAULT_CASTLE_NAME) def link(name = DEFAULT_CASTLE_NAME)
check_castle_existance(name, 'symlink') check_castle_existance(name, 'symlink')
inside castle_dir(name) do inside castle_dir(name) do

View File

@@ -159,13 +159,13 @@ describe 'homesick' do
end end
end end
describe 'symlink' do describe 'link' do
let(:castle) { given_castle('glencairn') } let(:castle) { given_castle('glencairn') }
it 'links dotfiles from a castle to the home folder' do it 'links dotfiles from a castle to the home folder' do
dotfile = castle.file('.some_dotfile') dotfile = castle.file('.some_dotfile')
homesick.symlink('glencairn') homesick.link('glencairn')
home.join('.some_dotfile').readlink.should == dotfile home.join('.some_dotfile').readlink.should == dotfile
end end
@@ -173,7 +173,7 @@ describe 'homesick' do
it 'links non-dotfiles from a castle to the home folder' do it 'links non-dotfiles from a castle to the home folder' do
dotfile = castle.file('bin') dotfile = castle.file('bin')
homesick.symlink('glencairn') homesick.link('glencairn')
home.join('bin').readlink.should == dotfile home.join('bin').readlink.should == dotfile
end end
@@ -188,7 +188,7 @@ describe 'homesick' do
dotdir = castle.directory('.vim') dotdir = castle.directory('.vim')
homesick.symlink('glencairn') homesick.link('glencairn')
existing_dotdir_link.readlink.should == dotdir existing_dotdir_link.readlink.should == dotdir
end end
@@ -198,7 +198,7 @@ describe 'homesick' do
dotdir = castle.directory('.vim') dotdir = castle.directory('.vim')
homesick.symlink('glencairn') homesick.link('glencairn')
existing_dotdir.readlink.should == dotdir existing_dotdir.readlink.should == dotdir
end end
@@ -210,7 +210,7 @@ describe 'homesick' do
dotdir = castle.directory('.config') dotdir = castle.directory('.config')
dotfile = dotdir.file('.some_dotfile') dotfile = dotdir.file('.some_dotfile')
homesick.symlink('glencairn') homesick.link('glencairn')
home_dotdir = home.join('.config') home_dotdir = home.join('.config')
home_dotdir.symlink?.should be == false home_dotdir.symlink?.should be == false
@@ -224,7 +224,7 @@ describe 'homesick' do
dotdir = castle.directory('.config').directory('appA') dotdir = castle.directory('.config').directory('appA')
dotfile = dotdir.file('.some_dotfile') dotfile = dotdir.file('.some_dotfile')
homesick.symlink('glencairn') homesick.link('glencairn')
home_dotdir = home.join('.config').join('appA') home_dotdir = home.join('.config').join('appA')
home_dotdir.symlink?.should be == false home_dotdir.symlink?.should be == false
@@ -242,7 +242,7 @@ describe 'homesick' do
someapp_dir = config_dir.directory('someapp') someapp_dir = config_dir.directory('someapp')
someapp_dotfile = someapp_dir.file('.some_appfile') someapp_dotfile = someapp_dir.file('.some_appfile')
homesick.symlink('glencairn') homesick.link('glencairn')
home_config_dir = home.join('.config') home_config_dir = home.join('.config')
home_someapp_dir = home_config_dir.join('someapp') home_someapp_dir = home_config_dir.join('someapp')
@@ -260,7 +260,7 @@ describe 'homesick' do
it 'using default castle name: "dotfiles"' do it 'using default castle name: "dotfiles"' do
dotfile = castle.file('.some_dotfile') dotfile = castle.file('.some_dotfile')
homesick.symlink homesick.link
home.join('.some_dotfile').readlink.should == dotfile home.join('.some_dotfile').readlink.should == dotfile
end end
@@ -273,7 +273,7 @@ describe 'homesick' do
it 'unlinks dotfiles in the home folder' do it 'unlinks dotfiles in the home folder' do
castle.file('.some_dotfile') castle.file('.some_dotfile')
homesick.symlink('glencairn') homesick.link('glencairn')
homesick.unlink('glencairn') homesick.unlink('glencairn')
home.join('.some_dotfile').should_not exist home.join('.some_dotfile').should_not exist
@@ -282,7 +282,7 @@ describe 'homesick' do
it 'unlinks non-dotfiles from the home folder' do it 'unlinks non-dotfiles from the home folder' do
castle.file('bin') castle.file('bin')
homesick.symlink('glencairn') homesick.link('glencairn')
homesick.unlink('glencairn') homesick.unlink('glencairn')
home.join('bin').should_not exist home.join('bin').should_not exist
@@ -294,7 +294,7 @@ describe 'homesick' do
it 'can unlink sub directories' do it 'can unlink sub directories' do
castle.directory('.config').file('.some_dotfile') castle.directory('.config').file('.some_dotfile')
homesick.symlink('glencairn') homesick.link('glencairn')
homesick.unlink('glencairn') homesick.unlink('glencairn')
home_dotdir = home.join('.config') home_dotdir = home.join('.config')
@@ -309,7 +309,7 @@ describe 'homesick' do
it 'can unsymlink in nested sub directory' do it 'can unsymlink in nested sub directory' do
castle.directory('.config').directory('appA').file('.some_dotfile') castle.directory('.config').directory('appA').file('.some_dotfile')
homesick.symlink('glencairn') homesick.link('glencairn')
homesick.unlink('glencairn') homesick.unlink('glencairn')
home_dotdir = home.join('.config').join('appA') home_dotdir = home.join('.config').join('appA')
@@ -328,7 +328,7 @@ describe 'homesick' do
config_dir.file('.some_dotfile') config_dir.file('.some_dotfile')
config_dir.directory('someapp').file('.some_appfile') config_dir.directory('someapp').file('.some_appfile')
homesick.symlink('glencairn') homesick.link('glencairn')
homesick.unlink('glencairn') homesick.unlink('glencairn')
home_config_dir = home.join('.config') home_config_dir = home.join('.config')
@@ -346,7 +346,7 @@ describe 'homesick' do
it 'using default castle name: "dotfiles"' do it 'using default castle name: "dotfiles"' do
castle.file('.some_dotfile') castle.file('.some_dotfile')
homesick.symlink homesick.link
homesick.unlink homesick.unlink
home.join('.some_dotfile').should_not exist home.join('.some_dotfile').should_not exist