homesick 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/ChangeLog.markdown +6 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +25 -23
- data/README.markdown +12 -0
- data/Rakefile +3 -3
- data/homesick.gemspec +15 -14
- data/lib/homesick.rb +38 -7
- data/lib/homesick/actions.rb +18 -3
- data/spec/homesick_spec.rb +95 -68
- data/spec/spec_helper.rb +15 -6
- metadata +119 -117
data/.travis.yml
ADDED
data/ChangeLog.markdown
CHANGED
data/Gemfile
CHANGED
@@ -6,10 +6,10 @@ gem "thor", ">= 0.14.0"
|
|
6
6
|
# Add dependencies to develop your gem here.
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
8
|
group :development do
|
9
|
-
gem "rake"
|
10
|
-
gem "rspec", "~> 2.
|
9
|
+
gem "rake", "~> 0.8.7"
|
10
|
+
gem "rspec", "~> 2.10"
|
11
11
|
gem "jeweler", ">= 1.6.2"
|
12
|
-
gem "rcov",
|
12
|
+
gem "rcov", :platforms => :mri_18
|
13
|
+
gem "simplecov", :platforms => :mri_19
|
13
14
|
gem "test-construct"
|
14
|
-
gem "ruby-debug"
|
15
15
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,40 +1,42 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
diff-lcs (1.1.2)
|
4
|
+
diff-lcs (1.1.3)
|
6
5
|
git (1.2.5)
|
7
|
-
jeweler (1.
|
6
|
+
jeweler (1.8.3)
|
8
7
|
bundler (~> 1.0)
|
9
8
|
git (>= 1.2.5)
|
10
9
|
rake
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
rspec
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
10
|
+
rdoc
|
11
|
+
json (1.7.3)
|
12
|
+
multi_json (1.3.6)
|
13
|
+
rake (0.8.7)
|
14
|
+
rcov (1.0.0)
|
15
|
+
rdoc (3.12)
|
16
|
+
json (~> 1.4)
|
17
|
+
rspec (2.10.0)
|
18
|
+
rspec-core (~> 2.10.0)
|
19
|
+
rspec-expectations (~> 2.10.0)
|
20
|
+
rspec-mocks (~> 2.10.0)
|
21
|
+
rspec-core (2.10.1)
|
22
|
+
rspec-expectations (2.10.0)
|
23
|
+
diff-lcs (~> 1.1.3)
|
24
|
+
rspec-mocks (2.10.1)
|
25
|
+
simplecov (0.6.4)
|
26
|
+
multi_json (~> 1.0)
|
27
|
+
simplecov-html (~> 0.5.3)
|
28
|
+
simplecov-html (0.5.3)
|
27
29
|
test-construct (1.2.0)
|
28
|
-
thor (0.
|
30
|
+
thor (0.15.2)
|
29
31
|
|
30
32
|
PLATFORMS
|
31
33
|
ruby
|
32
34
|
|
33
35
|
DEPENDENCIES
|
34
36
|
jeweler (>= 1.6.2)
|
35
|
-
rake
|
37
|
+
rake (~> 0.8.7)
|
36
38
|
rcov
|
37
|
-
rspec (~> 2.
|
38
|
-
|
39
|
+
rspec (~> 2.10)
|
40
|
+
simplecov
|
39
41
|
test-construct
|
40
42
|
thor (>= 0.14.0)
|
data/README.markdown
CHANGED
@@ -33,6 +33,18 @@ If you're not sure what castles you have around, you can easily list them:
|
|
33
33
|
|
34
34
|
homesick list
|
35
35
|
|
36
|
+
To pull your castle (or all castles):
|
37
|
+
|
38
|
+
homesick pull --all|CASTLE
|
39
|
+
|
40
|
+
To commit your castle's changes:
|
41
|
+
|
42
|
+
homesick commit CASTLE
|
43
|
+
|
44
|
+
To push your castle:
|
45
|
+
|
46
|
+
homesick push CASTLE
|
47
|
+
|
36
48
|
Not sure what else homesick has up its sleeve? There's always the built in help:
|
37
49
|
|
38
50
|
homesick help
|
data/Rakefile
CHANGED
@@ -19,10 +19,10 @@ Jeweler::Tasks.new do |gem|
|
|
19
19
|
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.
|
20
20
|
|
21
21
|
}
|
22
|
-
gem.email = "josh@technicalpickles.com"
|
22
|
+
gem.email = ["josh@technicalpickles.com", "info@muratayusuke.com"]
|
23
23
|
gem.homepage = "http://github.com/technicalpickles/homesick"
|
24
|
-
gem.authors = ["Joshua Nichols"]
|
25
|
-
gem.version = "0.
|
24
|
+
gem.authors = ["Joshua Nichols", "Yusuke Murata"]
|
25
|
+
gem.version = "0.8.0"
|
26
26
|
gem.license = "MIT"
|
27
27
|
# Have dependencies? Add them to Gemfile
|
28
28
|
|
data/homesick.gemspec
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "homesick"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.8.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Joshua Nichols"]
|
12
|
-
s.date = "
|
11
|
+
s.authors = ["Joshua Nichols", "Yusuke Murata"]
|
12
|
+
s.date = "2013-04-05"
|
13
13
|
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 "
|
14
|
-
s.email = "josh@technicalpickles.com"
|
14
|
+
s.email = ["josh@technicalpickles.com", "info@muratayusuke.com"]
|
15
15
|
s.executables = ["homesick"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"ChangeLog.markdown",
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
23
|
".rspec",
|
24
|
+
".travis.yml",
|
24
25
|
"ChangeLog.markdown",
|
25
26
|
"Gemfile",
|
26
27
|
"Gemfile.lock",
|
@@ -39,7 +40,7 @@ Gem::Specification.new do |s|
|
|
39
40
|
s.homepage = "http://github.com/technicalpickles/homesick"
|
40
41
|
s.licenses = ["MIT"]
|
41
42
|
s.require_paths = ["lib"]
|
42
|
-
s.rubygems_version = "1.8.
|
43
|
+
s.rubygems_version = "1.8.24"
|
43
44
|
s.summary = "A man's home is his castle. Never leave your dotfiles behind."
|
44
45
|
|
45
46
|
if s.respond_to? :specification_version then
|
@@ -47,29 +48,29 @@ Gem::Specification.new do |s|
|
|
47
48
|
|
48
49
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
50
|
s.add_runtime_dependency(%q<thor>, [">= 0.14.0"])
|
50
|
-
s.add_development_dependency(%q<rake>, ["
|
51
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.
|
51
|
+
s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
|
52
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.10"])
|
52
53
|
s.add_development_dependency(%q<jeweler>, [">= 1.6.2"])
|
53
54
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
54
56
|
s.add_development_dependency(%q<test-construct>, [">= 0"])
|
55
|
-
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
56
57
|
else
|
57
58
|
s.add_dependency(%q<thor>, [">= 0.14.0"])
|
58
|
-
s.add_dependency(%q<rake>, ["
|
59
|
-
s.add_dependency(%q<rspec>, ["~> 2.
|
59
|
+
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
60
|
+
s.add_dependency(%q<rspec>, ["~> 2.10"])
|
60
61
|
s.add_dependency(%q<jeweler>, [">= 1.6.2"])
|
61
62
|
s.add_dependency(%q<rcov>, [">= 0"])
|
63
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
62
64
|
s.add_dependency(%q<test-construct>, [">= 0"])
|
63
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
64
65
|
end
|
65
66
|
else
|
66
67
|
s.add_dependency(%q<thor>, [">= 0.14.0"])
|
67
|
-
s.add_dependency(%q<rake>, ["
|
68
|
-
s.add_dependency(%q<rspec>, ["~> 2.
|
68
|
+
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
69
|
+
s.add_dependency(%q<rspec>, ["~> 2.10"])
|
69
70
|
s.add_dependency(%q<jeweler>, [">= 1.6.2"])
|
70
71
|
s.add_dependency(%q<rcov>, [">= 0"])
|
72
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
71
73
|
s.add_dependency(%q<test-construct>, [">= 0"])
|
72
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
data/lib/homesick.rb
CHANGED
@@ -22,7 +22,7 @@ class Homesick < Thor
|
|
22
22
|
destination = nil
|
23
23
|
if File.exist?(uri)
|
24
24
|
uri = Pathname.new(uri).expand_path
|
25
|
-
if uri.to_s.start_with?(repos_dir)
|
25
|
+
if uri.to_s.start_with?(repos_dir.to_s)
|
26
26
|
raise "Castle already cloned to #{uri}"
|
27
27
|
end
|
28
28
|
|
@@ -32,7 +32,7 @@ class Homesick < Thor
|
|
32
32
|
elsif uri =~ GITHUB_NAME_REPO_PATTERN
|
33
33
|
destination = Pathname.new($1)
|
34
34
|
git_clone "git://github.com/#{$1}.git", :destination => destination
|
35
|
-
elsif uri =~ /\/([^\/]
|
35
|
+
elsif uri =~ /\/([^\/]*?)(\.git)?\Z/
|
36
36
|
destination = Pathname.new($1)
|
37
37
|
git_clone uri
|
38
38
|
elsif uri =~ /[^:]+:([^:]+)(\.git)?\Z/
|
@@ -64,7 +64,7 @@ class Homesick < Thor
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
desc "pull
|
67
|
+
desc "pull CASTLE", "Update the specified castle"
|
68
68
|
method_option :all, :type => :boolean, :default => false, :required => false, :desc => "Update all cloned castles"
|
69
69
|
def pull(name="")
|
70
70
|
if options[:all]
|
@@ -78,12 +78,25 @@ class Homesick < Thor
|
|
78
78
|
|
79
79
|
end
|
80
80
|
|
81
|
-
desc "
|
81
|
+
desc "commit CASTLE", "Commit the specified castle's changes"
|
82
|
+
def commit(name)
|
83
|
+
commit_castle name
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
desc "push CASTLE", "Push the specified castle"
|
88
|
+
def push(name)
|
89
|
+
push_castle name
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
desc "symlink CASTLE", "Symlinks all dotfiles from the specified castle"
|
94
|
+
method_option :force, :default => false, :desc => "Overwrite existing conflicting symlinks without prompting."
|
82
95
|
def symlink(name)
|
83
96
|
check_castle_existance(name, "symlink")
|
84
97
|
|
85
98
|
inside castle_dir(name) do
|
86
|
-
files = Pathname.glob('
|
99
|
+
files = Pathname.glob('{.*,*}').reject{|a| [".",".."].include?(a.to_s)}
|
87
100
|
files.each do |path|
|
88
101
|
absolute_path = path.expand_path
|
89
102
|
|
@@ -101,7 +114,7 @@ class Homesick < Thor
|
|
101
114
|
castle = Pathname.new(castle)
|
102
115
|
file = Pathname.new(file)
|
103
116
|
check_castle_existance(castle, 'track')
|
104
|
-
|
117
|
+
|
105
118
|
absolute_path = file.expand_path
|
106
119
|
castle_path = castle_dir(castle)
|
107
120
|
mv absolute_path, castle_path
|
@@ -111,12 +124,16 @@ class Homesick < Thor
|
|
111
124
|
home_path = home_dir + file
|
112
125
|
ln_s absolute_path, home_path
|
113
126
|
end
|
127
|
+
|
128
|
+
inside castle_path do
|
129
|
+
git_add absolute_path
|
130
|
+
end
|
114
131
|
end
|
115
132
|
|
116
133
|
desc "list", "List cloned castles"
|
117
134
|
def list
|
118
135
|
inside_each_castle do |castle|
|
119
|
-
say_status castle.relative_path_from(repos_dir), `git config remote.origin.url`.chomp, :cyan
|
136
|
+
say_status castle.relative_path_from(repos_dir).to_s, `git config remote.origin.url`.chomp, :cyan
|
120
137
|
end
|
121
138
|
end
|
122
139
|
|
@@ -188,4 +205,18 @@ class Homesick < Thor
|
|
188
205
|
git_submodule_update
|
189
206
|
end
|
190
207
|
end
|
208
|
+
|
209
|
+
def commit_castle(castle)
|
210
|
+
check_castle_existance(castle, "commit")
|
211
|
+
inside repos_dir.join(castle) do
|
212
|
+
git_commit_all
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
def push_castle(castle)
|
217
|
+
check_castle_existance(castle, "push")
|
218
|
+
inside repos_dir.join(castle) do
|
219
|
+
git_push
|
220
|
+
end
|
221
|
+
end
|
191
222
|
end
|
data/lib/homesick/actions.rb
CHANGED
@@ -4,7 +4,7 @@ class Homesick
|
|
4
4
|
def git_clone(repo, config = {})
|
5
5
|
config ||= {}
|
6
6
|
destination = config[:destination] || begin
|
7
|
-
repo =~ /([^\/]+)
|
7
|
+
repo =~ /([^\/]+)(?:\.git)?$/
|
8
8
|
$1
|
9
9
|
end
|
10
10
|
|
@@ -51,7 +51,7 @@ class Homesick
|
|
51
51
|
|
52
52
|
def git_submodule_update(config = {})
|
53
53
|
say_status 'git submodule', 'update', :green unless options[:quiet]
|
54
|
-
system "git submodule --quiet update >/dev/null 2>&1" unless options[:pretend]
|
54
|
+
system "git submodule --quiet update --init --recursive >/dev/null 2>&1" unless options[:pretend]
|
55
55
|
end
|
56
56
|
|
57
57
|
def git_pull(config = {})
|
@@ -59,6 +59,21 @@ class Homesick
|
|
59
59
|
system "git pull --quiet" unless options[:pretend]
|
60
60
|
end
|
61
61
|
|
62
|
+
def git_push(config = {})
|
63
|
+
say_status 'git push', '', :green unless options[:quiet]
|
64
|
+
system "git push" unless options[:pretend]
|
65
|
+
end
|
66
|
+
|
67
|
+
def git_commit_all(config = {})
|
68
|
+
say_status 'git commit all', '', :green unless options[:quiet]
|
69
|
+
system "git commit -v -a" unless options[:pretend]
|
70
|
+
end
|
71
|
+
|
72
|
+
def git_add(file, config = {})
|
73
|
+
say_status 'git add file', '', :green unless options[:quiet]
|
74
|
+
system "git add #{file}" unless options[:pretend]
|
75
|
+
end
|
76
|
+
|
62
77
|
def mv(source, destination, config = {})
|
63
78
|
source = Pathname.new(source)
|
64
79
|
destination = Pathname.new(destination + source.basename)
|
@@ -86,7 +101,7 @@ class Homesick
|
|
86
101
|
say_status :conflict, "#{destination} exists and points to #{destination.readlink}", :red unless options[:quiet]
|
87
102
|
|
88
103
|
if options[:force] || shell.file_collision(destination) { source }
|
89
|
-
system "ln -
|
104
|
+
system "ln -nsf #{source} #{destination}" unless options[:pretend]
|
90
105
|
end
|
91
106
|
end
|
92
107
|
elsif destination.exist?
|
data/spec/homesick_spec.rb
CHANGED
@@ -1,116 +1,136 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "homesick" do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
let(:home) { create_construct }
|
5
|
+
after { home.destroy! }
|
6
|
+
|
7
|
+
let(:castles) { home.directory(".homesick/repos") }
|
8
|
+
|
9
|
+
let(:homesick) { Homesick.new }
|
10
|
+
|
11
|
+
before { homesick.stub!(:repos_dir).and_return(castles) }
|
7
12
|
|
8
13
|
describe "clone" do
|
9
14
|
context "of a file" do
|
10
15
|
it "should symlink existing directories" do
|
11
16
|
somewhere = create_construct
|
12
|
-
somewhere.directory('wtf')
|
13
|
-
wtf = somewhere + 'wtf'
|
17
|
+
local_repo = somewhere.directory('wtf')
|
14
18
|
|
15
|
-
|
19
|
+
homesick.clone local_repo
|
16
20
|
|
17
|
-
|
21
|
+
castles.join("wtf").readlink.should == local_repo
|
18
22
|
end
|
19
23
|
|
20
24
|
context "when it exists in a repo directory" do
|
21
25
|
before do
|
22
|
-
|
23
|
-
@existing_dir =
|
24
|
-
@homesick.stub!(:repos_dir).and_return(@repos_dir)
|
26
|
+
existing_castle = given_castle("existing_castle")
|
27
|
+
@existing_dir = existing_castle.parent
|
25
28
|
end
|
26
29
|
|
27
30
|
it "should not symlink" do
|
28
|
-
|
31
|
+
homesick.should_not_receive(:git_clone)
|
29
32
|
|
30
|
-
|
33
|
+
homesick.clone @existing_dir.to_s rescue nil
|
31
34
|
end
|
32
35
|
|
33
36
|
it "should raise an error" do
|
34
|
-
|
35
|
-
lambda {
|
36
|
-
@homesick.clone @existing_castle.to_s
|
37
|
-
}.should raise_error(/already cloned/i)
|
37
|
+
expect { homesick.clone @existing_dir.to_s }.to raise_error(/already cloned/i)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should clone git repo like git://host/path/to.git" do
|
43
|
-
|
43
|
+
homesick.should_receive(:git_clone).with('git://github.com/technicalpickles/pickled-vim.git')
|
44
44
|
|
45
|
-
|
45
|
+
homesick.clone "git://github.com/technicalpickles/pickled-vim.git"
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should clone git repo like git@host:path/to.git" do
|
49
|
-
|
49
|
+
homesick.should_receive(:git_clone).with('git@github.com:technicalpickles/pickled-vim.git')
|
50
50
|
|
51
|
-
|
51
|
+
homesick.clone 'git@github.com:technicalpickles/pickled-vim.git'
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should clone git repo like http://host/path/to.git" do
|
55
|
-
|
55
|
+
homesick.should_receive(:git_clone).with('http://github.com/technicalpickles/pickled-vim.git')
|
56
56
|
|
57
|
-
|
57
|
+
homesick.clone 'http://github.com/technicalpickles/pickled-vim.git'
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should clone git repo like http://host/path/to" do
|
61
|
-
|
61
|
+
homesick.should_receive(:git_clone).with('http://github.com/technicalpickles/pickled-vim')
|
62
62
|
|
63
|
-
|
63
|
+
homesick.clone 'http://github.com/technicalpickles/pickled-vim'
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should clone git repo like host-alias:repos.git" do
|
67
|
-
|
67
|
+
homesick.should_receive(:git_clone).with('gitolite:pickled-vim.git')
|
68
68
|
|
69
|
-
|
69
|
+
homesick.clone 'gitolite:pickled-vim.git'
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should not try to clone a malformed uri like malformed" do
|
73
|
-
|
73
|
+
homesick.should_not_receive(:git_clone)
|
74
74
|
|
75
|
-
|
75
|
+
homesick.clone 'malformed' rescue nil
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should throw an exception when trying to clone a malformed uri like malformed" do
|
79
|
-
|
80
|
-
@homesick.clone 'malformed'
|
81
|
-
}.should raise_error
|
79
|
+
expect { homesick.clone 'malformed' }.to raise_error
|
82
80
|
end
|
83
81
|
|
84
82
|
it "should clone a github repo" do
|
85
|
-
|
83
|
+
homesick.should_receive(:git_clone).with('git://github.com/wfarr/dotfiles.git', :destination => Pathname.new('wfarr/dotfiles'))
|
86
84
|
|
87
|
-
|
85
|
+
homesick.clone "wfarr/dotfiles"
|
88
86
|
end
|
89
87
|
end
|
90
88
|
|
91
|
-
describe "
|
89
|
+
describe "symlink" do
|
90
|
+
let(:castle) { given_castle("glencairn") }
|
92
91
|
|
93
|
-
|
94
|
-
|
95
|
-
@user_dir.directory '.homesick/repos' do |repos_dir|
|
96
|
-
repos_dir.directory 'zomg' do |zomg|
|
97
|
-
Dir.chdir do
|
98
|
-
system "git init >/dev/null 2>&1"
|
99
|
-
system "git remote add origin git://github.com/technicalpickles/zomg.git >/dev/null 2>&1"
|
100
|
-
end
|
101
|
-
end
|
92
|
+
it "links dotfiles from a castle to the home folder" do
|
93
|
+
dotfile = castle.file(".some_dotfile")
|
102
94
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
@homesick.should_receive(:say_status).with("zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
|
111
|
-
@homesick.should_receive(:say_status).with("wtf/zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
|
95
|
+
homesick.symlink("glencairn")
|
96
|
+
|
97
|
+
home.join(".some_dotfile").readlink.should == dotfile
|
98
|
+
end
|
99
|
+
|
100
|
+
it "links non-dotfiles from a castle to the home folder" do
|
101
|
+
dotfile = castle.file("bin")
|
112
102
|
|
113
|
-
|
103
|
+
homesick.symlink("glencairn")
|
104
|
+
|
105
|
+
home.join("bin").readlink.should == dotfile
|
106
|
+
end
|
107
|
+
|
108
|
+
context "when forced" do
|
109
|
+
let(:homesick) { Homesick.new [], :force => true }
|
110
|
+
|
111
|
+
it "can override symlinks to directories" do
|
112
|
+
somewhere_else = create_construct
|
113
|
+
existing_dotdir_link = home.join(".vim")
|
114
|
+
FileUtils.ln_s somewhere_else, existing_dotdir_link
|
115
|
+
|
116
|
+
dotdir = castle.directory(".vim")
|
117
|
+
|
118
|
+
homesick.symlink("glencairn")
|
119
|
+
|
120
|
+
existing_dotdir_link.readlink.should == dotdir
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe "list" do
|
126
|
+
it "should say each castle in the castle directory" do
|
127
|
+
given_castle('zomg')
|
128
|
+
given_castle('zomg', 'wtf/zomg')
|
129
|
+
|
130
|
+
homesick.should_receive(:say_status).with("zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
|
131
|
+
homesick.should_receive(:say_status).with("wtf/zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
|
132
|
+
|
133
|
+
homesick.list
|
114
134
|
end
|
115
135
|
end
|
116
136
|
|
@@ -124,23 +144,30 @@ describe "homesick" do
|
|
124
144
|
|
125
145
|
end
|
126
146
|
|
147
|
+
describe "commit" do
|
148
|
+
|
149
|
+
xit "needs testing"
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "push" do
|
154
|
+
|
155
|
+
xit "needs testing"
|
156
|
+
|
157
|
+
end
|
158
|
+
|
127
159
|
describe "track" do
|
128
160
|
it "should move the tracked file into the castle" do
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
@homesick.should_receive(:mv).with(some_rc_file, castle_path)
|
142
|
-
@homesick.should_receive(:ln_s).with(castle_path + some_rc_file.basename, some_rc_file)
|
143
|
-
@homesick.track(some_rc_file.to_s, 'castle_repo')
|
161
|
+
castle = given_castle('castle_repo')
|
162
|
+
|
163
|
+
some_rc_file = home.file '.some_rc_file'
|
164
|
+
|
165
|
+
homesick.track(some_rc_file.to_s, 'castle_repo')
|
166
|
+
|
167
|
+
tracked_file = castle.join(".some_rc_file")
|
168
|
+
tracked_file.should exist
|
169
|
+
|
170
|
+
some_rc_file.readlink.should == tracked_file
|
144
171
|
end
|
145
172
|
end
|
146
173
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,15 +5,24 @@ require 'rspec'
|
|
5
5
|
require 'rspec/autorun'
|
6
6
|
require 'construct'
|
7
7
|
|
8
|
-
|
8
|
+
RSpec.configure do |config|
|
9
9
|
config.include Construct::Helpers
|
10
10
|
|
11
|
-
config.before
|
12
|
-
|
13
|
-
|
11
|
+
config.before { ENV['HOME'] = home.to_s }
|
12
|
+
|
13
|
+
config.before { silence! }
|
14
|
+
|
15
|
+
def silence!
|
16
|
+
homesick.stub(:say_status)
|
14
17
|
end
|
15
18
|
|
16
|
-
|
17
|
-
|
19
|
+
def given_castle(name, path=name)
|
20
|
+
castles.directory(path) do |castle|
|
21
|
+
Dir.chdir(castle) do
|
22
|
+
system "git init >/dev/null 2>&1"
|
23
|
+
system "git remote add origin git://github.com/technicalpickles/#{name}.git >/dev/null 2>&1"
|
24
|
+
return castle.directory("home")
|
25
|
+
end
|
26
|
+
end
|
18
27
|
end
|
19
28
|
end
|
metadata
CHANGED
@@ -1,139 +1,147 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: homesick
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
- 0
|
10
|
-
version: 0.7.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Joshua Nichols
|
9
|
+
- Yusuke Murata
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
13
|
+
date: 2013-04-05 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thor
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
23
18
|
none: false
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
hash: 39
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
- 14
|
31
|
-
- 0
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
32
22
|
version: 0.14.0
|
33
|
-
requirement: *id001
|
34
|
-
name: thor
|
35
23
|
type: :runtime
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
24
|
prerelease: false
|
38
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
26
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
- 0
|
46
|
-
version: "0"
|
47
|
-
requirement: *id002
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.14.0
|
31
|
+
- !ruby/object:Gem::Dependency
|
48
32
|
name: rake
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.8.7
|
49
39
|
type: :development
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
40
|
prerelease: false
|
52
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
42
|
none: false
|
54
|
-
requirements:
|
43
|
+
requirements:
|
55
44
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
|
59
|
-
- 2
|
60
|
-
- 1
|
61
|
-
- 0
|
62
|
-
version: 2.1.0
|
63
|
-
requirement: *id003
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.8.7
|
47
|
+
- !ruby/object:Gem::Dependency
|
64
48
|
name: rspec
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.10'
|
65
55
|
type: :development
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
56
|
prerelease: false
|
68
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
58
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
|
75
|
-
- 1
|
76
|
-
- 6
|
77
|
-
- 2
|
78
|
-
version: 1.6.2
|
79
|
-
requirement: *id004
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.10'
|
63
|
+
- !ruby/object:Gem::Dependency
|
80
64
|
name: jeweler
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.6.2
|
81
71
|
type: :development
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
72
|
prerelease: false
|
84
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
74
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
|
90
|
-
|
91
|
-
- 0
|
92
|
-
version: "0"
|
93
|
-
requirement: *id005
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 1.6.2
|
79
|
+
- !ruby/object:Gem::Dependency
|
94
80
|
name: rcov
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
95
87
|
type: :development
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
88
|
prerelease: false
|
98
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
90
|
none: false
|
100
|
-
requirements:
|
101
|
-
- -
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: simplecov
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
109
103
|
type: :development
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
104
|
prerelease: false
|
112
|
-
version_requirements:
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
106
|
none: false
|
114
|
-
requirements:
|
115
|
-
- -
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: test-construct
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
123
119
|
type: :development
|
124
|
-
|
125
|
-
|
126
|
-
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
description: ! "\n A man's home (directory) is his castle, so don't leave home
|
128
|
+
with out it.\n\n Homesick is sorta like rip, but for dotfiles. It uses git to
|
129
|
+
clone a repository containing dotfiles, and saves them in ~/.homesick. It then allows
|
130
|
+
you to symlink all the dotfiles into place with a single command. \n\n "
|
131
|
+
email:
|
132
|
+
- josh@technicalpickles.com
|
133
|
+
- info@muratayusuke.com
|
134
|
+
executables:
|
127
135
|
- homesick
|
128
136
|
extensions: []
|
129
|
-
|
130
|
-
extra_rdoc_files:
|
137
|
+
extra_rdoc_files:
|
131
138
|
- ChangeLog.markdown
|
132
139
|
- LICENSE
|
133
140
|
- README.markdown
|
134
|
-
files:
|
141
|
+
files:
|
135
142
|
- .document
|
136
143
|
- .rspec
|
144
|
+
- .travis.yml
|
137
145
|
- ChangeLog.markdown
|
138
146
|
- Gemfile
|
139
147
|
- Gemfile.lock
|
@@ -149,37 +157,31 @@ files:
|
|
149
157
|
- spec/spec.opts
|
150
158
|
- spec/spec_helper.rb
|
151
159
|
homepage: http://github.com/technicalpickles/homesick
|
152
|
-
licenses:
|
160
|
+
licenses:
|
153
161
|
- MIT
|
154
162
|
post_install_message:
|
155
163
|
rdoc_options: []
|
156
|
-
|
157
|
-
require_paths:
|
164
|
+
require_paths:
|
158
165
|
- lib
|
159
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
167
|
none: false
|
161
|
-
requirements:
|
162
|
-
- -
|
163
|
-
- !ruby/object:Gem::Version
|
164
|
-
|
165
|
-
segments:
|
168
|
+
requirements:
|
169
|
+
- - ! '>='
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
172
|
+
segments:
|
166
173
|
- 0
|
167
|
-
|
168
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
|
+
hash: 806513071
|
175
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
176
|
none: false
|
170
|
-
requirements:
|
171
|
-
- -
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
|
174
|
-
segments:
|
175
|
-
- 0
|
176
|
-
version: "0"
|
177
|
+
requirements:
|
178
|
+
- - ! '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
177
181
|
requirements: []
|
178
|
-
|
179
182
|
rubyforge_project:
|
180
|
-
rubygems_version: 1.8.
|
183
|
+
rubygems_version: 1.8.24
|
181
184
|
signing_key:
|
182
185
|
specification_version: 3
|
183
186
|
summary: A man's home is his castle. Never leave your dotfiles behind.
|
184
187
|
test_files: []
|
185
|
-
|