homesick 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,20 @@
1
+ # 0.7.0
2
+ * Fixed double-cloning #14
3
+ * New option for pull command: --all
4
+ * pulls each castle, instead of just one
5
+
6
+ # 0.6.1
7
+
8
+ * Add a license
9
+
10
+ # 0.6.0
11
+
12
+ * Introduce .homesickrc
13
+ * Castles can now have a .homesickrc inside them
14
+ * On clone, this is eval'd inside the destination directory
15
+ * Introduce track command
16
+ * Allows easily moving an existing file into a castle, and symlinking it back
17
+
1
18
  # 0.5.0
2
19
 
3
20
  * Fixed listing of castles cloned using `homesick clone <github-user>/<github-repo>` (issue 3)
data/Gemfile CHANGED
@@ -8,8 +8,8 @@ gem "thor", ">= 0.14.0"
8
8
  group :development do
9
9
  gem "rake"
10
10
  gem "rspec", "~> 2.1.0"
11
- gem "bundler", "~> 1.0.0"
12
- gem "jeweler", ">= 1.5.0.pre6"
11
+ gem "jeweler", ">= 1.6.2"
13
12
  gem "rcov", ">= 0"
14
13
  gem "test-construct"
14
+ gem "ruby-debug"
15
15
  end
@@ -1,14 +1,16 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ columnize (0.3.2)
4
5
  diff-lcs (1.1.2)
5
6
  git (1.2.5)
6
- jeweler (1.5.0.pre6)
7
- bundler (~> 1.0.0)
7
+ jeweler (1.6.2)
8
+ bundler (~> 1.0)
8
9
  git (>= 1.2.5)
9
10
  rake
10
- rake (0.8.7)
11
- rcov (0.9.8)
11
+ linecache (0.43)
12
+ rake (0.9.2)
13
+ rcov (0.9.9)
12
14
  rspec (2.1.0)
13
15
  rspec-core (~> 2.1.0)
14
16
  rspec-expectations (~> 2.1.0)
@@ -17,17 +19,22 @@ GEM
17
19
  rspec-expectations (2.1.0)
18
20
  diff-lcs (~> 1.1.2)
19
21
  rspec-mocks (2.1.0)
22
+ ruby-debug (0.10.4)
23
+ columnize (>= 0.1)
24
+ ruby-debug-base (~> 0.10.4.0)
25
+ ruby-debug-base (0.10.4)
26
+ linecache (>= 0.3)
20
27
  test-construct (1.2.0)
21
- thor (0.14.0)
28
+ thor (0.14.6)
22
29
 
23
30
  PLATFORMS
24
31
  ruby
25
32
 
26
33
  DEPENDENCIES
27
- bundler (~> 1.0.0)
28
- jeweler (>= 1.5.0.pre6)
34
+ jeweler (>= 1.6.2)
29
35
  rake
30
36
  rcov
31
37
  rspec (~> 2.1.0)
38
+ ruby-debug
32
39
  test-construct
33
40
  thor (>= 0.14.0)
@@ -25,7 +25,7 @@ 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:
28
+ If you use the shorthand syntax for GitHub repositories in your clone, please note you will instead need to run:
29
29
 
30
30
  homesick symlink technicalpickles/pickled-vim
31
31
 
@@ -45,6 +45,10 @@ Not sure what else homesick has up its sleeve? There's always the built in help:
45
45
  * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
46
46
  * Send me a pull request. Bonus points for topic branches.
47
47
 
48
+ ## Need homesick without the ruby dependency?
49
+
50
+ Check out [homeshick](https://github.com/andsens/homeshick).
51
+
48
52
  ## Copyright
49
53
 
50
54
  Copyright (c) 2010 Joshua Nichols. See LICENSE for details.
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.6.1"
25
+ gem.version = "0.7.0"
26
26
  gem.license = "MIT"
27
27
  # Have dependencies? Add them to Gemfile
28
28
 
@@ -1,23 +1,17 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{homesick}
8
- s.version = "0.6.1"
7
+ s.name = "homesick"
8
+ s.version = "0.7.0"
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-11-13}
13
- s.default_executable = %q{homesick}
14
- s.description = %q{
15
- A man's home (directory) is his castle, so don't leave home with out it.
16
-
17
- 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.
18
-
19
- }
20
- s.email = %q{josh@technicalpickles.com}
12
+ s.date = "2012-05-28"
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"
21
15
  s.executables = ["homesick"]
22
16
  s.extra_rdoc_files = [
23
17
  "ChangeLog.markdown",
@@ -42,45 +36,40 @@ Gem::Specification.new do |s|
42
36
  "spec/spec.opts",
43
37
  "spec/spec_helper.rb"
44
38
  ]
45
- s.homepage = %q{http://github.com/technicalpickles/homesick}
39
+ s.homepage = "http://github.com/technicalpickles/homesick"
46
40
  s.licenses = ["MIT"]
47
41
  s.require_paths = ["lib"]
48
- s.rubygems_version = %q{1.3.7}
49
- s.summary = %q{A man's home is his castle. Never leave your dotfiles behind.}
50
- s.test_files = [
51
- "spec/homesick_spec.rb",
52
- "spec/spec_helper.rb"
53
- ]
42
+ s.rubygems_version = "1.8.15"
43
+ s.summary = "A man's home is his castle. Never leave your dotfiles behind."
54
44
 
55
45
  if s.respond_to? :specification_version then
56
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
57
46
  s.specification_version = 3
58
47
 
59
48
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
60
49
  s.add_runtime_dependency(%q<thor>, [">= 0.14.0"])
61
50
  s.add_development_dependency(%q<rake>, [">= 0"])
62
51
  s.add_development_dependency(%q<rspec>, ["~> 2.1.0"])
63
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
64
- s.add_development_dependency(%q<jeweler>, [">= 1.5.0.pre6"])
52
+ s.add_development_dependency(%q<jeweler>, [">= 1.6.2"])
65
53
  s.add_development_dependency(%q<rcov>, [">= 0"])
66
54
  s.add_development_dependency(%q<test-construct>, [">= 0"])
55
+ s.add_development_dependency(%q<ruby-debug>, [">= 0"])
67
56
  else
68
57
  s.add_dependency(%q<thor>, [">= 0.14.0"])
69
58
  s.add_dependency(%q<rake>, [">= 0"])
70
59
  s.add_dependency(%q<rspec>, ["~> 2.1.0"])
71
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
72
- s.add_dependency(%q<jeweler>, [">= 1.5.0.pre6"])
60
+ s.add_dependency(%q<jeweler>, [">= 1.6.2"])
73
61
  s.add_dependency(%q<rcov>, [">= 0"])
74
62
  s.add_dependency(%q<test-construct>, [">= 0"])
63
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
75
64
  end
76
65
  else
77
66
  s.add_dependency(%q<thor>, [">= 0.14.0"])
78
67
  s.add_dependency(%q<rake>, [">= 0"])
79
68
  s.add_dependency(%q<rspec>, ["~> 2.1.0"])
80
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
81
- s.add_dependency(%q<jeweler>, [">= 1.5.0.pre6"])
69
+ s.add_dependency(%q<jeweler>, [">= 1.6.2"])
82
70
  s.add_dependency(%q<rcov>, [">= 0"])
83
71
  s.add_dependency(%q<test-construct>, [">= 0"])
72
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
84
73
  end
85
74
  end
86
75
 
@@ -21,7 +21,12 @@ class Homesick < Thor
21
21
  inside repos_dir do
22
22
  destination = nil
23
23
  if File.exist?(uri)
24
- destination = Pathname.new(uri).basename
24
+ uri = Pathname.new(uri).expand_path
25
+ if uri.to_s.start_with?(repos_dir)
26
+ raise "Castle already cloned to #{uri}"
27
+ end
28
+
29
+ destination = uri.basename
25
30
 
26
31
  ln_s uri, destination
27
32
  elsif uri =~ GITHUB_NAME_REPO_PATTERN
@@ -60,14 +65,17 @@ class Homesick < Thor
60
65
  end
61
66
 
62
67
  desc "pull NAME", "Update the specified castle"
63
- def pull(name)
64
- check_castle_existance(name, "pull")
65
-
66
- inside repos_dir.join(name) do
67
- git_pull
68
- git_submodule_init
69
- git_submodule_update
68
+ method_option :all, :type => :boolean, :default => false, :required => false, :desc => "Update all cloned castles"
69
+ def pull(name="")
70
+ if options[:all]
71
+ inside_each_castle do |castle|
72
+ shell.say castle.to_s.gsub(repos_dir.to_s + '/', '') + ':'
73
+ update_castle castle
74
+ end
75
+ else
76
+ update_castle name
70
77
  end
78
+
71
79
  end
72
80
 
73
81
  desc "symlink NAME", "Symlinks all dotfiles from the specified castle"
@@ -107,11 +115,8 @@ class Homesick < Thor
107
115
 
108
116
  desc "list", "List cloned castles"
109
117
  def list
110
- Pathname.glob("#{repos_dir}/**/*/.git") do |git_dir|
111
- castle = git_dir.dirname
112
- Dir.chdir castle do # so we can call git config from the right contxt
113
- say_status castle.relative_path_from(repos_dir), `git config remote.origin.url`.chomp, :cyan
114
- end
118
+ inside_each_castle do |castle|
119
+ say_status castle.relative_path_from(repos_dir), `git config remote.origin.url`.chomp, :cyan
115
120
  end
116
121
  end
117
122
 
@@ -158,4 +163,29 @@ class Homesick < Thor
158
163
  end
159
164
  end
160
165
 
166
+ def all_castles
167
+ dirs = Pathname.glob("#{repos_dir}/**/*/.git")
168
+ # reject paths that lie inside another castle, like git submodules
169
+ return dirs.reject do |dir|
170
+ dirs.any? {|other| dir != other && dir.fnmatch(other.parent.join('*').to_s) }
171
+ end
172
+ end
173
+
174
+ def inside_each_castle(&block)
175
+ all_castles.each do |git_dir|
176
+ castle = git_dir.dirname
177
+ Dir.chdir castle do # so we can call git config from the right contxt
178
+ yield castle
179
+ end
180
+ end
181
+ end
182
+
183
+ def update_castle(castle)
184
+ check_castle_existance(castle, "pull")
185
+ inside repos_dir.join(castle) do
186
+ git_pull
187
+ git_submodule_init
188
+ git_submodule_update
189
+ end
190
+ end
161
191
  end
@@ -1,19 +1,42 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Homesick do
3
+ describe "homesick" do
4
4
  before do
5
5
  @homesick = Homesick.new
6
6
  end
7
7
 
8
8
  describe "clone" do
9
- it "should symlink existing directories" do
10
- somewhere = create_construct
11
- somewhere.directory('wtf')
12
- wtf = somewhere + 'wtf'
9
+ context "of a file" do
10
+ it "should symlink existing directories" do
11
+ somewhere = create_construct
12
+ somewhere.directory('wtf')
13
+ wtf = somewhere + 'wtf'
13
14
 
14
- @homesick.should_receive(:ln_s).with(wtf.to_s, wtf.basename)
15
+ @homesick.should_receive(:ln_s).with(wtf, wtf.basename)
15
16
 
16
- @homesick.clone wtf.to_s
17
+ @homesick.clone wtf
18
+ end
19
+
20
+ context "when it exists in a repo directory" do
21
+ before do
22
+ @repos_dir = create_construct
23
+ @existing_dir = @repos_dir.directory('existing_castle')
24
+ @homesick.stub!(:repos_dir).and_return(@repos_dir)
25
+ end
26
+
27
+ it "should not symlink" do
28
+ @homesick.should_not_receive(:git_clone)
29
+
30
+ @homesick.clone @existing_dir.to_s rescue nil
31
+ end
32
+
33
+ it "should raise an error" do
34
+ @existing_castle = @homesick.send(:repos_dir) + 'existing_castle'
35
+ lambda {
36
+ @homesick.clone @existing_castle.to_s
37
+ }.should raise_error(/already cloned/i)
38
+ end
39
+ end
17
40
  end
18
41
 
19
42
  it "should clone git repo like git://host/path/to.git" do
@@ -91,6 +114,16 @@ describe Homesick do
91
114
  end
92
115
  end
93
116
 
117
+ describe "pull" do
118
+
119
+ xit "needs testing"
120
+
121
+ describe "--all" do
122
+ xit "needs testing"
123
+ end
124
+
125
+ end
126
+
94
127
  describe "track" do
95
128
  it "should move the tracked file into the castle" do
96
129
  some_rc_file = @user_dir.file '.some_rc_file'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: homesick
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
5
- prerelease: false
4
+ hash: 3
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 6
9
- - 1
10
- version: 0.6.1
8
+ - 7
9
+ - 0
10
+ version: 0.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Nichols
@@ -15,11 +15,9 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-13 00:00:00 -06:00
19
- default_executable: homesick
18
+ date: 2012-05-28 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: &id001 !ruby/object:Gem::Requirement
25
23
  none: false
@@ -32,10 +30,10 @@ dependencies:
32
30
  - 14
33
31
  - 0
34
32
  version: 0.14.0
35
- name: thor
36
33
  requirement: *id001
34
+ name: thor
35
+ type: :runtime
37
36
  - !ruby/object:Gem::Dependency
38
- type: :development
39
37
  prerelease: false
40
38
  version_requirements: &id002 !ruby/object:Gem::Requirement
41
39
  none: false
@@ -46,10 +44,10 @@ dependencies:
46
44
  segments:
47
45
  - 0
48
46
  version: "0"
49
- name: rake
50
47
  requirement: *id002
51
- - !ruby/object:Gem::Dependency
48
+ name: rake
52
49
  type: :development
50
+ - !ruby/object:Gem::Dependency
53
51
  prerelease: false
54
52
  version_requirements: &id003 !ruby/object:Gem::Requirement
55
53
  none: false
@@ -62,43 +60,40 @@ dependencies:
62
60
  - 1
63
61
  - 0
64
62
  version: 2.1.0
65
- name: rspec
66
63
  requirement: *id003
67
- - !ruby/object:Gem::Dependency
64
+ name: rspec
68
65
  type: :development
66
+ - !ruby/object:Gem::Dependency
69
67
  prerelease: false
70
68
  version_requirements: &id004 !ruby/object:Gem::Requirement
71
69
  none: false
72
70
  requirements:
73
- - - ~>
71
+ - - ">="
74
72
  - !ruby/object:Gem::Version
75
- hash: 23
73
+ hash: 11
76
74
  segments:
77
75
  - 1
78
- - 0
79
- - 0
80
- version: 1.0.0
81
- name: bundler
76
+ - 6
77
+ - 2
78
+ version: 1.6.2
82
79
  requirement: *id004
83
- - !ruby/object:Gem::Dependency
80
+ name: jeweler
84
81
  type: :development
82
+ - !ruby/object:Gem::Dependency
85
83
  prerelease: false
86
84
  version_requirements: &id005 !ruby/object:Gem::Requirement
87
85
  none: false
88
86
  requirements:
89
87
  - - ">="
90
88
  - !ruby/object:Gem::Version
91
- hash: -1876988219
89
+ hash: 3
92
90
  segments:
93
- - 1
94
- - 5
95
91
  - 0
96
- - pre6
97
- version: 1.5.0.pre6
98
- name: jeweler
92
+ version: "0"
99
93
  requirement: *id005
100
- - !ruby/object:Gem::Dependency
94
+ name: rcov
101
95
  type: :development
96
+ - !ruby/object:Gem::Dependency
102
97
  prerelease: false
103
98
  version_requirements: &id006 !ruby/object:Gem::Requirement
104
99
  none: false
@@ -109,10 +104,10 @@ dependencies:
109
104
  segments:
110
105
  - 0
111
106
  version: "0"
112
- name: rcov
113
107
  requirement: *id006
114
- - !ruby/object:Gem::Dependency
108
+ name: test-construct
115
109
  type: :development
110
+ - !ruby/object:Gem::Dependency
116
111
  prerelease: false
117
112
  version_requirements: &id007 !ruby/object:Gem::Requirement
118
113
  none: false
@@ -123,8 +118,9 @@ dependencies:
123
118
  segments:
124
119
  - 0
125
120
  version: "0"
126
- name: test-construct
127
121
  requirement: *id007
122
+ name: ruby-debug
123
+ type: :development
128
124
  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 "
129
125
  email: josh@technicalpickles.com
130
126
  executables:
@@ -152,7 +148,6 @@ files:
152
148
  - spec/homesick_spec.rb
153
149
  - spec/spec.opts
154
150
  - spec/spec_helper.rb
155
- has_rdoc: true
156
151
  homepage: http://github.com/technicalpickles/homesick
157
152
  licenses:
158
153
  - MIT
@@ -182,10 +177,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
177
  requirements: []
183
178
 
184
179
  rubyforge_project:
185
- rubygems_version: 1.3.7
180
+ rubygems_version: 1.8.15
186
181
  signing_key:
187
182
  specification_version: 3
188
183
  summary: A man's home is his castle. Never leave your dotfiles behind.
189
- test_files:
190
- - spec/homesick_spec.rb
191
- - spec/spec_helper.rb
184
+ test_files: []
185
+