emmy-extends 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/bin/emmy-thin +9 -0
- data/emmy-extends.gemspec +1 -2
- data/lib/emmy_extends/thin/backend.rb +0 -2
- data/lib/emmy_extends/thin/controller.rb +45 -29
- data/lib/emmy_extends/thin/rackup.rb +20 -0
- data/lib/emmy_extends/thin.rb +7 -6
- data/lib/emmy_extends/version.rb +1 -1
- metadata +6 -4
- data/lib/emmy_extends/thin/class_methods.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b9ea4d3a1fcacff55960ab9a41e129980ad6e66
|
4
|
+
data.tar.gz: cf1aee06b24799a6cdb0a6bc4c57df017aa36073
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f741508afbc3ffccd6ff986e380cbbe15877280cd390401a9076e3cc06cf8bc7d1443d177ce7d7bbd648e7ce3ebad0dfd98214a9ed70f3fec33084113ebeb91
|
7
|
+
data.tar.gz: 57a31dfbfb877b48ed77d2e002e054b0683b4f8bcd89ab870f20f189c3eb77519f384c4a086c3e226850ee830af53adc9046cce17a4ccb4b76a98ddbaf2cf51d
|
data/README.md
CHANGED
@@ -90,7 +90,10 @@ EmmyMachine.run do
|
|
90
90
|
run Application
|
91
91
|
end
|
92
92
|
|
93
|
-
|
93
|
+
thin = EmmyExtends::Thin::Controller.new({
|
94
|
+
url: "tcp://localhost:65535"
|
95
|
+
}, app)
|
96
|
+
EmmyMachine.bind(*thin)
|
94
97
|
end
|
95
98
|
```
|
96
99
|
|
data/bin/emmy-thin
ADDED
data/emmy-extends.gemspec
CHANGED
@@ -14,14 +14,13 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables =
|
17
|
+
spec.executables = ["emmy-thin"]
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "emmy-machine", "~> 0.1"
|
22
22
|
spec.add_dependency "emmy-http", "~> 0.1"
|
23
23
|
|
24
|
-
|
25
24
|
spec.add_development_dependency "eventmachine", "~> 1.0.3"
|
26
25
|
spec.add_development_dependency "rspec", "~> 3"
|
27
26
|
spec.add_development_dependency "bundler", "~> 1.7"
|
@@ -1,23 +1,35 @@
|
|
1
|
-
require 'uri'
|
2
|
-
|
3
1
|
module EmmyExtends
|
4
2
|
class Thin::Controller < ::Thin::Controllers::Controller
|
5
3
|
|
6
|
-
attr_accessor :app
|
4
|
+
attr_accessor :app
|
5
|
+
attr_accessor :config
|
6
|
+
attr_accessor :server
|
7
|
+
attr_accessor :backend
|
7
8
|
|
8
|
-
def initialize(
|
9
|
-
@url = URI(url.to_s)
|
9
|
+
def initialize(config, app, opts={})
|
10
10
|
@app = app
|
11
|
-
|
11
|
+
@config = config.is_a?(Hash) ? EmmyHttp::Configuration.new(config) : config
|
12
|
+
options = {
|
13
|
+
environment: config.environment,
|
14
|
+
address: config.url.host,
|
15
|
+
port: config.url.port,
|
16
|
+
pid: config.pid,
|
17
|
+
log: config.log || File.join(Dir.pwd, "log/#{config.backend}.log")
|
18
|
+
}
|
19
|
+
super(option_defaults.merge(options.merge(opts)))
|
20
|
+
setup
|
12
21
|
end
|
13
22
|
|
14
23
|
def start
|
24
|
+
end
|
25
|
+
|
26
|
+
def setup
|
15
27
|
if @options[:socket]
|
16
|
-
server = ::Thin::Server.new(@options[:socket], @options)
|
28
|
+
@server = ::Thin::Server.new(@options[:socket], @options)
|
17
29
|
else
|
18
|
-
server = ::Thin::Server.new(url.host, url.port, @options)
|
30
|
+
@server = ::Thin::Server.new(config.url.host, config.url.port, @options)
|
19
31
|
end
|
20
|
-
server.backend.url = url
|
32
|
+
server.backend.url = config.url
|
21
33
|
|
22
34
|
# Set options
|
23
35
|
server.pid_file = @options[:pid]
|
@@ -52,29 +64,33 @@ module EmmyExtends
|
|
52
64
|
#server.on_restart { Thin::Command.run(:start, @options) }
|
53
65
|
|
54
66
|
# just return thin-backend
|
55
|
-
server.backend
|
67
|
+
@backend = server.backend
|
68
|
+
end
|
69
|
+
|
70
|
+
def to_a
|
71
|
+
@backend.to_a
|
56
72
|
end
|
57
73
|
|
58
74
|
private
|
59
75
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
def option_defaults
|
77
|
+
{
|
78
|
+
backend: EmmyExtends::Thin::Backend,
|
79
|
+
threaded: false,
|
80
|
+
no_epoll: false,
|
81
|
+
chdir: Dir.pwd,
|
82
|
+
#environment: 'development',
|
83
|
+
#address: '0.0.0.0',
|
84
|
+
#port: 3434,
|
85
|
+
timeout: 0, #sec
|
86
|
+
#pid: "tmp/pids/thin.pid",
|
87
|
+
#log: File.join(Dir.pwd, "log/server.log"),
|
88
|
+
max_conns: 1024,
|
89
|
+
max_persistent_conns: 100,
|
90
|
+
require: [],
|
91
|
+
wait: 30, #sec
|
92
|
+
#daemonize: false
|
93
|
+
}
|
94
|
+
end
|
79
95
|
end
|
80
96
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
config = Emmy::Runner.instance.config
|
2
|
+
config_ru = File.join(Dir.getwd, "config.ru")
|
3
|
+
|
4
|
+
unless File.readable_real?(config_ru)
|
5
|
+
puts "Missing #{config_ru} file."
|
6
|
+
exit
|
7
|
+
end
|
8
|
+
|
9
|
+
rackup_code = File.read(config_ru)
|
10
|
+
# can run bundler in rackup.ru
|
11
|
+
app = eval("Rack::Builder.new { use Fibre::Rack::FiberPool; ( #{rackup_code}\n )}.to_app", TOPLEVEL_BINDING, config_ru)
|
12
|
+
|
13
|
+
require 'thin'
|
14
|
+
|
15
|
+
Emmy.run do
|
16
|
+
puts "Thin web server"
|
17
|
+
puts "Application starting in #{config.environment}"
|
18
|
+
puts "Listening on #{config.url}"
|
19
|
+
Emmy.bind *EmmyExtends::Thin::Controller.new(config, app)
|
20
|
+
end
|
data/lib/emmy_extends/thin.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
require 'thin'
|
2
|
+
|
1
3
|
module EmmyExtends
|
2
4
|
module Thin
|
3
|
-
|
4
|
-
autoload :Backend, "emmy_extends/thin/backend"
|
5
|
-
autoload :Controller, "emmy_extends/thin/controller"
|
6
|
-
autoload :ClassMethods, "emmy_extends/thin/class_methods"
|
7
|
-
|
8
|
-
extend ClassMethods
|
5
|
+
EMMY_BACKEND = File.expand_path('../thin/rackup.rb', __FILE__)
|
9
6
|
end
|
10
7
|
end
|
8
|
+
|
9
|
+
require "emmy_extends/thin/connection"
|
10
|
+
require "emmy_extends/thin/backend"
|
11
|
+
require "emmy_extends/thin/controller"
|
data/lib/emmy_extends/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emmy-extends
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- inre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: emmy-machine
|
@@ -97,7 +97,8 @@ dependencies:
|
|
97
97
|
description:
|
98
98
|
email:
|
99
99
|
- inre.storm@gmail.com
|
100
|
-
executables:
|
100
|
+
executables:
|
101
|
+
- emmy-thin
|
101
102
|
extensions: []
|
102
103
|
extra_rdoc_files: []
|
103
104
|
files:
|
@@ -106,6 +107,7 @@ files:
|
|
106
107
|
- LICENSE.txt
|
107
108
|
- README.md
|
108
109
|
- Rakefile
|
110
|
+
- bin/emmy-thin
|
109
111
|
- emmy-extends.gemspec
|
110
112
|
- lib/emmy_extends/activerecord/adapter.rb
|
111
113
|
- lib/emmy_extends/activerecord/connection_handling.rb
|
@@ -127,9 +129,9 @@ files:
|
|
127
129
|
- lib/emmy_extends/savon/operation.rb
|
128
130
|
- lib/emmy_extends/thin.rb
|
129
131
|
- lib/emmy_extends/thin/backend.rb
|
130
|
-
- lib/emmy_extends/thin/class_methods.rb
|
131
132
|
- lib/emmy_extends/thin/connection.rb
|
132
133
|
- lib/emmy_extends/thin/controller.rb
|
134
|
+
- lib/emmy_extends/thin/rackup.rb
|
133
135
|
- lib/emmy_extends/version.rb
|
134
136
|
- spec/ConvertTemperature.asmx.xml
|
135
137
|
- spec/em_http_request_spec.rb
|