5 Commits

Author SHA1 Message Date
muratayusuke
e07f3f0658 Regenerate gemspec for version 0.9.1 2013-06-17 12:36:14 +00:00
muratayusuke
b21aef09be bump up version 2013-06-17 12:35:39 +00:00
Yusuke Murata
d964e65a7e Merge pull request #40 from fnichol/fix-clone-destination
Remove .git suffix on destination directory if URL ends with it.
2013-06-17 04:47:20 -07:00
Fletcher Nichol
024856e538 Remove .git suffix on destination directory if URL ends with it.
For example, the following:

    homesick clone git://github.com/technicalpickles/pickled-vim.git

should produce a castle directory of:

    $HOME/.homesick/repos/pickled-vim
2013-06-16 10:47:53 -06:00
muratayusuke
e530df7239 fix #35 2013-06-09 23:10:21 +00:00
5 changed files with 42 additions and 17 deletions

View File

@@ -1,3 +1,6 @@
# 0.9.1
* Fixed small bugs: #35, #40
# 0.9.0 # 0.9.0
* Introduce .homesick_subdir #39 * Introduce .homesick_subdir #39

View File

@@ -22,7 +22,7 @@ Jeweler::Tasks.new do |gem|
gem.email = ["josh@technicalpickles.com", "info@muratayusuke.com"] gem.email = ["josh@technicalpickles.com", "info@muratayusuke.com"]
gem.homepage = "http://github.com/technicalpickles/homesick" gem.homepage = "http://github.com/technicalpickles/homesick"
gem.authors = ["Joshua Nichols", "Yusuke Murata"] gem.authors = ["Joshua Nichols", "Yusuke Murata"]
gem.version = "0.9.0" gem.version = "0.9.1"
gem.license = "MIT" gem.license = "MIT"
# Have dependencies? Add them to Gemfile # Have dependencies? Add them to Gemfile

View File

@@ -4,15 +4,20 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "homesick" s.name = %q{homesick}
s.version = "0.9.0" s.version = "0.9.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Joshua Nichols", "Yusuke Murata"] s.authors = [%q{Joshua Nichols}, %q{Yusuke Murata}]
s.date = "2013-06-06" s.date = %q{2013-06-17}
s.description = "\n A man's home (directory) is his castle, so don't leave home with out it.\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 " s.description = %q{
s.email = ["josh@technicalpickles.com", "info@muratayusuke.com"] A man's home (directory) is his castle, so don't leave home with out it.
s.executables = ["homesick"]
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.
}
s.email = [%q{josh@technicalpickles.com}, %q{info@muratayusuke.com}]
s.executables = [%q{homesick}]
s.extra_rdoc_files = [ s.extra_rdoc_files = [
"ChangeLog.markdown", "ChangeLog.markdown",
"LICENSE", "LICENSE",
@@ -37,11 +42,11 @@ Gem::Specification.new do |s|
"spec/spec.opts", "spec/spec.opts",
"spec/spec_helper.rb" "spec/spec_helper.rb"
] ]
s.homepage = "http://github.com/technicalpickles/homesick" s.homepage = %q{http://github.com/technicalpickles/homesick}
s.licenses = ["MIT"] s.licenses = [%q{MIT}]
s.require_paths = ["lib"] s.require_paths = [%q{lib}]
s.rubygems_version = "1.8.25" s.rubygems_version = %q{1.8.5}
s.summary = "A man's home is his castle. Never leave your dotfiles behind." s.summary = %q{A man's home is his castle. Never leave your dotfiles behind.}
if s.respond_to? :specification_version then if s.respond_to? :specification_version then
s.specification_version = 3 s.specification_version = 3

View File

@@ -3,10 +3,7 @@ class Homesick
# TODO move this to be more like thor's template, empty_directory, etc # TODO move this to be more like thor's template, empty_directory, etc
def git_clone(repo, config = {}) def git_clone(repo, config = {})
config ||= {} config ||= {}
destination = config[:destination] || begin destination = config[:destination] || File.basename(repo, '.git')
repo =~ /([^\/]+)(?:\.git)?$/
$1
end
destination = Pathname.new(destination) unless destination.kind_of?(Pathname) destination = Pathname.new(destination) unless destination.kind_of?(Pathname)
FileUtils.mkdir_p destination.dirname FileUtils.mkdir_p destination.dirname
@@ -109,6 +106,7 @@ class Homesick
say_status :conflict, "#{destination} exists", :red unless options[:quiet] say_status :conflict, "#{destination} exists", :red unless options[:quiet]
if options[:force] || shell.file_collision(destination) { source } if options[:force] || shell.file_collision(destination) { source }
system "rm -rf #{destination}" unless options[:pretend]
system "ln -sf #{source} #{destination}" unless options[:pretend] system "ln -sf #{source} #{destination}" unless options[:pretend]
end end
else else

View File

@@ -39,6 +39,14 @@ describe "homesick" do
end end
end end
it "should clone git repo like file:///path/to.git" do
bare_repo = File.join(create_construct.to_s, "dotfiles.git")
system "git init --bare #{bare_repo} >/dev/null 2>&1"
homesick.clone "file://#{bare_repo}"
File.directory?(File.join(home.to_s, '.homesick/repos/dotfiles')).should be_true
end
it "should clone git repo like git://host/path/to.git" do it "should clone git repo like git://host/path/to.git" do
homesick.should_receive(:git_clone).with('git://github.com/technicalpickles/pickled-vim.git') homesick.should_receive(:git_clone).with('git://github.com/technicalpickles/pickled-vim.git')
@@ -119,6 +127,17 @@ describe "homesick" do
existing_dotdir_link.readlink.should == dotdir existing_dotdir_link.readlink.should == dotdir
end end
it "can override existing directory" do
somewhere_else = create_construct
existing_dotdir = home.directory(".vim")
dotdir = castle.directory(".vim")
homesick.symlink("glencairn")
existing_dotdir.readlink.should == dotdir
end
end end
context "with '.config' in .homesick_subdir" do context "with '.config' in .homesick_subdir" do