homesick 1.1.5 → 1.1.6

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: f68e5c045dae084eed64f4ddbcbb67bbc81a1bc8
4
- data.tar.gz: 0e94e45fa015c99b0759156bd39a58934e82415c
3
+ metadata.gz: 883e37c1c9867b8620d8749c258607c19d35f887
4
+ data.tar.gz: 5f88fd0008afdb5d8bd4100077eb3ce63be3d99d
5
5
  SHA512:
6
- metadata.gz: e62d3a46c1eaf6ef94053ed3336af4656617de87b03661e8a282a0c7176a31145bf1fc3fbebba862142ce3a90c66b9b1d4353dca50cb4409f9c6e25040352f26
7
- data.tar.gz: 48e4bd658281708fc575bfb0c98d39450f2fd76b02a4e4ac63de41e5b83acb2a44a5c4c5dc45302240af7b205b64b57e786ca26f0fbcdbad135db8dc6e0e487f
6
+ metadata.gz: 0d983e5d652622d7fa93f02577186493271978cbfbcdbeffbb4409a2d064bf1a1985c6ca5cbcaec52adb088840ddd3e19d7de0e0e09630a06eb515ed3a614029
7
+ data.tar.gz: '00119db9851844f54697fe5ee309b463cb37cf7d7e29226c728f0a4ef95b35cc898f11eaf13580297f0aa634f297013de32d82cccc8ad2cc4e45017fd1db5739'
@@ -1,29 +1,34 @@
1
- #1.1.5
1
+ #1.1.6
2
+ * Makesure the FileUtils is imported correctly to avoid a potential error
3
+ * Fixes an issue where comparing a diff would not use the content of the new file
4
+ * Small documentation fixes
5
+
6
+ # 1.1.5
2
7
  * Fixed problem with version number being incorrect.
3
8
 
4
- #1.1.4
9
+ # 1.1.4
5
10
  * Make sure symlink conflicts are explicitly communicated to a user and symlinks are not silently overwritten
6
11
  * Use real paths of symlinks when linking a castle into home
7
12
  * Fix a problem when in a diff when asking a user to resolve a conflict
8
13
  * Some code refactoring and fixes
9
14
 
10
- #1.1.3
15
+ # 1.1.3
11
16
  * Allow a destination to be passed when cloning a castle
12
17
  * Make sure `homesick edit` opens default editor in the root of the given castle
13
18
  * Fixed bug when diffing edited files
14
19
  * Fixed crashing bug when attempting to diff directories
15
20
  * Ensure that messages are escaped correctly on `git commit all`
16
21
 
17
- #1.1.2
22
+ # 1.1.2
18
23
  * Added '--force' option to the rc command to bypass confirmation checks when running a .homesickrc file
19
24
  * 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.
20
25
  * Code refactoring and fixes.
21
26
 
22
- #1.1.0
27
+ # 1.1.0
23
28
  * Added exec and exec_all commands to run commands inside one or all clones castles.
24
29
  * Code refactoring.
25
30
 
26
- #1.0.0
31
+ # 1.0.0
27
32
  * Removed support for Ruby 1.8.7
28
33
  * Added a version command
29
34
 
@@ -30,7 +30,7 @@ Alternatively, if it's on github, there's a slightly shorter way:
30
30
 
31
31
  With the castle cloned, you can now link its contents into your home dir:
32
32
 
33
- homesick symlink pickled-vim
33
+ homesick link pickled-vim
34
34
 
35
35
  You can remove symlinks anytime when you don't need them anymore
36
36
 
@@ -84,7 +84,7 @@ If you ever want to see what version of homesick you have type:
84
84
 
85
85
  ## .homesick_subdir
86
86
 
87
- `homesick symlink` basically makes symlink to only first depth in `castle/home`. If you want to link nested files/directories, please use .homesick_subdir.
87
+ `homesick link` basically makes symlink to only first depth in `castle/home`. If you want to link nested files/directories, please use .homesick_subdir.
88
88
 
89
89
  For example, when you have castle like this:
90
90
 
@@ -114,7 +114,7 @@ castle/.homesick_subdir
114
114
 
115
115
  .config
116
116
 
117
- and run `homesick symlink CASTLE`. The result is:
117
+ and run `homesick link CASTLE`. The result is:
118
118
 
119
119
  ~
120
120
  |-- .config
@@ -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.5 ruby lib
5
+ # stub: homesick 1.1.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "homesick".freeze
9
- s.version = "1.1.5"
9
+ s.version = "1.1.6"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Joshua Nichols".freeze, "Yusuke Murata".freeze]
14
- s.date = "2017-03-23"
14
+ s.date = "2017-12-20"
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 ".freeze
16
16
  s.email = ["josh@technicalpickles.com".freeze, "info@muratayusuke.com".freeze]
17
17
  s.executables = ["homesick".freeze]
@@ -1,4 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
+ require 'fileutils'
2
3
  require 'thor'
3
4
 
4
5
  module Homesick
@@ -27,13 +28,13 @@ module Homesick
27
28
  # Hack in support for diffing symlinks
28
29
  # Also adds support for checking if destination or content is a directory
29
30
  shell_metaclass = class << shell; self; end
30
- shell_metaclass.send(:define_method, :show_diff) do |destination, content|
31
+ shell_metaclass.send(:define_method, :show_diff) do |destination, source|
31
32
  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?
33
+ source = Pathname.new(source)
34
+ return 'Unable to create diff: destination or content is a directory' if destination.directory? || source.directory?
35
+ return super(destination, File.binread(source)) unless destination.symlink?
35
36
  say "- #{destination.readlink}", :red, true
36
- say "+ #{content.expand_path}", :green, true
37
+ say "+ #{source.expand_path}", :green, true
37
38
  end
38
39
  end
39
40
 
@@ -37,7 +37,7 @@ module Homesick
37
37
  def check_castle_existance(name, action)
38
38
  return if castle_dir(name).exist?
39
39
  say_status :error,
40
- "Could not #{action} #{name}, expected #{castle_dir(name)} exist and contain dotfiles",
40
+ "Could not #{action} #{name}, expected #{castle_dir(name)} to exist and contain dotfiles",
41
41
  :red
42
42
  exit(1)
43
43
  end
@@ -150,7 +150,7 @@ module Homesick
150
150
 
151
151
  def collision_accepted?(destination, source)
152
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
- options[:force] || shell.file_collision(destination) { File.binread(source) }
153
+ options[:force] || shell.file_collision(destination) { source }
154
154
  end
155
155
 
156
156
  def each_file(castle, basedir, subdirs)
@@ -5,7 +5,7 @@ module Homesick
5
5
  module Version
6
6
  MAJOR = 1
7
7
  MINOR = 1
8
- PATCH = 5
8
+ PATCH = 6
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
11
11
  end
@@ -331,6 +331,40 @@ describe Homesick::CLI do
331
331
  expect(home.join('.some_dotfile').readlink).to eq(dotfile)
332
332
  end
333
333
  end
334
+
335
+ context 'when call and some files conflict' do
336
+ it 'shows differences for conflicting text files' do
337
+ contents = {:castle => 'castle has new content', :home => 'home already has content'}
338
+
339
+ dotfile = castle.file('text')
340
+ File.open(dotfile.to_s, 'w') do |f|
341
+ f.write contents[:castle]
342
+ end
343
+ File.open(home.join('text').to_s, 'w') do |f|
344
+ f.write contents[:home]
345
+ end
346
+ message = Capture.stdout { homesick.shell.show_diff(home.join('text'), dotfile) }
347
+ expect(message.b).to match(/- ?#{contents[:home]}\n.*\+ ?#{contents[:castle]}$/m)
348
+ end
349
+ it 'shows message or differences for conflicting binary files' do
350
+ # content which contains NULL character, without any parentheses, braces, ...
351
+ contents = {:castle => (0..255).step(30).map{|e| e.chr}.join(), :home => (0..255).step(30).reverse_each.map{|e| e.chr}.join()}
352
+
353
+ dotfile = castle.file('binary')
354
+ File.open(dotfile.to_s, 'w') do |f|
355
+ f.write contents[:castle]
356
+ end
357
+ File.open(home.join('binary').to_s, 'w') do |f|
358
+ f.write contents[:home]
359
+ end
360
+ message = Capture.stdout { homesick.shell.show_diff(home.join('binary'), dotfile) }
361
+ if homesick.shell.is_a?(Thor::Shell::Color)
362
+ expect(message.b).to match(/- ?#{contents[:home]}\n.*\+ ?#{contents[:castle]}$/m)
363
+ elsif homesick.shell.is_a?(Thor::Shell::Basic)
364
+ expect(message.b).to match(/^Binary files .+ differ$/)
365
+ end
366
+ end
367
+ end
334
368
  end
335
369
 
336
370
  describe 'unlink' do
@@ -499,7 +533,7 @@ describe Homesick::CLI do
499
533
  it 'prints an error message when trying to pull a non-existant castle' do
500
534
  expect(homesick).to receive('say_status').once
501
535
  .with(:error,
502
- /Could not pull castle_repo, expected .* exist and contain dotfiles/,
536
+ /Could not pull castle_repo, expected .* to exist and contain dotfiles/,
503
537
  :red)
504
538
  expect { homesick.pull 'castle_repo' }.to raise_error(SystemExit)
505
539
  end
@@ -529,7 +563,7 @@ describe Homesick::CLI do
529
563
 
530
564
  it 'prints an error message when trying to push a non-existant castle' do
531
565
  expect(homesick).to receive('say_status').once
532
- .with(:error, /Could not push castle_repo, expected .* exist and contain dotfiles/, :red)
566
+ .with(:error, /Could not push castle_repo, expected .* to exist and contain dotfiles/, :red)
533
567
  expect { homesick.push 'castle_repo' }.to raise_error(SystemExit)
534
568
  end
535
569
  end
@@ -687,7 +721,7 @@ describe Homesick::CLI do
687
721
 
688
722
  it 'returns an error message when the given castle does not exist' do
689
723
  expect(homesick).to receive('say_status').once
690
- .with(:error, /Could not cd castle_repo, expected .* exist and contain dotfiles/, :red)
724
+ .with(:error, /Could not cd castle_repo, expected .* to exist and contain dotfiles/, :red)
691
725
  expect { homesick.cd 'castle_repo' }.to raise_error(SystemExit)
692
726
  end
693
727
  end
@@ -716,7 +750,7 @@ describe Homesick::CLI do
716
750
  # Set a default just in case none is set
717
751
  allow(ENV).to receive(:[]).with('EDITOR').and_return('vim')
718
752
  allow(homesick).to receive('say_status').once
719
- .with(:error, /Could not open castle_repo, expected .* exist and contain dotfiles/, :red)
753
+ .with(:error, /Could not open castle_repo, expected .* to exist and contain dotfiles/, :red)
720
754
  expect { homesick.open 'castle_repo' }.to raise_error(SystemExit)
721
755
  end
722
756
  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.5
4
+ version: 1.1.6
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: 2017-03-23 00:00:00.000000000 Z
12
+ date: 2017-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor