Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7080321081 | ||
|
|
9d9cf66de6 | ||
|
|
9e9a940825 | ||
|
|
257e974c38 | ||
|
|
615e31428c | ||
|
|
8c2a1d0f84 | ||
|
|
62c934774b | ||
|
|
d3d6974b7b | ||
|
|
474d69da0b | ||
|
|
db6a513d1d | ||
|
|
ae343c4cab | ||
|
|
a2b365fb6f | ||
|
|
4cb2006f41 | ||
|
|
66347d307f | ||
|
|
8f92a1b4f0 |
@@ -1,29 +1,34 @@
|
|||||||
#1.1.5
|
#1.1.6
|
||||||
|
* Makesure the FileUtils is imported correctly to avoid a potential error
|
||||||
|
* Fixes an issue where comparing a diff would not use the content of the new file
|
||||||
|
* Small documentation fixes
|
||||||
|
|
||||||
|
# 1.1.5
|
||||||
* Fixed problem with version number being incorrect.
|
* Fixed problem with version number being incorrect.
|
||||||
|
|
||||||
#1.1.4
|
# 1.1.4
|
||||||
* Make sure symlink conflicts are explicitly communicated to a user and symlinks are not silently overwritten
|
* Make sure symlink conflicts are explicitly communicated to a user and symlinks are not silently overwritten
|
||||||
* Use real paths of symlinks when linking a castle into home
|
* Use real paths of symlinks when linking a castle into home
|
||||||
* Fix a problem when in a diff when asking a user to resolve a conflict
|
* Fix a problem when in a diff when asking a user to resolve a conflict
|
||||||
* Some code refactoring and fixes
|
* Some code refactoring and fixes
|
||||||
|
|
||||||
#1.1.3
|
# 1.1.3
|
||||||
* Allow a destination to be passed when cloning a castle
|
* Allow a destination to be passed when cloning a castle
|
||||||
* Make sure `homesick edit` opens default editor in the root of the given castle
|
* Make sure `homesick edit` opens default editor in the root of the given castle
|
||||||
* Fixed bug when diffing edited files
|
* Fixed bug when diffing edited files
|
||||||
* Fixed crashing bug when attempting to diff directories
|
* Fixed crashing bug when attempting to diff directories
|
||||||
* Ensure that messages are escaped correctly on `git commit all`
|
* Ensure that messages are escaped correctly on `git commit all`
|
||||||
|
|
||||||
#1.1.2
|
# 1.1.2
|
||||||
* Added '--force' option to the rc command to bypass confirmation checks when running a .homesickrc file
|
* Added '--force' option to the rc command to bypass confirmation checks when running a .homesickrc file
|
||||||
* Added a check to make sure that a minimum of Git 1.8.0 is installed. This stops Homesick failing silently if Git is not installed.
|
* Added a check to make sure that a minimum of Git 1.8.0 is installed. This stops Homesick failing silently if Git is not installed.
|
||||||
* Code refactoring and fixes.
|
* Code refactoring and fixes.
|
||||||
|
|
||||||
#1.1.0
|
# 1.1.0
|
||||||
* Added exec and exec_all commands to run commands inside one or all clones castles.
|
* Added exec and exec_all commands to run commands inside one or all clones castles.
|
||||||
* Code refactoring.
|
* Code refactoring.
|
||||||
|
|
||||||
#1.0.0
|
# 1.0.0
|
||||||
* Removed support for Ruby 1.8.7
|
* Removed support for Ruby 1.8.7
|
||||||
* Added a version command
|
* Added a version command
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Alternatively, if it's on github, there's a slightly shorter way:
|
|||||||
|
|
||||||
With the castle cloned, you can now link its contents into your home dir:
|
With the castle cloned, you can now link its contents into your home dir:
|
||||||
|
|
||||||
homesick symlink pickled-vim
|
homesick link pickled-vim
|
||||||
|
|
||||||
You can remove symlinks anytime when you don't need them anymore
|
You can remove symlinks anytime when you don't need them anymore
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ If you ever want to see what version of homesick you have type:
|
|||||||
|
|
||||||
## .homesick_subdir
|
## .homesick_subdir
|
||||||
|
|
||||||
`homesick symlink` basically makes symlink to only first depth in `castle/home`. If you want to link nested files/directories, please use .homesick_subdir.
|
`homesick link` basically makes symlink to only first depth in `castle/home`. If you want to link nested files/directories, please use .homesick_subdir.
|
||||||
|
|
||||||
For example, when you have castle like this:
|
For example, when you have castle like this:
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ castle/.homesick_subdir
|
|||||||
|
|
||||||
.config
|
.config
|
||||||
|
|
||||||
and run `homesick symlink CASTLE`. The result is:
|
and run `homesick link CASTLE`. The result is:
|
||||||
|
|
||||||
~
|
~
|
||||||
|-- .config
|
|-- .config
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
# DO NOT EDIT THIS FILE DIRECTLY
|
# DO NOT EDIT THIS FILE DIRECTLY
|
||||||
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
# stub: homesick 1.1.5 ruby lib
|
# stub: homesick 1.1.6 ruby lib
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "homesick".freeze
|
s.name = "homesick".freeze
|
||||||
s.version = "1.1.5"
|
s.version = "1.1.6"
|
||||||
|
|
||||||
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
||||||
s.require_paths = ["lib".freeze]
|
s.require_paths = ["lib".freeze]
|
||||||
s.authors = ["Joshua Nichols".freeze, "Yusuke Murata".freeze]
|
s.authors = ["Joshua Nichols".freeze, "Yusuke Murata".freeze]
|
||||||
s.date = "2017-03-23"
|
s.date = "2017-12-20"
|
||||||
s.description = "\n Your home directory is your castle. Don't leave your dotfiles behind.\n \n\n Homesick is sorta like rip, but for dotfiles. It uses git to clone a repository containing dotfiles, and saves them in ~/.homesick. It then allows you to symlink all the dotfiles into place with a single command. \n\n ".freeze
|
s.description = "\n Your home directory is your castle. Don't leave your dotfiles behind.\n \n\n Homesick is sorta like rip, but for dotfiles. It uses git to clone a repository containing dotfiles, and saves them in ~/.homesick. It then allows you to symlink all the dotfiles into place with a single command. \n\n ".freeze
|
||||||
s.email = ["josh@technicalpickles.com".freeze, "info@muratayusuke.com".freeze]
|
s.email = ["josh@technicalpickles.com".freeze, "info@muratayusuke.com".freeze]
|
||||||
s.executables = ["homesick".freeze]
|
s.executables = ["homesick".freeze]
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
|
require 'fileutils'
|
||||||
require 'thor'
|
require 'thor'
|
||||||
|
|
||||||
module Homesick
|
module Homesick
|
||||||
@@ -27,13 +28,13 @@ module Homesick
|
|||||||
# Hack in support for diffing symlinks
|
# Hack in support for diffing symlinks
|
||||||
# Also adds support for checking if destination or content is a directory
|
# Also adds support for checking if destination or content is a directory
|
||||||
shell_metaclass = class << shell; self; end
|
shell_metaclass = class << shell; self; end
|
||||||
shell_metaclass.send(:define_method, :show_diff) do |destination, content|
|
shell_metaclass.send(:define_method, :show_diff) do |destination, source|
|
||||||
destination = Pathname.new(destination)
|
destination = Pathname.new(destination)
|
||||||
content = Pathname.new(content)
|
source = Pathname.new(source)
|
||||||
return 'Unable to create diff: destination or content is a directory' if destination.directory? || content.directory?
|
return 'Unable to create diff: destination or content is a directory' if destination.directory? || source.directory?
|
||||||
return super(destination, content) unless destination.symlink?
|
return super(destination, File.binread(source)) unless destination.symlink?
|
||||||
say "- #{destination.readlink}", :red, true
|
say "- #{destination.readlink}", :red, true
|
||||||
say "+ #{content.expand_path}", :green, true
|
say "+ #{source.expand_path}", :green, true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ module Homesick
|
|||||||
def check_castle_existance(name, action)
|
def check_castle_existance(name, action)
|
||||||
return if castle_dir(name).exist?
|
return if castle_dir(name).exist?
|
||||||
say_status :error,
|
say_status :error,
|
||||||
"Could not #{action} #{name}, expected #{castle_dir(name)} exist and contain dotfiles",
|
"Could not #{action} #{name}, expected #{castle_dir(name)} to exist and contain dotfiles",
|
||||||
:red
|
:red
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
@@ -150,7 +150,7 @@ module Homesick
|
|||||||
|
|
||||||
def collision_accepted?(destination, source)
|
def collision_accepted?(destination, source)
|
||||||
fail "Arguments must be instances of Pathname, #{destination.class.name} and #{source.class.name} given" unless destination.instance_of?(Pathname) && source.instance_of?(Pathname)
|
fail "Arguments must be instances of Pathname, #{destination.class.name} and #{source.class.name} given" unless destination.instance_of?(Pathname) && source.instance_of?(Pathname)
|
||||||
options[:force] || shell.file_collision(destination) { File.binread(source) }
|
options[:force] || shell.file_collision(destination) { source }
|
||||||
end
|
end
|
||||||
|
|
||||||
def each_file(castle, basedir, subdirs)
|
def each_file(castle, basedir, subdirs)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ module Homesick
|
|||||||
module Version
|
module Version
|
||||||
MAJOR = 1
|
MAJOR = 1
|
||||||
MINOR = 1
|
MINOR = 1
|
||||||
PATCH = 5
|
PATCH = 6
|
||||||
|
|
||||||
STRING = [MAJOR, MINOR, PATCH].compact.join('.')
|
STRING = [MAJOR, MINOR, PATCH].compact.join('.')
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -331,6 +331,40 @@ describe Homesick::CLI do
|
|||||||
expect(home.join('.some_dotfile').readlink).to eq(dotfile)
|
expect(home.join('.some_dotfile').readlink).to eq(dotfile)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when call and some files conflict' do
|
||||||
|
it 'shows differences for conflicting text files' do
|
||||||
|
contents = {:castle => 'castle has new content', :home => 'home already has content'}
|
||||||
|
|
||||||
|
dotfile = castle.file('text')
|
||||||
|
File.open(dotfile.to_s, 'w') do |f|
|
||||||
|
f.write contents[:castle]
|
||||||
|
end
|
||||||
|
File.open(home.join('text').to_s, 'w') do |f|
|
||||||
|
f.write contents[:home]
|
||||||
|
end
|
||||||
|
message = Capture.stdout { homesick.shell.show_diff(home.join('text'), dotfile) }
|
||||||
|
expect(message.b).to match(/- ?#{contents[:home]}\n.*\+ ?#{contents[:castle]}$/m)
|
||||||
|
end
|
||||||
|
it 'shows message or differences for conflicting binary files' do
|
||||||
|
# content which contains NULL character, without any parentheses, braces, ...
|
||||||
|
contents = {:castle => (0..255).step(30).map{|e| e.chr}.join(), :home => (0..255).step(30).reverse_each.map{|e| e.chr}.join()}
|
||||||
|
|
||||||
|
dotfile = castle.file('binary')
|
||||||
|
File.open(dotfile.to_s, 'w') do |f|
|
||||||
|
f.write contents[:castle]
|
||||||
|
end
|
||||||
|
File.open(home.join('binary').to_s, 'w') do |f|
|
||||||
|
f.write contents[:home]
|
||||||
|
end
|
||||||
|
message = Capture.stdout { homesick.shell.show_diff(home.join('binary'), dotfile) }
|
||||||
|
if homesick.shell.is_a?(Thor::Shell::Color)
|
||||||
|
expect(message.b).to match(/- ?#{contents[:home]}\n.*\+ ?#{contents[:castle]}$/m)
|
||||||
|
elsif homesick.shell.is_a?(Thor::Shell::Basic)
|
||||||
|
expect(message.b).to match(/^Binary files .+ differ$/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'unlink' do
|
describe 'unlink' do
|
||||||
@@ -499,7 +533,7 @@ describe Homesick::CLI do
|
|||||||
it 'prints an error message when trying to pull a non-existant castle' do
|
it 'prints an error message when trying to pull a non-existant castle' do
|
||||||
expect(homesick).to receive('say_status').once
|
expect(homesick).to receive('say_status').once
|
||||||
.with(:error,
|
.with(:error,
|
||||||
/Could not pull castle_repo, expected .* exist and contain dotfiles/,
|
/Could not pull castle_repo, expected .* to exist and contain dotfiles/,
|
||||||
:red)
|
:red)
|
||||||
expect { homesick.pull 'castle_repo' }.to raise_error(SystemExit)
|
expect { homesick.pull 'castle_repo' }.to raise_error(SystemExit)
|
||||||
end
|
end
|
||||||
@@ -529,7 +563,7 @@ describe Homesick::CLI do
|
|||||||
|
|
||||||
it 'prints an error message when trying to push a non-existant castle' do
|
it 'prints an error message when trying to push a non-existant castle' do
|
||||||
expect(homesick).to receive('say_status').once
|
expect(homesick).to receive('say_status').once
|
||||||
.with(:error, /Could not push castle_repo, expected .* exist and contain dotfiles/, :red)
|
.with(:error, /Could not push castle_repo, expected .* to exist and contain dotfiles/, :red)
|
||||||
expect { homesick.push 'castle_repo' }.to raise_error(SystemExit)
|
expect { homesick.push 'castle_repo' }.to raise_error(SystemExit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -687,7 +721,7 @@ describe Homesick::CLI do
|
|||||||
|
|
||||||
it 'returns an error message when the given castle does not exist' do
|
it 'returns an error message when the given castle does not exist' do
|
||||||
expect(homesick).to receive('say_status').once
|
expect(homesick).to receive('say_status').once
|
||||||
.with(:error, /Could not cd castle_repo, expected .* exist and contain dotfiles/, :red)
|
.with(:error, /Could not cd castle_repo, expected .* to exist and contain dotfiles/, :red)
|
||||||
expect { homesick.cd 'castle_repo' }.to raise_error(SystemExit)
|
expect { homesick.cd 'castle_repo' }.to raise_error(SystemExit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -716,7 +750,7 @@ describe Homesick::CLI do
|
|||||||
# Set a default just in case none is set
|
# Set a default just in case none is set
|
||||||
allow(ENV).to receive(:[]).with('EDITOR').and_return('vim')
|
allow(ENV).to receive(:[]).with('EDITOR').and_return('vim')
|
||||||
allow(homesick).to receive('say_status').once
|
allow(homesick).to receive('say_status').once
|
||||||
.with(:error, /Could not open castle_repo, expected .* exist and contain dotfiles/, :red)
|
.with(:error, /Could not open castle_repo, expected .* to exist and contain dotfiles/, :red)
|
||||||
expect { homesick.open 'castle_repo' }.to raise_error(SystemExit)
|
expect { homesick.open 'castle_repo' }.to raise_error(SystemExit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user