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 +4 -4
- data/README.md +16 -4
- data/lib/falcon/command.rb +7 -1
- data/lib/falcon/server.rb +5 -0
- data/lib/falcon/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: cb0d5a4e2397edf4b80bfb5700d2032b5cf73b93
|
4
|
+
data.tar.gz: aa3b86a2d8d000b5e26c7ce2c2d67de3b43959e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
35
|
+
Falcon can restart very quickly and is ideal for use with guard. See [guard-falcon] for more details.
|
36
36
|
|
37
|
-
|
37
|
+
[guard-falcon]: https://github.com/socketry/guard-falcon
|
38
38
|
|
39
|
-
|
40
|
-
|
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
|
data/lib/falcon/command.rb
CHANGED
@@ -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:
|
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
|
data/lib/falcon/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http
|