manveru-ramaze 2009.04.01 → 2009.04.08
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +201 -0
- data/MANIFEST +10 -8
- data/Rakefile +19 -3
- data/bin/ramaze +142 -55
- data/doc/tutorial/todolist.html +83 -5
- data/doc/tutorial/todolist.txt +85 -33
- data/examples/app/blog/start.rb +1 -1
- data/examples/app/todolist/model/init.rb +3 -0
- data/examples/templates/template_redcloth.rb +2 -2
- data/lib/proto/layout/{default.nag → default.xhtml} +0 -0
- data/lib/proto/view/{index.nag → index.xhtml} +0 -0
- data/lib/proto/view/{page.nag → page.xhtml} +0 -0
- data/lib/ramaze/app.rb +5 -5
- data/lib/ramaze/cache.rb +3 -2
- data/lib/ramaze/cache/localmemcache.rb +56 -0
- data/lib/ramaze/contrib/app_graph.rb +64 -0
- data/lib/ramaze/controller/default.rb +5 -0
- data/lib/ramaze/helper.rb +6 -16
- data/lib/ramaze/helper/httpdigest.rb +1 -1
- data/lib/ramaze/helper/link.rb +2 -5
- data/lib/ramaze/helper/partial.rb +85 -10
- data/lib/ramaze/request.rb +20 -0
- data/lib/ramaze/snippets/ramaze/deprecated.rb +0 -1
- data/lib/ramaze/spec.rb +10 -0
- data/lib/ramaze/tool/create.rb +48 -0
- data/lib/ramaze/tool/project_creator.rb +111 -0
- data/lib/ramaze/version.rb +1 -1
- data/ramaze.gemspec +3 -9
- data/spec/examples/templates/template_markaby.rb +1 -1
- data/spec/ramaze/cache/localmemcache.rb +49 -0
- data/spec/ramaze/helper/sequel_form.rb +1 -1
- data/tasks/bacon.rake +38 -21
- metadata +12 -31
- data/examples/templates/template_xslt.rb +0 -48
- data/examples/templates/view/external.xsl +0 -57
- data/lib/ramaze/contrib/sequel/fill.rb +0 -12
- data/spec/contrib/sequel/fill.rb +0 -47
- data/spec/examples/templates/template_xslt.rb +0 -10
data/CHANGELOG
CHANGED
@@ -1,3 +1,204 @@
|
|
1
|
+
[e2a87c9 | Mon Apr 06 02:27:14 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
|
2
|
+
|
3
|
+
* changed path search to use request.request_uri instead of request.fullpath, to handle fastcgi, mod_rack, and any other method where rack strips part of fullpath to derive request_uri
|
4
|
+
|
5
|
+
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
6
|
+
|
7
|
+
[69c3bf4 | Tue Apr 07 11:12:40 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
8
|
+
|
9
|
+
* Only MainController is automapped to '/'
|
10
|
+
|
11
|
+
[de89b67 | Tue Apr 07 10:41:50 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
12
|
+
|
13
|
+
* Update tutorial HTML
|
14
|
+
|
15
|
+
[e43fa1b | Tue Apr 07 13:38:18 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
16
|
+
|
17
|
+
* render_template is really deprecated, no replacements
|
18
|
+
|
19
|
+
[5922f3c | Tue Apr 07 02:21:18 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
20
|
+
|
21
|
+
* Fix link to book.ramaze.net
|
22
|
+
|
23
|
+
[30fec68 | Mon Apr 06 10:41:41 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
24
|
+
|
25
|
+
* Add information about, and usage of: Sequel::Model.plugin(:schema)
|
26
|
+
|
27
|
+
[83d41e0 | Mon Apr 06 10:32:18 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
28
|
+
|
29
|
+
* Add some info about configuration to tutorial
|
30
|
+
|
31
|
+
[7467ff6 | Mon Apr 06 03:35:06 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
32
|
+
|
33
|
+
* Fix Flash and Link helpers
|
34
|
+
|
35
|
+
[b6297da | Mon Apr 06 02:43:40 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
36
|
+
|
37
|
+
* Add some lobster
|
38
|
+
|
39
|
+
[eabb559 | Mon Apr 06 01:33:30 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
40
|
+
|
41
|
+
* Change ext to reflect new default templating engine
|
42
|
+
|
43
|
+
[36431f7 | Sun Apr 05 23:57:58 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
44
|
+
|
45
|
+
* nitpicking
|
46
|
+
|
47
|
+
[983cede | Sun Apr 05 23:57:48 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
48
|
+
|
49
|
+
* Simplify Helper with options
|
50
|
+
|
51
|
+
[5a31740 | Sun Apr 05 23:57:13 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
52
|
+
|
53
|
+
* Take over the Partial helper from Innate, please use the Render helper instead
|
54
|
+
|
55
|
+
[9797116 | Sun Apr 05 17:38:19 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
56
|
+
|
57
|
+
* Adding Cache::LocalMemCache, see http://github.com/sck/localmemcache
|
58
|
+
|
59
|
+
[d725385 | Sun Apr 05 14:26:10 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
60
|
+
|
61
|
+
* Add methods removed from Innate::Request
|
62
|
+
|
63
|
+
[ad0ce13 | Sun Apr 05 09:01:57 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
64
|
+
|
65
|
+
* Adding contrib/app_graph, which shows all your sites apps, controllers, mappings and actions
|
66
|
+
|
67
|
+
[61f621a | Sat Apr 04 02:33:23 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
|
68
|
+
|
69
|
+
* Removed ramaze dependencies from binary where not needed
|
70
|
+
|
71
|
+
* Allows including of custom library paths with standard ruby -I
|
72
|
+
functionality.
|
73
|
+
* Now passing ARGV along to irb with console command.
|
74
|
+
|
75
|
+
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
76
|
+
|
77
|
+
[38f1b77 | Sat Apr 04 01:29:18 UTC 2009] bougyman <bougyman@falcon.(none)>
|
78
|
+
|
79
|
+
* Remove version and help message from bin/ramaze
|
80
|
+
|
81
|
+
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
82
|
+
|
83
|
+
[4cf3d4a | Sat Apr 04 14:17:35 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
84
|
+
|
85
|
+
* Remove trailing newlines from bin/ramaze
|
86
|
+
|
87
|
+
[6d912c9 | Sat Apr 04 00:53:48 UTC 2009] bougyman <bougyman@falcon.(none)>
|
88
|
+
|
89
|
+
* Added more help and --version
|
90
|
+
|
91
|
+
* Create command exits and prints error if no PROJECT given
|
92
|
+
* Added more verbose description of each command
|
93
|
+
* Now defaults to printing help instead of starting an application
|
94
|
+
|
95
|
+
TODO:
|
96
|
+
|
97
|
+
* Add ability to merge application options. Perhaps ENV setting.
|
98
|
+
|
99
|
+
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
100
|
+
|
101
|
+
[aed1603 | Sat Apr 04 06:26:53 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
102
|
+
|
103
|
+
* Remove contrib/sequel/fill, was quite useless anyway
|
104
|
+
|
105
|
+
[02cd6ec | Sat Apr 04 06:25:59 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
106
|
+
|
107
|
+
* Improve bacon task so specs can fail on dependencies without messing up all the output
|
108
|
+
|
109
|
+
[de5e21f | Sat Apr 04 04:05:21 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
110
|
+
|
111
|
+
* Use method instead of iv for App#url_map
|
112
|
+
|
113
|
+
[597ec8c | Sat Apr 04 04:04:08 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
114
|
+
|
115
|
+
* Add integration with rack/test, eventually we should port specs to that
|
116
|
+
|
117
|
+
[59d3083 | Sat Apr 04 04:02:53 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
118
|
+
|
119
|
+
* Run specs in spec/contrib as well
|
120
|
+
|
121
|
+
[49dd9d6 | Sat Apr 04 04:02:37 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
122
|
+
|
123
|
+
* Add commented list of development dependencies for release
|
124
|
+
|
125
|
+
[a4c080f | Sat Apr 04 03:43:24 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
126
|
+
|
127
|
+
* Improve bacon task
|
128
|
+
|
129
|
+
[729ce2d | Fri Apr 03 04:06:22 UTC 2009] bougyman <bougyman@falcon.(none)>
|
130
|
+
|
131
|
+
* Added better help output and lowered debug output
|
132
|
+
|
133
|
+
* Pass along rackup --help options when requesting --help
|
134
|
+
* Removed debug output from default_pidfile
|
135
|
+
|
136
|
+
TODO:
|
137
|
+
* Make ramaze --console work as expected
|
138
|
+
* Design a methodology to pass the ramaze application itself arguments, instead of just to rack(up)
|
139
|
+
|
140
|
+
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
141
|
+
|
142
|
+
[686a38d | Fri Apr 03 02:15:53 UTC 2009] bougyman <bougyman@falcon.(none)>
|
143
|
+
|
144
|
+
* Added --force and --amend support to ramaze create. Also updated Ramaze::Tool::Create to use ROOT instead of Ramaze::BaseDir
|
145
|
+
|
146
|
+
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
147
|
+
|
148
|
+
[b1ae885 | Fri Apr 03 01:58:37 UTC 2009] bougyman <bougyman@falcon.(none)>
|
149
|
+
|
150
|
+
* Rewrite of bin/ramaze
|
151
|
+
|
152
|
+
* Simple optparser for start|stop|restart|create
|
153
|
+
* Passing all other args on to config.ru
|
154
|
+
* Used old ramaze tool/create for creation from prototype
|
155
|
+
|
156
|
+
TODO:
|
157
|
+
* Enable --force and --amend to ramaze create
|
158
|
+
* Recognize app.rb and rackup's options to display in --help
|
159
|
+
|
160
|
+
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
161
|
+
|
162
|
+
[ea434b1 | Fri Apr 03 10:14:51 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
163
|
+
|
164
|
+
* Provide access to App#url_map
|
165
|
+
|
166
|
+
[aa99126 | Fri Apr 03 09:54:05 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
167
|
+
|
168
|
+
* Fix link to sqlite
|
169
|
+
|
170
|
+
[54f7ce0 | Fri Apr 03 09:49:13 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
171
|
+
|
172
|
+
* Remove the rack/innate dependencies until rack is out
|
173
|
+
|
174
|
+
[e5af4e5 | Fri Apr 03 09:48:16 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
175
|
+
|
176
|
+
* Fix for redcloth spec
|
177
|
+
|
178
|
+
[11118df | Fri Apr 03 09:28:26 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
179
|
+
|
180
|
+
* Fix the sequel_form spec
|
181
|
+
|
182
|
+
[cf18430 | Fri Apr 03 09:26:53 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
183
|
+
|
184
|
+
* Remove the XSLT example and spec
|
185
|
+
|
186
|
+
[0395321 | Tue Mar 31 16:53:40 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
187
|
+
|
188
|
+
* Change dependency to innate-manveru, there's no rubyforge gem for it anyway... but that will cause trouble for local rake install
|
189
|
+
|
190
|
+
[eb7d389 | Tue Mar 31 16:34:33 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
191
|
+
|
192
|
+
* Fix Optinoal reference in blog example
|
193
|
+
|
194
|
+
[5f210cc | Tue Mar 31 16:33:49 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
195
|
+
|
196
|
+
* Innate::Optional is now Innate::Optioned
|
197
|
+
|
198
|
+
[851e1bd | Tue Mar 31 16:21:56 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
199
|
+
|
200
|
+
* Version 2009.04.01
|
201
|
+
|
1
202
|
[9033500 | Tue Mar 31 06:12:46 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
2
203
|
|
3
204
|
* Use html syntax instead of xhtml for pdf generation
|
data/MANIFEST
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
.mailmap
|
2
|
+
CHANGELOG
|
3
|
+
MANIFEST
|
2
4
|
README.markdown
|
3
5
|
Rakefile
|
4
6
|
benchmark/results.txt
|
@@ -171,7 +173,6 @@ examples/templates/template_nagoro.rb
|
|
171
173
|
examples/templates/template_redcloth.rb
|
172
174
|
examples/templates/template_remarkably.rb
|
173
175
|
examples/templates/template_tenjin.rb
|
174
|
-
examples/templates/template_xslt.rb
|
175
176
|
examples/templates/view/external.haml
|
176
177
|
examples/templates/view/external.liquid
|
177
178
|
examples/templates/view/external.mab
|
@@ -180,12 +181,11 @@ examples/templates/view/external.redcloth
|
|
180
181
|
examples/templates/view/external.rem
|
181
182
|
examples/templates/view/external.rhtml
|
182
183
|
examples/templates/view/external.tenjin
|
183
|
-
examples/templates/view/external.xsl
|
184
184
|
examples/templates/view/external.zmr
|
185
185
|
lib/proto/config.ru
|
186
186
|
lib/proto/controller/init.rb
|
187
187
|
lib/proto/controller/main.rb
|
188
|
-
lib/proto/layout/default.
|
188
|
+
lib/proto/layout/default.xhtml
|
189
189
|
lib/proto/model/init.rb
|
190
190
|
lib/proto/public/.htaccess
|
191
191
|
lib/proto/public/css/screen.css
|
@@ -195,13 +195,15 @@ lib/proto/public/js/jquery.js
|
|
195
195
|
lib/proto/public/ramaze.png
|
196
196
|
lib/proto/spec/main.rb
|
197
197
|
lib/proto/start.rb
|
198
|
-
lib/proto/view/index.
|
199
|
-
lib/proto/view/page.
|
198
|
+
lib/proto/view/index.xhtml
|
199
|
+
lib/proto/view/page.xhtml
|
200
200
|
lib/ramaze.rb
|
201
201
|
lib/ramaze/app.rb
|
202
202
|
lib/ramaze/cache.rb
|
203
|
+
lib/ramaze/cache/localmemcache.rb
|
203
204
|
lib/ramaze/cache/memcache.rb
|
204
205
|
lib/ramaze/cache/sequel.rb
|
206
|
+
lib/ramaze/contrib/app_graph.rb
|
205
207
|
lib/ramaze/contrib/email.rb
|
206
208
|
lib/ramaze/contrib/facebook.rb
|
207
209
|
lib/ramaze/contrib/facebook/facebook.rb
|
@@ -214,7 +216,6 @@ lib/ramaze/contrib/maruku_uv.rb
|
|
214
216
|
lib/ramaze/contrib/profiling.rb
|
215
217
|
lib/ramaze/contrib/rest.rb
|
216
218
|
lib/ramaze/contrib/sequel/create_join.rb
|
217
|
-
lib/ramaze/contrib/sequel/fill.rb
|
218
219
|
lib/ramaze/contrib/sequel/form_field.rb
|
219
220
|
lib/ramaze/contrib/sequel/image.rb
|
220
221
|
lib/ramaze/contrib/sequel/relation.rb
|
@@ -311,6 +312,8 @@ lib/ramaze/spec/helper/bacon.rb
|
|
311
312
|
lib/ramaze/spec/helper/pretty_output.rb
|
312
313
|
lib/ramaze/spec/helper/snippets.rb
|
313
314
|
lib/ramaze/spec/helper/template_examples.rb
|
315
|
+
lib/ramaze/tool/create.rb
|
316
|
+
lib/ramaze/tool/project_creator.rb
|
314
317
|
lib/ramaze/version.rb
|
315
318
|
lib/ramaze/view.rb
|
316
319
|
lib/ramaze/view/erubis.rb
|
@@ -329,7 +332,6 @@ lib/vendor/etag.rb
|
|
329
332
|
lib/vendor/route_exceptions.rb
|
330
333
|
ramaze.gemspec
|
331
334
|
spec/contrib/rest.rb
|
332
|
-
spec/contrib/sequel/fill.rb
|
333
335
|
spec/examples/caching.rb
|
334
336
|
spec/examples/css.rb
|
335
337
|
spec/examples/element.rb
|
@@ -346,7 +348,6 @@ spec/examples/templates/template_nagoro.rb
|
|
346
348
|
spec/examples/templates/template_redcloth.rb
|
347
349
|
spec/examples/templates/template_remarkably.rb
|
348
350
|
spec/examples/templates/template_tenjin.rb
|
349
|
-
spec/examples/templates/template_xslt.rb
|
350
351
|
spec/helper.rb
|
351
352
|
spec/ramaze/action/render.rb
|
352
353
|
spec/ramaze/action/view/bar.xhtml
|
@@ -357,6 +358,7 @@ spec/ramaze/action/view/single_wrapper.xhtml
|
|
357
358
|
spec/ramaze/action/view/sub/sub_wrapper.erb
|
358
359
|
spec/ramaze/action/view/sub/sub_wrapper.xhtml
|
359
360
|
spec/ramaze/app.rb
|
361
|
+
spec/ramaze/cache/localmemcache.rb
|
360
362
|
spec/ramaze/cache/memcache.rb
|
361
363
|
spec/ramaze/cache/sequel.rb
|
362
364
|
spec/ramaze/controller/actionless_templates.rb
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ require 'rake/gempackagetask'
|
|
6
6
|
require 'time'
|
7
7
|
require 'date'
|
8
8
|
|
9
|
-
PROJECT_SPECS = Dir['spec/{examples,ramaze,snippets}/**/*.rb']
|
9
|
+
PROJECT_SPECS = Dir['spec/{contrib,examples,ramaze,snippets}/**/*.rb']
|
10
10
|
PROJECT_MODULE = 'Ramaze'
|
11
11
|
PROJECT_JQUERY_FILE = 'lib/proto/public/js/jquery.js'
|
12
12
|
PROJECT_README = 'README.markdown'
|
@@ -34,8 +34,24 @@ GEMSPEC = Gem::Specification.new{|s|
|
|
34
34
|
s.bindir = "bin"
|
35
35
|
s.executables = ["ramaze"]
|
36
36
|
s.rubyforge_project = "ramaze"
|
37
|
-
|
38
|
-
s.add_dependency('
|
37
|
+
|
38
|
+
# s.add_dependency('rack', '>= 0.9.9') # lies!
|
39
|
+
# s.add_dependency('manveru-innate', '>= 2009.04')
|
40
|
+
|
41
|
+
# s.add_development_dependency('rack-test', '>=0.1.0')
|
42
|
+
# s.add_development_dependency('json', '>=1.1.3')
|
43
|
+
# s.add_development_dependency('erubis', '>=2.6.4')
|
44
|
+
# s.add_development_dependency('ezamar')
|
45
|
+
# s.add_development_dependency('haml', '~>2.0.9')
|
46
|
+
# s.add_development_dependency('hpricot', '>=0.7')
|
47
|
+
# s.add_development_dependency('liquid', '~>2.0.0')
|
48
|
+
# s.add_development_dependency('memcache', '~>1.7.0')
|
49
|
+
# s.add_development_dependency('nagoro')
|
50
|
+
# s.add_development_dependency('Remarkably', '~>0.5.2')
|
51
|
+
# s.add_development_dependency('sequel', '>=2.11.0')
|
52
|
+
# s.add_development_dependency('tagz', '>=5.0.1')
|
53
|
+
# s.add_development_dependency('tenjin', '~>0.6.1')
|
54
|
+
|
39
55
|
s.post_install_message = <<MESSAGE.strip
|
40
56
|
============================================================
|
41
57
|
|
data/bin/ramaze
CHANGED
@@ -1,80 +1,167 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
$:.unshift File.join(File.dirname(__FILE__), '../lib')
|
5
|
-
require 'ramaze'
|
6
|
-
rescue LoadError
|
7
|
-
$:.shift
|
8
|
-
|
3
|
+
def include_ramaze
|
9
4
|
begin
|
10
|
-
|
5
|
+
$:.unshift File.join(File.dirname(__FILE__), '/../lib')
|
6
|
+
require 'ramaze'
|
11
7
|
rescue LoadError
|
8
|
+
$:.shift
|
9
|
+
|
10
|
+
begin
|
11
|
+
require 'rubygems'
|
12
|
+
rescue LoadError
|
13
|
+
end
|
14
|
+
require 'ramaze'
|
12
15
|
end
|
13
|
-
require 'ramaze'
|
14
16
|
end
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
18
|
+
def usage
|
19
|
+
<<-TXT
|
20
|
+
Usage:
|
19
21
|
|
20
|
-
|
21
|
-
require 'ramaze/tool/create'
|
22
|
-
Ramaze::Tool::Create.create(project_name)
|
23
|
-
exit
|
24
|
-
end
|
22
|
+
ramaze <start [PIDFILE]|stop [PIDFILE]|restart [PIDFILE]|create PROJECT|console> [ruby/rack options]
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
Commands:
|
25
|
+
start - Starts an instance of this application. Supply a pidfile name if you do
|
26
|
+
not want it to use the default (PROJECT.pid).
|
29
27
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
stop - Stops a running instance of this application. Supply a pidfile name if you
|
29
|
+
started it with a pidfile other than the default (PROJECT.pid).
|
30
|
+
|
31
|
+
restart - Stops running instance of this application, then starts it back up. Pidfile
|
32
|
+
(if supplied) is used for both stop and start.
|
34
33
|
|
35
|
-
|
36
|
-
|
34
|
+
create - Creates a new prototype Ramaze application in a directory named PROJECT in
|
35
|
+
the current directory. ramaze create foo would make ./foo containing an
|
36
|
+
application prototype. Rack options are meaningless here.
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
:root => File.dirname(runner),
|
41
|
-
:runner => runner, :origin => :console,
|
42
|
-
}
|
38
|
+
console - Starts an irb console with app.rb (and irb completion) loaded. This command
|
39
|
+
ignores rack options.
|
43
40
|
|
44
|
-
|
45
|
-
|
41
|
+
Rack Options
|
42
|
+
#{%x{rackup --help}.split("\n").reject { |line| line.match(/^Usage:/) }.join("\n\t")}
|
43
|
+
TXT
|
44
|
+
end
|
45
|
+
|
46
|
+
## Methods for commands {{{
|
47
|
+
def start
|
48
|
+
# Find the name of this app
|
49
|
+
app_name = default_pidfile.sub(/\.pid$/,'')
|
50
|
+
if daemonize = OURARGS.detect { |arg| arg.match(/^(-[dD]|--daemonize)$/) }
|
51
|
+
if pid_arg = OURARGS.detect { |arg| arg.match(/^(-P|--pid)/) }
|
52
|
+
puts "User supplied pid: #{pid_arg}"
|
53
|
+
pid_file = OURARGS[OURARGS.index(pid_arg) + 1]
|
54
|
+
puts "Starting daemon with user defined pidfile: #{pid_file}"
|
55
|
+
exec("rackup", "config.ru", *ARGV)
|
56
|
+
else
|
57
|
+
puts "Starting daemon with default pidfile: #{default_pidfile}"
|
58
|
+
exec("rackup", "config.ru", "-P", default_pidfile, *ARGV)
|
59
|
+
end
|
60
|
+
else
|
61
|
+
exec("rackup", "config.ru", *ARGV)
|
46
62
|
end
|
63
|
+
end
|
47
64
|
|
48
|
-
|
49
|
-
|
50
|
-
|
65
|
+
def create(command)
|
66
|
+
project_name = OURARGS[OURARGS.index(command) + 1]
|
67
|
+
if project_name.nil?
|
68
|
+
$stderr.puts "Must supply a project name" if project_name.nil?
|
69
|
+
puts usage
|
70
|
+
exit 1
|
71
|
+
end
|
72
|
+
opts = {}
|
73
|
+
if OURARGS.detect { |arg| arg.match(/^(--force)/) }
|
74
|
+
puts "Overwriting any existing files as requested."
|
75
|
+
opts[:force] = true
|
76
|
+
end
|
77
|
+
if OURARGS.detect { |arg| arg.match(/^(--amend)/) }
|
78
|
+
puts "Only amending missing files as requested."
|
79
|
+
opts[:amend] = true
|
80
|
+
end
|
81
|
+
include_ramaze
|
82
|
+
require 'ramaze/tool/create'
|
83
|
+
Ramaze::Tool::Create.create(project_name, opts)
|
84
|
+
end
|
51
85
|
|
52
|
-
|
53
|
-
|
86
|
+
def stop(command)
|
87
|
+
return false unless pid_file = find_pid(command)
|
88
|
+
pid = File.read(pid_file).to_i
|
89
|
+
puts "Killing pid #{pid}"
|
90
|
+
Process.kill("INT", pid)
|
91
|
+
sleep 1
|
92
|
+
begin
|
93
|
+
Process.getpriority(Process::PRIO_PROCESS, pid)
|
94
|
+
$stdout.puts "Process #{pid} did not die, forcing it with -9"
|
95
|
+
Process.kill(9, pid)
|
96
|
+
File.unlink(pid_file) if File.file?(pid_file)
|
97
|
+
true
|
98
|
+
rescue Errno::ESRCH
|
99
|
+
File.unlink(pid_file) if File.file?(pid_file)
|
100
|
+
true
|
101
|
+
end
|
102
|
+
end
|
54
103
|
|
55
|
-
|
56
|
-
require runner
|
104
|
+
## End Command methods }}}
|
57
105
|
|
58
|
-
|
59
|
-
|
106
|
+
# Helper methods {{{
|
107
|
+
def default_pidfile
|
108
|
+
return @default_pidfile if @default_pidfile
|
109
|
+
@default_pidfile = (File.basename(File.expand_path(ENV["PWD"])) + ".pid").strip
|
110
|
+
@default_pidfile
|
111
|
+
end
|
60
112
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
113
|
+
def find_pid(command)
|
114
|
+
pid_file = OURARGS[OURARGS.index(command) + 1]
|
115
|
+
if pid_file.nil? or not File.file?(pid_file)
|
116
|
+
pid_file = default_pidfile
|
117
|
+
end
|
118
|
+
unless File.file?(pid_file)
|
119
|
+
$stderr.puts "Could not find running process id."
|
120
|
+
return false
|
65
121
|
end
|
66
|
-
|
67
|
-
|
122
|
+
pid_file
|
123
|
+
end
|
124
|
+
|
125
|
+
## End helper methods }}}
|
126
|
+
|
127
|
+
OURARGS = ARGV.dup
|
128
|
+
command = ARGV.detect { |arg| arg.match(/^(?:--?)?(?:start|stop|restart|create|h(?:elp)?|v(?:ersion)?|console)/) }
|
129
|
+
if command.nil?
|
130
|
+
command = ""
|
131
|
+
else
|
132
|
+
ARGV.delete(command)
|
133
|
+
end
|
68
134
|
|
69
|
-
|
70
|
-
|
71
|
-
|
135
|
+
case command
|
136
|
+
when /^(?:--?)?restart$/
|
137
|
+
stop(command)
|
138
|
+
start
|
139
|
+
when /^(?:--?)?start$/
|
140
|
+
start
|
141
|
+
when /^(?:--?)?create$/
|
142
|
+
create(command)
|
143
|
+
when /^(?:--?)?stop$/
|
144
|
+
if stop(command)
|
145
|
+
puts "Ramazement has ended, go in peace"
|
146
|
+
$stdout.flush
|
72
147
|
else
|
73
|
-
Ramaze
|
74
|
-
require runner
|
75
|
-
Ramaze.start!
|
148
|
+
puts "Ramaze failed to stop (or was not running)"
|
76
149
|
end
|
150
|
+
when /^(?:--?)?console$/
|
151
|
+
exec("irb", "-r", "irb/completion", "-r", "app", *ARGV)
|
152
|
+
when /^(?:--?)?h(elp)?$/
|
153
|
+
puts usage
|
154
|
+
when /^(?:--?)?v(ersion)?$/
|
155
|
+
include_ramaze
|
156
|
+
puts Ramaze::VERSION
|
157
|
+
exit
|
158
|
+
when /^$/
|
159
|
+
puts "Must supply a valid command"
|
160
|
+
puts usage
|
161
|
+
exit 1
|
77
162
|
else
|
78
|
-
|
79
|
-
puts
|
163
|
+
puts "#{command} not implemented"
|
164
|
+
puts usage
|
165
|
+
exit 1
|
80
166
|
end
|
167
|
+
|