falcon 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b07f974b67bc387f25d6de874621983091f8f314
4
- data.tar.gz: 6ba760b987d37bf8c33073b10dd1f68105d5ed4f
3
+ metadata.gz: cb0d5a4e2397edf4b80bfb5700d2032b5cf73b93
4
+ data.tar.gz: aa3b86a2d8d000b5e26c7ce2c2d67de3b43959e8
5
5
  SHA512:
6
- metadata.gz: 7651153688e68b7cb2062a5af88185ff8073c3d3d03e7ee0852772a1d1e1fdf82ebcad5d7f33077cb056ba8e60130609f7007240314df360841f13c867b5ae89
7
- data.tar.gz: f6082bee731853ad813cb10f09db5187dea1ec369dc33636e18f92c9026c3d401dfe087eb66734d874e5d1584364f201cf0235e7fb2271ba028eda89cecccd99
6
+ metadata.gz: 9061371a25b049f64f5648277bf9d0d13e8c0866f87e72a6f3d9042e9357c2aa716ca44d0263d5fec986bba20e069bddc0820dd7210394d73e6094bfef211e3e
7
+ data.tar.gz: 11ed32abb1a9498bc8ea96b8cb0c5e413a3ebe01f65b9a4656ae2da4450afd7aa1eac6d12b7fd2f332411925af7b2a0b63f790d2a29615d699db33920f47c53d
data/README.md CHANGED
@@ -32,13 +32,25 @@ You can run `falcon` directly, and it will load the `config.ru` and start servin
32
32
 
33
33
  ### Integration with Guard
34
34
 
35
- Falcon can restart very quickly and is ideal for use with guard. In your `Guardfile`:
35
+ Falcon can restart very quickly and is ideal for use with guard. See [guard-falcon] for more details.
36
36
 
37
- ```ruby
37
+ [guard-falcon]: https://github.com/socketry/guard-falcon
38
38
 
39
- guard :falcon do
40
- end
39
+ ### Integration with Capybara
40
+
41
+ It is a very fast and light-weight alternative:
41
42
 
43
+ ```ruby
44
+ Capybara.register_server :falcon do |app, port, host|
45
+ require 'async/reactor'
46
+ require 'falcon/server'
47
+
48
+ Async::Reactor.run do
49
+ server = Falcon::Server.new(app, [Async::IO::Address.tcp(host, port)])
50
+
51
+ server.run
52
+ end
53
+ end
42
54
  ```
43
55
 
44
56
  ### Deploying with Passenger
@@ -30,6 +30,12 @@ require 'rack/server'
30
30
 
31
31
  module Falcon
32
32
  module Command
33
+ def self.default_concurrency
34
+ Etc.nprocessors
35
+ rescue
36
+ 2
37
+ end
38
+
33
39
  def self.parse(*args)
34
40
  Top.parse(*args)
35
41
  end
@@ -39,7 +45,7 @@ module Falcon
39
45
 
40
46
  options do
41
47
  option '-c/--config <path>', "Rackup configuration file to load", default: 'config.ru'
42
- option '-n/--concurrency <count>', "Number of processes to start", default: Etc.nprocessors, type: Integer
48
+ option '-n/--concurrency <count>', "Number of processes to start", default: Command.default_concurrency, type: Integer
43
49
 
44
50
  option '-b/--bind <address>', "Bind to the given hostname/address", default: "tcp://localhost:9292"
45
51
  end
data/lib/falcon/server.rb CHANGED
@@ -65,8 +65,13 @@ module Falcon
65
65
  'SERVER_PORT' => server_port,
66
66
  }.merge(request.headers)
67
67
 
68
+ if remote_address = peer.remote_address
69
+ env['REMOTE_ADDR'] = remote_address.ip_address if remote_address.ip?
70
+ end
71
+
68
72
  return @app.call(env)
69
73
  rescue
74
+ $stderr.puts "handle_request: #{$!.inspect} (#{$!.backtrace.first})"
70
75
  [500, {'Content-Type' => 'text/plain'}, [$!.inspect, "\n", $!.backtrace.join("\n\t")]]
71
76
  end
72
77
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Falcon
22
- VERSION = "0.2.0"
22
+ VERSION = "0.3.0"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falcon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-15 00:00:00.000000000 Z
11
+ date: 2017-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http