Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db0f604faf | ||
|
|
e5a6e43333 | ||
|
|
faa5f0b9ed | ||
|
|
7c13727978 | ||
|
|
2dba8b6496 | ||
|
|
2dadd4e064 | ||
|
|
a60ca62eba | ||
|
|
674ffb6bb2 | ||
|
|
5fa0fc037c | ||
|
|
8a537b8204 | ||
|
|
6e25f13e06 | ||
|
|
df8f6b1cb0 | ||
|
|
6050a9a7ac | ||
|
|
0abd9436ad | ||
|
|
af159f5b97 | ||
|
|
a657c5622e | ||
|
|
6f216cd916 | ||
|
|
8bf1864335 | ||
|
|
8931739e97 | ||
|
|
ab46cf7b2f | ||
|
|
d115714a9f | ||
|
|
e787abd3f3 | ||
|
|
1c0fe66944 | ||
|
|
148d18565f | ||
|
|
264d586863 | ||
|
|
76bee65475 | ||
|
|
8dac49548c | ||
|
|
5c5d204d15 |
@@ -2,4 +2,3 @@ language: ruby
|
|||||||
rvm:
|
rvm:
|
||||||
- 2.0.0
|
- 2.0.0
|
||||||
- 1.9.3
|
- 1.9.3
|
||||||
- 1.8.7
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
#1.0.0
|
||||||
|
* Removed support for Ruby 1.8.7
|
||||||
|
* Added a version command
|
||||||
|
|
||||||
# 0.9.8
|
# 0.9.8
|
||||||
* Introduce new commands
|
* Introduce new commands
|
||||||
* `homesick cd`
|
* `homesick cd`
|
||||||
|
|||||||
6
Gemfile
6
Gemfile
@@ -1,3 +1,4 @@
|
|||||||
|
require 'rbconfig'
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
# Add dependencies required to use your gem here.
|
# Add dependencies required to use your gem here.
|
||||||
@@ -14,8 +15,11 @@ group :development do
|
|||||||
gem "jeweler", ">= 1.6.2"
|
gem "jeweler", ">= 1.6.2"
|
||||||
gem "rcov", :platforms => :mri_18
|
gem "rcov", :platforms => :mri_18
|
||||||
gem "simplecov", :platforms => :mri_19
|
gem "simplecov", :platforms => :mri_19
|
||||||
gem "test-construct"
|
gem "test_construct"
|
||||||
gem "capture-output", "~> 1.0.0"
|
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'
|
if RUBY_VERSION >= '1.9.2'
|
||||||
gem "rubocop"
|
gem "rubocop"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
guard :rspec do
|
guard :rspec, :cmd => 'bundle exec rspec' do
|
||||||
watch(%r{^spec/.+_spec\.rb$})
|
watch(%r{^spec/.+_spec\.rb$})
|
||||||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
||||||
watch(%r{^lib/homesick/.*\.rb}) { "spec" }
|
watch(%r{^lib/homesick/.*\.rb}) { "spec" }
|
||||||
watch('spec/spec_helper.rb') { "spec" }
|
watch('spec/spec_helper.rb') { "spec" }
|
||||||
|
|
||||||
notification :tmux, display_message: true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
# homesick
|
# homesick
|
||||||
|
|
||||||
|
[](http://badge.fury.io/rb/homesick)
|
||||||
[](https://travis-ci.org/technicalpickles/homesick)
|
[](https://travis-ci.org/technicalpickles/homesick)
|
||||||
|
[](https://gemnasium.com/technicalpickles/homesick)
|
||||||
|
[](https://codeclimate.com/github/technicalpickles/homesick)
|
||||||
|
|
||||||
Your home directory is your castle. Don't leave your dotfiles behind.
|
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
|
homesick symlink 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
|
||||||
|
|
||||||
homesick unlink pickled-vim
|
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:
|
If you're not sure what castles you have around, you can easily list them:
|
||||||
|
|
||||||
homesick list
|
homesick list
|
||||||
@@ -60,6 +68,10 @@ Not sure what else homesick has up its sleeve? There's always the built in help:
|
|||||||
|
|
||||||
homesick help
|
homesick help
|
||||||
|
|
||||||
|
If you ever want to see what version of homesick you have type:
|
||||||
|
|
||||||
|
homesick version|-v|--version
|
||||||
|
|
||||||
## .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 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
|
`-- .emacs.d
|
||||||
`-- elisp
|
`-- elisp
|
||||||
|
|
||||||
|
## Supported Ruby Versions
|
||||||
|
|
||||||
|
Homesick is tested on the following Ruby versions:
|
||||||
|
|
||||||
|
* 1.9.3
|
||||||
|
* 2.0.0
|
||||||
|
|
||||||
## Note on Patches/Pull Requests
|
## Note on Patches/Pull Requests
|
||||||
|
|
||||||
* Fork the project.
|
* Fork the project.
|
||||||
|
|||||||
3
Rakefile
3
Rakefile
@@ -1,5 +1,6 @@
|
|||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'bundler'
|
require 'bundler'
|
||||||
|
require_relative 'lib/homesick/version'
|
||||||
begin
|
begin
|
||||||
Bundler.setup(:default, :development)
|
Bundler.setup(:default, :development)
|
||||||
rescue Bundler::BundlerError => e
|
rescue Bundler::BundlerError => e
|
||||||
@@ -23,7 +24,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.7"
|
gem.version = Homesick::Version::STRING
|
||||||
gem.license = "MIT"
|
gem.license = "MIT"
|
||||||
# Have dependencies? Add them to Gemfile
|
# Have dependencies? Add them to Gemfile
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +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.0.0 ruby lib
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "homesick"
|
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.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.authors = ["Joshua Nichols", "Yusuke Murata"]
|
s.authors = ["Joshua Nichols", "Yusuke Murata"]
|
||||||
s.date = "2013-12-31"
|
s.date = "2014-01-16"
|
||||||
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 = "\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.email = ["josh@technicalpickles.com", "info@muratayusuke.com"]
|
||||||
s.executables = ["homesick"]
|
s.executables = ["homesick"]
|
||||||
s.extra_rdoc_files = [
|
s.extra_rdoc_files = [
|
||||||
@@ -24,6 +25,7 @@ Gem::Specification.new do |s|
|
|||||||
".travis.yml",
|
".travis.yml",
|
||||||
"ChangeLog.markdown",
|
"ChangeLog.markdown",
|
||||||
"Gemfile",
|
"Gemfile",
|
||||||
|
"Guardfile",
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
"README.markdown",
|
"README.markdown",
|
||||||
"Rakefile",
|
"Rakefile",
|
||||||
@@ -32,6 +34,7 @@ Gem::Specification.new do |s|
|
|||||||
"lib/homesick.rb",
|
"lib/homesick.rb",
|
||||||
"lib/homesick/actions.rb",
|
"lib/homesick/actions.rb",
|
||||||
"lib/homesick/shell.rb",
|
"lib/homesick/shell.rb",
|
||||||
|
"lib/homesick/version.rb",
|
||||||
"spec/homesick_spec.rb",
|
"spec/homesick_spec.rb",
|
||||||
"spec/spec.opts",
|
"spec/spec.opts",
|
||||||
"spec/spec_helper.rb"
|
"spec/spec_helper.rb"
|
||||||
@@ -39,39 +42,54 @@ Gem::Specification.new do |s|
|
|||||||
s.homepage = "http://github.com/technicalpickles/homesick"
|
s.homepage = "http://github.com/technicalpickles/homesick"
|
||||||
s.licenses = ["MIT"]
|
s.licenses = ["MIT"]
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
s.rubygems_version = "1.8.23"
|
s.rubygems_version = "2.1.11"
|
||||||
s.summary = "A man's home is his castle. Never leave your dotfiles behind."
|
s.summary = "Your home directory is your castle. Don't 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 = 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>, [">= 0.14.0"])
|
||||||
s.add_development_dependency(%q<rake>, [">= 0.8.7"])
|
s.add_development_dependency(%q<rake>, [">= 0.8.7"])
|
||||||
s.add_development_dependency(%q<rspec>, ["~> 2.10"])
|
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<jeweler>, [">= 1.6.2"])
|
||||||
s.add_development_dependency(%q<rcov>, [">= 0"])
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
||||||
s.add_development_dependency(%q<simplecov>, [">= 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"])
|
s.add_development_dependency(%q<rubocop>, [">= 0"])
|
||||||
else
|
else
|
||||||
s.add_dependency(%q<thor>, [">= 0.14.0"])
|
s.add_dependency(%q<thor>, [">= 0.14.0"])
|
||||||
s.add_dependency(%q<rake>, [">= 0.8.7"])
|
s.add_dependency(%q<rake>, [">= 0.8.7"])
|
||||||
s.add_dependency(%q<rspec>, ["~> 2.10"])
|
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<jeweler>, [">= 1.6.2"])
|
||||||
s.add_dependency(%q<rcov>, [">= 0"])
|
s.add_dependency(%q<rcov>, [">= 0"])
|
||||||
s.add_dependency(%q<simplecov>, [">= 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"])
|
s.add_dependency(%q<rubocop>, [">= 0"])
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
s.add_dependency(%q<thor>, [">= 0.14.0"])
|
s.add_dependency(%q<thor>, [">= 0.14.0"])
|
||||||
s.add_dependency(%q<rake>, [">= 0.8.7"])
|
s.add_dependency(%q<rake>, [">= 0.8.7"])
|
||||||
s.add_dependency(%q<rspec>, ["~> 2.10"])
|
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<jeweler>, [">= 1.6.2"])
|
||||||
s.add_dependency(%q<rcov>, [">= 0"])
|
s.add_dependency(%q<rcov>, [">= 0"])
|
||||||
s.add_dependency(%q<simplecov>, [">= 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"])
|
s.add_dependency(%q<rubocop>, [">= 0"])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ require 'thor'
|
|||||||
class Homesick < Thor
|
class Homesick < Thor
|
||||||
autoload :Shell, 'homesick/shell'
|
autoload :Shell, 'homesick/shell'
|
||||||
autoload :Actions, 'homesick/actions'
|
autoload :Actions, 'homesick/actions'
|
||||||
|
autoload :Version, 'homesick/version'
|
||||||
|
|
||||||
include Thor::Actions
|
include Thor::Actions
|
||||||
include Homesick::Actions
|
include Homesick::Actions
|
||||||
|
include Homesick::Version
|
||||||
|
|
||||||
add_runtime_options!
|
add_runtime_options!
|
||||||
|
|
||||||
@@ -15,6 +17,9 @@ class Homesick < Thor
|
|||||||
|
|
||||||
DEFAULT_CASTLE_NAME = 'dotfiles'
|
DEFAULT_CASTLE_NAME = 'dotfiles'
|
||||||
|
|
||||||
|
map '-v' => :version
|
||||||
|
map '--version' => :version
|
||||||
|
|
||||||
def initialize(args = [], options = {}, config = {})
|
def initialize(args = [], options = {}, config = {})
|
||||||
super
|
super
|
||||||
self.shell = Homesick::Shell.new
|
self.shell = Homesick::Shell.new
|
||||||
@@ -264,6 +269,11 @@ class Homesick < Thor
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'version', 'Display the current version of homesick'
|
||||||
|
def version
|
||||||
|
say Homesick::Version::STRING
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def home_dir
|
def home_dir
|
||||||
|
|||||||
10
lib/homesick/version.rb
Normal file
10
lib/homesick/version.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# -*- encoding : utf-8 -*-
|
||||||
|
class Homesick
|
||||||
|
module Version
|
||||||
|
MAJOR = 1
|
||||||
|
MINOR = 0
|
||||||
|
PATCH = 0
|
||||||
|
|
||||||
|
STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -23,6 +23,7 @@ describe 'homesick' do
|
|||||||
|
|
||||||
expect($stdout).to receive(:print)
|
expect($stdout).to receive(:print)
|
||||||
expect($stdin).to receive(:gets).and_return('y')
|
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
|
homesick.clone local_repo
|
||||||
|
|
||||||
castles.join('some_repo').join('testing').should exist
|
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
|
it 'should clone git repo like file:///path/to.git' do
|
||||||
bare_repo = File.join(create_construct.to_s, 'dotfiles.git')
|
bare_repo = File.join(create_construct.to_s, 'dotfiles.git')
|
||||||
system "git init --bare #{bare_repo} >/dev/null 2>&1"
|
system "git init --bare #{bare_repo} >/dev/null 2>&1"
|
||||||
|
# Capture stderr to suppress message about cloning an empty repo.
|
||||||
homesick.clone "file://#{bare_repo}"
|
Capture.stderr do
|
||||||
|
homesick.clone "file://#{bare_repo}"
|
||||||
|
end
|
||||||
File.directory?(File.join(home.to_s, '.homesick/repos/dotfiles')).should be_true
|
File.directory?(File.join(home.to_s, '.homesick/repos/dotfiles')).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -116,6 +119,7 @@ describe 'homesick' do
|
|||||||
file << "File.open(Dir.pwd + '/testing', 'w') { |f| f.print 'testing' }"
|
file << "File.open(Dir.pwd + '/testing', 'w') { |f| f.print 'testing' }"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
expect_any_instance_of(Thor::Shell::Basic).to receive(:say_status).with('eval', kind_of(Pathname))
|
||||||
homesick.rc castle
|
homesick.rc castle
|
||||||
|
|
||||||
castle.join('testing').should exist
|
castle.join('testing').should exist
|
||||||
@@ -133,6 +137,7 @@ describe 'homesick' do
|
|||||||
file << "File.open(Dir.pwd + '/testing', 'w') { |f| f.print 'testing' }"
|
file << "File.open(Dir.pwd + '/testing', 'w') { |f| f.print 'testing' }"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
expect_any_instance_of(Thor::Shell::Basic).to receive(:say_status).with('eval skip', /not evaling.+/, :blue)
|
||||||
homesick.rc castle
|
homesick.rc castle
|
||||||
|
|
||||||
castle.join('testing').should_not exist
|
castle.join('testing').should_not exist
|
||||||
@@ -358,9 +363,26 @@ describe 'homesick' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe 'diff' do
|
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
|
end
|
||||||
|
|
||||||
describe 'show_path' do
|
describe 'show_path' do
|
||||||
@@ -374,19 +396,43 @@ describe 'homesick' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe 'pull' do
|
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
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'push' do
|
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
|
end
|
||||||
|
|
||||||
describe 'track' do
|
describe 'track' do
|
||||||
@@ -555,7 +601,7 @@ describe 'homesick' do
|
|||||||
|
|
||||||
it "returns an error message when the $EDITOR environment variable is not set" 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.
|
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)
|
expect { homesick.open "castle_repo" }.to raise_error(SystemExit)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -565,4 +611,11 @@ describe 'homesick' do
|
|||||||
expect { homesick.open "castle_repo" }.to raise_error(SystemExit)
|
expect { homesick.open "castle_repo" }.to raise_error(SystemExit)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|||||||
require 'homesick'
|
require 'homesick'
|
||||||
require 'rspec'
|
require 'rspec'
|
||||||
require 'rspec/autorun'
|
require 'rspec/autorun'
|
||||||
require 'construct'
|
require 'test_construct'
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.include Construct::Helpers
|
config.include TestConstruct::Helpers
|
||||||
|
|
||||||
config.before { ENV['HOME'] = home.to_s }
|
config.before { ENV['HOME'] = home.to_s }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user