ahc 0.3.0 → 0.3.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.
- checksums.yaml +4 -4
- data/Makefile +4 -0
- data/VERSION +1 -1
- data/ahc.gemspec +2 -1
- data/lib/ahc_helper.rb +25 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 274bab4f1810d8911a6621bad446271de8f27633
|
4
|
+
data.tar.gz: 39819c1cafa22d37179d3d971ca1a5fcad559f47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb9a2e2c6c2ac2676dfc60cc85856e554701d120c70eead3475ddc87e083c70dce840f25b46419d40352b5796fc87ae6f15df7bbabb7e89a259e72da75bda43c
|
7
|
+
data.tar.gz: c3f658bf58674d7095b71a59d601eb822a5d6f1956cfa5dc853cfae9b45db9b8ca73aad8da2b77e9b61a12a04849bd29a67016fe5a960e8d608b428435da1958
|
data/Makefile
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/ahc.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ahc"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andriy Romanov"]
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
"Gemfile",
|
23
23
|
"Gemfile.lock",
|
24
24
|
"LICENSE.txt",
|
25
|
+
"Makefile",
|
25
26
|
"README.rdoc",
|
26
27
|
"Rakefile",
|
27
28
|
"VERSION",
|
data/lib/ahc_helper.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
|
1
4
|
module AhcHelper
|
2
5
|
|
3
6
|
def render_ahc(template)
|
@@ -22,3 +25,25 @@ module AhcInheritedResourcesHelper
|
|
22
25
|
end
|
23
26
|
|
24
27
|
end
|
28
|
+
|
29
|
+
class AhcProxy
|
30
|
+
|
31
|
+
def initialize(app)
|
32
|
+
@app = app
|
33
|
+
end
|
34
|
+
|
35
|
+
def call(env)
|
36
|
+
request = Rack::Request.new(env)
|
37
|
+
path = request.fullpath
|
38
|
+
if path.start_with?('/s/') || path.start_with?('/static/') || path.start_with?('/plovr/')
|
39
|
+
begin
|
40
|
+
response = Net::HTTP.get(URI.parse("http://#{Ahc.host || Ahc.default_host}:#{Ahc.port || Ahc.default_port}" + path))
|
41
|
+
return [200, {}, [response]]
|
42
|
+
rescue
|
43
|
+
return [200, {}, ['Ahc server is not running']]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
@app.call(env)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ahc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andriy Romanov
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- Gemfile
|
80
80
|
- Gemfile.lock
|
81
81
|
- LICENSE.txt
|
82
|
+
- Makefile
|
82
83
|
- README.rdoc
|
83
84
|
- Rakefile
|
84
85
|
- VERSION
|