dit 0.2 → 0.2.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dit.rb +11 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40c3229cc364f6d858c3ff061c564eb1009fa661
4
- data.tar.gz: d60799dfbfe44a94c0d478b8e58b09d7e653df00
3
+ metadata.gz: 9eb1874c62ec31afe27cb0af065d6a80e0353128
4
+ data.tar.gz: 920fcc3e92fe1a3bae5f2f10657df2f7d524fe07
5
5
  SHA512:
6
- metadata.gz: 755aae9e97a7139012a64e04f5efe9a44922af945f4ef322a56a94b0da3a21c39864a97333f315e221f72b515489e82f3b70b888cccd0aa87077df0ba913f65f
7
- data.tar.gz: b0bc69bde3916ff81847a53830a8e340c722c67cd8cf7c5c78250c4001419552587a46989a0816c9bfceb49006e5ec228007019e0c94bc08ed5ba160c270dd1f
6
+ metadata.gz: 7036f768b02c42805287c8813b0a55809ae20dbcc81216de386babd72b80b2cb2c4b6f89bbf0dc71cb33505fdb48bb7e033f5156d4b9367e8cdd1420948461d4
7
+ data.tar.gz: 709f19cc118efcd93357bacbf7bca2b6908092f2b749924d14a53e78df89a9467714fa84499853d16752f47c2d17d955daa5bebf5d7e6ded755d8d742e73b9a5
data/lib/dit.rb CHANGED
@@ -16,7 +16,8 @@ class Dit
16
16
  puts "Dit has detected an existing git repo, and will initialize it to " +
17
17
  "populate your ~ directory with symlinks."
18
18
  puts "Please confirm this by typing y, or anything else to cancel."
19
- return unless gets.chomp! === 'y'
19
+ response = STDIN.gets.chomp.upcase
20
+ return unless (response === 'Y')
20
21
  symlink_all
21
22
  else
22
23
  Git.init(Dir.getwd)
@@ -80,6 +81,7 @@ class Dit
80
81
  f.write "exec ruby \"$@\"\n"
81
82
  end
82
83
  end
84
+
83
85
  # Make sure they're executable
84
86
  FileUtils.chmod '+x', %w(post-commit post-merge dit force-ruby)
85
87
  end
@@ -87,6 +89,7 @@ class Dit
87
89
 
88
90
  def self.symlink_list(list)
89
91
  list.each do |f|
92
+ f.strip!
90
93
  wd_f = File.absolute_path f
91
94
  home_f = File.absolute_path(f).gsub(Dir.getwd, Dir.home)
92
95
  symlink wd_f, home_f
@@ -98,7 +101,7 @@ class Dit
98
101
  end
99
102
 
100
103
  def self.symlink_all
101
- current_branch = `git rev-parse --abbrev-ref HEAD`
104
+ current_branch = `git rev-parse --abbrev-ref HEAD`.chomp
102
105
  symlink_list `git ls-tree -r #{current_branch} --name-only`.split("\n")
103
106
  end
104
107
 
@@ -128,6 +131,9 @@ class Dit
128
131
  puts "You have post-commit hooks already that use bash, so we'll " +
129
132
  "append ourselves to the file."
130
133
  append_to_post_commit = true
134
+ elsif `cat post-commit`.include?("./.git/hooks/dit")
135
+ puts "Dit hook already installed."
136
+ cannot_post_commit = true
131
137
  else
132
138
  puts "You have post-commit hooks that use some foreign language, " +
133
139
  "so we won't interfere, but we can't hook in there."
@@ -140,6 +146,9 @@ class Dit
140
146
  puts "You have post-merge hooks already that use bash, so we'll " +
141
147
  "append ourselve to the file."
142
148
  append_to_post_merge = true
149
+ elsif `cat post-commit`.include?("./.git/hooks/dit")
150
+ puts "Dit hook already installed."
151
+ cannot_post_commit = true
143
152
  else
144
153
  puts "You have post-merge hooks that use some not-bash language, " +
145
154
  "so we won't interfere, but we can't hook in there."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dit
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Fahringer