oop_rails_server 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/lib/oop_rails_server/rails_server.rb +22 -5
- data/lib/oop_rails_server/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1893e258310ea8d845e3556e11d4b58b0fc6a68
|
4
|
+
data.tar.gz: 9cffe310681d48ba02a1a96c75397afd679f7dd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 023a271744abaab2104181a7d052c9aeccd1ba9ce29cb87223790536091fcd02c605ab995fb4533975ff9cacd49d143d20e0c5f6e70f15dc10f33b67c69495e9
|
7
|
+
data.tar.gz: 88bfe8d4e47bc66062a6f25ed76c82dba2e5b410cbd13698e2b1352895e61423a1bd564fe0ea1a4a7654ac496545c317db054bd026044a1bad0f9ea987e9ad7e
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# `oop_rails_server` Releases
|
2
2
|
|
3
|
+
## 0.0.23, 18 October 2016
|
4
|
+
|
5
|
+
* Allow for POSTs, not just GETs, on the server.
|
6
|
+
|
3
7
|
## 0.0.22, 27 September 2016
|
4
8
|
|
5
9
|
* Fixed a bug caused by trying to call `Exception#cause` without checking if it exists; this doesn't exist in older
|
@@ -70,6 +70,10 @@ module OopRailsServer
|
|
70
70
|
stop_server! if server_pid
|
71
71
|
end
|
72
72
|
|
73
|
+
def post(path_or_uri, options = { })
|
74
|
+
send_http_request(path_or_uri, options.merge(:http_method => :post))
|
75
|
+
end
|
76
|
+
|
73
77
|
def get(path_or_uri, options = { })
|
74
78
|
out = get_response(path_or_uri, options)
|
75
79
|
out.body.strip if out
|
@@ -93,14 +97,23 @@ module OopRailsServer
|
|
93
97
|
"127.0.0.1"
|
94
98
|
end
|
95
99
|
|
96
|
-
def
|
97
|
-
options.assert_valid_keys(:ignore_status_code, :nil_on_not_found, :query, :no_layout, :accept_header)
|
100
|
+
def send_http_request(path_or_uri, options = { })
|
101
|
+
options.assert_valid_keys(:ignore_status_code, :nil_on_not_found, :query, :no_layout, :accept_header, :http_method, :post_variables)
|
98
102
|
|
99
103
|
uri = uri_for(path_or_uri, options[:query])
|
100
104
|
data = nil
|
101
105
|
accept_header = options.fetch(:accept_header, 'text/html')
|
106
|
+
|
107
|
+
http_method = options[:http_method] || :get
|
108
|
+
|
102
109
|
Net::HTTP.start(uri.host, uri.port) do |http|
|
103
|
-
|
110
|
+
klass = Net::HTTP.const_get(http_method.to_s.strip.camelize)
|
111
|
+
request = klass.new(uri.to_s)
|
112
|
+
|
113
|
+
if options[:post_variables]
|
114
|
+
request.set_form_data(options[:post_variables])
|
115
|
+
end
|
116
|
+
|
104
117
|
request['Accept'] = accept_header if accept_header
|
105
118
|
data = http.request(request)
|
106
119
|
end
|
@@ -117,6 +130,10 @@ module OopRailsServer
|
|
117
130
|
data
|
118
131
|
end
|
119
132
|
|
133
|
+
def get_response(path_or_uri, options = { })
|
134
|
+
send_http_request(path_or_uri, options.merge(:http_method => :get))
|
135
|
+
end
|
136
|
+
|
120
137
|
def run_command_in_rails_root!(command)
|
121
138
|
Bundler.with_clean_env do
|
122
139
|
with_rails_env do
|
@@ -382,8 +399,8 @@ The last #{last_lines.length} lines of this log are:
|
|
382
399
|
raise_startup_failed_error!(Time.now - start_time, "'#{server_verify_url}' returned: #{result.inspect}")
|
383
400
|
end
|
384
401
|
actual_version = $1
|
385
|
-
ruby_version = $
|
386
|
-
ruby_engine = $
|
402
|
+
ruby_version = $3
|
403
|
+
ruby_engine = $4
|
387
404
|
|
388
405
|
if rails_version != :default && (actual_version != rails_version)
|
389
406
|
raise "We seem to have spawned the wrong version of Rails; wanted: #{rails_version.inspect} but got: #{actual_version.inspect}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oop_rails_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Geweke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|