homesick 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog.markdown +6 -0
- data/README.markdown +5 -1
- data/Rakefile +1 -1
- data/homesick.gemspec +2 -2
- data/lib/homesick.rb +45 -8
- data/lib/homesick/actions.rb +30 -0
- data/spec/homesick_spec.rb +11 -2
- metadata +38 -38
data/ChangeLog.markdown
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# 0.5.0
|
2
|
+
|
3
|
+
* Fixed listing of castles cloned using `homesick clone <github-user>/<github-repo>` (issue 3)
|
4
|
+
* Added `homesick pull <CASTLE>` for updating castles (thanks Jorge Dias!)
|
5
|
+
* Added a very basic `homesick generate <CASTLE>`
|
6
|
+
|
1
7
|
# 0.4.1
|
2
8
|
|
3
9
|
* Improved error message when a castle's home dir doesn't exist
|
data/README.markdown
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
A man's home (directory) is his castle, so don't leave home with out it.
|
4
4
|
|
5
|
-
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.
|
5
|
+
Homesick is sorta like [rip](http://github.com/defunkt/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.
|
6
6
|
|
7
7
|
We call a repository that is compatible with homesick to be a 'castle'. To act as a castle, a repository must be organized like so:
|
8
8
|
|
@@ -25,6 +25,10 @@ With the castle cloned, you can now link its contents into your home dir:
|
|
25
25
|
|
26
26
|
homesick symlink pickled-vim
|
27
27
|
|
28
|
+
If uou use the shorthand syntax for GitHub repositories in your clone, please note you will instead need to run:
|
29
|
+
|
30
|
+
homesick symlink technicalpickles/pickled-vim
|
31
|
+
|
28
32
|
If you're not sure what castles you have around, you can easily list them:
|
29
33
|
|
30
34
|
homesick list
|
data/Rakefile
CHANGED
@@ -22,7 +22,7 @@ Jeweler::Tasks.new do |gem|
|
|
22
22
|
gem.email = "josh@technicalpickles.com"
|
23
23
|
gem.homepage = "http://github.com/technicalpickles/homesick"
|
24
24
|
gem.authors = ["Joshua Nichols"]
|
25
|
-
gem.version = "0.
|
25
|
+
gem.version = "0.5.1"
|
26
26
|
# Have dependencies? Add them to Gemfile
|
27
27
|
|
28
28
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
data/homesick.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{homesick}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joshua Nichols"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-05-18}
|
13
13
|
s.default_executable = %q{homesick}
|
14
14
|
s.description = %q{
|
15
15
|
A man’s home (directory) is his castle, so don’t leave home with out it.
|
data/lib/homesick.rb
CHANGED
@@ -44,13 +44,20 @@ class Homesick < Thor
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
desc "pull NAME", "Update the specified castle"
|
48
|
+
def pull(name)
|
49
|
+
check_castle_existance(name, "pull")
|
50
|
+
|
51
|
+
inside repos_dir.join(name) do
|
52
|
+
git_pull
|
53
|
+
git_submodule_init
|
54
|
+
git_submodule_update
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
47
58
|
desc "symlink NAME", "Symlinks all dotfiles from the specified castle"
|
48
59
|
def symlink(name)
|
49
|
-
|
50
|
-
say_status :error, "Could not symlink #{name}, expected #{castle_dir(name)} exist and contain dotfiles", :red
|
51
|
-
|
52
|
-
exit(1)
|
53
|
-
end
|
60
|
+
check_castle_existance(name, "symlink")
|
54
61
|
|
55
62
|
inside castle_dir(name) do
|
56
63
|
files = Pathname.glob('.*').reject{|a| [".",".."].include?(a.to_s)}
|
@@ -68,10 +75,33 @@ class Homesick < Thor
|
|
68
75
|
|
69
76
|
desc "list", "List cloned castles"
|
70
77
|
def list
|
71
|
-
|
78
|
+
#require 'ruby-debug'; breakpoint
|
79
|
+
Pathname.glob("#{repos_dir}/**/*/.git") do |git_dir|
|
80
|
+
castle = git_dir.dirname
|
72
81
|
Dir.chdir castle do # so we can call git config from the right contxt
|
73
|
-
say_status castle.
|
82
|
+
say_status castle.relative_path_from(repos_dir), `git config remote.origin.url`.chomp, :cyan
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
desc "generate PATH", "generate a homesick-ready git repo at PATH"
|
88
|
+
def generate(castle)
|
89
|
+
castle = Pathname.new(castle).expand_path
|
90
|
+
|
91
|
+
github_user = `git config github.user`.chomp
|
92
|
+
github_user = nil if github_user == ""
|
93
|
+
github_repo = castle.basename
|
94
|
+
|
95
|
+
|
96
|
+
empty_directory castle
|
97
|
+
inside castle do
|
98
|
+
git_init
|
99
|
+
if github_user
|
100
|
+
url = "git@github.com:#{github_user}/#{github_repo}.git"
|
101
|
+
git_remote_add 'origin', url
|
74
102
|
end
|
103
|
+
|
104
|
+
empty_directory "home"
|
75
105
|
end
|
76
106
|
end
|
77
107
|
|
@@ -85,9 +115,16 @@ class Homesick < Thor
|
|
85
115
|
@repos_dir ||= home_dir.join('.homesick', 'repos').expand_path
|
86
116
|
end
|
87
117
|
|
88
|
-
|
89
118
|
def castle_dir(name)
|
90
119
|
repos_dir.join(name, 'home')
|
91
120
|
end
|
92
121
|
|
122
|
+
def check_castle_existance(name, action)
|
123
|
+
unless castle_dir(name).exist?
|
124
|
+
say_status :error, "Could not #{action} #{name}, expected #{castle_dir(name)} exist and contain dotfiles", :red
|
125
|
+
|
126
|
+
exit(1)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
93
130
|
end
|
data/lib/homesick/actions.rb
CHANGED
@@ -19,6 +19,31 @@ class Homesick
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def git_init(path = ".")
|
23
|
+
path = Pathname.new(path)
|
24
|
+
|
25
|
+
inside path do
|
26
|
+
unless path.join('.git').exist?
|
27
|
+
say_status 'git init', '' unless options[:quiet]
|
28
|
+
system "git init >/dev/null" unless options[:pretend]
|
29
|
+
else
|
30
|
+
say_status 'git init', 'already initialized', :blue unless options[:quiet]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def git_remote_add(name, url)
|
36
|
+
existing_remote = `git config remote.#{name}.url`.chomp
|
37
|
+
existing_remote = nil if existing_remote == ''
|
38
|
+
|
39
|
+
unless existing_remote
|
40
|
+
say_status 'git remote', "add #{name} #{url}" unless options[:quiet]
|
41
|
+
system "git remote add #{name} #{url}" unless options[:pretend]
|
42
|
+
else
|
43
|
+
say_status 'git remote', "#{name} already exists", :blue unless options[:quiet]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
22
47
|
def git_submodule_init(config = {})
|
23
48
|
say_status 'git submodule', 'init', :green unless options[:quiet]
|
24
49
|
system "git submodule --quiet init" unless options[:pretend]
|
@@ -29,6 +54,11 @@ class Homesick
|
|
29
54
|
system "git submodule --quiet update >/dev/null 2>&1" unless options[:pretend]
|
30
55
|
end
|
31
56
|
|
57
|
+
def git_pull(config = {})
|
58
|
+
say_status 'git pull', '', :green unless options[:quiet]
|
59
|
+
system "git pull --quiet" unless options[:pretend]
|
60
|
+
end
|
61
|
+
|
32
62
|
def ln_s(source, destination, config = {})
|
33
63
|
source = Pathname.new(source)
|
34
64
|
destination = Pathname.new(destination)
|
data/spec/homesick_spec.rb
CHANGED
@@ -11,10 +11,11 @@ describe Homesick do
|
|
11
11
|
somewhere.directory('wtf')
|
12
12
|
wtf = somewhere + 'wtf'
|
13
13
|
|
14
|
-
@homesick.should_receive(:ln_s).with(wtf.to_s, wtf.basename
|
14
|
+
@homesick.should_receive(:ln_s).with(wtf.to_s, wtf.basename)
|
15
15
|
|
16
16
|
@homesick.clone wtf.to_s
|
17
17
|
end
|
18
|
+
|
18
19
|
it "should clone git repo like git://host/path/to.git" do
|
19
20
|
@homesick.should_receive(:git_clone).with('git://github.com/technicalpickles/pickled-vim.git')
|
20
21
|
|
@@ -34,7 +35,7 @@ describe Homesick do
|
|
34
35
|
end
|
35
36
|
|
36
37
|
it "should clone a github repo" do
|
37
|
-
@homesick.should_receive(:git_clone).with('git://github.com/wfarr/dotfiles.git', :destination => 'wfarr/dotfiles')
|
38
|
+
@homesick.should_receive(:git_clone).with('git://github.com/wfarr/dotfiles.git', :destination => Pathname.new('wfarr/dotfiles'))
|
38
39
|
|
39
40
|
@homesick.clone "wfarr/dotfiles"
|
40
41
|
end
|
@@ -51,9 +52,17 @@ describe Homesick do
|
|
51
52
|
system "git remote add origin git://github.com/technicalpickles/zomg.git >/dev/null 2>&1"
|
52
53
|
end
|
53
54
|
end
|
55
|
+
|
56
|
+
repos_dir.directory 'wtf/zomg' do |zomg|
|
57
|
+
Dir.chdir do
|
58
|
+
system "git init >/dev/null 2>&1"
|
59
|
+
system "git remote add origin git://github.com/technicalpickles/zomg.git >/dev/null 2>&1"
|
60
|
+
end
|
61
|
+
end
|
54
62
|
end
|
55
63
|
|
56
64
|
@homesick.should_receive(:say_status).with("zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
|
65
|
+
@homesick.should_receive(:say_status).with("wtf/zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
|
57
66
|
|
58
67
|
@homesick.list
|
59
68
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 5
|
8
8
|
- 1
|
9
|
-
version: 0.
|
9
|
+
version: 0.5.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Joshua Nichols
|
@@ -14,37 +14,36 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-05-18 00:00:00 -04:00
|
18
18
|
default_executable: homesick
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
type: :runtime
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - ">="
|
26
25
|
- !ruby/object:Gem::Version
|
27
26
|
segments:
|
28
27
|
- 0
|
29
28
|
version: "0"
|
30
|
-
|
31
|
-
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: rake
|
29
|
+
name: thor
|
30
|
+
requirement: *id001
|
34
31
|
prerelease: false
|
35
|
-
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
type: :development
|
34
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
36
35
|
requirements:
|
37
36
|
- - ">="
|
38
37
|
- !ruby/object:Gem::Version
|
39
38
|
segments:
|
40
39
|
- 0
|
41
40
|
version: "0"
|
42
|
-
|
43
|
-
|
44
|
-
- !ruby/object:Gem::Dependency
|
45
|
-
name: rspec
|
41
|
+
name: rake
|
42
|
+
requirement: *id002
|
46
43
|
prerelease: false
|
47
|
-
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
type: :development
|
46
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
48
47
|
requirements:
|
49
48
|
- - ">="
|
50
49
|
- !ruby/object:Gem::Version
|
@@ -53,12 +52,12 @@ dependencies:
|
|
53
52
|
- 2
|
54
53
|
- 9
|
55
54
|
version: 1.2.9
|
56
|
-
|
57
|
-
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
name: bundler
|
55
|
+
name: rspec
|
56
|
+
requirement: *id003
|
60
57
|
prerelease: false
|
61
|
-
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
type: :development
|
60
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
62
61
|
requirements:
|
63
62
|
- - ">="
|
64
63
|
- !ruby/object:Gem::Version
|
@@ -67,12 +66,12 @@ dependencies:
|
|
67
66
|
- 9
|
68
67
|
- 5
|
69
68
|
version: 0.9.5
|
70
|
-
|
71
|
-
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
|
-
name: jeweler
|
69
|
+
name: bundler
|
70
|
+
requirement: *id004
|
74
71
|
prerelease: false
|
75
|
-
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
type: :development
|
74
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
76
75
|
requirements:
|
77
76
|
- - ">="
|
78
77
|
- !ruby/object:Gem::Version
|
@@ -81,32 +80,33 @@ dependencies:
|
|
81
80
|
- 4
|
82
81
|
- 0
|
83
82
|
version: 1.4.0
|
84
|
-
|
85
|
-
|
86
|
-
- !ruby/object:Gem::Dependency
|
87
|
-
name: rcov
|
83
|
+
name: jeweler
|
84
|
+
requirement: *id005
|
88
85
|
prerelease: false
|
89
|
-
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
type: :development
|
88
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
90
89
|
requirements:
|
91
90
|
- - ">="
|
92
91
|
- !ruby/object:Gem::Version
|
93
92
|
segments:
|
94
93
|
- 0
|
95
94
|
version: "0"
|
96
|
-
|
97
|
-
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: test-construct
|
95
|
+
name: rcov
|
96
|
+
requirement: *id006
|
100
97
|
prerelease: false
|
101
|
-
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
type: :development
|
100
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
102
101
|
requirements:
|
103
102
|
- - ">="
|
104
103
|
- !ruby/object:Gem::Version
|
105
104
|
segments:
|
106
105
|
- 0
|
107
106
|
version: "0"
|
108
|
-
|
109
|
-
|
107
|
+
name: test-construct
|
108
|
+
requirement: *id007
|
109
|
+
prerelease: false
|
110
110
|
description: "\n A man\xE2\x80\x99s home (directory) is his castle, so don\xE2\x80\x99t 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 "
|
111
111
|
email: josh@technicalpickles.com
|
112
112
|
executables:
|