hot_reload_proxy 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f03fd143a588b65f080279e9eb7dda2ef2c87c8
4
- data.tar.gz: 089efe575eada0d86b07a4379b8e48279a99c17e
3
+ metadata.gz: 5b32bd6ebb331a6f7363216beb2d4d05ab25b4ad
4
+ data.tar.gz: affbdecec5305b3e42bb2446c6adb81ced570ac1
5
5
  SHA512:
6
- metadata.gz: 3b129b7470fbe58c75e753155d97dd7eb82d2fc72e4b1ebf7f56e18abff4ef1c052e7badef93b957c160aec6f7775e1fa0276c965b8b1a8f8350914ae387929e
7
- data.tar.gz: fabdf346cc140410f45e1ac42a18b524544d74852891b2a7dc78131e9494b37a55ffb6d741ebe54bf2ef258644dc9b923b2b5cceb9787be098360d79b7853220
6
+ metadata.gz: 3b45a6fb53f1eea8a989857377db213aef5ac645cdcc69e53535ba787d7c304db4696cbb58d2ed0fd75beb5f401588b6056c255ef59191b92fb52fdc531fc6a3
7
+ data.tar.gz: d188301c3bd1a9ddd2a3c8386d2945f092241fdd773fd2aeb4a7b413f0243117c7c16b5c0149c2562532efc1797ee8e3bec5d943bbedd72c9d6b9f8141691556
data/README.md CHANGED
@@ -22,6 +22,17 @@ Or install it yourself as:
22
22
  $ gem install hot_reload_proxy
23
23
  ```
24
24
 
25
+ __Rails__: No other configuration is needed
26
+
27
+ __Non-Rails__: If you are not using Rails you'll need to add the `HotReloadProxy::Proxy` proxy to the middleware stack manually.
28
+
29
+ ## Configuration
30
+
31
+ ```
32
+ HotReloadProxy.host = 'localhost' # Default
33
+ HotReloadProxy.port = '3100' # Default
34
+ ```
35
+
25
36
  ## Development
26
37
 
27
38
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
data/bin/console CHANGED
@@ -1,14 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "hot_reload_proxy"
3
+ require 'bundler/setup'
4
+ require 'hot_reload_proxy'
5
5
 
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
6
+ require 'irb'
14
7
  IRB.start
@@ -2,32 +2,6 @@ require 'rack-proxy'
2
2
 
3
3
  module HotReloadProxy
4
4
  class Proxy < Rack::Proxy
5
- DEFAULT_HOST = 'localhost'
6
- DEFAULT_PORT = '3100'
7
- @foreign_host = DEFAULT_HOST
8
- @foreign_port = DEFAULT_PORT
9
-
10
- def self.foreign_host=(host)
11
- @foreign_host = host
12
- end
13
-
14
- def self.foreign_port=(port)
15
- @foreign_port = port.to_s
16
- end
17
-
18
- def self.foreign_host
19
- @foreign_host
20
- end
21
-
22
- def self.foreign_port
23
- @foreign_port
24
- end
25
-
26
- def self.reset!
27
- @foreign_host = DEFAULT_HOST
28
- @foreign_port = DEFAULT_PORT
29
- end
30
-
31
5
  WEBPACK_HOT_RELOAD_FILE_PATTERN = '.hot-update.'
32
6
 
33
7
  def initialize(app)
@@ -44,8 +18,8 @@ module HotReloadProxy
44
18
  end
45
19
 
46
20
  def rewrite_env(env)
47
- port = self.class.foreign_port
48
- host = self.class.foreign_host
21
+ port = HotReloadProxy.port
22
+ host = HotReloadProxy.host
49
23
  env['HTTP_HOST'] = "#{host}:#{port}"
50
24
  env
51
25
  end
@@ -2,7 +2,7 @@ require 'rails/railtie'
2
2
 
3
3
  module HotReloadProxy
4
4
  class HotReloadProxyRailtie < ::Rails::Railtie
5
- initializer "hot_reload_proxy_railtie.configure_rails_initialization" do |app|
5
+ initializer 'hot_reload_proxy_railtie.configure_rails_initialization' do |app|
6
6
  app.middleware.use HotReloadProxy::Proxy
7
7
  end
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module HotReloadProxy
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -3,4 +3,30 @@ require 'hot_reload_proxy/proxy'
3
3
  require 'hot_reload_proxy/railtie' if defined?(Rails)
4
4
 
5
5
  module HotReloadProxy
6
+ DEFAULT_HOST = 'localhost'
7
+ DEFAULT_PORT = '3100'
8
+
9
+ @host = DEFAULT_HOST
10
+ @port = DEFAULT_PORT
11
+
12
+ def self.host=(host)
13
+ @host = host
14
+ end
15
+
16
+ def self.port=(port)
17
+ @port = port.to_s
18
+ end
19
+
20
+ def self.host
21
+ @host
22
+ end
23
+
24
+ def self.port
25
+ @port
26
+ end
27
+
28
+ def self.reset!
29
+ @host = DEFAULT_HOST
30
+ @port = DEFAULT_PORT
31
+ end
6
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hot_reload_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Burenstam
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-07 00:00:00.000000000 Z
11
+ date: 2015-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack-proxy