ahc 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +4 -0
  3. data/VERSION +1 -1
  4. data/ahc.gemspec +2 -1
  5. data/lib/ahc_helper.rb +25 -0
  6. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27ae39deee3de104d4820c1884ff3aaeee43dd6c
4
- data.tar.gz: f6d5add79d98087e0a5d24c834aa12e7c21c4606
3
+ metadata.gz: 274bab4f1810d8911a6621bad446271de8f27633
4
+ data.tar.gz: 39819c1cafa22d37179d3d971ca1a5fcad559f47
5
5
  SHA512:
6
- metadata.gz: fd7e4844d84793505f44634510cefd104f22cb97de81e1b13c888ffddf479e1b776114232647517dd733eceac6bb0937c4e406ddfae8776c950e993a58717fe9
7
- data.tar.gz: e4b33add627acfb266d0f9cc80d514de6a1f0dd922e1dd8b08b30bda3c07aaa0febde2d58d88b6e5e73f24addaad3fe77210f4e5fb7674cb0f4237050bf6fe36
6
+ metadata.gz: cb9a2e2c6c2ac2676dfc60cc85856e554701d120c70eead3475ddc87e083c70dce840f25b46419d40352b5796fc87ae6f15df7bbabb7e89a259e72da75bda43c
7
+ data.tar.gz: c3f658bf58674d7095b71a59d601eb822a5d6f1956cfa5dc853cfae9b45db9b8ca73aad8da2b77e9b61a12a04849bd29a67016fe5a960e8d608b428435da1958
data/Makefile ADDED
@@ -0,0 +1,4 @@
1
+ all:
2
+ @gem build ahc.gemspec
3
+ @gem uninstall ahc
4
+ @gem install --local ahc*.gem
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
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.0"
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.0
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