Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d60ae9d1a | ||
|
|
3b8a5b4be4 | ||
|
|
6590a1eeff | ||
|
|
693ae5f05e | ||
|
|
da3002f199 | ||
|
|
feaaab2fa4 | ||
|
|
59f75711a4 | ||
|
|
f24030b51f | ||
|
|
71bb120a12 | ||
|
|
85f46e01b1 | ||
|
|
c5b24b9b38 | ||
|
|
68460af45e | ||
|
|
5614b6b8b3 | ||
|
|
570b063632 | ||
|
|
1d398587d0 | ||
|
|
085853faaa | ||
|
|
21b4e344a9 | ||
|
|
a6194dfe8b | ||
|
|
5692194fa2 | ||
|
|
11745098c2 | ||
|
|
b1bb0c996c | ||
|
|
a62039da50 | ||
|
|
4bfd1c60c2 | ||
|
|
f0e11abb5b | ||
|
|
ed397bdaf8 | ||
|
|
2f5e20d963 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -48,3 +48,6 @@ Gemfile.lock
|
|||||||
vendor/
|
vendor/
|
||||||
|
|
||||||
homesick*.gem
|
homesick*.gem
|
||||||
|
|
||||||
|
# rbenv configuration
|
||||||
|
.ruby-version
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
language: ruby
|
language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 2.1.0
|
- 2.4.0
|
||||||
- 2.0.0
|
- 2.3.3
|
||||||
- 1.9.3
|
- 2.2.6
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
* 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.
|
||||||
|
|||||||
38
Gemfile
38
Gemfile
@@ -1,28 +1,36 @@
|
|||||||
require 'rbconfig'
|
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
this_ruby = Gem::Version.new(RUBY_VERSION)
|
||||||
|
ruby_230 = Gem::Version.new('2.3.0')
|
||||||
|
|
||||||
# Add dependencies required to use your gem here.
|
# Add dependencies required to use your gem here.
|
||||||
gem "thor", ">= 0.14.0"
|
gem 'thor', '>= 0.14.0'
|
||||||
|
|
||||||
# Add dependencies to develop your gem here.
|
# Add dependencies to develop your gem here.
|
||||||
# Include everything needed to run rake, tests, features, etc.
|
# Include everything needed to run rake, tests, features, etc.
|
||||||
group :development do
|
group :development do
|
||||||
gem "rake", ">= 0.8.7"
|
gem 'capture-output', '~> 1.0.0'
|
||||||
gem "rspec", "~> 3.1.0"
|
|
||||||
gem "guard"
|
|
||||||
gem "guard-rspec"
|
|
||||||
gem "rb-readline", "~> 0.5.0"
|
|
||||||
gem "jeweler", ">= 1.6.2"
|
|
||||||
gem 'coveralls', require: false
|
gem 'coveralls', require: false
|
||||||
gem "test_construct"
|
gem 'guard'
|
||||||
gem "capture-output", "~> 1.0.0"
|
gem 'guard-rspec'
|
||||||
if RbConfig::CONFIG['host_os'] =~ /linux|freebsd|openbsd|sunos|solaris/
|
gem 'jeweler', '>= 1.6.2', '< 2.2' if this_ruby < ruby_230
|
||||||
|
gem 'jeweler', '>= 1.6.2' if this_ruby >= ruby_230
|
||||||
|
gem 'rake', '>= 0.8.7'
|
||||||
|
gem 'rb-readline', '~> 0.5.0'
|
||||||
|
gem 'rspec', '~> 3.5.0'
|
||||||
|
gem 'rubocop'
|
||||||
|
gem 'test_construct'
|
||||||
|
|
||||||
|
install_if -> { RUBY_PLATFORM =~ /linux|freebsd|openbsd|sunos|solaris/ } do
|
||||||
gem 'libnotify'
|
gem 'libnotify'
|
||||||
end
|
end
|
||||||
if RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
|
||||||
gem 'terminal-notifier-guard', '~> 1.6.1'
|
install_if -> { RUBY_PLATFORM =~ /darwin/ } do
|
||||||
|
gem 'terminal-notifier-guard', '~> 1.7.0'
|
||||||
end
|
end
|
||||||
if RUBY_VERSION >= '1.9.2'
|
|
||||||
gem "rubocop"
|
install_if -> { this_ruby < ruby_230 } do
|
||||||
|
gem 'listen', '< 3'
|
||||||
|
gem 'rack', '< 2'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -164,9 +164,9 @@ and castle
|
|||||||
|
|
||||||
Homesick is tested on the following Ruby versions:
|
Homesick is tested on the following Ruby versions:
|
||||||
|
|
||||||
* 1.9.3
|
* 2.2.6
|
||||||
* 2.0.0
|
* 2.3.3
|
||||||
* 2.1.0
|
* 2.4.0
|
||||||
|
|
||||||
## Note on Patches/Pull Requests
|
## Note on Patches/Pull Requests
|
||||||
|
|
||||||
|
|||||||
106
homesick.gemspec
106
homesick.gemspec
@@ -2,19 +2,19 @@
|
|||||||
# 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.3 ruby lib
|
# stub: homesick 1.1.4 ruby lib
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "homesick"
|
s.name = "homesick".freeze
|
||||||
s.version = "1.1.3"
|
s.version = "1.1.4"
|
||||||
|
|
||||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") 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"]
|
s.require_paths = ["lib".freeze]
|
||||||
s.authors = ["Joshua Nichols", "Yusuke Murata"]
|
s.authors = ["Joshua Nichols".freeze, "Yusuke Murata".freeze]
|
||||||
s.date = "2015-10-31"
|
s.date = "2017-03-22"
|
||||||
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 "
|
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", "info@muratayusuke.com"]
|
s.email = ["josh@technicalpickles.com".freeze, "info@muratayusuke.com".freeze]
|
||||||
s.executables = ["homesick"]
|
s.executables = ["homesick".freeze]
|
||||||
s.extra_rdoc_files = [
|
s.extra_rdoc_files = [
|
||||||
"ChangeLog.markdown",
|
"ChangeLog.markdown",
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
@@ -43,51 +43,63 @@ 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 = "http://github.com/technicalpickles/homesick".freeze
|
||||||
s.licenses = ["MIT"]
|
s.licenses = ["MIT".freeze]
|
||||||
s.rubygems_version = "2.2.2"
|
s.rubygems_version = "2.6.11".freeze
|
||||||
s.summary = "Your home directory is your castle. Don't leave your dotfiles behind."
|
s.summary = "Your home directory is your castle. Don't leave your dotfiles behind.".freeze
|
||||||
|
|
||||||
if s.respond_to? :specification_version then
|
if s.respond_to? :specification_version then
|
||||||
s.specification_version = 4
|
s.specification_version = 4
|
||||||
|
|
||||||
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
||||||
s.add_runtime_dependency(%q<thor>, [">= 0.14.0"])
|
s.add_runtime_dependency(%q<thor>.freeze, [">= 0.14.0"])
|
||||||
s.add_development_dependency(%q<rake>, [">= 0.8.7"])
|
s.add_development_dependency(%q<capture-output>.freeze, ["~> 1.0.0"])
|
||||||
s.add_development_dependency(%q<rspec>, ["~> 3.1.0"])
|
s.add_development_dependency(%q<coveralls>.freeze, [">= 0"])
|
||||||
s.add_development_dependency(%q<guard>, [">= 0"])
|
s.add_development_dependency(%q<guard>.freeze, [">= 0"])
|
||||||
s.add_development_dependency(%q<guard-rspec>, [">= 0"])
|
s.add_development_dependency(%q<guard-rspec>.freeze, [">= 0"])
|
||||||
s.add_development_dependency(%q<rb-readline>, ["~> 0.5.0"])
|
s.add_development_dependency(%q<jeweler>.freeze, [">= 1.6.2"])
|
||||||
s.add_development_dependency(%q<jeweler>, [">= 1.6.2"])
|
s.add_development_dependency(%q<rake>.freeze, [">= 0.8.7"])
|
||||||
s.add_development_dependency(%q<coveralls>, [">= 0"])
|
s.add_development_dependency(%q<rb-readline>.freeze, ["~> 0.5.0"])
|
||||||
s.add_development_dependency(%q<test_construct>, [">= 0"])
|
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
||||||
s.add_development_dependency(%q<capture-output>, ["~> 1.0.0"])
|
s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
|
||||||
s.add_development_dependency(%q<rubocop>, [">= 0"])
|
s.add_development_dependency(%q<test_construct>.freeze, [">= 0"])
|
||||||
|
s.add_development_dependency(%q<libnotify>.freeze, [">= 0"])
|
||||||
|
s.add_development_dependency(%q<terminal-notifier-guard>.freeze, ["~> 1.7.0"])
|
||||||
|
s.add_development_dependency(%q<listen>.freeze, ["< 3"])
|
||||||
|
s.add_development_dependency(%q<rack>.freeze, ["< 2"])
|
||||||
else
|
else
|
||||||
s.add_dependency(%q<thor>, [">= 0.14.0"])
|
s.add_dependency(%q<thor>.freeze, [">= 0.14.0"])
|
||||||
s.add_dependency(%q<rake>, [">= 0.8.7"])
|
s.add_dependency(%q<capture-output>.freeze, ["~> 1.0.0"])
|
||||||
s.add_dependency(%q<rspec>, ["~> 3.1.0"])
|
s.add_dependency(%q<coveralls>.freeze, [">= 0"])
|
||||||
s.add_dependency(%q<guard>, [">= 0"])
|
s.add_dependency(%q<guard>.freeze, [">= 0"])
|
||||||
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
s.add_dependency(%q<guard-rspec>.freeze, [">= 0"])
|
||||||
s.add_dependency(%q<rb-readline>, ["~> 0.5.0"])
|
s.add_dependency(%q<jeweler>.freeze, [">= 1.6.2"])
|
||||||
s.add_dependency(%q<jeweler>, [">= 1.6.2"])
|
s.add_dependency(%q<rake>.freeze, [">= 0.8.7"])
|
||||||
s.add_dependency(%q<coveralls>, [">= 0"])
|
s.add_dependency(%q<rb-readline>.freeze, ["~> 0.5.0"])
|
||||||
s.add_dependency(%q<test_construct>, [">= 0"])
|
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
||||||
s.add_dependency(%q<capture-output>, ["~> 1.0.0"])
|
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
||||||
s.add_dependency(%q<rubocop>, [">= 0"])
|
s.add_dependency(%q<test_construct>.freeze, [">= 0"])
|
||||||
|
s.add_dependency(%q<libnotify>.freeze, [">= 0"])
|
||||||
|
s.add_dependency(%q<terminal-notifier-guard>.freeze, ["~> 1.7.0"])
|
||||||
|
s.add_dependency(%q<listen>.freeze, ["< 3"])
|
||||||
|
s.add_dependency(%q<rack>.freeze, ["< 2"])
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
s.add_dependency(%q<thor>, [">= 0.14.0"])
|
s.add_dependency(%q<thor>.freeze, [">= 0.14.0"])
|
||||||
s.add_dependency(%q<rake>, [">= 0.8.7"])
|
s.add_dependency(%q<capture-output>.freeze, ["~> 1.0.0"])
|
||||||
s.add_dependency(%q<rspec>, ["~> 3.1.0"])
|
s.add_dependency(%q<coveralls>.freeze, [">= 0"])
|
||||||
s.add_dependency(%q<guard>, [">= 0"])
|
s.add_dependency(%q<guard>.freeze, [">= 0"])
|
||||||
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
s.add_dependency(%q<guard-rspec>.freeze, [">= 0"])
|
||||||
s.add_dependency(%q<rb-readline>, ["~> 0.5.0"])
|
s.add_dependency(%q<jeweler>.freeze, [">= 1.6.2"])
|
||||||
s.add_dependency(%q<jeweler>, [">= 1.6.2"])
|
s.add_dependency(%q<rake>.freeze, [">= 0.8.7"])
|
||||||
s.add_dependency(%q<coveralls>, [">= 0"])
|
s.add_dependency(%q<rb-readline>.freeze, ["~> 0.5.0"])
|
||||||
s.add_dependency(%q<test_construct>, [">= 0"])
|
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
||||||
s.add_dependency(%q<capture-output>, ["~> 1.0.0"])
|
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
||||||
s.add_dependency(%q<rubocop>, [">= 0"])
|
s.add_dependency(%q<test_construct>.freeze, [">= 0"])
|
||||||
|
s.add_dependency(%q<libnotify>.freeze, [">= 0"])
|
||||||
|
s.add_dependency(%q<terminal-notifier-guard>.freeze, ["~> 1.7.0"])
|
||||||
|
s.add_dependency(%q<listen>.freeze, ["< 3"])
|
||||||
|
s.add_dependency(%q<rack>.freeze, ["< 2"])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ module Homesick
|
|||||||
end
|
end
|
||||||
|
|
||||||
def ln_s(source, destination)
|
def ln_s(source, destination)
|
||||||
source = Pathname.new(source)
|
source = Pathname.new(source).realpath
|
||||||
destination = Pathname.new(destination)
|
destination = Pathname.new(destination)
|
||||||
FileUtils.mkdir_p destination.dirname
|
FileUtils.mkdir_p destination.dirname
|
||||||
|
|
||||||
@@ -63,16 +63,14 @@ module Homesick
|
|||||||
case action
|
case action
|
||||||
when :identical
|
when :identical
|
||||||
say_status :identical, destination.expand_path, :blue
|
say_status :identical, destination.expand_path, :blue
|
||||||
when :symlink_conflict
|
when :symlink_conflict, :conflict
|
||||||
|
if action == :conflict
|
||||||
|
say_status :conflict, "#{destination} exists", :red
|
||||||
|
else
|
||||||
say_status :conflict,
|
say_status :conflict,
|
||||||
"#{destination} exists and points to #{destination.readlink}",
|
"#{destination} exists and points to #{destination.readlink}",
|
||||||
:red
|
:red
|
||||||
|
end
|
||||||
FileUtils.rm destination
|
|
||||||
FileUtils.ln_s source, destination, force: true unless options[:pretend]
|
|
||||||
when :conflict
|
|
||||||
say_status :conflict, "#{destination} exists", :red
|
|
||||||
|
|
||||||
if collision_accepted?(destination, source)
|
if collision_accepted?(destination, source)
|
||||||
FileUtils.rm_r destination, force: true unless options[:pretend]
|
FileUtils.rm_r destination, force: true unless options[:pretend]
|
||||||
FileUtils.ln_s source, destination, force: true unless options[:pretend]
|
FileUtils.ln_s source, destination, force: true unless options[:pretend]
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ module Homesick
|
|||||||
|
|
||||||
desc 'rc CASTLE', 'Run the .homesickrc for the specified castle'
|
desc 'rc CASTLE', 'Run the .homesickrc for the specified castle'
|
||||||
method_option :force,
|
method_option :force,
|
||||||
|
type: :boolean,
|
||||||
default: false,
|
default: false,
|
||||||
desc: 'Evaluate .homesickrc without prompting.'
|
desc: 'Evaluate .homesickrc without prompting.'
|
||||||
def rc(name = DEFAULT_CASTLE_NAME)
|
def rc(name = DEFAULT_CASTLE_NAME)
|
||||||
@@ -128,6 +129,7 @@ module Homesick
|
|||||||
|
|
||||||
desc 'link CASTLE', 'Symlinks all dotfiles from the specified castle'
|
desc 'link CASTLE', 'Symlinks all dotfiles from the specified castle'
|
||||||
method_option :force,
|
method_option :force,
|
||||||
|
type: :boolean,
|
||||||
default: false,
|
default: false,
|
||||||
desc: 'Overwrite existing conflicting symlinks without prompting.'
|
desc: 'Overwrite existing conflicting symlinks without prompting.'
|
||||||
def link(name = DEFAULT_CASTLE_NAME)
|
def link(name = DEFAULT_CASTLE_NAME)
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ require 'pathname'
|
|||||||
module Homesick
|
module Homesick
|
||||||
# Various utility methods that are used by Homesick
|
# Various utility methods that are used by Homesick
|
||||||
module Utils
|
module Utils
|
||||||
QUIETABLE = ['say_status']
|
QUIETABLE = [:say_status]
|
||||||
|
|
||||||
PRETENDABLE = ['system']
|
PRETENDABLE = [:system]
|
||||||
|
|
||||||
QUIETABLE.each do |method_name|
|
QUIETABLE.each do |method_name|
|
||||||
define_method(method_name) do |*args|
|
define_method(method_name) do |*args|
|
||||||
@@ -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) { source }
|
options[:force] || shell.file_collision(destination) { File.binread(source) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def each_file(castle, basedir, subdirs)
|
def each_file(castle, basedir, subdirs)
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ describe Homesick::CLI do
|
|||||||
|
|
||||||
it 'throws an exception when trying to clone a malformed uri like malformed' do
|
it 'throws an exception when trying to clone a malformed uri like malformed' do
|
||||||
expect(homesick).not_to receive(:git_clone)
|
expect(homesick).not_to receive(:git_clone)
|
||||||
expect { homesick.clone 'malformed' }.to raise_error
|
expect { homesick.clone 'malformed' }.to raise_error(RuntimeError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'clones a github repo' do
|
it 'clones a github repo' do
|
||||||
|
|||||||
Reference in New Issue
Block a user