emmy-engine 0.2.15 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/emmy-engine.gemspec +22 -18
- data/lib/emmy.rb +4 -0
- data/lib/emmy/http.rb +0 -2
- data/lib/emmy/rack/async.rb +22 -0
- data/lib/emmy/runner.rb +17 -15
- data/lib/emmy/version.rb +1 -1
- metadata +26 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f0affd3d94ec5901308857dd8ea928cdd072bad
|
4
|
+
data.tar.gz: b4eb84bfdfad8e35b435d38125c07ed540e70e98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22f10fd61797625d502339076cdec88bf35f19a47d61e042bd8b47f7ea13009f965745c03d8e3177b7c87e380fd47f50b266eba7622401ea0ee4dc57db30903b
|
7
|
+
data.tar.gz: 675c636ec3d8c0f50451223230cbfd5f863996078563539d0537bec1b20dc62c6f8796f30d370d25377d49a71e1a0334028d5fdbc52a70a0077d141a752511db
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/emmy-engine.gemspec
CHANGED
@@ -5,32 +5,36 @@ require 'emmy/version'
|
|
5
5
|
|
6
6
|
version = File.read(File.expand_path('../../EMMY_VERSION', __FILE__)).strip
|
7
7
|
if version != Emmy::VERSION
|
8
|
-
puts
|
8
|
+
puts 'Emmy Engine gem has the different version than Emmy gem has. (expect #{Emmy::VERSION}, current #{version})'
|
9
9
|
exit
|
10
10
|
end
|
11
11
|
|
12
12
|
Gem::Specification.new do |spec|
|
13
|
-
spec.name =
|
13
|
+
spec.name = 'emmy-engine'
|
14
14
|
spec.version = Emmy::VERSION
|
15
|
-
spec.
|
16
|
-
spec.
|
15
|
+
spec.summary = %q{Console interface for Emmy}
|
16
|
+
spec.description = %q{Support commands: start/stop server, display configuration, run console}
|
17
|
+
spec.license = "MIT"
|
17
18
|
|
18
|
-
spec.
|
19
|
-
|
20
|
-
|
19
|
+
spec.authors = ['Maksim V.']
|
20
|
+
spec.email = ['inre.storm@gmail.com']
|
21
|
+
spec.homepage = 'https://github.com/emmygems'
|
21
22
|
|
22
23
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
-
spec.bindir =
|
24
|
-
spec.executables =
|
25
|
-
spec.require_paths = [
|
24
|
+
spec.bindir = 'bin'
|
25
|
+
spec.executables = 'emmy'
|
26
|
+
spec.require_paths = ['lib']
|
26
27
|
|
27
|
-
spec.
|
28
|
-
spec.
|
29
|
-
spec.add_dependency "emmy-http-client", "~> 0.1"
|
30
|
-
spec.add_dependency "emmy-http-server", "~> 0.1"
|
28
|
+
spec.required_ruby_version = '>= 2.2.2'
|
29
|
+
spec.required_rubygems_version = '>= 2.3.0'
|
31
30
|
|
32
|
-
spec.
|
33
|
-
spec.
|
34
|
-
spec.
|
35
|
-
spec.
|
31
|
+
spec.add_dependency 'emmy-machine', '~> 0.4'
|
32
|
+
spec.add_dependency 'emmy-http', '~> 0.4'
|
33
|
+
spec.add_dependency 'emmy-http-client', '~> 0.2'
|
34
|
+
spec.add_dependency 'emmy-http-server', '~> 0.2'
|
35
|
+
|
36
|
+
spec.add_development_dependency 'eventmachine', '~> 1'
|
37
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
38
|
+
spec.add_development_dependency 'rake', '~> 10'
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3'
|
36
40
|
end
|
data/lib/emmy.rb
CHANGED
data/lib/emmy/http.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Emmy
|
2
|
+
module Rack
|
3
|
+
class Async
|
4
|
+
def initialize(app, options={})
|
5
|
+
@app = app
|
6
|
+
@rescue_exception = options[:rescue_exception] || (->(env, ex) { [500, {}, ["Internal Server Error"]] })
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
call_app = lambda do
|
11
|
+
result = @app.call(env)
|
12
|
+
env['async.callback'].call result
|
13
|
+
end
|
14
|
+
|
15
|
+
Emmy.async(&call_app)
|
16
|
+
throw :async
|
17
|
+
rescue => ex
|
18
|
+
@rescue_exception[env, ex]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/emmy/runner.rb
CHANGED
@@ -4,7 +4,7 @@ module Emmy
|
|
4
4
|
class Runner
|
5
5
|
include Singleton
|
6
6
|
using EventObject
|
7
|
-
events :bootstrap, :instance
|
7
|
+
events :bootstrap, :instance, :parse_options
|
8
8
|
|
9
9
|
RUBY = Gem.ruby
|
10
10
|
BIN_EMMY = "bin/emmy"
|
@@ -24,18 +24,20 @@ module Emmy
|
|
24
24
|
on :bootstrap do
|
25
25
|
parse_environment!
|
26
26
|
end
|
27
|
-
on :bootstrap do
|
28
|
-
option_parser.parse!(argv)
|
29
|
-
end
|
30
27
|
on :bootstrap do
|
31
28
|
defaults!
|
32
29
|
end
|
33
|
-
|
34
|
-
update_rack_environment!
|
35
|
-
end
|
30
|
+
|
36
31
|
on :instance do |id|
|
37
32
|
instance_defaults!(id)
|
38
33
|
end
|
34
|
+
|
35
|
+
on :parse_options do
|
36
|
+
option_parser.parse!(argv)
|
37
|
+
end
|
38
|
+
on :parse_options do
|
39
|
+
update_rack_environment!
|
40
|
+
end
|
39
41
|
end
|
40
42
|
|
41
43
|
def execute_bin_emmy
|
@@ -110,7 +112,8 @@ module Emmy
|
|
110
112
|
|
111
113
|
def run_action
|
112
114
|
# Bootstrap
|
113
|
-
bootstrap!
|
115
|
+
bootstrap! if @action != :display_help
|
116
|
+
parse_options!
|
114
117
|
# start action
|
115
118
|
send(action)
|
116
119
|
self
|
@@ -133,9 +136,8 @@ module Emmy
|
|
133
136
|
start_server
|
134
137
|
end
|
135
138
|
end
|
136
|
-
sleep(1)
|
137
139
|
end
|
138
|
-
sleep(
|
140
|
+
sleep(1)
|
139
141
|
end
|
140
142
|
|
141
143
|
def start_server
|
@@ -158,7 +160,7 @@ module Emmy
|
|
158
160
|
end
|
159
161
|
|
160
162
|
def start_console
|
161
|
-
EmmyMachine.
|
163
|
+
EmmyMachine.run_once do
|
162
164
|
if defined?(binding.pry)
|
163
165
|
TOPLEVEL_BINDING.pry
|
164
166
|
else
|
@@ -200,11 +202,11 @@ module Emmy
|
|
200
202
|
end
|
201
203
|
|
202
204
|
def bootstrap!
|
203
|
-
bootstrap.
|
205
|
+
bootstrap.instance_fire(self)
|
204
206
|
end
|
205
207
|
|
206
208
|
def instance!
|
207
|
-
instance.
|
209
|
+
instance.instance_fire(self, config.id)
|
208
210
|
end
|
209
211
|
|
210
212
|
private
|
@@ -251,13 +253,13 @@ module Emmy
|
|
251
253
|
pid = File.read(pid_file).to_i
|
252
254
|
unless pid.zero?
|
253
255
|
Process.kill("TERM", pid)
|
254
|
-
puts "Stopping
|
256
|
+
puts "Stopping..."
|
255
257
|
while File.exists?(config.pid)
|
256
258
|
sleep(0.1)
|
257
259
|
end
|
260
|
+
#Process.wait(pid)
|
258
261
|
end
|
259
262
|
rescue Errno::ESRCH
|
260
|
-
puts "No such process"
|
261
263
|
end
|
262
264
|
|
263
265
|
def delete_pid
|
data/lib/emmy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emmy-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Maksim V.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: emmy-machine
|
@@ -16,98 +16,98 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: emmy-http
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: emmy-http-client
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: emmy-http-server
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.2'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: eventmachine
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1
|
75
|
+
version: '1'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1
|
82
|
+
version: '1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
89
|
+
version: '1.12'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.12'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '10
|
103
|
+
version: '10'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '10
|
110
|
+
version: '10'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '3'
|
125
|
-
description:
|
125
|
+
description: 'Support commands: start/stop server, display configuration, run console'
|
126
126
|
email:
|
127
127
|
- inre.storm@gmail.com
|
128
128
|
executables:
|
@@ -140,10 +140,12 @@ files:
|
|
140
140
|
- lib/emmy.rb
|
141
141
|
- lib/emmy/backend.rb
|
142
142
|
- lib/emmy/http.rb
|
143
|
+
- lib/emmy/rack/async.rb
|
143
144
|
- lib/emmy/runner.rb
|
144
145
|
- lib/emmy/version.rb
|
145
|
-
homepage:
|
146
|
-
licenses:
|
146
|
+
homepage: https://github.com/emmygems
|
147
|
+
licenses:
|
148
|
+
- MIT
|
147
149
|
metadata: {}
|
148
150
|
post_install_message:
|
149
151
|
rdoc_options: []
|
@@ -153,16 +155,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
155
|
requirements:
|
154
156
|
- - ">="
|
155
157
|
- !ruby/object:Gem::Version
|
156
|
-
version:
|
158
|
+
version: 2.2.2
|
157
159
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
160
|
requirements:
|
159
161
|
- - ">="
|
160
162
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
163
|
+
version: 2.3.0
|
162
164
|
requirements: []
|
163
165
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.
|
166
|
+
rubygems_version: 2.6.6
|
165
167
|
signing_key:
|
166
168
|
specification_version: 4
|
167
|
-
summary: Emmy
|
169
|
+
summary: Console interface for Emmy
|
168
170
|
test_files: []
|