merb 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README +64 -80
- data/Rakefile +25 -12
- data/bin/merb +2 -223
- data/examples/README_EXAMPLES +10 -0
- data/examples/skeleton.tar +0 -0
- data/lib/merb.rb +48 -21
- data/lib/merb/core_ext.rb +12 -2
- data/lib/merb/core_ext/merb_class.rb +21 -21
- data/lib/merb/core_ext/merb_kernel.rb +60 -0
- data/lib/merb/core_ext/merb_object.rb +14 -0
- data/lib/merb/core_ext/merb_string.rb +3 -13
- data/lib/merb/generators/merb_app/merb_app.rb +33 -0
- data/lib/merb/merb_constants.rb +7 -0
- data/lib/merb/merb_controller.rb +31 -23
- data/lib/merb/merb_drb_server.rb +6 -60
- data/lib/merb/merb_exceptions.rb +162 -2
- data/lib/merb/merb_handler.rb +8 -19
- data/lib/merb/merb_mailer.rb +60 -0
- data/lib/merb/merb_router.rb +1 -1
- data/lib/merb/merb_server.rb +240 -0
- data/lib/merb/merb_upload_handler.rb +1 -1
- data/lib/merb/merb_view_context.rb +11 -6
- data/lib/merb/mixins/basic_authentication_mixin.rb +11 -13
- data/lib/merb/mixins/controller_mixin.rb +12 -6
- data/lib/merb/mixins/form_control_mixin.rb +94 -0
- data/lib/merb/mixins/render_mixin.rb +50 -24
- data/lib/merb/mixins/view_context_mixin.rb +122 -0
- data/lib/merb/session/merb_ar_session.rb +13 -14
- data/lib/merb/session/merb_memory_session.rb +105 -0
- metadata +13 -132
- data/examples/app_skeleton/Rakefile +0 -82
- data/examples/app_skeleton/dist/app/helpers/global_helper.rb +0 -6
- data/examples/app_skeleton/dist/conf/merb.yml +0 -11
- data/examples/app_skeleton/dist/conf/merb_init.rb +0 -16
- data/examples/app_skeleton/dist/conf/mup.conf +0 -5
- data/examples/app_skeleton/dist/conf/router.rb +0 -19
- data/examples/app_skeleton/scripts/merb_stop +0 -13
- data/examples/app_skeleton/scripts/new_migration +0 -21
- data/examples/app_skeleton/test/test_helper.rb +0 -1
- data/examples/sample_app/Rakefile +0 -82
- data/examples/sample_app/dist/app/controllers/files.rb +0 -31
- data/examples/sample_app/dist/app/controllers/posts.rb +0 -71
- data/examples/sample_app/dist/app/controllers/test.rb +0 -40
- data/examples/sample_app/dist/app/helpers/global_helper.rb +0 -7
- data/examples/sample_app/dist/app/helpers/posts_helper.rb +0 -4
- data/examples/sample_app/dist/app/models/comment.rb +0 -3
- data/examples/sample_app/dist/app/models/post.rb +0 -4
- data/examples/sample_app/dist/app/views/files/progress.jerb +0 -3
- data/examples/sample_app/dist/app/views/files/start.herb +0 -62
- data/examples/sample_app/dist/app/views/files/upload.herb +0 -6
- data/examples/sample_app/dist/app/views/layout/application.herb +0 -61
- data/examples/sample_app/dist/app/views/layout/foo.herb +0 -6
- data/examples/sample_app/dist/app/views/posts/_comments.herb +0 -11
- data/examples/sample_app/dist/app/views/posts/comment.jerb +0 -1
- data/examples/sample_app/dist/app/views/posts/list.herb +0 -5
- data/examples/sample_app/dist/app/views/posts/new.herb +0 -37
- data/examples/sample_app/dist/app/views/posts/show.herb +0 -37
- data/examples/sample_app/dist/app/views/posts/xml_test.xerb +0 -3
- data/examples/sample_app/dist/app/views/shared/_test.herb +0 -1
- data/examples/sample_app/dist/app/views/test/foo.herb +0 -2
- data/examples/sample_app/dist/app/views/test/hello.herb +0 -5
- data/examples/sample_app/dist/app/views/test/json.jerb +0 -1
- data/examples/sample_app/dist/conf/merb.yml +0 -11
- data/examples/sample_app/dist/conf/merb_init.rb +0 -24
- data/examples/sample_app/dist/conf/mup.conf +0 -5
- data/examples/sample_app/dist/conf/router.rb +0 -19
- data/examples/sample_app/dist/public/images/bg.jpg +0 -0
- data/examples/sample_app/dist/public/images/book.gif +0 -0
- data/examples/sample_app/dist/public/images/booksmall.gif +0 -0
- data/examples/sample_app/dist/public/images/greenright.jpg +0 -0
- data/examples/sample_app/dist/public/images/louiecon.gif +0 -0
- data/examples/sample_app/dist/public/images/menu.gif +0 -0
- data/examples/sample_app/dist/public/images/menuleft.gif +0 -0
- data/examples/sample_app/dist/public/images/menuright.gif +0 -0
- data/examples/sample_app/dist/public/images/mountain.jpg +0 -0
- data/examples/sample_app/dist/public/images/n3.jpg +0 -0
- data/examples/sample_app/dist/public/images/nautica.jpg +0 -0
- data/examples/sample_app/dist/public/javascripts/application.js +0 -0
- data/examples/sample_app/dist/public/javascripts/effects.js +0 -975
- data/examples/sample_app/dist/public/javascripts/mup.js +0 -113
- data/examples/sample_app/dist/public/javascripts/prototype.js +0 -2264
- data/examples/sample_app/dist/public/stylesheets/merb.css +0 -277
- data/examples/sample_app/dist/public/test.html +0 -5
- data/examples/sample_app/dist/schema/migrations/001_add_comments_to_posts.rb +0 -22
- data/examples/sample_app/dist/schema/migrations/002_add_sessions_table.rb +0 -14
- data/examples/sample_app/dist/schema/schema.rb +0 -28
- data/examples/sample_app/foo.txt +0 -0
- data/examples/sample_app/log/merb.4000.pid +0 -1
- data/examples/sample_app/script/merb_stop +0 -13
- data/examples/sample_app/script/new_migration +0 -21
- data/examples/sample_app/test/test_helper.rb +0 -1
- data/lib/merb/mixins/javascript_mixin.rb +0 -147
- data/lib/merb/session/merb_drb_session.rb +0 -65
- data/test/test_helper.rb +0 -1
- data/test/unit/route_matcher_test.rb +0 -46
@@ -6,16 +6,18 @@ module Merb
|
|
6
6
|
|
7
7
|
def setup_session
|
8
8
|
MERB_LOGGER.info("Setting up session")
|
9
|
-
|
10
|
-
@
|
9
|
+
before = cookies[session_id_key]
|
10
|
+
@session, cookies[session_id_key] = Merb::Session.persist(cookies[session_id_key])
|
11
|
+
@_fingerprint_before = Marshal.dump(@session).hash
|
12
|
+
@_new_cookie = cookies[session_id_key] != before
|
11
13
|
end
|
12
14
|
|
13
15
|
def finalize_session
|
14
16
|
MERB_LOGGER.info("Finalize session")
|
15
|
-
unless Marshal.dump(@session).hash == @
|
17
|
+
unless Marshal.dump(@session).hash == @_fingerprint_before
|
16
18
|
@session.save
|
17
19
|
end
|
18
|
-
|
20
|
+
set_cookie(session_id_key, cookies[session_id_key], Time.now+Merb::Const::WEEK*2) if @_new_cookie
|
19
21
|
end
|
20
22
|
|
21
23
|
end
|
@@ -24,7 +26,6 @@ module Merb
|
|
24
26
|
# Customizable data column name. Defaults to 'data'.
|
25
27
|
cattr_accessor :data_column_name
|
26
28
|
self.data_column_name = 'data'
|
27
|
-
|
28
29
|
before_save :marshal_data!
|
29
30
|
before_save :raise_on_session_data_overflow!
|
30
31
|
|
@@ -32,24 +33,22 @@ module Merb
|
|
32
33
|
|
33
34
|
class << self
|
34
35
|
# Generates a new session ID and creates a row for the new session in the database.
|
35
|
-
def generate
|
36
|
+
def generate
|
36
37
|
rand_max = RAND_CHARS.size
|
37
38
|
sid = (0...32).inject("") { |ret,_| ret << RAND_CHARS[rand(rand_max)] }
|
38
|
-
|
39
|
-
cookies[:session_id] = sess.session_id
|
40
|
-
sess
|
39
|
+
create(:session_id => sid, :data => {})
|
41
40
|
end
|
42
41
|
|
43
42
|
# Gets the existing session based on the <tt>session_id</tt> available in cookies.
|
44
43
|
# If none is found, generates a new session.
|
45
|
-
def persist(
|
46
|
-
if
|
47
|
-
session = find_by_session_id(
|
44
|
+
def persist(session_id)
|
45
|
+
if session_id
|
46
|
+
session = find_by_session_id(session_id)
|
48
47
|
end
|
49
48
|
unless session
|
50
|
-
session = generate
|
49
|
+
session = generate
|
51
50
|
end
|
52
|
-
session
|
51
|
+
[session, session.session_id]
|
53
52
|
end
|
54
53
|
|
55
54
|
# Don't try to reload ARStore::Session in dev mode.
|
@@ -0,0 +1,105 @@
|
|
1
|
+
module Merb
|
2
|
+
|
3
|
+
module SessionMixin
|
4
|
+
|
5
|
+
def setup_session
|
6
|
+
MERB_LOGGER.info("Setting up session")
|
7
|
+
before = cookies[session_id_key]
|
8
|
+
@session , cookies[session_id_key] = Merb::MemorySession.persist(cookies[session_id_key])
|
9
|
+
@_new_cookie = cookies[session_id_key] != before
|
10
|
+
end
|
11
|
+
|
12
|
+
def finalize_session
|
13
|
+
MERB_LOGGER.info("Finalize session")
|
14
|
+
set_cookie(session_id_key, cookies[session_id_key], Time.now+Merb::Const::WEEK*2) if @_new_cookie
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
class MemorySession
|
20
|
+
|
21
|
+
class << self
|
22
|
+
|
23
|
+
RAND_CHARS = [*'A'..'Z'] + [*'0'..'9'] + [*'a'..'z']
|
24
|
+
|
25
|
+
# Generates a new session ID and creates a row for the new session in the database.
|
26
|
+
def generate
|
27
|
+
rand_max = RAND_CHARS.size
|
28
|
+
sid = (0...32).inject("") { |ret,_| ret << RAND_CHARS[rand(rand_max)] }
|
29
|
+
[create(:session_id => sid, :data => {}), sid]
|
30
|
+
end
|
31
|
+
|
32
|
+
# Gets the existing session based on the <tt>session_id</tt> available in cookies.
|
33
|
+
# If none is found, generates a new session.
|
34
|
+
def persist(session_id)
|
35
|
+
if session_id
|
36
|
+
session = self[session_id]
|
37
|
+
sid = session_id
|
38
|
+
end
|
39
|
+
unless session
|
40
|
+
session, sid = generate
|
41
|
+
end
|
42
|
+
[session, sid]
|
43
|
+
end
|
44
|
+
|
45
|
+
def setup(opts={})
|
46
|
+
@opts = opts
|
47
|
+
@sessions = Hash.new
|
48
|
+
@timestamps = Hash.new
|
49
|
+
@mutex = Mutex.new
|
50
|
+
@session_ttl = opts.fetch(:session_ttl, 60*60) # default 1 hour
|
51
|
+
start_timer
|
52
|
+
self
|
53
|
+
end
|
54
|
+
|
55
|
+
def create(opts={})
|
56
|
+
self[opts[:session_id]] = opts[:data]
|
57
|
+
end
|
58
|
+
|
59
|
+
def [](key)
|
60
|
+
@mutex.synchronize {
|
61
|
+
@timestamps[key] = Time.now
|
62
|
+
@sessions[key]
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
def []=(key, val)
|
67
|
+
@mutex.synchronize {
|
68
|
+
@timestamps[key] = Time.now
|
69
|
+
@sessions[key] = val
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
def delete(key)
|
74
|
+
@mutex.synchronize {
|
75
|
+
@sessions.delete(key)
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def reap_old_sessions
|
80
|
+
@timestamps.each do |key,stamp|
|
81
|
+
if stamp + @session_ttl < Time.now
|
82
|
+
delete(key)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
GC.start
|
86
|
+
end
|
87
|
+
|
88
|
+
def start_timer
|
89
|
+
Thread.new do
|
90
|
+
loop {
|
91
|
+
sleep @session_ttl
|
92
|
+
reap_old_sessions
|
93
|
+
}
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def sessions
|
98
|
+
@sessions
|
99
|
+
end
|
100
|
+
|
101
|
+
end # end singleton class
|
102
|
+
|
103
|
+
end # end DRbSession
|
104
|
+
|
105
|
+
end
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.0
|
2
|
+
rubygems_version: 0.9.0.9
|
3
3
|
specification_version: 1
|
4
4
|
name: merb
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date:
|
6
|
+
version: 0.0.9
|
7
|
+
date: 2007-01-14 00:00:00 -08:00
|
8
8
|
summary: Merb == Mongrel + Erb. Pocket rocket web framework.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -34,22 +34,22 @@ files:
|
|
34
34
|
- Rakefile
|
35
35
|
- TODO
|
36
36
|
- bin/merb
|
37
|
-
- test/test_helper.rb
|
38
|
-
- test/unit
|
39
|
-
- test/unit/route_matcher_test.rb
|
40
37
|
- lib/merb
|
41
38
|
- lib/merb.rb
|
42
39
|
- lib/merb_tasks.rb
|
43
40
|
- lib/tasks
|
44
41
|
- lib/merb/core_ext
|
45
42
|
- lib/merb/core_ext.rb
|
43
|
+
- lib/merb/generators
|
46
44
|
- lib/merb/merb_constants.rb
|
47
45
|
- lib/merb/merb_controller.rb
|
48
46
|
- lib/merb/merb_drb_server.rb
|
49
47
|
- lib/merb/merb_exceptions.rb
|
50
48
|
- lib/merb/merb_handler.rb
|
49
|
+
- lib/merb/merb_mailer.rb
|
51
50
|
- lib/merb/merb_request.rb
|
52
51
|
- lib/merb/merb_router.rb
|
52
|
+
- lib/merb/merb_server.rb
|
53
53
|
- lib/merb/merb_upload_handler.rb
|
54
54
|
- lib/merb/merb_upload_progress.rb
|
55
55
|
- lib/merb/merb_view_context.rb
|
@@ -66,134 +66,24 @@ files:
|
|
66
66
|
- lib/merb/core_ext/merb_object.rb
|
67
67
|
- lib/merb/core_ext/merb_string.rb
|
68
68
|
- lib/merb/core_ext/merb_symbol.rb
|
69
|
+
- lib/merb/generators/merb_app
|
70
|
+
- lib/merb/generators/merb_app/merb_app.rb
|
69
71
|
- lib/merb/mixins/basic_authentication_mixin.rb
|
70
72
|
- lib/merb/mixins/controller_mixin.rb
|
71
73
|
- lib/merb/mixins/erubis_capture_mixin.rb
|
72
|
-
- lib/merb/mixins/
|
74
|
+
- lib/merb/mixins/form_control_mixin.rb
|
73
75
|
- lib/merb/mixins/merb_status_codes.rb
|
74
76
|
- lib/merb/mixins/render_mixin.rb
|
75
77
|
- lib/merb/mixins/responder_mixin.rb
|
78
|
+
- lib/merb/mixins/view_context_mixin.rb
|
76
79
|
- lib/merb/session/merb_ar_session.rb
|
77
|
-
- lib/merb/session/
|
80
|
+
- lib/merb/session/merb_memory_session.rb
|
78
81
|
- lib/merb/vendor/paginator
|
79
82
|
- lib/merb/vendor/paginator/paginator.rb
|
80
83
|
- lib/merb/vendor/paginator/README.txt
|
81
84
|
- lib/tasks/db.rake
|
82
|
-
- examples/
|
83
|
-
- examples/
|
84
|
-
- examples/app_skeleton/dist
|
85
|
-
- examples/app_skeleton/log
|
86
|
-
- examples/app_skeleton/plugins
|
87
|
-
- examples/app_skeleton/Rakefile
|
88
|
-
- examples/app_skeleton/scripts
|
89
|
-
- examples/app_skeleton/test
|
90
|
-
- examples/app_skeleton/dist/app
|
91
|
-
- examples/app_skeleton/dist/conf
|
92
|
-
- examples/app_skeleton/dist/lib
|
93
|
-
- examples/app_skeleton/dist/plugins
|
94
|
-
- examples/app_skeleton/dist/public
|
95
|
-
- examples/app_skeleton/dist/schema
|
96
|
-
- examples/app_skeleton/dist/app/controllers
|
97
|
-
- examples/app_skeleton/dist/app/helpers
|
98
|
-
- examples/app_skeleton/dist/app/models
|
99
|
-
- examples/app_skeleton/dist/app/views
|
100
|
-
- examples/app_skeleton/dist/app/helpers/global_helper.rb
|
101
|
-
- examples/app_skeleton/dist/app/views/layout
|
102
|
-
- examples/app_skeleton/dist/conf/merb.yml
|
103
|
-
- examples/app_skeleton/dist/conf/merb_init.rb
|
104
|
-
- examples/app_skeleton/dist/conf/mup.conf
|
105
|
-
- examples/app_skeleton/dist/conf/router.rb
|
106
|
-
- examples/app_skeleton/dist/public/files
|
107
|
-
- examples/app_skeleton/dist/public/images
|
108
|
-
- examples/app_skeleton/dist/public/javascripts
|
109
|
-
- examples/app_skeleton/dist/public/stylesheets
|
110
|
-
- examples/app_skeleton/dist/schema/migrations
|
111
|
-
- examples/app_skeleton/scripts/merb_stop
|
112
|
-
- examples/app_skeleton/scripts/new_migration
|
113
|
-
- examples/app_skeleton/test/fixtures
|
114
|
-
- examples/app_skeleton/test/spec
|
115
|
-
- examples/app_skeleton/test/test_helper.rb
|
116
|
-
- examples/app_skeleton/test/unit
|
117
|
-
- examples/sample_app/dist
|
118
|
-
- examples/sample_app/foo.txt
|
119
|
-
- examples/sample_app/log
|
120
|
-
- examples/sample_app/plugins
|
121
|
-
- examples/sample_app/Rakefile
|
122
|
-
- examples/sample_app/script
|
123
|
-
- examples/sample_app/test
|
124
|
-
- examples/sample_app/dist/app
|
125
|
-
- examples/sample_app/dist/conf
|
126
|
-
- examples/sample_app/dist/lib
|
127
|
-
- examples/sample_app/dist/plugins
|
128
|
-
- examples/sample_app/dist/public
|
129
|
-
- examples/sample_app/dist/schema
|
130
|
-
- examples/sample_app/dist/app/controllers
|
131
|
-
- examples/sample_app/dist/app/helpers
|
132
|
-
- examples/sample_app/dist/app/models
|
133
|
-
- examples/sample_app/dist/app/views
|
134
|
-
- examples/sample_app/dist/app/controllers/files.rb
|
135
|
-
- examples/sample_app/dist/app/controllers/posts.rb
|
136
|
-
- examples/sample_app/dist/app/controllers/test.rb
|
137
|
-
- examples/sample_app/dist/app/helpers/global_helper.rb
|
138
|
-
- examples/sample_app/dist/app/helpers/posts_helper.rb
|
139
|
-
- examples/sample_app/dist/app/models/comment.rb
|
140
|
-
- examples/sample_app/dist/app/models/post.rb
|
141
|
-
- examples/sample_app/dist/app/views/files
|
142
|
-
- examples/sample_app/dist/app/views/layout
|
143
|
-
- examples/sample_app/dist/app/views/posts
|
144
|
-
- examples/sample_app/dist/app/views/shared
|
145
|
-
- examples/sample_app/dist/app/views/test
|
146
|
-
- examples/sample_app/dist/app/views/files/progress.jerb
|
147
|
-
- examples/sample_app/dist/app/views/files/start.herb
|
148
|
-
- examples/sample_app/dist/app/views/files/upload.herb
|
149
|
-
- examples/sample_app/dist/app/views/layout/application.herb
|
150
|
-
- examples/sample_app/dist/app/views/layout/foo.herb
|
151
|
-
- examples/sample_app/dist/app/views/posts/_comments.herb
|
152
|
-
- examples/sample_app/dist/app/views/posts/comment.jerb
|
153
|
-
- examples/sample_app/dist/app/views/posts/list.herb
|
154
|
-
- examples/sample_app/dist/app/views/posts/new.herb
|
155
|
-
- examples/sample_app/dist/app/views/posts/show.herb
|
156
|
-
- examples/sample_app/dist/app/views/posts/xml_test.xerb
|
157
|
-
- examples/sample_app/dist/app/views/shared/_test.herb
|
158
|
-
- examples/sample_app/dist/app/views/test/foo.herb
|
159
|
-
- examples/sample_app/dist/app/views/test/hello.herb
|
160
|
-
- examples/sample_app/dist/app/views/test/json.jerb
|
161
|
-
- examples/sample_app/dist/conf/merb.yml
|
162
|
-
- examples/sample_app/dist/conf/merb_init.rb
|
163
|
-
- examples/sample_app/dist/conf/mup.conf
|
164
|
-
- examples/sample_app/dist/conf/router.rb
|
165
|
-
- examples/sample_app/dist/public/files
|
166
|
-
- examples/sample_app/dist/public/images
|
167
|
-
- examples/sample_app/dist/public/javascripts
|
168
|
-
- examples/sample_app/dist/public/stylesheets
|
169
|
-
- examples/sample_app/dist/public/test.html
|
170
|
-
- examples/sample_app/dist/public/images/bg.jpg
|
171
|
-
- examples/sample_app/dist/public/images/book.gif
|
172
|
-
- examples/sample_app/dist/public/images/booksmall.gif
|
173
|
-
- examples/sample_app/dist/public/images/greenright.jpg
|
174
|
-
- examples/sample_app/dist/public/images/louiecon.gif
|
175
|
-
- examples/sample_app/dist/public/images/menu.gif
|
176
|
-
- examples/sample_app/dist/public/images/menuleft.gif
|
177
|
-
- examples/sample_app/dist/public/images/menuright.gif
|
178
|
-
- examples/sample_app/dist/public/images/mountain.jpg
|
179
|
-
- examples/sample_app/dist/public/images/n3.jpg
|
180
|
-
- examples/sample_app/dist/public/images/nautica.jpg
|
181
|
-
- examples/sample_app/dist/public/javascripts/application.js
|
182
|
-
- examples/sample_app/dist/public/javascripts/effects.js
|
183
|
-
- examples/sample_app/dist/public/javascripts/mup.js
|
184
|
-
- examples/sample_app/dist/public/javascripts/prototype.js
|
185
|
-
- examples/sample_app/dist/public/stylesheets/merb.css
|
186
|
-
- examples/sample_app/dist/schema/migrations
|
187
|
-
- examples/sample_app/dist/schema/schema.rb
|
188
|
-
- examples/sample_app/dist/schema/migrations/001_add_comments_to_posts.rb
|
189
|
-
- examples/sample_app/dist/schema/migrations/002_add_sessions_table.rb
|
190
|
-
- examples/sample_app/log/merb.4000.pid
|
191
|
-
- examples/sample_app/script/merb_stop
|
192
|
-
- examples/sample_app/script/new_migration
|
193
|
-
- examples/sample_app/test/fixtures
|
194
|
-
- examples/sample_app/test/spec
|
195
|
-
- examples/sample_app/test/test_helper.rb
|
196
|
-
- examples/sample_app/test/unit
|
85
|
+
- examples/README_EXAMPLES
|
86
|
+
- examples/skeleton.tar
|
197
87
|
test_files: []
|
198
88
|
|
199
89
|
rdoc_options:
|
@@ -247,12 +137,3 @@ dependencies:
|
|
247
137
|
- !ruby/object:Gem::Version
|
248
138
|
version: 0.0.0
|
249
139
|
version:
|
250
|
-
- !ruby/object:Gem::Dependency
|
251
|
-
name: mime-types
|
252
|
-
version_requirement:
|
253
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
254
|
-
requirements:
|
255
|
-
- - ">"
|
256
|
-
- !ruby/object:Gem::Version
|
257
|
-
version: 0.0.0
|
258
|
-
version:
|
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/rdoctask'
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'code_statistics'
|
5
|
-
require 'fileutils'
|
6
|
-
require 'rubygems'
|
7
|
-
require 'merb'
|
8
|
-
require MERB_FRAMEWORK_ROOT+'/merb_tasks'
|
9
|
-
MERB_ROOT = File.dirname(__FILE__)
|
10
|
-
include FileUtils
|
11
|
-
|
12
|
-
|
13
|
-
#desc "Packages up Merb."
|
14
|
-
#task :default => [:package]
|
15
|
-
|
16
|
-
desc "load merb_init.rb"
|
17
|
-
task :merb_init do
|
18
|
-
require 'merb'
|
19
|
-
require File.dirname(__FILE__)+'/dist/conf/merb_init.rb'
|
20
|
-
end
|
21
|
-
|
22
|
-
desc "Load db schema"
|
23
|
-
task :load_schema => [:merb_init] do
|
24
|
-
require File.dirname(__FILE__)+'/dist/schema/schema.rb'
|
25
|
-
end
|
26
|
-
|
27
|
-
task :uninstall => [:clean] do
|
28
|
-
sh %{sudo gem uninstall #{NAME}}
|
29
|
-
end
|
30
|
-
|
31
|
-
desc 'Run unit tests'
|
32
|
-
Rake::TestTask.new('test_unit') do |t|
|
33
|
-
t.libs << 'test'
|
34
|
-
t.pattern = 'test/unit/*_test.rb'
|
35
|
-
t.verbose = true
|
36
|
-
end
|
37
|
-
|
38
|
-
desc 'Run functional tests'
|
39
|
-
Rake::TestTask.new('test_functional') do |t|
|
40
|
-
t.libs << 'test'
|
41
|
-
t.pattern = 'test/functional/*_test.rb'
|
42
|
-
t.verbose = true
|
43
|
-
end
|
44
|
-
|
45
|
-
desc 'Run all tests'
|
46
|
-
Rake::TestTask.new('test') do |t|
|
47
|
-
t.libs << 'test'
|
48
|
-
t.pattern = 'test/**/*_test.rb'
|
49
|
-
t.verbose = true
|
50
|
-
end
|
51
|
-
|
52
|
-
desc 'Run all tests, specs and finish with rcov'
|
53
|
-
task :aok do
|
54
|
-
sh %{rake rcov}
|
55
|
-
sh %{rake spec}
|
56
|
-
end
|
57
|
-
|
58
|
-
##############################################################################
|
59
|
-
# Statistics
|
60
|
-
##############################################################################
|
61
|
-
|
62
|
-
STATS_DIRECTORIES = [
|
63
|
-
%w(Code lib/),
|
64
|
-
%w(Unit\ tests test/unit),
|
65
|
-
%w(Functional\ tests test/functional)
|
66
|
-
].collect { |name, dir| [ name, "./#{dir}" ] }.select { |name, dir| File.directory?(dir) }
|
67
|
-
|
68
|
-
desc "Report code statistics (KLOCs, etc) from the application"
|
69
|
-
task :stats do
|
70
|
-
#require 'extra/stats'
|
71
|
-
verbose = true
|
72
|
-
CodeStatistics.new(*STATS_DIRECTORIES).to_s
|
73
|
-
end
|
74
|
-
|
75
|
-
##############################################################################
|
76
|
-
# SVN
|
77
|
-
##############################################################################
|
78
|
-
|
79
|
-
desc "Add new files to subversion"
|
80
|
-
task :svn_add do
|
81
|
-
system "svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add"
|
82
|
-
end
|