dit 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dit.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9eb1874c62ec31afe27cb0af065d6a80e0353128
|
4
|
+
data.tar.gz: 920fcc3e92fe1a3bae5f2f10657df2f7d524fe07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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."
|