rest_connection 0.1.11 → 0.1.12

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.11
1
+ 0.1.12
@@ -11,3 +11,4 @@
11
11
  :azure_hack_on: true
12
12
  :azure_hack_retry_count: 5
13
13
  :azure_hack_sleep_seconds: 60
14
+ :api_logging: false
data/git_hooks/pre-commit CHANGED
@@ -1,60 +1,8 @@
1
1
  #!/bin/bash
2
2
 
3
- lod_message() {
4
- cat <<EOS
5
-
6
- OMM MM$
7
- MMMM MMMM
8
- MMM MMO
9
- =MM MMM
10
- MMM MMD
11
- MMMMMMMMMMMMMMMMMMMMM NMMMMMMMMMMMMMMMMMMMMM
12
- MMMMMMMMMMMMMMMMMMMM NMMMMMMMMMMMMMMMMMMM,
13
- MMMM? ?MMMM =MMMM MMMMD
14
- =MMM ?MMM MMMM MMMN
15
- :MMM MMM NMM= =MMD
16
- MMM ,MMO MMM DMM
17
- MMM MMMD MMM DMM? ,MMM, MMD
18
- MMM MMM$ MMM NMM? MMM MMN
19
- MMM MMM OMMM =MMO
20
- MMMN NMM$ MMM MMM
21
- MMM? MMMM DMMM MMM$
22
- MMMM: :MMMM DMMMM MMMM$
23
- =MMMMMMMMMMMMMM? MMMMMMMMMMMMMMM
24
- MMMMMMMMMMM MMMMMMMMMMM
25
-
26
-
27
-
28
-
29
- DMMMMMMMMMMMMMMMMMMMMMMM
30
-
31
- EOS
32
- }
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
-
43
- whitespace=""
44
3
  echo "Checking for syntax errors..."
45
4
  for FILE in `git diff-index --name-only HEAD --` ; do
46
5
  if test -f $FILE; then
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
56
- fi
57
-
58
6
  # If a file is ruby, check for syntax errors using ruby
59
7
  if [[ "$FILE" =~ .*\.rb$ ]]; then
60
8
  if [[ "$fail" -eq 0 || -z "$fail" ]]; then
@@ -96,7 +44,6 @@ git diff-index --check HEAD --
96
44
 
97
45
  if [[ "$fail" -ne 0 && -n "$fail" ]]; then
98
46
  echo "Syntax Errors Found. Aborting commit"
99
- lod_message
100
47
  exit 1
101
48
  fi
102
49
 
@@ -114,36 +61,18 @@ done
114
61
 
115
62
  if [[ "$fail" -ne 0 && -n "$fail" ]]; then
116
63
  echo "Syntax Warnings Found. Aborting commit"
117
- lod_message
118
64
  exit 1
119
65
  fi
120
66
 
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
127
-
128
- # Check that project metadata files exist
129
- for FILE in "README.rdoc" "VERSION" ".gitignore" "Rakefile"; do
130
- if test ! -e $FILE; then
131
- echo "$FILE not present. Aborting commit"
132
- exit 1
133
- fi
134
- done
135
-
136
67
  # Check that username and user emails are filled properly
137
68
  username=`git config --get user.name`
138
69
  useremail=`git config --get user.email`
139
70
  emaildomain=`echo $useremail | grep -o "[^@]*$"`
140
71
  if [[ "$username" == "Put Your Name Here" || "$username" == "" ]]; then
141
72
  echo "Please set your git user.name by running 'git config user.name <your github username>'"
142
- lod_message
143
73
  exit 1
144
74
  elif [[ "$useremail" == "setyouremail@rightscale.com" || "$useremail" == "" ]] || ! host "$emaildomain" &> /dev/null; then
145
75
  echo "Please set your git user.email by running 'git config user.email <your github email>'"
146
- lod_message
147
76
  exit 1
148
77
  fi
149
78
 
@@ -84,6 +84,7 @@ module RestConnection
84
84
  @settings[:azure_hack_on] ||= true
85
85
  @settings[:azure_hack_retry_count] ||= 5
86
86
  @settings[:azure_hack_sleep_seconds] ||= 60
87
+ @settings[:api_logging] ||= false
87
88
  end
88
89
 
89
90
  # Main HTTP connection loop. Common settings are set here, then we yield(BASE_URI, OPTIONAL_HEADERS) to other methods for each type of HTTP request: GET, PUT, POST, DELETE
@@ -154,7 +155,7 @@ module RestConnection
154
155
  def get(href, additional_parameters = "")
155
156
  rest_connect do |base_uri,headers|
156
157
  new_href = (href =~ /^\// ? href : "#{base_uri}/#{href}")
157
- puts("DEBUG: new_href get : #{new_href.inspect}")
158
+ puts("DEBUG: new_href get : #{new_href.inspect}") if @settings[:api_logging]
158
159
  params = requestify(additional_parameters) || ""
159
160
  new_path = URI.escape(new_href + @settings[:extension] + "?") + params
160
161
  Net::HTTP::Get.new(new_path, headers)
@@ -169,7 +170,7 @@ module RestConnection
169
170
  def post(href, additional_parameters = {})
170
171
  rest_connect do |base_uri, headers|
171
172
  new_href = (href =~ /^\// ? href : "#{base_uri}/#{href}")
172
- puts("DEBUG: new_href post : #{new_href.inspect}")
173
+ puts("DEBUG: new_href post : #{new_href.inspect}") if @settings[:api_logging]
173
174
  res = Net::HTTP::Post.new(new_href , headers)
174
175
  unless additional_parameters.empty?
175
176
  res.set_content_type('application/json')
@@ -189,9 +190,9 @@ module RestConnection
189
190
  rest_connect do |base_uri, headers|
190
191
  new_href = (href =~ /^\// ? href : "#{base_uri}/#{href}")
191
192
  new_path = URI.escape(new_href)
192
- puts("DEBUG: new_href put : #{new_href.inspect}")
193
+ puts("DEBUG: new_href put : #{new_href.inspect}") if @settings[:api_logging]
193
194
  req = Net::HTTP::Put.new(new_path, headers)
194
- puts("DEBUG: req put : #{req.inspect}")
195
+ puts("DEBUG: req put : #{req.inspect}") if @settings[:api_logging]
195
196
  req.set_content_type('application/json')
196
197
  req.body = additional_parameters.to_json
197
198
  req
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: 13
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 11
10
- version: 0.1.11
9
+ - 12
10
+ version: 0.1.12
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-08-28 00:00:00 Z
19
+ date: 2012-11-12 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: activesupport
@@ -131,9 +131,6 @@ files:
131
131
  - examples/cucumber/step_definitions/spot_check_steps.rb
132
132
  - examples/relaunch_deployment.rb
133
133
  - examples/right_scale_ec2_instances_api_test.rb
134
- - git_hooks/post-commit
135
- - git_hooks/post-commit.disabled
136
- - git_hooks/post-merge.disabled
137
134
  - git_hooks/pre-commit
138
135
  - lib/rest_connection.rb
139
136
  - lib/rest_connection/patches.rb
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env ruby
2
- puts <<EOS
3
- ..,ONMMMMMO.
4
- NM8~:~:.,+NMM=
5
- MO .MM:
6
- NM. ,MN
7
- .. .7MN . . 8M,
8
- ==. ?N: .MMN .,,.. 8$ZZ.~MN
9
- .$. N8 ,DD. ,MMN ...+:. .MMM
10
- D 8D.Z= .$. NMMM..,~8I ,88+. MMMM:.
11
- ,~... ,MM .N . MMMM7. .... MMMMM,
12
- DZ.. .:OZ.:M. ..8= .MMMM. .OMMMMM
13
- :7 . 8+$M:.D+ +MMMM, .:N+,MMD: 7MMMMM.
14
- .MM7:.... 8 .M. 7MMMMM. MMMMZMMMMO.7MMMMM.
15
- ,?. .. ..8 ,M =MMMMM MMN8$7O8DMM.OMMM~ +.
16
- N.. . .+ M, .MMMMMOM M8. .OM.MIMMMZ =,.
17
- =NZI+~, + I8 .MMMMMMM= .=DD, MMMMMI ~~
18
- O. .N + M. IMMMMMMMMMD ~MN 7MMMMMMM .Z
19
- .MNZZNMZ. . MM 7MMMMMMMMMMMMMMMMMMMMMMMM, .~M,.
20
- ID=. . . MMI MMMMMMMMMMMMMMMMMMMMMMMMMD. .+N
21
- .DMO,ZND+. MMM. :MMMMMMMMN =MMMMMMMMN:ZMMM,. +M~,$OD$
22
- .MMO... MMM OMMMMMMMM~ . ,I++O7. OMMM= .IM7 . .=..+MNI.
23
- .8MO :MMM .MMMMMMMMMM. MMMMM= ~D ?MO:7MN...
24
- +$ON. $NMM .NMMMMMMMMM7. .MMMMM. .8Z. :7N...MM:
25
- O7?N M+MMNMMMMMMMMMMMMMMMMMN MMMMMM8D. . $, .$8 M ..,$MN~,,.
26
- N$:=M. .NM.MM. ?MMMMMMO. .. D IO$IM:D.,$O, ,. O.I,Z :M: .+MI
27
- MO, MMI ..NM8.MM. =. MM..IMN7,. .,IDN7~MMMMMM, N .Z N.M. ,M. =N.
28
- .MO. MMMMMMMM::MM .: . .M :+I?=D.~.MMMMMMM?,,~INMMNNM+ ~ ~. D8. ,8.
29
- .M8. MMMMMMMM ZM$. 8 7. ~ M,MM+MMMMMMMMMMMMMMM.. , : ,M. .O+
30
- .MO. MMMMMMMI.MM, N = .....,IDI. MMMMMMMM8MMMMMM.. = M+ .M.
31
- .MZ~.MMMMMMM..MM . N .=. ?M,NMMMMMM?~MM$IMMM7MMMMM7 :O M
32
- M7I.NMMMMM8.$MZ.~ 8 .~, : MMMMMMMMMMMMM.~OOIMMM+MMMMM, .N M
33
- N=D OMMMMM, MM O .I .7. MMMMMMMMMMMMMMMMMMMMMD7NMM:MMMMN D .M
34
- O:M,~MMMMD NM? D.=, 8 OMMMMMMMMMMMMMMMMMMMMMZZMM?MMMM: ... Z .M
35
- +=M$ MMMZ :MN ~, D. I. ~MMMMMMM+,,~I, .NMMMMMZ.MDNMM7 I. . .M.
36
- .$NM .,.. MM .M :N. :~ .MMMMMM. MMMMMMZ=M,MM. .M. 7M
37
- .N.MM~ $MZ. O. N? N. ,MMMMMMM. MMMMMMMM+8Z: NZ. . .MI.
38
- .M.=MMMMN.. .+=..M. M. NMMMMMMMD 8MMMMMMM.MMM. $M. . ?, ~M.
39
- +. ~MM .. $, M: N: . 7MMMMMMN .~MMMMMM8,MMMMMMMMMMM ..M. :MM
40
- D N . ,M N NN. I8. $MMMMMMM?.. .?MMMMMMM?OMMMMMMMMMMMMMMMMMMMMI . ...MM$
41
- 7? .?N.7O DM ,M ZMMMMMMMMMM7.IMMMMMMMMD$MMMMMMMMMMMMMMMMMMMMMMMMZ: IMMN.
42
- .~MM?.=NM~DM8.. M 8MMMMMMMMMMMMMMMMM7=MMMMMMMMMMMMMMMMMD.IMMMNZZNMMN~
43
- EOS
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
-
3
- rake build
4
- gem install ../pkg/virtualmonkey*.gem --no-rdoc --no-ri
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
-
3
- rake build
4
- gem install ../pkg/virtualmonkey*.gem --no-rdoc --no-ri