28 Commits

Author SHA1 Message Date
Jeremy Cook
db0f604faf Regenerate gemspec for version 1.0.0 2014-01-15 20:24:36 -05:00
Jeremy Cook
e5a6e43333 Preparing for 1.0.0 release. 2014-01-15 20:23:25 -05:00
Jeremy Cook
faa5f0b9ed Merge pull request #79 from JCook21/Tests
Added tests for untested methods
2014-01-15 16:43:35 -08:00
Jeremy Cook
7c13727978 Merge branch 'master' into Tests 2014-01-15 19:41:06 -05:00
Jeremy Cook
2dba8b6496 Merge branch 'master' of github.com:technicalpickles/homesick 2014-01-15 19:38:29 -05:00
Jeremy Cook
2dadd4e064 Removed libnotify which seems to be causing build errors. 2014-01-15 19:38:02 -05:00
Jeremy Cook
a60ca62eba Merge pull request #71 from thenickperson/master
Merging this one in following discussions on #80.
2014-01-15 16:35:17 -08:00
Nicolas McCurdy
674ffb6bb2 Merge remote-tracking branch 'upstream/master' 2014-01-15 16:57:41 -05:00
Jeremy Cook
5fa0fc037c Updated README for .homesickrc. 2014-01-10 09:36:09 -05:00
Nicolas McCurdy
8a537b8204 Add gem version, dependency status, and code quality badges to the readme 2014-01-10 09:36:09 -05:00
Jeremy Cook
6e25f13e06 Added libnotify Gem on *nix systems in case people want to use it for
Guard notifications.
2014-01-10 09:36:09 -05:00
Jeremy Cook
df8f6b1cb0 Added command to display current version of homesick. 2014-01-10 09:36:09 -05:00
Jeremy Cook
6050a9a7ac Updated README for .homesickrc. 2014-01-09 22:38:47 -05:00
Jeremy Cook
0abd9436ad Merge branch 'master' of github.com:technicalpickles/homesick 2014-01-09 22:34:36 -05:00
Jeremy Cook
af159f5b97 Added libnotify Gem on *nix systems in case people want to use it for
Guard notifications.
2014-01-09 17:45:05 -05:00
Josh Nichols
a657c5622e Merge pull request #77 from thenickperson/readme-badges
Add gem version, dependency status, and code quality badges to the readme
2014-01-09 08:11:56 -08:00
Nicolas McCurdy
6f216cd916 Add gem version, dependency status, and code quality badges to the readme 2014-01-09 02:59:26 -05:00
Nicolas McCurdy
8bf1864335 Switch from the test-construct gem (deprecated) to test_construct 2014-01-09 02:49:52 -05:00
Nicolas McCurdy
8931739e97 Travis: Don't test on Ruby 1.8 (it's deprecated, and it breaks the build) 2014-01-09 02:49:52 -05:00
Jeremy Cook
ab46cf7b2f Merge branch 'master' of github.com:technicalpickles/homesick into Tests 2014-01-06 21:47:17 -05:00
Jeremy Cook
d115714a9f Merge branch 'master' of github.com:technicalpickles/homesick 2014-01-06 21:45:04 -05:00
Jeremy Cook
e787abd3f3 Merge pull request #78 from JCook21/Docs
Added docs for the rc command.
2014-01-06 18:43:06 -08:00
Jeremy Cook
1c0fe66944 Added docs for the rc command. 2014-01-06 21:42:24 -05:00
Jeremy Cook
148d18565f Added tests for untested methods. 2014-01-06 21:24:24 -05:00
Jeremy Cook
264d586863 Updated tests to remove shell output from test results. 2014-01-06 21:24:24 -05:00
Jeremy Cook
76bee65475 Updated gems to use test_construct, removing warning message. 2014-01-06 21:24:24 -05:00
Jeremy Cook
8dac49548c Added command to display current version of homesick. 2014-01-06 19:12:13 -05:00
Jeremy Cook
5c5d204d15 Removed notification settings from project so that user can set them in
~/.guard.rb instead.
2014-01-05 10:08:29 -05:00
11 changed files with 143 additions and 28 deletions

View File

@@ -2,4 +2,3 @@ language: ruby
rvm:
- 2.0.0
- 1.9.3
- 1.8.7

View File

@@ -1,3 +1,7 @@
#1.0.0
* Removed support for Ruby 1.8.7
* Added a version command
# 0.9.8
* Introduce new commands
* `homesick cd`

View File

@@ -1,3 +1,4 @@
require 'rbconfig'
source 'https://rubygems.org'
# Add dependencies required to use your gem here.
@@ -14,8 +15,11 @@ group :development do
gem "jeweler", ">= 1.6.2"
gem "rcov", :platforms => :mri_18
gem "simplecov", :platforms => :mri_19
gem "test-construct"
gem "test_construct"
gem "capture-output", "~> 1.0.0"
if RbConfig::CONFIG['host_os'] =~ /linux|freebsd|openbsd|sunos|solaris/
gem 'libnotify'
end
if RUBY_VERSION >= '1.9.2'
gem "rubocop"
end

View File

@@ -1,9 +1,6 @@
guard :rspec do
guard :rspec, :cmd => 'bundle exec rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/homesick/.*\.rb}) { "spec" }
watch('spec/spec_helper.rb') { "spec" }
notification :tmux, display_message: true
end

View File

@@ -1,6 +1,9 @@
# homesick
[![Gem Version](https://badge.fury.io/rb/homesick.png)](http://badge.fury.io/rb/homesick)
[![Build Status](https://travis-ci.org/technicalpickles/homesick.png?branch=master)](https://travis-ci.org/technicalpickles/homesick)
[![Dependency Status](https://gemnasium.com/technicalpickles/homesick.png)](https://gemnasium.com/technicalpickles/homesick)
[![Code Climate](https://codeclimate.com/github/technicalpickles/homesick.png)](https://codeclimate.com/github/technicalpickles/homesick)
Your home directory is your castle. Don't leave your dotfiles behind.
@@ -27,11 +30,16 @@ With the castle cloned, you can now link its contents into your home dir:
homesick symlink pickled-vim
You can remove symlinks anytime when you don't need them anymore
homesick unlink pickled-vim
If you need to add further configuration steps you can add these in a file called '.homesickrc' in the root of a castle. Once you've cloned a castle with a .homesickrc run the configuration with:
homesick rc CASTLE
The contents of the .homesickrc file must be valid Ruby code as the file will be executed with Ruby's eval construct. The .homesickrc is also passed the current homesick object during its execution and this is available within the .homesickrc file as the 'self' variable.
If you're not sure what castles you have around, you can easily list them:
homesick list
@@ -60,6 +68,10 @@ Not sure what else homesick has up its sleeve? There's always the built in help:
homesick help
If you ever want to see what version of homesick you have type:
homesick version|-v|--version
## .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.
@@ -138,6 +150,13 @@ and castle
`-- .emacs.d
`-- elisp
## Supported Ruby Versions
Homesick is tested on the following Ruby versions:
* 1.9.3
* 2.0.0
## Note on Patches/Pull Requests
* Fork the project.

View File

@@ -1,5 +1,6 @@
require 'rubygems'
require 'bundler'
require_relative 'lib/homesick/version'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
@@ -23,7 +24,7 @@ Jeweler::Tasks.new do |gem|
gem.email = ["josh@technicalpickles.com", "info@muratayusuke.com"]
gem.homepage = "http://github.com/technicalpickles/homesick"
gem.authors = ["Joshua Nichols", "Yusuke Murata"]
gem.version = "0.9.7"
gem.version = Homesick::Version::STRING
gem.license = "MIT"
# Have dependencies? Add them to Gemfile

View File

@@ -2,15 +2,16 @@
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: homesick 1.0.0 ruby lib
Gem::Specification.new do |s|
s.name = "homesick"
s.version = "0.9.8"
s.version = "1.0.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Joshua Nichols", "Yusuke Murata"]
s.date = "2013-12-31"
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.date = "2014-01-16"
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.email = ["josh@technicalpickles.com", "info@muratayusuke.com"]
s.executables = ["homesick"]
s.extra_rdoc_files = [
@@ -24,6 +25,7 @@ Gem::Specification.new do |s|
".travis.yml",
"ChangeLog.markdown",
"Gemfile",
"Guardfile",
"LICENSE",
"README.markdown",
"Rakefile",
@@ -32,6 +34,7 @@ Gem::Specification.new do |s|
"lib/homesick.rb",
"lib/homesick/actions.rb",
"lib/homesick/shell.rb",
"lib/homesick/version.rb",
"spec/homesick_spec.rb",
"spec/spec.opts",
"spec/spec_helper.rb"
@@ -39,39 +42,54 @@ Gem::Specification.new do |s|
s.homepage = "http://github.com/technicalpickles/homesick"
s.licenses = ["MIT"]
s.require_paths = ["lib"]
s.rubygems_version = "1.8.23"
s.summary = "A man's home is his castle. Never leave your dotfiles behind."
s.rubygems_version = "2.1.11"
s.summary = "Your home directory is your castle. Don't leave your dotfiles behind."
if s.respond_to? :specification_version then
s.specification_version = 3
s.specification_version = 4
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<thor>, [">= 0.14.0"])
s.add_development_dependency(%q<rake>, [">= 0.8.7"])
s.add_development_dependency(%q<rspec>, ["~> 2.10"])
s.add_development_dependency(%q<guard>, [">= 0"])
s.add_development_dependency(%q<guard-rspec>, [">= 0"])
s.add_development_dependency(%q<rb-readline>, ["~> 0.5.0"])
s.add_development_dependency(%q<jeweler>, [">= 1.6.2"])
s.add_development_dependency(%q<rcov>, [">= 0"])
s.add_development_dependency(%q<simplecov>, [">= 0"])
s.add_development_dependency(%q<test-construct>, [">= 0"])
s.add_development_dependency(%q<test_construct>, [">= 0"])
s.add_development_dependency(%q<capture-output>, ["~> 1.0.0"])
s.add_development_dependency(%q<libnotify>, [">= 0"])
s.add_development_dependency(%q<rubocop>, [">= 0"])
else
s.add_dependency(%q<thor>, [">= 0.14.0"])
s.add_dependency(%q<rake>, [">= 0.8.7"])
s.add_dependency(%q<rspec>, ["~> 2.10"])
s.add_dependency(%q<guard>, [">= 0"])
s.add_dependency(%q<guard-rspec>, [">= 0"])
s.add_dependency(%q<rb-readline>, ["~> 0.5.0"])
s.add_dependency(%q<jeweler>, [">= 1.6.2"])
s.add_dependency(%q<rcov>, [">= 0"])
s.add_dependency(%q<simplecov>, [">= 0"])
s.add_dependency(%q<test-construct>, [">= 0"])
s.add_dependency(%q<test_construct>, [">= 0"])
s.add_dependency(%q<capture-output>, ["~> 1.0.0"])
s.add_dependency(%q<libnotify>, [">= 0"])
s.add_dependency(%q<rubocop>, [">= 0"])
end
else
s.add_dependency(%q<thor>, [">= 0.14.0"])
s.add_dependency(%q<rake>, [">= 0.8.7"])
s.add_dependency(%q<rspec>, ["~> 2.10"])
s.add_dependency(%q<guard>, [">= 0"])
s.add_dependency(%q<guard-rspec>, [">= 0"])
s.add_dependency(%q<rb-readline>, ["~> 0.5.0"])
s.add_dependency(%q<jeweler>, [">= 1.6.2"])
s.add_dependency(%q<rcov>, [">= 0"])
s.add_dependency(%q<simplecov>, [">= 0"])
s.add_dependency(%q<test-construct>, [">= 0"])
s.add_dependency(%q<test_construct>, [">= 0"])
s.add_dependency(%q<capture-output>, ["~> 1.0.0"])
s.add_dependency(%q<libnotify>, [">= 0"])
s.add_dependency(%q<rubocop>, [">= 0"])
end
end

View File

@@ -4,9 +4,11 @@ require 'thor'
class Homesick < Thor
autoload :Shell, 'homesick/shell'
autoload :Actions, 'homesick/actions'
autoload :Version, 'homesick/version'
include Thor::Actions
include Homesick::Actions
include Homesick::Version
add_runtime_options!
@@ -15,6 +17,9 @@ class Homesick < Thor
DEFAULT_CASTLE_NAME = 'dotfiles'
map '-v' => :version
map '--version' => :version
def initialize(args = [], options = {}, config = {})
super
self.shell = Homesick::Shell.new
@@ -264,6 +269,11 @@ class Homesick < Thor
end
end
desc 'version', 'Display the current version of homesick'
def version
say Homesick::Version::STRING
end
protected
def home_dir

10
lib/homesick/version.rb Normal file
View File

@@ -0,0 +1,10 @@
# -*- encoding : utf-8 -*-
class Homesick
module Version
MAJOR = 1
MINOR = 0
PATCH = 0
STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
end
end

View File

@@ -23,6 +23,7 @@ describe 'homesick' do
expect($stdout).to receive(:print)
expect($stdin).to receive(:gets).and_return('y')
expect_any_instance_of(Thor::Shell::Basic).to receive(:say_status).with('eval', kind_of(Pathname))
homesick.clone local_repo
castles.join('some_repo').join('testing').should exist
@@ -55,8 +56,10 @@ describe 'homesick' do
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}"
# Capture stderr to suppress message about cloning an empty repo.
Capture.stderr do
homesick.clone "file://#{bare_repo}"
end
File.directory?(File.join(home.to_s, '.homesick/repos/dotfiles')).should be_true
end
@@ -116,6 +119,7 @@ describe 'homesick' do
file << "File.open(Dir.pwd + '/testing', 'w') { |f| f.print 'testing' }"
end
expect_any_instance_of(Thor::Shell::Basic).to receive(:say_status).with('eval', kind_of(Pathname))
homesick.rc castle
castle.join('testing').should exist
@@ -133,6 +137,7 @@ describe 'homesick' do
file << "File.open(Dir.pwd + '/testing', 'w') { |f| f.print 'testing' }"
end
expect_any_instance_of(Thor::Shell::Basic).to receive(:say_status).with('eval skip', /not evaling.+/, :blue)
homesick.rc castle
castle.join('testing').should_not exist
@@ -358,9 +363,26 @@ describe 'homesick' do
end
describe 'diff' do
it 'should output an empty message when there are no changes to commit' do
given_castle('castle_repo')
some_rc_file = home.file '.some_rc_file'
homesick.track(some_rc_file.to_s, 'castle_repo')
Capture.stdout { homesick.commit 'castle_repo', 'Adding a file to the test' }
text = Capture.stdout { homesick.diff('castle_repo') }
text.should eq('')
end
xit 'needs testing'
it 'should output a diff message when there are changes to commit' do
given_castle('castle_repo')
some_rc_file = home.file '.some_rc_file'
homesick.track(some_rc_file.to_s, 'castle_repo')
Capture.stdout { homesick.commit 'castle_repo', 'Adding a file to the test' }
File.open(some_rc_file.to_s, 'w') do |file|
file.puts "Some test text"
end
text = Capture.stdout { homesick.diff('castle_repo') }
text.should =~ /diff --git.+Some test text$/m
end
end
describe 'show_path' do
@@ -374,19 +396,43 @@ describe 'homesick' do
end
describe 'pull' do
it 'should perform a pull, submodule init and update when the given castle exists' do
given_castle('castle_repo')
homesick.stub(:system).once.with('git pull --quiet')
homesick.stub(:system).once.with('git submodule --quiet init')
homesick.stub(:system).once.with('git submodule --quiet update --init --recursive >/dev/null 2>&1')
homesick.pull 'castle_repo'
end
xit 'needs testing'
it 'should print an error message when trying to pull a non-existant castle' do
homesick.should_receive("say_status").once.with(:error, /Could not pull castle_repo, expected \/tmp\/construct_container.* exist and contain dotfiles/, :red)
expect { homesick.pull "castle_repo" }.to raise_error(SystemExit)
end
describe '--all' do
xit 'needs testing'
it 'should pull each castle when invoked with --all' do
given_castle('castle_repo')
given_castle('glencairn')
homesick.stub(:system).exactly(2).times.with('git pull --quiet')
homesick.stub(:system).exactly(2).times.with('git submodule --quiet init')
homesick.stub(:system).exactly(2).times.with('git submodule --quiet update --init --recursive >/dev/null 2>&1')
Capture.stdout { Capture.stderr { homesick.invoke 'pull', [], all: true } }
end
end
end
describe 'push' do
it 'should perform a git push on the given castle' do
given_castle('castle_repo')
homesick.stub(:system).once.with('git push')
homesick.push 'castle_repo'
end
xit 'needs testing'
it 'should print an error message when trying to push a non-existant castle' do
homesick.should_receive("say_status").once.with(:error, /Could not push castle_repo, expected \/tmp\/construct_container.* exist and contain dotfiles/, :red)
expect { homesick.push "castle_repo" }.to raise_error(SystemExit)
end
end
describe 'track' do
@@ -555,7 +601,7 @@ describe 'homesick' do
it "returns an error message when the $EDITOR environment variable is not set" do
ENV.stub(:[]).with('EDITOR').and_return(nil) # Set the default editor to make sure it fails.
homesick.should_receive("say_status").once.with(:error,"The $EDITOR environment variable must be set to use this command", :red)
homesick.should_receive("say_status").once.with(:error, "The $EDITOR environment variable must be set to use this command", :red)
expect { homesick.open "castle_repo" }.to raise_error(SystemExit)
end
@@ -565,4 +611,11 @@ describe 'homesick' do
expect { homesick.open "castle_repo" }.to raise_error(SystemExit)
end
end
describe 'version' do
it 'should print the current version of homesick' do
text = Capture.stdout { homesick.version }
text.chomp.should =~ /\d+\.\d+\.\d+/
end
end
end

View File

@@ -3,11 +3,11 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'homesick'
require 'rspec'
require 'rspec/autorun'
require 'construct'
require 'test_construct'
require 'tempfile'
RSpec.configure do |config|
config.include Construct::Helpers
config.include TestConstruct::Helpers
config.before { ENV['HOME'] = home.to_s }