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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1cb113b23785e4193d34f224c7506f6c782e9d0b
4
- data.tar.gz: 3643fdd78e1c5474d01e2b90d9e82f45058c8a37
3
+ metadata.gz: 0f0affd3d94ec5901308857dd8ea928cdd072bad
4
+ data.tar.gz: b4eb84bfdfad8e35b435d38125c07ed540e70e98
5
5
  SHA512:
6
- metadata.gz: 49f9e2f09c307d3005d79f5b268a661930ae3762297451477d34efb0844340361b4d13d44aab0b19e123d0298bd4eb057be4acfebfcf5fb2713460ec3e44296e
7
- data.tar.gz: b55d702ad0623086699387c0cdf8a0942fb95293124374b0da2cb2fd75bccf4f2614ada024b20ce355763e5d30bbe1590799d3ff0dfe441237303eb815985918
6
+ metadata.gz: 22f10fd61797625d502339076cdec88bf35f19a47d61e042bd8b47f7ea13009f965745c03d8e3177b7c87e380fd47f50b266eba7622401ea0ee4dc57db30903b
7
+ data.tar.gz: 675c636ec3d8c0f50451223230cbfd5f863996078563539d0537bec1b20dc62c6f8796f30d370d25377d49a71e1a0334028d5fdbc52a70a0077d141a752511db
data/Gemfile CHANGED
@@ -3,4 +3,4 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in emmy-engine.gemspec
4
4
  gemspec
5
5
 
6
- gem 'eventmachine', '~> 1.0.7'
6
+ gem 'eventmachine', '~> 1.2.0'
data/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # Emmy Engine
2
2
 
3
- Don't use directly use emmy gem instead
3
+ This is a part of Emmy framework. A short description can be found in the root of this repository in README.md
@@ -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 "Different version numbers"
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 = "emmy-engine"
13
+ spec.name = 'emmy-engine'
14
14
  spec.version = Emmy::VERSION
15
- spec.authors = ["inre"]
16
- spec.email = ["inre.storm@gmail.com"]
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.summary = %q{Emmy Engine}
19
- #spec.description = %q{TODO: Write a longer description or delete this line.}
20
- #spec.homepage = "TODO: Put your gem's website or public repo URL here."
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 = "bin"
24
- spec.executables = "emmy"
25
- spec.require_paths = ["lib"]
24
+ spec.bindir = 'bin'
25
+ spec.executables = 'emmy'
26
+ spec.require_paths = ['lib']
26
27
 
27
- spec.add_dependency "emmy-machine", "~> 0.1"
28
- spec.add_dependency "emmy-http", "~> 0.2"
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.add_development_dependency "eventmachine", "~> 1.0"
33
- spec.add_development_dependency "bundler", "~> 1.9"
34
- spec.add_development_dependency "rake", "~> 10.0"
35
- spec.add_development_dependency "rspec", "~> 3"
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
@@ -13,6 +13,10 @@ module Emmy
13
13
  autoload :Backend, 'emmy/backend'
14
14
  autoload :Runner, 'emmy/runner'
15
15
 
16
+ module Rack
17
+ autoload :Async, 'emmy/rack/async'
18
+ end
19
+
16
20
  module_function
17
21
 
18
22
  def env
@@ -1,5 +1,3 @@
1
- require 'emmy_http/client'
2
-
3
1
  module Emmy
4
2
  class Http
5
3
  include EmmyHttp::Model
@@ -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
@@ -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
- on :bootstrap do
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(2)
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.run_block do
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.fire_for(self)
205
+ bootstrap.instance_fire(self)
204
206
  end
205
207
 
206
208
  def instance!
207
- instance.fire_for(self, config.id)
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 #{pid}..."
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
@@ -1,3 +1,3 @@
1
1
  module Emmy
2
- VERSION = "0.2.15"
2
+ VERSION = "0.4"
3
3
  end
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.2.15
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
- - inre
7
+ - Maksim V.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
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.1'
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.1'
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.2'
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.2'
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.1'
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.1'
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.1'
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.1'
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.0'
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.0'
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.9'
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.9'
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.0'
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.0'
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: '0'
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: '0'
163
+ version: 2.3.0
162
164
  requirements: []
163
165
  rubyforge_project:
164
- rubygems_version: 2.4.6
166
+ rubygems_version: 2.6.6
165
167
  signing_key:
166
168
  specification_version: 4
167
- summary: Emmy Engine
169
+ summary: Console interface for Emmy
168
170
  test_files: []