doozer 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +10 -6
- data/VERSION +1 -1
- data/doozer.gemspec +2 -2
- data/lib/doozer/app.rb +10 -11
- data/lib/doozer/scripts/cluster.rb +29 -1
- data/lib/doozer/version.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -7,16 +7,20 @@
|
|
7
7
|
* Clustering ala Mongrel::Cluster
|
8
8
|
|
9
9
|
== Requirements
|
10
|
-
* Ruby < 1.9 (
|
11
|
-
* Rack (http://rack.rubyforge.org) gem (0.9.1 or 1.0.
|
12
|
-
* Any http server supported by Rack
|
13
|
-
* ActiveRecord, DataMapper or Sequel (only if you need DB support)
|
10
|
+
* Ruby < 1.9 (untested on Ruby 1.9 as of now)
|
11
|
+
* Rack (http://rack.rubyforge.org) gem (0.9.1, 1.0.0, or 1.0.1)
|
12
|
+
* Any http server supported by Rack out of the box (CGI, FastCGI, Mongrel, EventedMongrel, SwiftipliedMongrel, WEBrick, LSWS, SCGI, or Thin)
|
13
|
+
* ActiveRecord, DataMapper, or Sequel (only if you need DB support)
|
14
|
+
|
15
|
+
== Gems
|
16
|
+
* As of version >= 0.2.0, the doozer gem is now distributed via gemcutter.
|
17
|
+
* The project homepage is here: http://gemcutter.org/gems/doozer
|
14
18
|
|
15
19
|
== Getting Started
|
16
20
|
1. Install the gem(s):
|
17
|
-
- gem sources -a http://
|
21
|
+
- gem sources -a http://gemcutter.org (if you haven't already)
|
18
22
|
- sudo gem install rack
|
19
|
-
- sudo gem install
|
23
|
+
- sudo gem install doozer
|
20
24
|
2. Run 'doozer test-app' to generate the base application skeleton.
|
21
25
|
3. Fire up the application in development mode
|
22
26
|
- cd test-app
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/doozer.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{doozer}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["grippy"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-23}
|
13
13
|
s.default_executable = %q{doozer}
|
14
14
|
s.description = %q{This GEM provides a small, barebones framework for creating MVC Rack applications.}
|
15
15
|
s.email = %q{gmelton@whorde.com}
|
data/lib/doozer/app.rb
CHANGED
@@ -35,32 +35,31 @@ module Doozer
|
|
35
35
|
controller = controller_klass.new({:env=>env, :route=>route, :extra_params=>extra_params, :port=>@options[:Port]})
|
36
36
|
|
37
37
|
# call after_initialize test for excludes
|
38
|
-
execution_time('controller.after_initialize',:start)
|
38
|
+
#execution_time('controller.after_initialize',:start)
|
39
39
|
controller.after_initialize if not controller_klass.after_initialize_exclude.include?(route.action.to_sym)
|
40
|
-
execution_time(nil, :end)
|
40
|
+
#execution_time(nil, :end)
|
41
41
|
|
42
42
|
begin
|
43
43
|
|
44
44
|
# call before_filter test for excludes
|
45
|
-
execution_time('controller.before_filter',:start)
|
45
|
+
#execution_time('controller.before_filter',:start)
|
46
46
|
controller.before_filter if not controller_klass.before_filter_exclude.include?(route.action.to_sym)
|
47
|
-
execution_time(nil,:end)
|
47
|
+
#execution_time(nil,:end)
|
48
48
|
|
49
49
|
# call the action method
|
50
|
-
execution_time('controller.method(route.action).call',:start)
|
50
|
+
#execution_time('controller.method(route.action).call',:start)
|
51
51
|
controller.method(route.action).call()
|
52
|
-
execution_time(nil,:end)
|
52
|
+
#execution_time(nil,:end)
|
53
53
|
|
54
54
|
# call after_filter test for excludes
|
55
|
-
execution_time('controller.after_filter',:start)
|
55
|
+
#execution_time('controller.after_filter',:start)
|
56
56
|
controller.after_filter if not controller_klass.after_filter_exclude.include?(route.action.to_sym)
|
57
|
-
execution_time(nil, :end)
|
57
|
+
#execution_time(nil, :end)
|
58
58
|
|
59
59
|
# render controller...
|
60
|
-
execution_time('controller.render_result',:start)
|
61
|
-
# r = Rack::Response.new(controller.render_controller(view, layout), route.status, {"Content-Type" => route.content_type})
|
60
|
+
#execution_time('controller.render_result',:start)
|
62
61
|
r = Rack::Response.new(controller.render_result, route.status, {"Content-Type" => route.content_type})
|
63
|
-
execution_time(nil,:end)
|
62
|
+
#execution_time(nil,:end)
|
64
63
|
r.set_cookie('flash',{:value=>nil, :path=>'/'})
|
65
64
|
r.set_cookie('session',{:value=>controller.session_to_cookie(), :path=>'/'})
|
66
65
|
|
@@ -20,6 +20,7 @@ clusters = Doozer::Configs.symbolize_keys(config[:clusters])
|
|
20
20
|
@server = clusters[:server]
|
21
21
|
@config = DOOZER_PATH + '/doozer/rackup/server.ru'
|
22
22
|
@test_config = DOOZER_PATH + '/doozer/rackup/test.rb'
|
23
|
+
@config_file = '' #optional config file to use instead of the default unicorn config
|
23
24
|
@apps = []
|
24
25
|
|
25
26
|
for app in clusters[:apps]
|
@@ -59,6 +60,29 @@ def start
|
|
59
60
|
system("ps -aux | grep rackup")
|
60
61
|
end
|
61
62
|
|
63
|
+
# Call to start unicorn server
|
64
|
+
#
|
65
|
+
# Set the app.yml clusters server to unicorn complete with one ip:port value.
|
66
|
+
#
|
67
|
+
# You can also pass an optional value -c FILE to override the default unicorn conf.
|
68
|
+
#
|
69
|
+
# See Unicorn::Configurator for more details => http://unicorn.bogomips.org/Unicorn/Configurator.html
|
70
|
+
#
|
71
|
+
# You'll need to create your own scripts for stoping and restarting.
|
72
|
+
#
|
73
|
+
# See this page for details => http://unicorn.bogomips.org/SIGNALS.html
|
74
|
+
def start_unicorn
|
75
|
+
printf "Starting unicorn... \n"
|
76
|
+
for app in @apps
|
77
|
+
# unicorn
|
78
|
+
@config_file = "-c #{@config_file}" if @config_file != ''
|
79
|
+
cmd = "unicorn -p #{app[:port]} -E #{@env.to_s} -o #{app[:ip]} #{@daemonize} #{@config_file} #{@config}"
|
80
|
+
printf "Command: #{cmd}\n"
|
81
|
+
system(cmd)
|
82
|
+
break
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
62
86
|
# Calls stop() and then start()
|
63
87
|
def restart
|
64
88
|
stop
|
@@ -101,6 +125,10 @@ opts = OptionParser.new("", 24, ' ') { |opts|
|
|
101
125
|
opts.on("-E", "--env ENVIRONMENT", "default: development || deployment") { | e |
|
102
126
|
@env = e.downcase.to_sym
|
103
127
|
}
|
128
|
+
opts.on("-c", "--config-file FILE", "optional config file to use for server (supported by unicorn, etc.)") { | cf |
|
129
|
+
@config_file = cf || ''
|
130
|
+
}
|
131
|
+
|
104
132
|
opts.on_tail("-h", "--help", "Show this message") do
|
105
133
|
puts opts
|
106
134
|
exit
|
@@ -113,7 +141,7 @@ opts = OptionParser.new("", 24, ' ') { |opts|
|
|
113
141
|
|
114
142
|
case @command
|
115
143
|
when :start
|
116
|
-
start()
|
144
|
+
@server != 'unicorn' ? start() : start_unicorn()
|
117
145
|
when :restart
|
118
146
|
restart()
|
119
147
|
when :stop
|
data/lib/doozer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doozer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- grippy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-23 00:00:00 -07:00
|
13
13
|
default_executable: doozer
|
14
14
|
dependencies: []
|
15
15
|
|