15 Commits

Author SHA1 Message Date
Jeremy Cook
7080321081 Regenerate gemspec for version 1.1.6 2017-12-20 16:03:17 -05:00
Jeremy Cook
9d9cf66de6 Prepare for release of new version 2017-12-20 16:01:20 -05:00
Jeremy Cook
9e9a940825 Merge pull request #170 from diraol/fix-fileutils
Require fileutils correctly
2017-12-18 10:48:14 -05:00
Diego Rabatone Oliveira
257e974c38 Require fileutils correctly
Fix #165
2017-12-18 13:40:44 -02:00
Jeremy Cook
615e31428c Merge pull request #167 from mail6543210/master
Fix "diff" action on binary files
2017-10-13 17:59:36 -04:00
mail6543210
8c2a1d0f84 Add testcase 2017-09-23 00:41:33 +08:00
mail6543210
62c934774b Real fix for #148 2017-09-19 20:30:15 +08:00
mail6543210
d3d6974b7b Rename content to source
It is a instance of Pathname, not binary content
2017-09-19 20:29:06 +08:00
mail6543210
474d69da0b Revert "Use source content instead of source path (fixes: #148)"
This reverts commit ed397bdaf8.
2017-09-19 20:26:01 +08:00
Jeremy Cook
db6a513d1d Merge pull request #166 from MainShayne233/master
Enhancement/Add 'to' to error message.
2017-09-02 19:59:40 -04:00
Shayne Tremblay
ae343c4cab Add 'to' to error message. 2017-09-02 13:06:46 -07:00
Jeremy Cook
a2b365fb6f Merge pull request #164 from fuzzbomb/update-README-symlink-command
Rename symlink command to link in README.
2017-08-28 12:55:50 -04:00
Andrew Macpherson
4cb2006f41 Rename symlink command to link in README.
symlink command was previously renamed to link, but references in the README
were not updated.
2017-06-12 17:37:45 +01:00
Jeremy Cook
66347d307f Merge pull request #161 from philoserf/patch-1
Update ChangeLog.markdown
2017-03-23 17:33:31 -04:00
Mark Ayers
8f92a1b4f0 Update ChangeLog.markdown
Add the space that markdown requires between the header marker `#` and the header text.
2017-03-23 13:44:33 -07:00
7 changed files with 64 additions and 24 deletions

View File

@@ -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.
#1.1.4
# 1.1.4
* 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
* Fix a problem when in a diff when asking a user to resolve a conflict
* Some code refactoring and fixes
#1.1.3
# 1.1.3
* Allow a destination to be passed when cloning a castle
* Make sure `homesick edit` opens default editor in the root of the given castle
* Fixed bug when diffing edited files
* Fixed crashing bug when attempting to diff directories
* 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 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.
#1.1.0
# 1.1.0
* Added exec and exec_all commands to run commands inside one or all clones castles.
* Code refactoring.
#1.0.0
# 1.0.0
* Removed support for Ruby 1.8.7
* Added a version command

View File

@@ -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:
homesick symlink pickled-vim
homesick link pickled-vim
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 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:
@@ -114,7 +114,7 @@ castle/.homesick_subdir
.config
and run `homesick symlink CASTLE`. The result is:
and run `homesick link CASTLE`. The result is:
~
|-- .config

View File

@@ -2,16 +2,16 @@
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: homesick 1.1.5 ruby lib
# stub: homesick 1.1.6 ruby lib
Gem::Specification.new do |s|
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.require_paths = ["lib".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.email = ["josh@technicalpickles.com".freeze, "info@muratayusuke.com".freeze]
s.executables = ["homesick".freeze]

View File

@@ -1,4 +1,5 @@
# -*- encoding : utf-8 -*-
require 'fileutils'
require 'thor'
module Homesick
@@ -27,13 +28,13 @@ module Homesick
# Hack in support for diffing symlinks
# Also adds support for checking if destination or content is a directory
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)
content = Pathname.new(content)
return 'Unable to create diff: destination or content is a directory' if destination.directory? || content.directory?
return super(destination, content) unless destination.symlink?
source = Pathname.new(source)
return 'Unable to create diff: destination or content is a directory' if destination.directory? || source.directory?
return super(destination, File.binread(source)) unless destination.symlink?
say "- #{destination.readlink}", :red, true
say "+ #{content.expand_path}", :green, true
say "+ #{source.expand_path}", :green, true
end
end

View File

@@ -37,7 +37,7 @@ module Homesick
def check_castle_existance(name, action)
return if castle_dir(name).exist?
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
exit(1)
end
@@ -150,7 +150,7 @@ module Homesick
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)
options[:force] || shell.file_collision(destination) { File.binread(source) }
options[:force] || shell.file_collision(destination) { source }
end
def each_file(castle, basedir, subdirs)

View File

@@ -5,7 +5,7 @@ module Homesick
module Version
MAJOR = 1
MINOR = 1
PATCH = 5
PATCH = 6
STRING = [MAJOR, MINOR, PATCH].compact.join('.')
end

View File

@@ -331,6 +331,40 @@ describe Homesick::CLI do
expect(home.join('.some_dotfile').readlink).to eq(dotfile)
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
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
expect(homesick).to receive('say_status').once
.with(:error,
/Could not pull castle_repo, expected .* exist and contain dotfiles/,
/Could not pull castle_repo, expected .* to exist and contain dotfiles/,
:red)
expect { homesick.pull 'castle_repo' }.to raise_error(SystemExit)
end
@@ -529,7 +563,7 @@ describe Homesick::CLI do
it 'prints an error message when trying to push a non-existant castle' do
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)
end
end
@@ -687,7 +721,7 @@ describe Homesick::CLI do
it 'returns an error message when the given castle does not exist' do
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)
end
end
@@ -716,7 +750,7 @@ describe Homesick::CLI do
# Set a default just in case none is set
allow(ENV).to receive(:[]).with('EDITOR').and_return('vim')
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)
end
end