homesick 1.0.0 → 1.1.0
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +19 -0
- data/.travis.yml +1 -0
- data/ChangeLog.markdown +4 -0
- data/Gemfile +2 -2
- data/README.markdown +11 -0
- data/bin/homesick +1 -1
- data/homesick.gemspec +14 -16
- data/lib/homesick.rb +9 -444
- data/lib/homesick/actions/file_actions.rb +91 -0
- data/lib/homesick/actions/git_actions.rb +94 -0
- data/lib/homesick/cli.rb +316 -0
- data/lib/homesick/shell.rb +3 -3
- data/lib/homesick/utils.rb +216 -0
- data/lib/homesick/version.rb +5 -3
- data/spec/homesick_cli_spec.rb +787 -0
- data/spec/spec_helper.rb +7 -2
- metadata +37 -61
- data/lib/homesick/actions.rb +0 -175
- data/spec/homesick_spec.rb +0 -621
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
1
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
6
|
require 'homesick'
|
@@ -9,12 +12,14 @@ require 'tempfile'
|
|
9
12
|
RSpec.configure do |config|
|
10
13
|
config.include TestConstruct::Helpers
|
11
14
|
|
15
|
+
config.expect_with(:rspec) { |c| c.syntax = :expect }
|
16
|
+
|
12
17
|
config.before { ENV['HOME'] = home.to_s }
|
13
18
|
|
14
19
|
config.before { silence! }
|
15
20
|
|
16
21
|
def silence!
|
17
|
-
homesick.
|
22
|
+
allow(homesick).to receive(:say_status)
|
18
23
|
end
|
19
24
|
|
20
25
|
def given_castle(path, subdirs = [])
|
@@ -28,7 +33,7 @@ RSpec.configure do |config|
|
|
28
33
|
if subdirs
|
29
34
|
subdir_file = castle.join(Homesick::SUBDIR_FILENAME)
|
30
35
|
subdirs.each do |subdir|
|
31
|
-
|
36
|
+
File.open(subdir_file, 'a') { |file| file.write "\n#{subdir}\n" }
|
32
37
|
end
|
33
38
|
end
|
34
39
|
return castle.directory('home')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: homesick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Nichols
|
@@ -9,188 +9,160 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 0.14.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 0.14.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 0.8.7
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 0.8.7
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - ~>
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '2.10'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - ~>
|
53
|
+
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '2.10'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: guard
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: guard-rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: rb-readline
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - ~>
|
88
|
+
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 0.5.0
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - ~>
|
95
|
+
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 0.5.0
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: jeweler
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: 1.6.2
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: 1.6.2
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
113
|
+
name: coveralls
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- -
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: simplecov
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - '>='
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: '0'
|
133
|
-
type: :development
|
134
|
-
prerelease: false
|
135
|
-
version_requirements: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - '>='
|
123
|
+
- - ">="
|
138
124
|
- !ruby/object:Gem::Version
|
139
125
|
version: '0'
|
140
126
|
- !ruby/object:Gem::Dependency
|
141
127
|
name: test_construct
|
142
128
|
requirement: !ruby/object:Gem::Requirement
|
143
129
|
requirements:
|
144
|
-
- -
|
130
|
+
- - ">="
|
145
131
|
- !ruby/object:Gem::Version
|
146
132
|
version: '0'
|
147
133
|
type: :development
|
148
134
|
prerelease: false
|
149
135
|
version_requirements: !ruby/object:Gem::Requirement
|
150
136
|
requirements:
|
151
|
-
- -
|
137
|
+
- - ">="
|
152
138
|
- !ruby/object:Gem::Version
|
153
139
|
version: '0'
|
154
140
|
- !ruby/object:Gem::Dependency
|
155
141
|
name: capture-output
|
156
142
|
requirement: !ruby/object:Gem::Requirement
|
157
143
|
requirements:
|
158
|
-
- - ~>
|
144
|
+
- - "~>"
|
159
145
|
- !ruby/object:Gem::Version
|
160
146
|
version: 1.0.0
|
161
147
|
type: :development
|
162
148
|
prerelease: false
|
163
149
|
version_requirements: !ruby/object:Gem::Requirement
|
164
150
|
requirements:
|
165
|
-
- - ~>
|
151
|
+
- - "~>"
|
166
152
|
- !ruby/object:Gem::Version
|
167
153
|
version: 1.0.0
|
168
|
-
- !ruby/object:Gem::Dependency
|
169
|
-
name: libnotify
|
170
|
-
requirement: !ruby/object:Gem::Requirement
|
171
|
-
requirements:
|
172
|
-
- - '>='
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version: '0'
|
175
|
-
type: :development
|
176
|
-
prerelease: false
|
177
|
-
version_requirements: !ruby/object:Gem::Requirement
|
178
|
-
requirements:
|
179
|
-
- - '>='
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '0'
|
182
154
|
- !ruby/object:Gem::Dependency
|
183
155
|
name: rubocop
|
184
156
|
requirement: !ruby/object:Gem::Requirement
|
185
157
|
requirements:
|
186
|
-
- -
|
158
|
+
- - ">="
|
187
159
|
- !ruby/object:Gem::Version
|
188
160
|
version: '0'
|
189
161
|
type: :development
|
190
162
|
prerelease: false
|
191
163
|
version_requirements: !ruby/object:Gem::Requirement
|
192
164
|
requirements:
|
193
|
-
- -
|
165
|
+
- - ">="
|
194
166
|
- !ruby/object:Gem::Version
|
195
167
|
version: '0'
|
196
168
|
description: "\n Your home directory is your castle. Don't leave your dotfiles
|
@@ -208,9 +180,10 @@ extra_rdoc_files:
|
|
208
180
|
- LICENSE
|
209
181
|
- README.markdown
|
210
182
|
files:
|
211
|
-
- .document
|
212
|
-
- .rspec
|
213
|
-
- .
|
183
|
+
- ".document"
|
184
|
+
- ".rspec"
|
185
|
+
- ".rubocop.yml"
|
186
|
+
- ".travis.yml"
|
214
187
|
- ChangeLog.markdown
|
215
188
|
- Gemfile
|
216
189
|
- Guardfile
|
@@ -220,10 +193,13 @@ files:
|
|
220
193
|
- bin/homesick
|
221
194
|
- homesick.gemspec
|
222
195
|
- lib/homesick.rb
|
223
|
-
- lib/homesick/actions.rb
|
196
|
+
- lib/homesick/actions/file_actions.rb
|
197
|
+
- lib/homesick/actions/git_actions.rb
|
198
|
+
- lib/homesick/cli.rb
|
224
199
|
- lib/homesick/shell.rb
|
200
|
+
- lib/homesick/utils.rb
|
225
201
|
- lib/homesick/version.rb
|
226
|
-
- spec/
|
202
|
+
- spec/homesick_cli_spec.rb
|
227
203
|
- spec/spec.opts
|
228
204
|
- spec/spec_helper.rb
|
229
205
|
homepage: http://github.com/technicalpickles/homesick
|
@@ -236,17 +212,17 @@ require_paths:
|
|
236
212
|
- lib
|
237
213
|
required_ruby_version: !ruby/object:Gem::Requirement
|
238
214
|
requirements:
|
239
|
-
- -
|
215
|
+
- - ">="
|
240
216
|
- !ruby/object:Gem::Version
|
241
217
|
version: '0'
|
242
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
219
|
requirements:
|
244
|
-
- -
|
220
|
+
- - ">="
|
245
221
|
- !ruby/object:Gem::Version
|
246
222
|
version: '0'
|
247
223
|
requirements: []
|
248
224
|
rubyforge_project:
|
249
|
-
rubygems_version: 2.
|
225
|
+
rubygems_version: 2.2.2
|
250
226
|
signing_key:
|
251
227
|
specification_version: 4
|
252
228
|
summary: Your home directory is your castle. Don't leave your dotfiles behind.
|
data/lib/homesick/actions.rb
DELETED
@@ -1,175 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
class Homesick
|
3
|
-
module Actions
|
4
|
-
# TODO move this to be more like thor's template, empty_directory, etc
|
5
|
-
def git_clone(repo, config = {})
|
6
|
-
config ||= {}
|
7
|
-
destination = config[:destination] || File.basename(repo, '.git')
|
8
|
-
|
9
|
-
destination = Pathname.new(destination) unless destination.kind_of?(Pathname)
|
10
|
-
FileUtils.mkdir_p destination.dirname
|
11
|
-
|
12
|
-
if ! destination.directory?
|
13
|
-
say_status 'git clone', "#{repo} to #{destination.expand_path}", :green unless options[:quiet]
|
14
|
-
system "git clone -q --config push.default=upstream --recursive #{repo} #{destination}" unless options[:pretend]
|
15
|
-
else
|
16
|
-
say_status :exist, destination.expand_path, :blue unless options[:quiet]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def git_init(path = '.')
|
21
|
-
path = Pathname.new(path)
|
22
|
-
|
23
|
-
inside path do
|
24
|
-
if !path.join('.git').exist?
|
25
|
-
say_status 'git init', '' unless options[:quiet]
|
26
|
-
system 'git init >/dev/null' unless options[:pretend]
|
27
|
-
else
|
28
|
-
say_status 'git init', 'already initialized', :blue unless options[:quiet]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def git_remote_add(name, url)
|
34
|
-
existing_remote = `git config remote.#{name}.url`.chomp
|
35
|
-
existing_remote = nil if existing_remote == ''
|
36
|
-
|
37
|
-
if !existing_remote
|
38
|
-
say_status 'git remote', "add #{name} #{url}" unless options[:quiet]
|
39
|
-
system "git remote add #{name} #{url}" unless options[:pretend]
|
40
|
-
else
|
41
|
-
say_status 'git remote', "#{name} already exists", :blue unless options[:quiet]
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def git_submodule_init(config = {})
|
46
|
-
say_status 'git submodule', 'init', :green unless options[:quiet]
|
47
|
-
system 'git submodule --quiet init' unless options[:pretend]
|
48
|
-
end
|
49
|
-
|
50
|
-
def git_submodule_update(config = {})
|
51
|
-
say_status 'git submodule', 'update', :green unless options[:quiet]
|
52
|
-
system 'git submodule --quiet update --init --recursive >/dev/null 2>&1' unless options[:pretend]
|
53
|
-
end
|
54
|
-
|
55
|
-
def git_pull(config = {})
|
56
|
-
say_status 'git pull', '', :green unless options[:quiet]
|
57
|
-
system 'git pull --quiet' unless options[:pretend]
|
58
|
-
end
|
59
|
-
|
60
|
-
def git_push(config = {})
|
61
|
-
say_status 'git push', '', :green unless options[:quiet]
|
62
|
-
system 'git push' unless options[:pretend]
|
63
|
-
end
|
64
|
-
|
65
|
-
def git_commit_all(config = {})
|
66
|
-
say_status 'git commit all', '', :green unless options[:quiet]
|
67
|
-
if config[:message]
|
68
|
-
system "git commit -a -m '#{config[:message]}'" unless options[:pretend]
|
69
|
-
else
|
70
|
-
system 'git commit -v -a' unless options[:pretend]
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def git_add(file, config = {})
|
75
|
-
say_status 'git add file', '', :green unless options[:quiet]
|
76
|
-
system "git add '#{file}'" unless options[:pretend]
|
77
|
-
end
|
78
|
-
|
79
|
-
def git_status(config = {})
|
80
|
-
say_status 'git status', '', :green unless options[:quiet]
|
81
|
-
system "git status" unless options[:pretend]
|
82
|
-
end
|
83
|
-
|
84
|
-
def git_diff(config = {})
|
85
|
-
say_status 'git diff', '', :green unless options[:quiet]
|
86
|
-
system "git diff" unless options[:pretend]
|
87
|
-
end
|
88
|
-
|
89
|
-
def mv(source, destination, config = {})
|
90
|
-
source = Pathname.new(source)
|
91
|
-
destination = Pathname.new(destination + source.basename)
|
92
|
-
|
93
|
-
if destination.exist?
|
94
|
-
say_status :conflict, "#{destination} exists", :red unless options[:quiet]
|
95
|
-
|
96
|
-
if options[:force] || shell.file_collision(destination) { source }
|
97
|
-
system "mv '#{source}' '#{destination}'" unless options[:pretend]
|
98
|
-
end
|
99
|
-
else
|
100
|
-
# this needs some sort of message here.
|
101
|
-
system "mv '#{source}' '#{destination}'" unless options[:pretend]
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def rm_link(target)
|
106
|
-
target = Pathname.new(target)
|
107
|
-
|
108
|
-
if target.symlink?
|
109
|
-
say_status :unlink, "#{target.expand_path}", :green unless options[:quiet]
|
110
|
-
FileUtils.rm_rf target
|
111
|
-
else
|
112
|
-
say_status :conflict, "#{target} is not a symlink", :red unless options[:quiet]
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def rm(file)
|
117
|
-
say_status "rm #{file}", '', :green unless options[:quiet]
|
118
|
-
system "rm #{file}" if File.exists?(file)
|
119
|
-
end
|
120
|
-
|
121
|
-
def rm_rf(dir)
|
122
|
-
say_status "rm -rf #{dir}", '', :green unless options[:quiet]
|
123
|
-
system "rm -rf #{dir}"
|
124
|
-
end
|
125
|
-
|
126
|
-
def rm_link(target)
|
127
|
-
target = Pathname.new(target)
|
128
|
-
|
129
|
-
if target.symlink?
|
130
|
-
say_status :unlink, "#{target.expand_path}", :green unless options[:quiet]
|
131
|
-
FileUtils.rm_rf target
|
132
|
-
else
|
133
|
-
say_status :conflict, "#{target} is not a symlink", :red unless options[:quiet]
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def rm(file)
|
138
|
-
say_status "rm #{file}", '', :green unless options[:quiet]
|
139
|
-
system "rm #{file}"
|
140
|
-
end
|
141
|
-
|
142
|
-
def rm_r(dir)
|
143
|
-
say_status "rm -r #{dir}", '', :green unless options[:quiet]
|
144
|
-
system "rm -r #{dir}"
|
145
|
-
end
|
146
|
-
|
147
|
-
def ln_s(source, destination, config = {})
|
148
|
-
source = Pathname.new(source)
|
149
|
-
destination = Pathname.new(destination)
|
150
|
-
FileUtils.mkdir_p destination.dirname
|
151
|
-
|
152
|
-
if destination.symlink?
|
153
|
-
if destination.readlink == source
|
154
|
-
say_status :identical, destination.expand_path, :blue unless options[:quiet]
|
155
|
-
else
|
156
|
-
say_status :conflict, "#{destination} exists and points to #{destination.readlink}", :red unless options[:quiet]
|
157
|
-
|
158
|
-
if options[:force] || shell.file_collision(destination) { source }
|
159
|
-
system "ln -nsf '#{source}' '#{destination}'" unless options[:pretend]
|
160
|
-
end
|
161
|
-
end
|
162
|
-
elsif destination.exist?
|
163
|
-
say_status :conflict, "#{destination} exists", :red unless options[:quiet]
|
164
|
-
|
165
|
-
if options[:force] || shell.file_collision(destination) { source }
|
166
|
-
system "rm -rf '#{destination}'" unless options[:pretend]
|
167
|
-
system "ln -sf '#{source}' '#{destination}'" unless options[:pretend]
|
168
|
-
end
|
169
|
-
else
|
170
|
-
say_status :symlink, "#{source.expand_path} to #{destination.expand_path}", :green unless options[:quiet]
|
171
|
-
system "ln -s '#{source}' '#{destination}'" unless options[:pretend]
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|