rest_connection 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/git_hooks/pre-commit +24 -11
- data/lib/rest_connection/ssh_hax.rb +2 -2
- metadata +5 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
data/git_hooks/pre-commit
CHANGED
@@ -31,17 +31,28 @@ MMMN NMM$ MMM MMM
|
|
31
31
|
EOS
|
32
32
|
}
|
33
33
|
|
34
|
+
mac_unix_name=Darwin
|
35
|
+
uname_returned=`uname -a`
|
36
|
+
unix_name=${uname_returned:0:${#mac_unix_name}}
|
37
|
+
if [ "$unix_name" = "$mac_unix_name" ]; then
|
38
|
+
echo "MAC OS \"$mac_unix_name\" detected so whitespace modification logic suppressed..."
|
39
|
+
else
|
40
|
+
echo "non-MAC OS detected..."
|
41
|
+
fi
|
42
|
+
|
34
43
|
whitespace=""
|
35
44
|
echo "Checking for syntax errors..."
|
36
45
|
for FILE in `git diff-index --name-only HEAD --` ; do
|
37
46
|
if test -f $FILE; then
|
38
|
-
|
39
|
-
|
40
|
-
if [[
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
47
|
+
if [ "$unix_name" != "$mac_unix_name" ]; then
|
48
|
+
filetype=`file -b $FILE`
|
49
|
+
if [[ "$filetype" =~ "text" ]]; then
|
50
|
+
if [[ -n `grep "\\s\\s*$" $FILE` ]]; then whitespace="$whitespace $FILE"; fi
|
51
|
+
# Remove trailing whitespace
|
52
|
+
sed -i "s/\\s\\s*$//g" $FILE
|
53
|
+
# Remove tabs
|
54
|
+
sed -i "s/\t/ /g" $FILE
|
55
|
+
fi
|
45
56
|
fi
|
46
57
|
|
47
58
|
# If a file is ruby, check for syntax errors using ruby
|
@@ -107,10 +118,12 @@ if [[ "$fail" -ne 0 && -n "$fail" ]]; then
|
|
107
118
|
exit 1
|
108
119
|
fi
|
109
120
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
121
|
+
if [ "$unix_name" != "$mac_unix_name" ]; then
|
122
|
+
for FILE in $whitespace; do
|
123
|
+
echo "Whitespace problem fixed. Please re-add '$FILE' to your commit"
|
124
|
+
done
|
125
|
+
if [[ -n "$whitespace" ]]; then lod_message; exit 1; fi
|
126
|
+
fi
|
114
127
|
|
115
128
|
# Check that project metadata files exist
|
116
129
|
for FILE in "README.rdoc" "VERSION" ".gitignore" "Rakefile"; do
|
@@ -153,7 +153,7 @@ module SshHax
|
|
153
153
|
# returns hash of exit_status and output from command
|
154
154
|
def spot_check_command(command, ssh_key=nil, host_dns=self.reachable_ip, do_not_log_result=false)
|
155
155
|
raise "FATAL: spot_check_command called on a server with no reachable_ip. You need to run .settings on the server to populate this attribute." unless host_dns
|
156
|
-
connection.logger "SSHing to #{host_dns} using key(s) #{ssh_key_config(ssh_key)}"
|
156
|
+
connection.logger "SSHing to #{host_dns} using key(s) #{ssh_key_config(ssh_key).inspect}"
|
157
157
|
status = nil
|
158
158
|
output = ""
|
159
159
|
success = false
|
@@ -163,7 +163,7 @@ module SshHax
|
|
163
163
|
# Test for ability to connect; Net::SSH.start sometimes hangs under certain server-side sshd configs
|
164
164
|
test_ssh = ""
|
165
165
|
[5, 15, 60].each { |timeout_max|
|
166
|
-
test_ssh = `ssh -o \"BatchMode=yes\" -o \"ConnectTimeout #{timeout_max}\" root@#{host_dns} -C \"exit\" 2>&1`.chomp
|
166
|
+
test_ssh = `ssh -o \"BatchMode=yes\" -o \"StrictHostKeyChecking=no\" -o \"ConnectTimeout #{timeout_max}\" root@#{host_dns} -C \"exit\" 2>&1`.chomp
|
167
167
|
break if test_ssh =~ /permission denied/i or test_ssh.empty?
|
168
168
|
}
|
169
169
|
raise test_ssh unless test_ssh =~ /permission denied/i or test_ssh.empty?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest_connection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 9
|
10
|
+
version: 0.1.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeremy Deininger
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-03-
|
19
|
+
date: 2012-03-26 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: activesupport
|
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
253
|
requirements: []
|
254
254
|
|
255
255
|
rubyforge_project:
|
256
|
-
rubygems_version: 1.8.
|
256
|
+
rubygems_version: 1.8.15
|
257
257
|
signing_key:
|
258
258
|
specification_version: 3
|
259
259
|
summary: Modular RESTful API library
|