homesick 0.5.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ group :development do
9
9
  gem "rake"
10
10
  gem "rspec", ">= 1.2.9"
11
11
  gem "bundler", ">= 0.9.5"
12
- gem "jeweler", ">= 1.5.0.pre"
12
+ gem "jeweler", ">= 1.5.0.pre2"
13
13
  gem "rcov", ">= 0"
14
14
  gem "test-construct"
15
15
  end
@@ -2,8 +2,8 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  git (1.2.5)
5
- jeweler (1.5.0.pre)
6
- bundler (>= 1.0.0.rc.5)
5
+ jeweler (1.5.0.pre3)
6
+ bundler (~> 1.0.0)
7
7
  git (>= 1.2.5)
8
8
  rake
9
9
  rake (0.8.7)
@@ -17,7 +17,7 @@ PLATFORMS
17
17
 
18
18
  DEPENDENCIES
19
19
  bundler (>= 0.9.5)
20
- jeweler (>= 1.5.0.pre)
20
+ jeweler (>= 1.5.0.pre2)
21
21
  rake
22
22
  rcov
23
23
  rspec (>= 1.2.9)
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.5.4"
25
+ gem.version = "0.6.0"
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
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{homesick}
8
- s.version = "0.5.4"
8
+ s.version = "0.6.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-09-03}
12
+ s.date = %q{2010-10-27}
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.
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
44
44
  ]
45
45
  s.homepage = %q{http://github.com/technicalpickles/homesick}
46
46
  s.require_paths = ["lib"]
47
- s.rubygems_version = %q{1.3.6}
47
+ s.rubygems_version = %q{1.3.7}
48
48
  s.summary = %q{A man's home is his castle. Never leave your dotfiles behind.}
49
49
  s.test_files = [
50
50
  "spec/homesick_spec.rb",
@@ -55,12 +55,12 @@ Gem::Specification.new do |s|
55
55
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
56
56
  s.specification_version = 3
57
57
 
58
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
58
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
59
59
  s.add_runtime_dependency(%q<thor>, [">= 0.14.0"])
60
60
  s.add_development_dependency(%q<rake>, [">= 0"])
61
61
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
62
62
  s.add_development_dependency(%q<bundler>, [">= 0.9.5"])
63
- s.add_development_dependency(%q<jeweler>, [">= 1.5.0.pre"])
63
+ s.add_development_dependency(%q<jeweler>, [">= 1.5.0.pre2"])
64
64
  s.add_development_dependency(%q<rcov>, [">= 0"])
65
65
  s.add_development_dependency(%q<test-construct>, [">= 0"])
66
66
  else
@@ -68,7 +68,7 @@ Gem::Specification.new do |s|
68
68
  s.add_dependency(%q<rake>, [">= 0"])
69
69
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
70
70
  s.add_dependency(%q<bundler>, [">= 0.9.5"])
71
- s.add_dependency(%q<jeweler>, [">= 1.5.0.pre"])
71
+ s.add_dependency(%q<jeweler>, [">= 1.5.0.pre2"])
72
72
  s.add_dependency(%q<rcov>, [">= 0"])
73
73
  s.add_dependency(%q<test-construct>, [">= 0"])
74
74
  end
@@ -77,7 +77,7 @@ Gem::Specification.new do |s|
77
77
  s.add_dependency(%q<rake>, [">= 0"])
78
78
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
79
79
  s.add_dependency(%q<bundler>, [">= 0.9.5"])
80
- s.add_dependency(%q<jeweler>, [">= 1.5.0.pre"])
80
+ s.add_dependency(%q<jeweler>, [">= 1.5.0.pre2"])
81
81
  s.add_dependency(%q<rcov>, [">= 0"])
82
82
  s.add_dependency(%q<test-construct>, [">= 0"])
83
83
  end
@@ -43,6 +43,19 @@ class Homesick < Thor
43
43
  git_submodule_update
44
44
  end
45
45
  end
46
+
47
+ homesickrc = destination.join('.homesickrc').expand_path
48
+ if homesickrc.exist?
49
+ proceed = shell.yes?("#{uri} has a .homesickrc. Proceed with evaling it? (This could be destructive)")
50
+ if proceed
51
+ shell.say_status "eval", homesickrc
52
+ inside destination do
53
+ eval homesickrc.read, binding, homesickrc.expand_path
54
+ end
55
+ else
56
+ shell.say_status "eval skip", "not evaling #{homesickrc}, #{destination} may need manual configuration", :blue
57
+ end
58
+ end
46
59
  end
47
60
  end
48
61
 
@@ -75,6 +88,23 @@ class Homesick < Thor
75
88
  end
76
89
  end
77
90
 
91
+ desc "track FILE CASTLE", "add a file to a castle"
92
+ def track(file, castle)
93
+ castle = Pathname.new(castle)
94
+ file = Pathname.new(file)
95
+ check_castle_existance(castle, 'track')
96
+
97
+ absolute_path = file.expand_path
98
+ castle_path = castle_dir(castle)
99
+ mv absolute_path, castle_path
100
+
101
+ inside home_dir do
102
+ absolute_path = castle_dir(castle) + file.basename
103
+ home_path = home_dir + file
104
+ ln_s absolute_path, home_path
105
+ end
106
+ end
107
+
78
108
  desc "list", "List cloned castles"
79
109
  def list
80
110
  #require 'ruby-debug'; breakpoint
@@ -94,7 +124,6 @@ class Homesick < Thor
94
124
  github_user = nil if github_user == ""
95
125
  github_repo = castle.basename
96
126
 
97
-
98
127
  empty_directory castle
99
128
  inside castle do
100
129
  git_init
@@ -107,6 +136,7 @@ class Homesick < Thor
107
136
  end
108
137
  end
109
138
 
139
+
110
140
  protected
111
141
 
112
142
  def home_dir
@@ -59,6 +59,22 @@ class Homesick
59
59
  system "git pull --quiet" unless options[:pretend]
60
60
  end
61
61
 
62
+ def mv(source, destination, config = {})
63
+ source = Pathname.new(source)
64
+ destination = Pathname.new(destination + source.basename)
65
+
66
+ if destination.exist?
67
+ say_status :conflict, "#{destination} exists", :red unless options[:quiet]
68
+
69
+ if options[:force] || shell.file_collision(destination) { source }
70
+ system "mv #{source} #{destination}" unless options[:pretend]
71
+ end
72
+ else
73
+ # this needs some sort of message here.
74
+ system "mv #{source} #{destination}" unless options[:pretend]
75
+ end
76
+ end
77
+
62
78
  def ln_s(source, destination, config = {})
63
79
  source = Pathname.new(source)
64
80
  destination = Pathname.new(destination)
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe Homesick do
4
4
  before do
@@ -83,13 +83,31 @@ describe Homesick do
83
83
  system "git remote add origin git://github.com/technicalpickles/zomg.git >/dev/null 2>&1"
84
84
  end
85
85
  end
86
- end
87
-
86
+ end
88
87
  @homesick.should_receive(:say_status).with("zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
89
88
  @homesick.should_receive(:say_status).with("wtf/zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
90
89
 
91
90
  @homesick.list
92
91
  end
92
+ end
93
93
 
94
+ describe "track" do
95
+ it "should move the tracked file into the castle" do
96
+ some_rc_file = @user_dir.file '.some_rc_file'
97
+ homesickrepo = @user_dir.directory('.homesick').directory('repos').directory('castle_repo')
98
+ castle_path = homesickrepo.directory 'home'
99
+
100
+ # There is some hideous thing going on with construct; rming the file I'm moving works on this test.
101
+ # Otherwise when track ln_s's it back out, it sees a conflict. Its as if file operations don't
102
+ # actually effect this thing, or something.
103
+ system "rm #{some_rc_file.to_s}"
104
+ Dir.chdir homesickrepo do
105
+ system "git init >/dev/null 2>&1"
106
+ end
107
+
108
+ @homesick.should_receive(:mv).with(some_rc_file, castle_path)
109
+ @homesick.should_receive(:ln_s).with(castle_path + some_rc_file.basename, some_rc_file)
110
+ @homesick.track(some_rc_file.to_s, 'castle_repo')
111
+ end
94
112
  end
95
113
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: homesick
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 7
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 5
8
- - 4
9
- version: 0.5.4
8
+ - 6
9
+ - 0
10
+ version: 0.6.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Joshua Nichols
@@ -14,15 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-09-03 00:00:00 -04:00
18
+ date: 2010-10-27 00:00:00 -04:00
18
19
  default_executable: homesick
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  type: :runtime
23
+ prerelease: false
22
24
  version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
29
+ hash: 39
26
30
  segments:
27
31
  - 0
28
32
  - 14
@@ -30,25 +34,29 @@ dependencies:
30
34
  version: 0.14.0
31
35
  name: thor
32
36
  requirement: *id001
33
- prerelease: false
34
37
  - !ruby/object:Gem::Dependency
35
38
  type: :development
39
+ prerelease: false
36
40
  version_requirements: &id002 !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ">="
39
44
  - !ruby/object:Gem::Version
45
+ hash: 3
40
46
  segments:
41
47
  - 0
42
48
  version: "0"
43
49
  name: rake
44
50
  requirement: *id002
45
- prerelease: false
46
51
  - !ruby/object:Gem::Dependency
47
52
  type: :development
53
+ prerelease: false
48
54
  version_requirements: &id003 !ruby/object:Gem::Requirement
55
+ none: false
49
56
  requirements:
50
57
  - - ">="
51
58
  - !ruby/object:Gem::Version
59
+ hash: 13
52
60
  segments:
53
61
  - 1
54
62
  - 2
@@ -56,13 +64,15 @@ dependencies:
56
64
  version: 1.2.9
57
65
  name: rspec
58
66
  requirement: *id003
59
- prerelease: false
60
67
  - !ruby/object:Gem::Dependency
61
68
  type: :development
69
+ prerelease: false
62
70
  version_requirements: &id004 !ruby/object:Gem::Requirement
71
+ none: false
63
72
  requirements:
64
73
  - - ">="
65
74
  - !ruby/object:Gem::Version
75
+ hash: 49
66
76
  segments:
67
77
  - 0
68
78
  - 9
@@ -70,46 +80,51 @@ dependencies:
70
80
  version: 0.9.5
71
81
  name: bundler
72
82
  requirement: *id004
73
- prerelease: false
74
83
  - !ruby/object:Gem::Dependency
75
84
  type: :development
85
+ prerelease: false
76
86
  version_requirements: &id005 !ruby/object:Gem::Requirement
87
+ none: false
77
88
  requirements:
78
89
  - - ">="
79
90
  - !ruby/object:Gem::Version
91
+ hash: -1876988199
80
92
  segments:
81
93
  - 1
82
94
  - 5
83
95
  - 0
84
- - pre
85
- version: 1.5.0.pre
96
+ - pre2
97
+ version: 1.5.0.pre2
86
98
  name: jeweler
87
99
  requirement: *id005
88
- prerelease: false
89
100
  - !ruby/object:Gem::Dependency
90
101
  type: :development
102
+ prerelease: false
91
103
  version_requirements: &id006 !ruby/object:Gem::Requirement
104
+ none: false
92
105
  requirements:
93
106
  - - ">="
94
107
  - !ruby/object:Gem::Version
108
+ hash: 3
95
109
  segments:
96
110
  - 0
97
111
  version: "0"
98
112
  name: rcov
99
113
  requirement: *id006
100
- prerelease: false
101
114
  - !ruby/object:Gem::Dependency
102
115
  type: :development
116
+ prerelease: false
103
117
  version_requirements: &id007 !ruby/object:Gem::Requirement
118
+ none: false
104
119
  requirements:
105
120
  - - ">="
106
121
  - !ruby/object:Gem::Version
122
+ hash: 3
107
123
  segments:
108
124
  - 0
109
125
  version: "0"
110
126
  name: test-construct
111
127
  requirement: *id007
112
- prerelease: false
113
128
  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 "
114
129
  email: josh@technicalpickles.com
115
130
  executables:
@@ -147,23 +162,27 @@ rdoc_options: []
147
162
  require_paths:
148
163
  - lib
149
164
  required_ruby_version: !ruby/object:Gem::Requirement
165
+ none: false
150
166
  requirements:
151
167
  - - ">="
152
168
  - !ruby/object:Gem::Version
169
+ hash: 3
153
170
  segments:
154
171
  - 0
155
172
  version: "0"
156
173
  required_rubygems_version: !ruby/object:Gem::Requirement
174
+ none: false
157
175
  requirements:
158
176
  - - ">="
159
177
  - !ruby/object:Gem::Version
178
+ hash: 3
160
179
  segments:
161
180
  - 0
162
181
  version: "0"
163
182
  requirements: []
164
183
 
165
184
  rubyforge_project:
166
- rubygems_version: 1.3.6
185
+ rubygems_version: 1.3.7
167
186
  signing_key:
168
187
  specification_version: 3
169
188
  summary: A man's home is his castle. Never leave your dotfiles behind.