moomerman-rambo 0.4.3 → 0.4.4

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.
Files changed (3) hide show
  1. data/README +1 -1
  2. data/lib/rambo/env.rb +19 -15
  3. metadata +1 -1
data/README CHANGED
@@ -7,7 +7,7 @@ To run the example:
7
7
 
8
8
  git clone git://github.com/moomerman/rambo.git
9
9
  cd rambo/example/blog/
10
- rake db:setup # assumes database named rambo_blog
10
+ 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/
data/lib/rambo/env.rb CHANGED
@@ -1,21 +1,25 @@
1
1
  module Rambo
2
2
  class Env
3
3
  def initialize
4
- # load from config - only do this IF database required
5
- require 'dm-core'
6
- require 'dm-validations'
7
- require 'dm-timestamps'
8
- #DataMapper.setup(:default, 'mysql://localhost/moo_development')
9
- @connection ||= DataMapper.setup(
10
- :default,
11
- :adapter => :mysql,
12
- :host => 'localhost',
13
- :database => 'rambo_blog',
14
- :username => 'root',
15
- :password => ''
16
- )
17
- #DataObjects::Mysql.logger = DataObjects::Logger.new(STDOUT, :debug)
18
-
4
+ # TODO: config reload
5
+ @@config ||= YAML.load_file("config.yml") rescue nil || {}
6
+
7
+ if dbconf = @@config['database']
8
+ require 'dm-core'
9
+ require 'dm-validations'
10
+ require 'dm-timestamps'
11
+ #DataMapper.setup(:default, 'mysql://localhost/moo_development')
12
+ @connection ||= DataMapper.setup(
13
+ :default,
14
+ :adapter => dbconf['adapter'],
15
+ :host => dbconf['host'],
16
+ :database => dbconf['database'],
17
+ :username => dbconf['username'],
18
+ :password => dbconf['password']
19
+ )
20
+ #DataObjects::Mysql.logger = DataObjects::Logger.new(STDOUT, :debug)
21
+ end
22
+
19
23
  Dir["controller/*.rb"].each { |x| funkyload x }
20
24
  Dir["model/*.rb"].each { |x| funkyload x }
21
25
  Dir["lib/*.rb"].each { |x| funkyload x }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moomerman-rambo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Taylor