angelo 0.1.12 → 0.1.13

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: d8b3d7e04d65efc3b63b8e866b1831fe772457c3
4
- data.tar.gz: e71d70c1f4685ed93631661d4b19600612c563dd
3
+ metadata.gz: e5eddbc45b846a99f2c3970949b8bcaea4a8da2a
4
+ data.tar.gz: b03151aeabb0265da3b371d1dbaa9023de404499
5
5
  SHA512:
6
- metadata.gz: 89d7d40daa608b501aa3f4a24faa967b62bf6a346adf495c3838e0ed42e1cbaca2e10e50c9ae801d48113001afc69d67d9ee67f8b4b167a0b8363fcf0bb16d84
7
- data.tar.gz: 4ab1b3d6e547d703733517f7b17e1d5aa56a3c544b6d28dc0a4619deab9c87468b7413f19bcf1e0150a1094c9e9878519177c5b6cb99801d53837c95420c89cb
6
+ metadata.gz: b398233f7e0e60a647661ff90c92f78485e23561a64243548f5eacc59b8f7d07918c03d071520ffee784bf921d23d40afc189224ce6b3290e4eacd295622a078
7
+ data.tar.gz: 33d0251cf93ef34be952eecdfa5969f0e4278b8f22a73e00ee8ec5ee8a68b44d4cd797e51bc8a18425f04714f20246e95d26d67c8ab58f2362d4dd5aa60e4bc3
data/.travis.yml CHANGED
@@ -2,5 +2,5 @@ language: ruby
2
2
  rvm:
3
3
  - "1.9.3"
4
4
  - "2.0.0"
5
- - "2.1.1"
5
+ - "2.1.2"
6
6
  script: rake
data/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  changelog
2
2
  =========
3
3
 
4
+ ### 0.1.13 19 jun 2014
5
+
6
+ * add log level settings
7
+ * make response logging default to :info level
8
+ * catch SystemCallError, IOError in Stash#each\* methods
9
+
10
+ ### 0.1.12 17 jun 2014
11
+
12
+ * before and after blocks now wrap websocket routes
13
+ * add :js content_type
14
+
4
15
  ### 0.1.11 13 jun 2014
5
16
 
6
17
  * add halt method and handling
data/lib/angelo/base.rb CHANGED
@@ -11,6 +11,7 @@ module Angelo
11
11
  @@port = DEFAULT_PORT
12
12
 
13
13
  @@ping_time = DEFAULT_PING_TIME
14
+ @@log_level = DEFAULT_LOG_LEVEL
14
15
 
15
16
  if ARGV.any? and not Kernel.const_defined?('Minitest')
16
17
  require 'optparse'
@@ -108,6 +109,7 @@ module Angelo
108
109
  end
109
110
 
110
111
  def run addr = @@addr, port = @@port
112
+ Celluloid.logger.level = @@log_level
111
113
  @server = Angelo::Server.new self, addr, port
112
114
  @server.async.ping_websockets
113
115
  trap "INT" do
data/lib/angelo/stash.rb CHANGED
@@ -44,7 +44,8 @@ module Angelo
44
44
  stash.each do |ws|
45
45
  begin
46
46
  yield ws
47
- rescue Reel::SocketError
47
+ rescue Reel::SocketError, IOError, SystemCallError => e
48
+ debug e.message
48
49
  remove_socket ws
49
50
  end
50
51
  end
@@ -73,7 +74,8 @@ module Angelo
73
74
  @@stashes.values.flatten.each do |ws|
74
75
  begin
75
76
  yield ws
76
- rescue IOError
77
+ rescue Reel::SocketError, IOError, SystemCallError => e
78
+ debug e.message
77
79
  remove_socket ws
78
80
  end
79
81
  end
@@ -32,12 +32,10 @@ module Angelo
32
32
 
33
33
  def templates
34
34
  @templates ||= templatify('**', '*.erb'){|v| v =~ /^layouts\//}
35
- @templates
36
35
  end
37
36
 
38
37
  def layout_templates
39
38
  @layout_templates ||= templatify 'layouts', '*.erb'
40
- @layout_templates
41
39
  end
42
40
 
43
41
  def default_layout
@@ -1,3 +1,3 @@
1
1
  module Angelo
2
- VERSION = '0.1.12'
2
+ VERSION = '0.1.13'
3
3
  end
data/lib/angelo.rb CHANGED
@@ -38,6 +38,9 @@ module Angelo
38
38
  DEFAULT_VIEW_DIR = 'views'
39
39
  DEFAULT_PUBLIC_DIR = 'public'
40
40
 
41
+ DEFAULT_LOG_LEVEL = ::Logger::INFO
42
+ DEFAULT_RESPONSE_LOG_LEVEL = :info
43
+
41
44
  DEFAULT_RESPONSE_HEADERS = {
42
45
  CONTENT_TYPE_HEADER_KEY => HTML_TYPE
43
46
  }
@@ -54,6 +57,16 @@ module Angelo
54
57
 
55
58
  HALT_STRUCT = Struct.new :status, :body
56
59
 
60
+ class << self
61
+
62
+ attr_writer :response_log_level
63
+
64
+ def response_log_level
65
+ @response_log_level ||= DEFAULT_RESPONSE_LOG_LEVEL
66
+ end
67
+
68
+ end
69
+
57
70
  def self.log connection, request, socket, status, body_size = '-'
58
71
 
59
72
  remote_ip = ->{
@@ -64,7 +77,7 @@ module Angelo
64
77
  end
65
78
  }
66
79
 
67
- Celluloid::Logger.debug LOG_FORMAT % [
80
+ Celluloid::Logger.__send__ Angelo.response_log_level, LOG_FORMAT % [
68
81
  remote_ip[],
69
82
  request.method,
70
83
  request.path,
@@ -181,6 +181,7 @@ describe Angelo::WebsocketResponder do
181
181
  Reactor.remove_action :go
182
182
  end
183
183
 
184
+ sleep 1
184
185
  invoked.must_equal 8
185
186
  end
186
187
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angelo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenichi Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-17 00:00:00.000000000 Z
11
+ date: 2014-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reel