moomerman-rambo 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +9 -0
- data/lib/rambo/env.rb +8 -7
- metadata +1 -1
data/README
CHANGED
|
@@ -11,3 +11,12 @@ rake db:setup # check config.yml for your specific db settings
|
|
|
11
11
|
rake server
|
|
12
12
|
|
|
13
13
|
head over to http://localhost:4000/
|
|
14
|
+
|
|
15
|
+
Features:
|
|
16
|
+
= No Ruby object base class modifications
|
|
17
|
+
= Lightweight and fast
|
|
18
|
+
= Rack-based so works with most web servers (thin, mongrel, passenger)
|
|
19
|
+
= Ability to proxy request to n backend app servers [experimental]
|
|
20
|
+
= Request caching built in
|
|
21
|
+
= fast static file serving
|
|
22
|
+
= works with erb or haml templates (more to come)
|
data/lib/rambo/env.rb
CHANGED
|
@@ -4,20 +4,20 @@ module Rambo
|
|
|
4
4
|
# TODO: config reload
|
|
5
5
|
@@config ||= YAML.load_file("config.yml") rescue nil || {}
|
|
6
6
|
|
|
7
|
-
if dbconf = @@config['
|
|
7
|
+
if dbconf = @@config['datamapper']
|
|
8
8
|
require 'dm-core'
|
|
9
9
|
require 'dm-validations'
|
|
10
10
|
require 'dm-timestamps'
|
|
11
11
|
#DataMapper.setup(:default, 'mysql://localhost/moo_development')
|
|
12
|
-
|
|
13
|
-
:default,
|
|
14
|
-
:adapter =>
|
|
12
|
+
@@connection ||= DataMapper.setup(
|
|
13
|
+
:default,
|
|
14
|
+
:adapter => :mysql,
|
|
15
15
|
:host => dbconf['host'],
|
|
16
16
|
:database => dbconf['database'],
|
|
17
17
|
:username => dbconf['username'],
|
|
18
18
|
:password => dbconf['password']
|
|
19
19
|
)
|
|
20
|
-
|
|
20
|
+
@@dblogger ||= DataObjects::Mysql.logger = DataObjects::Logger.new(STDOUT, dbconf['logging']) if dbconf['logging']
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
Dir["controller/*.rb"].each { |x| funkyload x }
|
|
@@ -31,9 +31,10 @@ module Rambo
|
|
|
31
31
|
# request/response cycle
|
|
32
32
|
def funkyload(file)
|
|
33
33
|
@@loadcache ||= {}
|
|
34
|
-
if cache = @@loadcache[file]
|
|
34
|
+
if cache = @@loadcache[file]
|
|
35
|
+
return unless @@config['rambo']['reload_classes']
|
|
35
36
|
if (mtime = File.mtime(file)) > cache
|
|
36
|
-
|
|
37
|
+
puts "rambo: reloading: #{file}"
|
|
37
38
|
load file
|
|
38
39
|
@@loadcache[file] = mtime
|
|
39
40
|
end
|