homesick 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 935d44fa24cb4310c884525e49132d31b9e7c4ae
4
- data.tar.gz: c6ca2fd9083135f116f686495d200dcc197b5edb
3
+ metadata.gz: b921342f64064305be6b441b198208c20c3d6477
4
+ data.tar.gz: 8dee41e99c1fa490e46ff6aa3824b42c90bf9542
5
5
  SHA512:
6
- metadata.gz: c50908d9d15eb4375a92e377601f2b198a5d2cffb76c58768e7d43cf397a19f10704ef6e83cfa37c974b11de923d111d5ead0a6606dcd1aacab359f4d87dfa33
7
- data.tar.gz: c1a5a4b9161eb038fa435ba16686a99b0f23dc0a2f05b68c5db9842108d618f08ccc38c8f62025323a09167e27d63a177d30ee0bd411bd19a420b9e49fbe44b2
6
+ metadata.gz: 477bdf748078093e787b8ac05b400dc7841ab9510813f850a608a5363804a91d463b71753cddd6c751b093b549040dd9d3854c95a8949e659f70e74a8407c192
7
+ data.tar.gz: 0cca501be8f34e94fdc02a86c7dc6e2d4ac96d707ad32289f5177b579906b4f74ad1484b3997c8c5acceb375e007f726838bd248609df4b659321671b5efcc58
@@ -3,3 +3,4 @@ rvm:
3
3
  - 2.1.0
4
4
  - 2.0.0
5
5
  - 1.9.3
6
+ sudo: false
@@ -1,3 +1,9 @@
1
+ #1.1.3
2
+ * Allow a destinaton to be passed when cloning a castle
3
+ * Make sure `homesick edit` opens default editor in the root of the given castle
4
+ * Fixed bug when diffing edited files
5
+ * Fixed crashing bug when attempting to diff directories
6
+ * Ensure that messages are escaped correctly on `git commit all`
1
7
  #1.1.2
2
8
  * Added '--force' option to the rc command to bypass confirmation checks when running a .homesickrc file
3
9
  * Added a check to make sure that a minimum of Git 1.8.0 is installed. This stops Homesick failing silently if Git is not installed.
data/Gemfile CHANGED
@@ -19,6 +19,9 @@ group :development do
19
19
  if RbConfig::CONFIG['host_os'] =~ /linux|freebsd|openbsd|sunos|solaris/
20
20
  gem 'libnotify'
21
21
  end
22
+ if RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
23
+ gem 'terminal-notifier-guard', '~> 1.6.1'
24
+ end
22
25
  if RUBY_VERSION >= '1.9.2'
23
26
  gem "rubocop"
24
27
  end
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: homesick 1.1.2 ruby lib
5
+ # stub: homesick 1.1.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "homesick"
9
- s.version = "1.1.2"
9
+ s.version = "1.1.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Joshua Nichols", "Yusuke Murata"]
14
- s.date = "2015-01-02"
14
+ s.date = "2015-10-31"
15
15
  s.description = "\n Your home directory is your castle. Don't leave your dotfiles behind.\n \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 "
16
16
  s.email = ["josh@technicalpickles.com", "info@muratayusuke.com"]
17
17
  s.executables = ["homesick"]
@@ -7,7 +7,7 @@ require 'homesick/cli'
7
7
 
8
8
  # Homesick's top-level module
9
9
  module Homesick
10
- GITHUB_NAME_REPO_PATTERN = /\A([A-Za-z0-9_-]+\/[A-Za-z0-9_-]+)\Z/
10
+ GITHUB_NAME_REPO_PATTERN = %r{\A([A-Za-z0-9_-]+/[A-Za-z0-9_-]+)\Z}
11
11
  SUBDIR_FILENAME = '.homesick_subdir'
12
12
 
13
13
  DEFAULT_CASTLE_NAME = 'dotfiles'
@@ -3,16 +3,14 @@ module Homesick
3
3
  module Actions
4
4
  # File-related helper methods for Homesick
5
5
  module FileActions
6
- def mv(source, destination, config = {})
6
+ def mv(source, destination)
7
7
  source = Pathname.new(source)
8
8
  destination = Pathname.new(destination + source.basename)
9
-
10
- if destination.exist?
9
+ case
10
+ when destination.exist? && (options[:force] || shell.file_collision(destination) { source })
11
11
  say_status :conflict, "#{destination} exists", :red
12
-
13
- FileUtils.mv source, destination if (options[:force] || shell.file_collision(destination) { source }) && !options[:pretend]
12
+ FileUtils.mv source, destination unless options[:pretend]
14
13
  else
15
- # this needs some sort of message here.
16
14
  FileUtils.mv source, destination unless options[:pretend]
17
15
  end
18
16
  end
@@ -43,7 +41,7 @@ module Homesick
43
41
  FileUtils.rm_r dir
44
42
  end
45
43
 
46
- def ln_s(source, destination, config = {})
44
+ def ln_s(source, destination)
47
45
  source = Pathname.new(source)
48
46
  destination = Pathname.new(destination)
49
47
  FileUtils.mkdir_p destination.dirname
@@ -75,7 +73,7 @@ module Homesick
75
73
  when :conflict
76
74
  say_status :conflict, "#{destination} exists", :red
77
75
 
78
- if collision_accepted?(destination)
76
+ if collision_accepted?(destination, source)
79
77
  FileUtils.rm_r destination, force: true unless options[:pretend]
80
78
  FileUtils.ln_s source, destination, force: true unless options[:pretend]
81
79
  end
@@ -14,7 +14,7 @@ module Homesick
14
14
  def git_version_correct?
15
15
  info = `git --version`.scan(/(\d+)\.(\d+)\.(\d+)/).flatten.map(&:to_i)
16
16
  return false unless info.count == 3
17
- current_version = Hash[ [:major, :minor, :patch].zip(info) ]
17
+ current_version = Hash[[:major, :minor, :patch].zip(info)]
18
18
  return true if current_version.eql?(MIN_VERSION)
19
19
  return true if current_version[:major] > MIN_VERSION[:major]
20
20
  return true if current_version[:major] == MIN_VERSION[:major] && current_version[:minor] > MIN_VERSION[:minor]
@@ -27,7 +27,7 @@ module Homesick
27
27
  config ||= {}
28
28
  destination = config[:destination] || File.basename(repo, '.git')
29
29
 
30
- destination = Pathname.new(destination) unless destination.kind_of?(Pathname)
30
+ destination = Pathname.new(destination) unless destination.is_a?(Pathname)
31
31
  FileUtils.mkdir_p destination.dirname
32
32
 
33
33
  if destination.directory?
@@ -65,22 +65,22 @@ module Homesick
65
65
  end
66
66
  end
67
67
 
68
- def git_submodule_init(config = {})
68
+ def git_submodule_init
69
69
  say_status 'git submodule', 'init', :green
70
70
  system 'git submodule --quiet init'
71
71
  end
72
72
 
73
- def git_submodule_update(config = {})
73
+ def git_submodule_update
74
74
  say_status 'git submodule', 'update', :green
75
75
  system 'git submodule --quiet update --init --recursive >/dev/null 2>&1'
76
76
  end
77
77
 
78
- def git_pull(config = {})
78
+ def git_pull
79
79
  say_status 'git pull', '', :green
80
80
  system 'git pull --quiet'
81
81
  end
82
82
 
83
- def git_push(config = {})
83
+ def git_push
84
84
  say_status 'git push', '', :green
85
85
  system 'git push'
86
86
  end
@@ -88,23 +88,23 @@ module Homesick
88
88
  def git_commit_all(config = {})
89
89
  say_status 'git commit all', '', :green
90
90
  if config[:message]
91
- system "git commit -a -m '#{config[:message]}'"
91
+ system %(git commit -a -m "#{config[:message]}")
92
92
  else
93
93
  system 'git commit -v -a'
94
94
  end
95
95
  end
96
96
 
97
- def git_add(file, config = {})
97
+ def git_add(file)
98
98
  say_status 'git add file', '', :green
99
99
  system "git add '#{file}'"
100
100
  end
101
101
 
102
- def git_status(config = {})
102
+ def git_status
103
103
  say_status 'git status', '', :green
104
104
  system 'git status'
105
105
  end
106
106
 
107
- def git_diff(config = {})
107
+ def git_diff
108
108
  say_status 'git diff', '', :green
109
109
  system 'git diff'
110
110
  end
@@ -25,38 +25,37 @@ module Homesick
25
25
  exit(1)
26
26
  end
27
27
  # Hack in support for diffing symlinks
28
- self.shell = Thor::Shell::Color.new
29
- class << shell
30
- def show_diff(destination, content)
31
- destination = Pathname.new(destination)
32
- if destination.symlink?
33
- say "- #{destination.readlink}", :red, true
34
- say "+ #{content.expand_path}", :green, true
35
- else
36
- super
37
- end
38
- end
28
+ # Also adds support for checking if destination or content is a directory
29
+ shell_metaclass = class << shell; self; end
30
+ shell_metaclass.send(:define_method, :show_diff) do |destination, content|
31
+ destination = Pathname.new(destination)
32
+ content = Pathname.new(content)
33
+ return 'Unable to create diff: destination or content is a directory' if destination.directory? || content.directory?
34
+ return super(destination, content) unless destination.symlink?
35
+ say "- #{destination.readlink}", :red, true
36
+ say "+ #{content.expand_path}", :green, true
39
37
  end
40
38
  end
41
39
 
42
- desc 'clone URI', 'Clone +uri+ as a castle for homesick'
43
- def clone(uri)
40
+ desc 'clone URI CASTLE_NAME', 'Clone +uri+ as a castle with name CASTLE_NAME for homesick'
41
+ def clone(uri, destination=nil)
42
+ destination = Pathname.new(destination) unless destination.nil?
43
+
44
44
  inside repos_dir do
45
- destination = nil
46
45
  if File.exist?(uri)
47
46
  uri = Pathname.new(uri).expand_path
48
47
  fail "Castle already cloned to #{uri}" if uri.to_s.start_with?(repos_dir.to_s)
49
48
 
50
- destination = uri.basename
49
+ destination = uri.basename if destination.nil?
51
50
 
52
51
  ln_s uri, destination
53
52
  elsif uri =~ GITHUB_NAME_REPO_PATTERN
54
- destination = Pathname.new(uri).basename
53
+ destination = Pathname.new(uri).basename if destination.nil?
55
54
  git_clone "https://github.com/#{Regexp.last_match[1]}.git",
56
55
  destination: destination
57
56
  elsif uri =~ /%r([^%r]*?)(\.git)?\Z/ || uri =~ /[^:]+:([^:]+)(\.git)?\Z/
58
- destination = Pathname.new(Regexp.last_match[1])
59
- git_clone uri
57
+ destination = Pathname.new(Regexp.last_match[1].gsub(/\.git$/, '')).basename if destination.nil?
58
+ git_clone uri, destination: destination
60
59
  else
61
60
  fail "Unknown URI format: #{uri}"
62
61
  end
@@ -73,18 +72,12 @@ module Homesick
73
72
  inside repos_dir do
74
73
  destination = Pathname.new(name)
75
74
  homesickrc = destination.join('.homesickrc').expand_path
76
- if homesickrc.exist?
77
- proceed = options[:force] || shell.yes?("#{name} has a .homesickrc. Proceed with evaling it? (This could be destructive)")
78
- if proceed
79
- say_status 'eval', homesickrc
80
- inside destination do
81
- eval homesickrc.read, binding, homesickrc.expand_path.to_s
82
- end
83
- else
84
- say_status 'eval skip',
85
- "not evaling #{homesickrc}, #{destination} may need manual configuration",
86
- :blue
87
- end
75
+ return unless homesickrc.exist?
76
+ proceed = options[:force] || shell.yes?("#{name} has a .homesickrc. Proceed with evaling it? (This could be destructive)")
77
+ return say_status 'eval skip', "not evaling #{homesickrc}, #{destination} may need manual configuration", :blue unless proceed
78
+ say_status 'eval', homesickrc
79
+ inside destination do
80
+ eval homesickrc.read, binding, homesickrc.expand_path.to_s
88
81
  end
89
82
  end
90
83
  end
@@ -252,11 +245,10 @@ module Homesick
252
245
  desc 'destroy CASTLE', 'Delete all symlinks and remove the cloned repository'
253
246
  def destroy(name)
254
247
  check_castle_existance name, 'destroy'
248
+ return unless shell.yes?('This will destroy your castle irreversible! Are you sure?')
255
249
 
256
- if shell.yes?('This will destroy your castle irreversible! Are you sure?')
257
- unlink(name)
258
- rm_rf repos_dir.join(name)
259
- end
250
+ unlink(name)
251
+ rm_rf repos_dir.join(name)
260
252
  end
261
253
 
262
254
  desc 'cd CASTLE', 'Open a new shell in the root of the given castle'
@@ -283,11 +275,11 @@ module Homesick
283
275
  end
284
276
  check_castle_existance castle, 'open'
285
277
  castle_dir = repos_dir.join(castle)
286
- say_status "#{ENV['EDITOR']} #{castle_dir.realpath}",
278
+ say_status "#{castle_dir.realpath}: #{ENV['EDITOR']} .",
287
279
  "Opening the root directory of castle '#{castle}' in editor '#{ENV['EDITOR']}'.",
288
280
  :green
289
281
  inside castle_dir do
290
- system(ENV['EDITOR'])
282
+ system("#{ENV['EDITOR']} .")
291
283
  end
292
284
  end
293
285
 
@@ -1,4 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
+ require 'pathname'
3
+
2
4
  module Homesick
3
5
  # Various utility methods that are used by Homesick
4
6
  module Utils
@@ -33,12 +35,11 @@ module Homesick
33
35
  end
34
36
 
35
37
  def check_castle_existance(name, action)
36
- unless castle_dir(name).exist?
37
- say_status :error,
38
- "Could not #{action} #{name}, expected #{castle_dir(name)} exist and contain dotfiles",
39
- :red
40
- exit(1)
41
- end
38
+ return if castle_dir(name).exist?
39
+ say_status :error,
40
+ "Could not #{action} #{name}, expected #{castle_dir(name)} exist and contain dotfiles",
41
+ :red
42
+ exit(1)
42
43
  end
43
44
 
44
45
  def all_castles
@@ -51,7 +52,7 @@ module Homesick
51
52
  end
52
53
  end
53
54
 
54
- def inside_each_castle(&block)
55
+ def inside_each_castle
55
56
  all_castles.each do |git_dir|
56
57
  castle = git_dir.dirname
57
58
  Dir.chdir castle do # so we can call git config from the right contxt
@@ -128,7 +129,6 @@ module Homesick
128
129
  def move_dir_contents(target, dir_path)
129
130
  child_files = dir_path.children
130
131
  child_files.each do |child|
131
-
132
132
  target_path = target.join(child.basename)
133
133
  if target_path.exist?
134
134
  if more_recent?(child, target_path) && target.file?
@@ -148,8 +148,8 @@ module Homesick
148
148
  first_p.mtime > second_p.mtime && !first_p.symlink?
149
149
  end
150
150
 
151
- def collision_accepted?(destination)
152
- fail "Argument must be an instance of Pathname, #{destination.class.name} given" unless destination.instance_of?(Pathname)
151
+ def collision_accepted?(destination, source)
152
+ fail "Arguments must be instances of Pathname, #{destination.class.name} and #{source.class.name} given" unless destination.instance_of?(Pathname) && source.instance_of?(Pathname)
153
153
  options[:force] || shell.file_collision(destination) { source }
154
154
  end
155
155
 
@@ -191,7 +191,7 @@ module Homesick
191
191
  end
192
192
 
193
193
  def unsymlink_each(castle, basedir, subdirs)
194
- each_file(castle, basedir, subdirs) do |absolute_path, home_path|
194
+ each_file(castle, basedir, subdirs) do |_absolute_path, home_path|
195
195
  rm_link home_path
196
196
  end
197
197
  end
@@ -5,7 +5,7 @@ module Homesick
5
5
  module Version
6
6
  MAJOR = 1
7
7
  MINOR = 1
8
- PATCH = 2
8
+ PATCH = 3
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
11
11
  end
@@ -26,10 +26,10 @@ describe Homesick::CLI do
26
26
 
27
27
  context 'when a git version that doesn\'t meet the minimum required is installed' do
28
28
  before do
29
- expect_any_instance_of(Homesick::Actions::GitActions).to receive(:`).and_return("git version 1.7.6")
29
+ expect_any_instance_of(Homesick::Actions::GitActions).to receive(:`).and_return('git version 1.7.6')
30
30
  end
31
31
  it 'should raise an exception' do
32
- output = Capture.stdout{ expect{Homesick::CLI.new}.to raise_error SystemExit }
32
+ output = Capture.stdout { expect { Homesick::CLI.new }.to raise_error SystemExit }
33
33
  expect(output.chomp).to include(Homesick::Actions::GitActions::STRING)
34
34
  end
35
35
  end
@@ -39,20 +39,19 @@ describe Homesick::CLI do
39
39
  expect_any_instance_of(Homesick::Actions::GitActions).to receive(:`).at_least(:once).and_return("git version #{Homesick::Actions::GitActions::STRING}")
40
40
  end
41
41
  it 'should not raise an exception' do
42
- output = Capture.stdout{ expect{Homesick::CLI.new}.not_to raise_error }
42
+ output = Capture.stdout { expect { Homesick::CLI.new }.not_to raise_error }
43
43
  expect(output.chomp).not_to include(Homesick::Actions::GitActions::STRING)
44
44
  end
45
45
  end
46
46
 
47
47
  context 'when a git version that is greater than the minimum required is installed' do
48
48
  before do
49
- expect_any_instance_of(Homesick::Actions::GitActions).to receive(:`).at_least(:once).and_return("git version 3.9.8")
49
+ expect_any_instance_of(Homesick::Actions::GitActions).to receive(:`).at_least(:once).and_return('git version 3.9.8')
50
50
  end
51
51
  it 'should not raise an exception' do
52
- output = Capture.stdout{ expect{Homesick::CLI.new}.not_to raise_error }
52
+ output = Capture.stdout { expect { Homesick::CLI.new }.not_to raise_error }
53
53
  expect(output.chomp).not_to include(Homesick::Actions::GitActions::STRING)
54
54
  end
55
-
56
55
  end
57
56
  end
58
57
 
@@ -112,34 +111,35 @@ describe Homesick::CLI do
112
111
 
113
112
  it 'clones git repo like git://host/path/to.git' do
114
113
  expect(homesick).to receive(:git_clone)
115
- .with('git://github.com/technicalpickles/pickled-vim.git')
114
+ .with('git://github.com/technicalpickles/pickled-vim.git', destination: Pathname.new('pickled-vim'))
116
115
 
117
116
  homesick.clone 'git://github.com/technicalpickles/pickled-vim.git'
118
117
  end
119
118
 
120
119
  it 'clones git repo like git@host:path/to.git' do
121
120
  expect(homesick).to receive(:git_clone)
122
- .with('git@github.com:technicalpickles/pickled-vim.git')
121
+ .with('git@github.com:technicalpickles/pickled-vim.git', destination: Pathname.new('pickled-vim'))
123
122
 
124
123
  homesick.clone 'git@github.com:technicalpickles/pickled-vim.git'
125
124
  end
126
125
 
127
126
  it 'clones git repo like http://host/path/to.git' do
128
127
  expect(homesick).to receive(:git_clone)
129
- .with('http://github.com/technicalpickles/pickled-vim.git')
128
+ .with('http://github.com/technicalpickles/pickled-vim.git', destination: Pathname.new('pickled-vim'))
130
129
 
131
130
  homesick.clone 'http://github.com/technicalpickles/pickled-vim.git'
132
131
  end
133
132
 
134
133
  it 'clones git repo like http://host/path/to' do
135
134
  expect(homesick).to receive(:git_clone)
136
- .with('http://github.com/technicalpickles/pickled-vim')
135
+ .with('http://github.com/technicalpickles/pickled-vim', destination: Pathname.new('pickled-vim'))
137
136
 
138
137
  homesick.clone 'http://github.com/technicalpickles/pickled-vim'
139
138
  end
140
139
 
141
140
  it 'clones git repo like host-alias:repos.git' do
142
- expect(homesick).to receive(:git_clone).with('gitolite:pickled-vim.git')
141
+ expect(homesick).to receive(:git_clone).with('gitolite:pickled-vim.git',
142
+ destination: Pathname.new('pickled-vim'))
143
143
 
144
144
  homesick.clone 'gitolite:pickled-vim.git'
145
145
  end
@@ -151,11 +151,18 @@ describe Homesick::CLI do
151
151
 
152
152
  it 'clones a github repo' do
153
153
  expect(homesick).to receive(:git_clone)
154
- .with('https://github.com/wfarr/dotfiles.git',
155
- destination: Pathname.new('dotfiles'))
154
+ .with('https://github.com/wfarr/dotfiles.git', destination: Pathname.new('dotfiles'))
156
155
 
157
156
  homesick.clone 'wfarr/dotfiles'
158
157
  end
158
+
159
+ it 'accepts a destination', :focus do
160
+ expect(homesick).to receive(:git_clone)
161
+ .with('https://github.com/wfarr/dotfiles.git',
162
+ destination: Pathname.new('other-name'))
163
+
164
+ homesick.clone 'wfarr/dotfiles', 'other-name'
165
+ end
159
166
  end
160
167
 
161
168
  describe 'rc' do
@@ -220,7 +227,7 @@ describe Homesick::CLI do
220
227
  end
221
228
  end
222
229
 
223
- describe 'link' do
230
+ describe 'link_castle' do
224
231
  let(:castle) { given_castle('glencairn') }
225
232
 
226
233
  it 'links dotfiles from a castle to the home folder' do
@@ -308,11 +315,9 @@ describe Homesick::CLI do
308
315
  home_config_dir = home.join('.config')
309
316
  home_someapp_dir = home_config_dir.join('someapp')
310
317
  expect(home_config_dir.symlink?).to eq(false)
311
- expect(home_config_dir.join('.some_dotfile').readlink)
312
- .to eq(config_dotfile)
318
+ expect(home_config_dir.join('.some_dotfile').readlink).to eq(config_dotfile)
313
319
  expect(home_someapp_dir.symlink?).to eq(false)
314
- expect(home_someapp_dir.join('.some_appfile').readlink)
315
- .to eq(someapp_dotfile)
320
+ expect(home_someapp_dir.join('.some_appfile').readlink).to eq(someapp_dotfile)
316
321
  end
317
322
  end
318
323
 
@@ -421,13 +426,9 @@ describe Homesick::CLI do
421
426
  given_castle('wtf/zomg')
422
427
 
423
428
  expect(homesick).to receive(:say_status)
424
- .with('zomg',
425
- 'git://github.com/technicalpickles/zomg.git',
426
- :cyan)
429
+ .with('zomg', 'git://github.com/technicalpickles/zomg.git', :cyan)
427
430
  expect(homesick).to receive(:say_status)
428
- .with('wtf/zomg',
429
- 'git://github.com/technicalpickles/zomg.git',
430
- :cyan)
431
+ .with('wtf/zomg', 'git://github.com/technicalpickles/zomg.git', :cyan)
431
432
 
432
433
  homesick.list
433
434
  end
@@ -437,7 +438,7 @@ describe Homesick::CLI do
437
438
  it 'says "nothing to commit" when there are no changes' do
438
439
  given_castle('castle_repo')
439
440
  text = Capture.stdout { homesick.status('castle_repo') }
440
- expect(text).to match(/nothing to commit \(create\/copy files and use "git add" to track\)$/)
441
+ expect(text).to match(%r{nothing to commit \(create/copy files and use "git add" to track\)$})
441
442
  end
442
443
 
443
444
  it 'says "Changes to be committed" when there are changes' do
@@ -445,9 +446,7 @@ describe Homesick::CLI do
445
446
  some_rc_file = home.file '.some_rc_file'
446
447
  homesick.track(some_rc_file.to_s, 'castle_repo')
447
448
  text = Capture.stdout { homesick.status('castle_repo') }
448
- expect(text).to match(
449
- /Changes to be committed:.*new file:\s*home\/.some_rc_file/m
450
- )
449
+ expect(text).to match(%r{Changes to be committed:.*new file:\s*home\/.some_rc_file}m)
451
450
  end
452
451
  end
453
452
 
@@ -519,7 +518,6 @@ describe Homesick::CLI do
519
518
  end
520
519
  end
521
520
  end
522
-
523
521
  end
524
522
 
525
523
  describe 'push' do
@@ -531,9 +529,7 @@ describe Homesick::CLI do
531
529
 
532
530
  it 'prints an error message when trying to push a non-existant castle' do
533
531
  expect(homesick).to receive('say_status').once
534
- .with(:error,
535
- /Could not push castle_repo, expected .* exist and contain dotfiles/,
536
- :red)
532
+ .with(:error, /Could not push castle_repo, expected .* exist and contain dotfiles/, :red)
537
533
  expect { homesick.push 'castle_repo' }.to raise_error(SystemExit)
538
534
  end
539
535
  end
@@ -617,7 +613,6 @@ describe Homesick::CLI do
617
613
  # Note that this is a test for the subdir_file related feature of track,
618
614
  # not for the subdir_file method itself.
619
615
  describe 'subdir_file' do
620
-
621
616
  it 'adds the nested files parent to the subdir_file' do
622
617
  castle = given_castle('castle_repo')
623
618
 
@@ -692,9 +687,7 @@ describe Homesick::CLI do
692
687
 
693
688
  it 'returns an error message when the given castle does not exist' do
694
689
  expect(homesick).to receive('say_status').once
695
- .with(:error,
696
- /Could not cd castle_repo, expected .* exist and contain dotfiles/,
697
- :red)
690
+ .with(:error, /Could not cd castle_repo, expected .* exist and contain dotfiles/, :red)
698
691
  expect { homesick.cd 'castle_repo' }.to raise_error(SystemExit)
699
692
  end
700
693
  end
@@ -707,7 +700,7 @@ describe Homesick::CLI do
707
700
  allow(ENV).to receive(:[]).with('EDITOR').and_return('vim')
708
701
  given_castle 'castle_repo'
709
702
  expect(homesick).to receive('inside').once.with(kind_of(Pathname)).and_yield
710
- expect(homesick).to receive('system').once.with('vim')
703
+ expect(homesick).to receive('system').once.with('vim .')
711
704
  Capture.stdout { homesick.open 'castle_repo' }
712
705
  end
713
706
 
@@ -715,9 +708,7 @@ describe Homesick::CLI do
715
708
  # Set the default editor to make sure it fails.
716
709
  allow(ENV).to receive(:[]).with('EDITOR').and_return(nil)
717
710
  expect(homesick).to receive('say_status').once
718
- .with(:error,
719
- 'The $EDITOR environment variable must be set to use this command',
720
- :red)
711
+ .with(:error, 'The $EDITOR environment variable must be set to use this command', :red)
721
712
  expect { homesick.open 'castle_repo' }.to raise_error(SystemExit)
722
713
  end
723
714
 
@@ -725,9 +716,7 @@ describe Homesick::CLI do
725
716
  # Set a default just in case none is set
726
717
  allow(ENV).to receive(:[]).with('EDITOR').and_return('vim')
727
718
  allow(homesick).to receive('say_status').once
728
- .with(:error,
729
- /Could not open castle_repo, expected .* exist and contain dotfiles/,
730
- :red)
719
+ .with(:error, /Could not open castle_repo, expected .* exist and contain dotfiles/, :red)
731
720
  expect { homesick.open 'castle_repo' }.to raise_error(SystemExit)
732
721
  end
733
722
  end
@@ -746,9 +735,7 @@ describe Homesick::CLI do
746
735
  it 'executes a single command with no arguments inside a given castle' do
747
736
  allow(homesick).to receive('inside').once.with(kind_of(Pathname)).and_yield
748
737
  allow(homesick).to receive('say_status').once
749
- .with(be_a(String),
750
- be_a(String),
751
- :green)
738
+ .with(be_a(String), be_a(String), :green)
752
739
  allow(homesick).to receive('system').once.with('ls')
753
740
  Capture.stdout { homesick.exec 'castle_repo', 'ls' }
754
741
  end
@@ -756,18 +743,14 @@ describe Homesick::CLI do
756
743
  it 'executes a single command with arguments inside a given castle' do
757
744
  allow(homesick).to receive('inside').once.with(kind_of(Pathname)).and_yield
758
745
  allow(homesick).to receive('say_status').once
759
- .with(be_a(String),
760
- be_a(String),
761
- :green)
746
+ .with(be_a(String), be_a(String), :green)
762
747
  allow(homesick).to receive('system').once.with('ls -la')
763
748
  Capture.stdout { homesick.exec 'castle_repo', 'ls', '-la' }
764
749
  end
765
750
 
766
751
  it 'raises an error when the method is called without a command' do
767
752
  allow(homesick).to receive('say_status').once
768
- .with(:error,
769
- be_a(String),
770
- :red)
753
+ .with(:error, be_a(String), :red)
771
754
  allow(homesick).to receive('exit').once.with(1)
772
755
  Capture.stdout { homesick.exec 'castle_repo' }
773
756
  end
@@ -775,9 +758,7 @@ describe Homesick::CLI do
775
758
  context 'pretend' do
776
759
  it 'does not execute a command when the pretend option is passed' do
777
760
  allow(homesick).to receive('say_status').once
778
- .with(be_a(String),
779
- match(/.*Would execute.*/),
780
- :green)
761
+ .with(be_a(String), match(/.*Would execute.*/), :green)
781
762
  expect(homesick).to receive('system').never
782
763
  Capture.stdout { homesick.invoke 'exec', %w(castle_repo ls -la), pretend: true }
783
764
  end
@@ -787,7 +768,7 @@ describe Homesick::CLI do
787
768
  it 'does not print status information when quiet is passed' do
788
769
  expect(homesick).to receive('say_status').never
789
770
  allow(homesick).to receive('system').once
790
- .with('ls -la')
771
+ .with('ls -la')
791
772
  Capture.stdout { homesick.invoke 'exec', %w(castle_repo ls -la), quiet: true }
792
773
  end
793
774
  end
@@ -802,9 +783,7 @@ describe Homesick::CLI do
802
783
  it 'executes a command without arguments inside the root of each cloned castle' do
803
784
  allow(homesick).to receive('inside_each_castle').exactly(:twice).and_yield('castle_repo').and_yield('another_castle_repo')
804
785
  allow(homesick).to receive('say_status').at_least(:once)
805
- .with(be_a(String),
806
- be_a(String),
807
- :green)
786
+ .with(be_a(String), be_a(String), :green)
808
787
  allow(homesick).to receive('system').at_least(:once).with('ls')
809
788
  Capture.stdout { homesick.exec_all 'ls' }
810
789
  end
@@ -812,18 +791,14 @@ describe Homesick::CLI do
812
791
  it 'executes a command with arguments inside the root of each cloned castle' do
813
792
  allow(homesick).to receive('inside_each_castle').exactly(:twice).and_yield('castle_repo').and_yield('another_castle_repo')
814
793
  allow(homesick).to receive('say_status').at_least(:once)
815
- .with(be_a(String),
816
- be_a(String),
817
- :green)
794
+ .with(be_a(String), be_a(String), :green)
818
795
  allow(homesick).to receive('system').at_least(:once).with('ls -la')
819
796
  Capture.stdout { homesick.exec_all 'ls', '-la' }
820
797
  end
821
798
 
822
799
  it 'raises an error when the method is called without a command' do
823
800
  allow(homesick).to receive('say_status').once
824
- .with(:error,
825
- be_a(String),
826
- :red)
801
+ .with(:error, be_a(String), :red)
827
802
  allow(homesick).to receive('exit').once.with(1)
828
803
  Capture.stdout { homesick.exec_all }
829
804
  end
@@ -831,9 +806,7 @@ describe Homesick::CLI do
831
806
  context 'pretend' do
832
807
  it 'does not execute a command when the pretend option is passed' do
833
808
  allow(homesick).to receive('say_status').at_least(:once)
834
- .with(be_a(String),
835
- match(/.*Would execute.*/),
836
- :green)
809
+ .with(be_a(String), match(/.*Would execute.*/), :green)
837
810
  expect(homesick).to receive('system').never
838
811
  Capture.stdout { homesick.invoke 'exec_all', %w(ls -la), pretend: true }
839
812
  end
@@ -843,7 +816,7 @@ describe Homesick::CLI do
843
816
  it 'does not print status information when quiet is passed' do
844
817
  expect(homesick).to receive('say_status').never
845
818
  allow(homesick).to receive('system').at_least(:once)
846
- .with('ls -la')
819
+ .with('ls -la')
847
820
  Capture.stdout { homesick.invoke 'exec_all', %w(ls -la), quiet: true }
848
821
  end
849
822
  end
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.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Nichols
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-02 00:00:00.000000000 Z
12
+ date: 2015-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -221,8 +221,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  version: '0'
222
222
  requirements: []
223
223
  rubyforge_project:
224
- rubygems_version: 2.2.2
224
+ rubygems_version: 2.4.8
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: Your home directory is your castle. Don't leave your dotfiles behind.
228
228
  test_files: []
229
+ has_rdoc: