deas 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/deas/server.rb CHANGED
@@ -29,7 +29,7 @@ module Deas
29
29
 
30
30
  # server handling options
31
31
  option :error_procs, Array, :default => []
32
- option :init_proc, Proc, :default => proc{ }
32
+ option :init_procs, Array, :default => []
33
33
  option :logger, :default => proc{ Deas::NullLogger.new }
34
34
  option :middlewares, Array, :default => []
35
35
  option :verbose_logging, :default => true
@@ -105,7 +105,7 @@ module Deas
105
105
  end
106
106
 
107
107
  def init(&block)
108
- self.configuration.init_proc = block
108
+ self.configuration.init_procs << block
109
109
  end
110
110
 
111
111
  def logger(*args)
@@ -7,7 +7,10 @@ module Deas
7
7
  module SinatraApp
8
8
 
9
9
  def self.new(server_config)
10
- server_config.init_proc.call
10
+ # the reason this is done here is b/c the below sinatra configuration is
11
+ # not considered valid until the init procs have been run and the routes
12
+ # have been constantized.
13
+ server_config.init_procs.each{ |p| p.call }
11
14
  server_config.routes.each(&:constantize!)
12
15
 
13
16
  Sinatra.new do
data/lib/deas/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Deas
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -76,9 +76,11 @@ class Deas::Server
76
76
  subject.logger stdout_logger
77
77
  assert_equal stdout_logger, config.logger
78
78
 
79
+ assert_equal 0, config.init_procs.size
79
80
  init_proc = proc{ }
80
81
  subject.init(&init_proc)
81
- assert_equal init_proc, config.init_proc
82
+ assert_equal 1, config.init_procs.size
83
+ assert_equal init_proc, config.init_procs.first
82
84
  end
83
85
 
84
86
  should "add a GET route using #get" do
@@ -172,7 +174,7 @@ class Deas::Server
172
174
  should have_imeths :static_files, :reload_templates
173
175
 
174
176
  # server handling options
175
- should have_imeths :init_proc, :logger, :verbose_logging, :middlewares
177
+ should have_imeths :init_procs, :logger, :verbose_logging, :middlewares
176
178
  should have_imeths :routes, :view_handler_ns
177
179
 
178
180
  should "default the env to 'development'" do
@@ -32,10 +32,13 @@ module Deas::SinatraApp
32
32
 
33
33
  should "call init procs when initialized" do
34
34
  initialized = false
35
- @configuration.init_proc = proc{ initialized = true }
35
+ other_initialized = false
36
+ @configuration.init_procs << proc{ initialized = true }
37
+ @configuration.init_procs << proc{ other_initialized = true }
36
38
  @sinatra_app = Deas::SinatraApp.new(@configuration)
37
39
 
38
40
  assert_equal true, initialized
41
+ assert_equal true, other_initialized
39
42
  end
40
43
 
41
44
  should "call constantize! on all routes" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deas
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Redding
@@ -19,8 +19,9 @@ cert_chain: []
19
19
  date: 2013-05-07 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
+ name: ns-options
22
23
  prerelease: false
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ requirement: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
27
  - - ~>
@@ -38,12 +39,12 @@ dependencies:
38
39
  - 1
39
40
  - 4
40
41
  version: 1.1.4
41
- requirement: *id001
42
- name: ns-options
43
42
  type: :runtime
43
+ version_requirements: *id001
44
44
  - !ruby/object:Gem::Dependency
45
+ name: rack
45
46
  prerelease: false
46
- version_requirements: &id002 !ruby/object:Gem::Requirement
47
+ requirement: &id002 !ruby/object:Gem::Requirement
47
48
  none: false
48
49
  requirements:
49
50
  - - ~>
@@ -53,12 +54,12 @@ dependencies:
53
54
  - 1
54
55
  - 5
55
56
  version: "1.5"
56
- requirement: *id002
57
- name: rack
58
57
  type: :runtime
58
+ version_requirements: *id002
59
59
  - !ruby/object:Gem::Dependency
60
+ name: sinatra
60
61
  prerelease: false
61
- version_requirements: &id003 !ruby/object:Gem::Requirement
62
+ requirement: &id003 !ruby/object:Gem::Requirement
62
63
  none: false
63
64
  requirements:
64
65
  - - ~>
@@ -68,12 +69,12 @@ dependencies:
68
69
  - 1
69
70
  - 4
70
71
  version: "1.4"
71
- requirement: *id003
72
- name: sinatra
73
72
  type: :runtime
73
+ version_requirements: *id003
74
74
  - !ruby/object:Gem::Dependency
75
+ name: assert
75
76
  prerelease: false
76
- version_requirements: &id004 !ruby/object:Gem::Requirement
77
+ requirement: &id004 !ruby/object:Gem::Requirement
77
78
  none: false
78
79
  requirements:
79
80
  - - ~>
@@ -83,12 +84,12 @@ dependencies:
83
84
  - 2
84
85
  - 0
85
86
  version: "2.0"
86
- requirement: *id004
87
- name: assert
88
87
  type: :development
88
+ version_requirements: *id004
89
89
  - !ruby/object:Gem::Dependency
90
+ name: assert-mocha
90
91
  prerelease: false
91
- version_requirements: &id005 !ruby/object:Gem::Requirement
92
+ requirement: &id005 !ruby/object:Gem::Requirement
92
93
  none: false
93
94
  requirements:
94
95
  - - ~>
@@ -98,12 +99,12 @@ dependencies:
98
99
  - 1
99
100
  - 0
100
101
  version: "1.0"
101
- requirement: *id005
102
- name: assert-mocha
103
102
  type: :development
103
+ version_requirements: *id005
104
104
  - !ruby/object:Gem::Dependency
105
+ name: rack-test
105
106
  prerelease: false
106
- version_requirements: &id006 !ruby/object:Gem::Requirement
107
+ requirement: &id006 !ruby/object:Gem::Requirement
107
108
  none: false
108
109
  requirements:
109
110
  - - ~>
@@ -113,9 +114,8 @@ dependencies:
113
114
  - 0
114
115
  - 6
115
116
  version: "0.6"
116
- requirement: *id006
117
- name: rack-test
118
117
  type: :development
118
+ version_requirements: *id006
119
119
  description: Handler-based web framework powered by Sinatra
120
120
  email:
121
121
  - kelly@kellyredding.com
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  requirements: []
200
200
 
201
201
  rubyforge_project:
202
- rubygems_version: 1.8.15
202
+ rubygems_version: 1.8.24
203
203
  signing_key:
204
204
  specification_version: 3
205
205
  summary: Handler-based web framework powered by Sinatra