public
Description: Life On The Edge With Merb, DataMapper & RSpec
Homepage: http://blog.new-bamboo.co.uk
Clone URL: git://github.com/deimos1986/book_mdar.git
Search Repo:
ready for next post
deimos1986 (author)
Fri Apr 18 10:01:30 -0700 2008
commit  e1c4aa1a1177647baffc6d7f27e540899dd48b98
tree    9cd88d0956615ca798ae63768758145710de5457
parent  1373749b5f6974a97f8fa66d6b4331fddcc27f1f
...
28
29
30
31
 
32
33
34
35
36
37
...
44
45
46
47
 
48
49
50
...
28
29
30
 
31
32
 
 
33
34
35
...
42
43
44
 
45
46
47
48
0
@@ -28,10 +28,8 @@
0
     cd merb-more ; rake install ; cd ..
0
     cd merb-plugins; rake install ; cd ..
0
 
0
-The `json_pure` gem is needed for merb to install on JRuby, otherwise use the `json` gem as it's faster.
0
+The `json_pure` gem is needed for merb to install on [JRuby](http://jruby.codehaus.org/) (Java implementation of a Ruby Interpreter), otherwise use the `json` gem as it's faster.
0
 
0
-(TODO) - What is JRuby
0
-
0
 Merb is ORM agnostic, but as the title of this book suggests we'll be using DataMapper.
0
 Should you want to stick with ActiveRecord or play with Sequel, check the [merb documentation](http://merb.rubyforge.org/files/README.html) for install instructions.
0
 
0
@@ -44,7 +42,7 @@
0
 
0
 We will use MySQL in the following example, but you can use either sqlite3 or PostgreSQL, just install the appropriate gem. You will also need to ensure that MySQL is on your system path for the gem to install correctly.
0
 
0
-(TODO) - gem instructions for DM, once 0.9 comes out
0
+(TODO) - gem instructions for DM 0.9 once they are released
0
 
0
 To get the gem from source:
0
 
...
25
26
27
28
29
30
 
 
31
32
33
34
35
36
37
38
39
40
41
42
 
 
 
 
 
 
 
 
 
 
 
 
43
44
45
46
47
48
49
50
 
 
 
51
52
...
25
26
27
 
 
28
29
30
31
32
33
 
 
 
 
 
 
 
 
 
34
35
36
37
38
39
40
41
42
43
44
45
46
 
 
 
 
 
 
 
47
48
49
50
51
0
@@ -25,29 +25,28 @@
0
     use_orm :dm_core
0
 
0
     use_test :rspec
0
-
0
- dependencies 'linguistics'
0
 
0
+ dependencies "Linguistics", "dm-validations"
0
+
0
     
0
 Now add a config/database.yml file with the following:
0
 
0
- ---
0
- development: &defaults
0
- adapter: mysql
0
- database: golb
0
- username: root
0
- password:
0
- host: localhost
0
- log_stream: STDOUT
0
- log_level: 0
0
+ ---
0
+ # Edit this file:
0
+ development: &defaults
0
+ # These are the settings for repository :default
0
+ adapter: mysql
0
+ database: golb
0
+ host: localhost
0
+ username: root
0
+ password:
0
+ socket: /opt/local/var/run/mysql5/mysqld.sock
0
+ log_stream: STDOUT
0
+ log_level: 0
0
 
0
- test:
0
- <<: *defaults
0
- database: golb_test
0
-
0
- production:
0
- <<: *defaults
0
- database: golb_production
0
+ test: &defaults
0
+ # These are the settings for repository :default
0
+ database: golb_test
0
       
0
 Now we're ready to rock and roll ...
...
6
7
8
9
 
10
11
12
13
 
14
15
16
...
6
7
8
 
9
10
11
12
 
13
14
15
16
0
@@ -6,11 +6,11 @@
0
 
0
 Having discussed the functionality we can deduce that we will need the following models, `Post`, `Comment`, `Tag`, `User` and `Image`.
0
 
0
-Merb has a model generator just as rails does:
0
+DataMapper has a model generator just as rails does:
0
 
0
     merb-gen model post
0
 
0
-This is make a post model for you, provided that you have defined an orm and the database simple_blog, in the previous steps.
0
+This will make a post model for you, provided that you have defined an orm and the database golb, in the previous steps.
0
 
0
 When you run `rake dm:db:auto_migrate`, it will create the database table and all the properties, but take care this is a destructive method!
0
 
...
1
2
 
3
4
5
...
8
9
10
 
 
11
12
13
...
1
 
2
3
4
5
...
8
9
10
11
12
13
14
15
0
@@ -1,5 +1,5 @@
0
 ---
0
-# This is a sample database file for the DataMapper ORM
0
+# Edit this file:
0
 development: &defaults
0
     # These are the settings for repository :default
0
     adapter: mysql
0
@@ -8,6 +8,8 @@
0
     username: root
0
     password:
0
     socket: /opt/local/var/run/mysql5/mysqld.sock
0
+ log_stream: STDOUT
0
+ log_level: 0
0
 
0
 test: &defaults
0
     # These are the settings for repository :default
...
13
14
15
16
 
17
18
19
...
13
14
15
 
16
17
18
19
0
@@ -13,7 +13,7 @@
0
 
0
 use_test :rspec
0
 
0
-dependency "dm-validations"
0
+dependencies "Linguistics", "dm-validations"
0
 
0
 Merb::BootLoader.after_app_loads do
0
 

Comments

    No one has commented yet.