railties 3.0.9 → 3.0.10.rc1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,8 @@
1
- *Rails 3.0.8 (unreleased)*
1
+ *Rails 3.0.10 (unreleased)*
2
+
3
+ *Rails 3.0.9 (June 16, 2011)*
4
+
5
+ *Rails 3.0.8 (June 7, 2011)*
2
6
 
3
7
  * Fix Rake 0.9.0 support.
4
8
 
@@ -2,7 +2,7 @@ h2. Contributing to Ruby on Rails
2
2
 
3
3
  This guide covers ways in which _you_ can become a part of the ongoing development of Ruby on Rails. After reading it, you should be familiar with:
4
4
 
5
- * Using Lighthouse to report issues
5
+ * Using GitHub to report issues
6
6
  * Cloning master and running the test suite
7
7
  * Helping to resolve existing issues
8
8
  * Contributing to the Ruby on Rails documentation
@@ -14,29 +14,25 @@ endprologue.
14
14
 
15
15
  h3. Reporting an Issue
16
16
 
17
- Ruby on Rails uses a "Lighthouse project":http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/ to track issues (primarily bugs and contributions of new code). If you've found a bug in Ruby on Rails, this is the place to start. You'll need to create a (free) Lighthouse account in order to comment on issues or to upload patches.
17
+ Ruby on Rails uses "GitHub Issue Tracking":https://github.com/rails/rails/issues to track issues (primarily bugs and contributions of new code). If you've found a bug in Ruby on Rails, this is the place to start. You'll need to create a (free) GitHub account in order to either submit an issue, comment on them or create pull requests.
18
18
 
19
19
  NOTE: Bugs in the most recent released version of Ruby on Rails are likely to get the most attention. Also, the Rails core team is always interested in feedback from those who can take the time to test _edge Rails_ (the code for the version of Rails that is currently under development). Later in this guide you'll find out how to get edge Rails for testing.
20
20
 
21
21
  h4. Creating a Bug Report
22
22
 
23
- If you've found a problem in Ruby on Rails which is not a security risk do a search in Lighthouse in case it was already reported. If you find no ticket addressing it you can "add a new one":http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/new. (See the next section for reporting security issues.)
23
+ If you've found a problem in Ruby on Rails which is not a security risk do a search in GitHub Issues in case it was already reported. If you find no issue addressing it you can "add a new one":https://github.com/rails/rails/issues/new. (See the next section for reporting security issues.)
24
24
 
25
- At the minimum, your ticket needs a title and descriptive text. But that's only a minimum. You should include as much relevant information as possible. You need to at least post the code sample that has the issue. Even better is to include a unit test that shows how the expected behavior is not occurring. Your goal should be to make it easy for yourself - and others - to replicate the bug and figure out a fix.
25
+ At the minimum, your issue report needs a title and descriptive text. But that's only a minimum. You should include as much relevant information as possible. You need to at least post the code sample that has the issue. Even better is to include a unit test that shows how the expected behavior is not occurring. Your goal should be to make it easy for yourself - and others - to replicate the bug and figure out a fix.
26
26
 
27
- You shouldn't assign the bug to a particular core developer unless you know for sure which developer will be handling that issue. The core team periodically reviews issues and assigns developers and milestones to them.
28
-
29
- You should set tags for your issue. Use the "bug" tag for a bug report, and add the "patch" tag if you are attaching a patch. Try to find some relevant tags from the existing tag list (which will appear as soon as you start typing in the "Choose some tags" textbox), rather than creating new tags.
30
-
31
- Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kind of bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to confirm it with a "I'm having this problem too" comment.
27
+ Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kind of bug, you're creating this issue report in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the issue report will automatically see any activity or that others will jump to fix it. Creating an issue like this is mostly to help yourself start on the path of fixing the problem and for others to confirm it with a "I'm having this problem too" comment.
32
28
 
33
29
  h4. Special Treatment for Security Issues
34
30
 
35
- WARNING: Please do not report security vulnerabilities on public Lighthouse tickets. The "Rails security policy page":http://rubyonrails.org/security details the procedure to follow for security issues.
31
+ WARNING: Please do not report security vulnerabilities with public GitHub issue reports. The "Rails security policy page":http://rubyonrails.org/security details the procedure to follow for security issues.
36
32
 
37
33
  h4. What About Feature Requests?
38
34
 
39
- Please don't put "feature request" tickets into Lighthouse. If there's a new feature that you want to see added to Ruby on Rails, you'll need to write the code yourself - or convince someone else to partner with you to write the code. Later in this guide you'll find detailed instructions for proposing a patch to Ruby on Rails. If you enter a wishlist item in Lighthouse with no code, you can expect it to be marked "invalid" as soon as it's reviewed.
35
+ Please don't put "feature request" items into GitHub Issues. If there's a new feature that you want to see added to Ruby on Rails, you'll need to write the code yourself - or convince someone else to partner with you to write the code. Later in this guide you'll find detailed instructions for proposing a patch to Ruby on Rails. If you enter a wishlist item in GitHub Issues with no code, you can expect it to be marked "invalid" as soon as it's reviewed.
40
36
 
41
37
  h3. Running the Test Suite
42
38
 
@@ -48,7 +44,7 @@ Ruby on Rails uses git for source code control. The "git homepage":http://git-sc
48
44
 
49
45
  * "Everyday Git":http://www.kernel.org/pub/software/scm/git/docs/everyday.html will teach you just enough about git to get by.
50
46
  * The "PeepCode screencast":https://peepcode.com/products/git on git ($9) is easier to follow.
51
- * "GitHub":http://github.com/guides/home offers links to a variety of git resources.
47
+ * "GitHub":http://help.github.com offers links to a variety of git resources.
52
48
  * "Pro Git":http://progit.org/book/ is an entire book about git with a Creative Commons license.
53
49
 
54
50
  h4. Clone the Ruby on Rails Repository
@@ -56,8 +52,8 @@ h4. Clone the Ruby on Rails Repository
56
52
  Navigate to the folder where you want the Ruby on Rails source code (it will create its own +rails+ subdirectory) and run:
57
53
 
58
54
  <shell>
59
- git clone git://github.com/rails/rails.git
60
- cd rails
55
+ $ git clone git://github.com/rails/rails.git
56
+ $ cd rails
61
57
  </shell>
62
58
 
63
59
  h4. Set up and Run the Tests
@@ -67,40 +63,48 @@ The test suite must pass with any submitted code. No matter whether you are writ
67
63
  Install first libxml2 and libxslt together with their development files for Nokogiri. In Ubuntu that's
68
64
 
69
65
  <shell>
70
- sudo apt-get install libxml2 libxml2-dev libxslt1-dev
66
+ $ sudo apt-get install libxml2 libxml2-dev libxslt1-dev
71
67
  </shell>
72
68
 
73
69
  Also, SQLite3 and its development files for the +sqlite3-ruby+ gem, in Ubuntu you're done with
74
70
 
75
71
  <shell>
76
- sudo apt-get install sqlite3 libsqlite3-dev
72
+ $ sudo apt-get install sqlite3 libsqlite3-dev
77
73
  </shell>
78
74
 
79
75
  Get a recent version of "Bundler":http://gembundler.com/:
80
76
 
81
77
  <shell>
82
- gem install bundler
78
+ $ gem install bundler
83
79
  </shell>
84
80
 
85
81
  and run:
86
82
 
87
83
  <shell>
88
- bundle install --without db
84
+ $ bundle install --without db
89
85
  </shell>
90
86
 
91
87
  This command will install all dependencies except the MySQL and PostgreSQL Ruby drivers. We will come back at these soon. With dependencies installed, you can run the test suite with:
92
88
 
93
89
  <shell>
94
- rake test
90
+ $ rake test
91
+ </shell>
92
+
93
+ You can also run tests for a specific framework, like Action Pack, by going into its directory and executing the same command:
94
+
95
+ <shell>
96
+ $ cd actionpack
97
+ $ rake test
95
98
  </shell>
96
99
 
97
- You can also run tests for an specific framework, like Action Pack, by going into its directory and executing the same command:
100
+ If you want to run tests from the specific directory use the +TEST_DIR+ environment variable. For example, this will run tests inside +railties/test/generators+ directory only:
98
101
 
99
102
  <shell>
100
- cd actionpack
101
- rake test
103
+ $ cd railties
104
+ $ TEST_DIR=generators rake test
102
105
  </shell>
103
106
 
107
+
104
108
  h4. Warnings
105
109
 
106
110
  The test suite runs with warnings enabled. Ideally Ruby on Rails should issue no warning, but there may be a few, and also some from third-party libraries. Please ignore (or fix!) them if any, and submit patches that do not issue new warnings.
@@ -108,7 +112,7 @@ The test suite runs with warnings enabled. Ideally Ruby on Rails should issue no
108
112
  As of this writing they are specially noisy with Ruby 1.9. If you are sure about what you are doing and would like to have a more clear output, there's a way to override the flag:
109
113
 
110
114
  <shell>
111
- RUBYOPT=-W0 rake test
115
+ $ RUBYOPT=-W0 rake test
112
116
  </shell>
113
117
 
114
118
  h4. Testing Active Record
@@ -122,8 +126,8 @@ h5. SQLite3
122
126
  The gem +sqlite3-ruby+ does not belong to the "db" group indeed, if you followed the instructions above you're ready. This is how you run the Active Record test suite only for SQLite3:
123
127
 
124
128
  <shell>
125
- cd activerecord
126
- rake test_sqlite3
129
+ $ cd activerecord
130
+ $ rake test_sqlite3
127
131
  </shell>
128
132
 
129
133
  h5. MySQL and PostgreSQL
@@ -131,15 +135,15 @@ h5. MySQL and PostgreSQL
131
135
  To be able to run the suite for MySQL and PostgreSQL we need their gems. Install first the servers, their client libraries, and their development files. In Ubuntu just run
132
136
 
133
137
  <shell>
134
- sudo apt-get install mysql-server libmysqlclient15-dev
135
- sudo apt-get install postgresql postgresql-client postgresql-contrib libpq-dev
138
+ $ sudo apt-get install mysql-server libmysqlclient15-dev
139
+ $ sudo apt-get install postgresql postgresql-client postgresql-contrib libpq-dev
136
140
  </shell>
137
141
 
138
142
  After that run:
139
143
 
140
144
  <shell>
141
- rm .bundle/config
142
- bundle install
145
+ $ rm .bundle/config
146
+ $ bundle install
143
147
  </shell>
144
148
 
145
149
  We need first to delete +.bundle/config+ because Bundler remembers in that file that we didn't want to install the "db" group (alternatively you can edit the file).
@@ -156,21 +160,21 @@ mysql> GRANT ALL PRIVILEGES ON activerecord_unittest2.*
156
160
  and create the test databases:
157
161
 
158
162
  <shell>
159
- cd activerecord
160
- rake mysql:build_databases
163
+ $ cd activerecord
164
+ $ rake mysql:build_databases
161
165
  </shell>
162
166
 
163
167
  PostgreSQL's authentication works differently. A simple way to setup the development environment for example is to run with your development account
164
168
 
165
169
  <shell>
166
- sudo -u postgres createuser --superuser $USER
170
+ $ sudo -u postgres createuser --superuser $USER
167
171
  </shell>
168
172
 
169
173
  and after that create the test databases with
170
174
 
171
175
  <shell>
172
- cd activerecord
173
- rake postgresql:build_databases
176
+ $ cd activerecord
177
+ $ rake postgresql:build_databases
174
178
  </shell>
175
179
 
176
180
  NOTE: Using the rake task to create the test databases ensures they have the correct character set and collation.
@@ -188,7 +192,7 @@ test_postgresql
188
192
  respectively. As we mentioned before
189
193
 
190
194
  <shell>
191
- rake test
195
+ $ rake test
192
196
  </shell>
193
197
 
194
198
  will now run the four of them in turn.
@@ -200,19 +204,19 @@ h4. Older versions of Ruby on Rails
200
204
  If you want to add a fix to older versions of Ruby on Rails, you'll need to set up and switch to your own local tracking branch. Here is an example to switch to the 2-3-stable branch:
201
205
 
202
206
  <shell>
203
- git branch --track 2-3-stable origin/2-3-stable
204
- git checkout 2-3-stable
207
+ $ git branch --track 2-3-stable origin/2-3-stable
208
+ $ git checkout 2-3-stable
205
209
  </shell>
206
210
 
207
211
  TIP: You may want to "put your git branch name in your shell prompt":http://qugstart.com/blog/git-and-svn/add-colored-git-branch-name-to-your-shell-prompt/ to make it easier to remember which version of the code you're working with.
208
212
 
209
213
  h3. Helping to Resolve Existing Issues
210
214
 
211
- As a next step beyond reporting issues, you can help the core team resolve existing issues. If you check the "open tickets":https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets?q=state%3Aopen list in Lighthouse, you'll find lots of issues already requiring attention. What can you do for these? Quite a bit, actually:
215
+ As a next step beyond reporting issues, you can help the core team resolve existing issues. If you check the "Everyone's Issues":https://github.com/rails/rails/issues?sort=created&direction=desc&state=open&page=1 list in GitHub Issues, you'll find lots of issues already requiring attention. What can you do for these? Quite a bit, actually:
212
216
 
213
217
  h4. Verifying Bug Reports
214
218
 
215
- For starters, it helps to just verify bug reports. Can you reproduce the reported issue on your own computer? If so, you can add a comment to the ticket saying that you're seeing the same thing.
219
+ For starters, it helps to just verify bug reports. Can you reproduce the reported issue on your own computer? If so, you can add a comment to the issue saying that you're seeing the same thing.
216
220
 
217
221
  If something is very vague, can you help squish it down into something specific? Maybe you can provide additional information to help reproduce a bug, or eliminate needless steps that aren't required to help demonstrate the problem.
218
222
 
@@ -222,44 +226,45 @@ Anything you can do to make bug reports more succinct or easier to reproduce is
222
226
 
223
227
  h4. Testing Patches
224
228
 
225
- You can also help out by examining patches that have been submitted to Ruby on Rails via Lighthouse. To apply someone's changes you need to first create a dedicated branch:
229
+ You can also help out by examining pull requests that have been submitted to Ruby on Rails via GitHub. To apply someone's changes you need to first create a dedicated branch:
226
230
 
227
231
  <shell>
228
- git checkout -b testing_branch
232
+ $ git checkout -b testing_branch
229
233
  </shell>
230
234
 
231
- Then you can apply their patch:
235
+ Then you can use their remote branch to update your codebase. For example, let's say the GitHub user JohnSmith has forked and pushed to the topic branch located at https://github.com/JohnSmith/rails.
232
236
 
233
237
  <shell>
234
- git am their-patch-file.diff
238
+ $ git remote add JohnSmith git://github.com/JohnSmith/rails.git
239
+ $ git pull JohnSmith topic
235
240
  </shell>
236
241
 
237
- After applying a patch, test it out! Here are some things to think about:
242
+ After applying their branch, test it out! Here are some things to think about:
238
243
 
239
- * Does the patch actually work?
244
+ * Does the change actually work?
240
245
  * Are you happy with the tests? Can you follow what they're testing? Are there any tests missing?
241
246
  * Does it have proper documentation coverage? Should documentation elsewhere be updated?
242
247
  * Do you like the implementation? Can you think of a nicer or faster way to implement a part of their change?
243
248
 
244
- Once you're happy that the patch contains a good change, comment on the Lighthouse ticket indicating your approval. Your comment should indicate that you like the change and what you like about it. Something like:
249
+ Once you're happy that the pull request contains a good change, comment on the GitHub issue indicating your approval. Your comment should indicate that you like the change and what you like about it. Something like:
245
250
 
246
251
  <blockquote>
247
252
  I like the way you've restructured that code in generate_finder_sql, much nicer. The tests look good too.
248
253
  </blockquote>
249
254
 
250
- If your comment simply says "+1", then odds are that other reviewers aren't going to take it too seriously. Show that you took the time to review the patch. Once three people have approved it, add the "verified" tag. This will bring it to the attention of a core team member who will review the changes looking for the same kinds of things.
255
+ If your comment simply says "+1", then odds are that other reviewers aren't going to take it too seriously. Show that you took the time to review the pull request.
251
256
 
252
257
  h3. Contributing to the Rails Documentation
253
258
 
254
259
  Ruby on Rails has two main sets of documentation: The guides help you to learn Ruby on Rails, and the API is a reference.
255
260
 
256
- You can create a ticket in Lighthouse to fix or expand documentation. However, if you're confident about your changes you can push them yourself directly via "docrails":http://github.com/lifo/docrails/tree/master. docrails is a branch with an *open commit policy* and public write access. Commits to docrails are still reviewed, but that happens after they are pushed. docrails is merged with master regularly, so you are effectively editing the Ruby on Rails documentation.
261
+ You can create an issue in GitHub issues to fix or expand documentation. However, if you're confident about your changes you can push them yourself directly via "docrails":https://github.com/lifo/docrails/tree/master. docrails is a branch with an *open commit policy* and public write access. Commits to docrails are still reviewed, but that happens after they are pushed. docrails is merged with master regularly, so you are effectively editing the Ruby on Rails documentation.
257
262
 
258
263
  When working with documentation, please take into account the "API Documentation Guidelines":api_documentation_guidelines.html and the "Ruby on Rails Guides Guidelines":ruby_on_rails_guides_guidelines.html.
259
264
 
260
265
  NOTE: As explained above, ordinary code patches should have proper documentation coverage. docrails is only used for isolated documentation improvements.
261
266
 
262
- WARNING: docrails has a very strict policy: no code can be touched whatsoever, no matter how trivial or small the change. Only RDoc and guides can be edited via docrails.
267
+ WARNING: docrails has a very strict policy: no code can be touched whatsoever, no matter how trivial or small the change. Only RDoc and guides can be edited via docrails. Also, CHANGELOGs should never be edited in docrails.
263
268
 
264
269
  If you have an idea for a new guide you can refer to the "contribution page":contribute.html for instructions on getting involved.
265
270
 
@@ -270,14 +275,14 @@ h4. Clone the Rails Repository
270
275
  The first thing you need to do to be able to contribute code is to clone the repository:
271
276
 
272
277
  <shell>
273
- git clone git://github.com/rails/rails.git
278
+ $ git clone git://github.com/rails/rails.git
274
279
  </shell>
275
280
 
276
281
  and create a dedicated branch:
277
282
 
278
283
  <shell>
279
- cd rails
280
- git checkout -b my_new_branch
284
+ $ cd rails
285
+ $ git checkout -b my_new_branch
281
286
  </shell>
282
287
 
283
288
  It doesn’t really matter what name you use, because this branch will only exist on your local computer.
@@ -295,10 +300,16 @@ h4. Follow the Coding Conventions
295
300
 
296
301
  Rails follows a simple set of coding style conventions.
297
302
 
298
- * Two spaces, no tabs
299
- * Prefer +&amp;&amp;+/+||+ over +and+/+or+
300
- * +MyClass.my_method(my_arg)+ not +my_method( my_arg )+ or +my_method my_arg+
301
- * Follow the conventions you see used in the source already
303
+ * Two spaces, no tabs.
304
+ * No trailing whitespace. Blank lines should not have any space.
305
+ * Indent after private/protected.
306
+ * Prefer +&amp;&amp;+/+||+ over +and+/+or+.
307
+ * Prefer class << self block over self.method for class methods.
308
+ * +MyClass.my_method(my_arg)+ not +my_method( my_arg )+ or +my_method my_arg+.
309
+ * a = b and not a=b.
310
+ * Follow the conventions you see used in the source already.
311
+
312
+ These are some guidelines and please use your best judgment in using them.
302
313
 
303
314
  h4. Sanity Check
304
315
 
@@ -311,7 +322,7 @@ h4. Commit Your Changes
311
322
  When you're happy with the code on your computer, you need to commit the changes to git:
312
323
 
313
324
  <shell>
314
- git commit -a -m "Here is a commit message"
325
+ $ git commit -a -m "Here is a commit message on what I changed in this commit"
315
326
  </shell>
316
327
 
317
328
  h4. Update master
@@ -319,37 +330,48 @@ h4. Update master
319
330
  It’s pretty likely that other changes to master have happened while you were working. Go get them:
320
331
 
321
332
  <shell>
322
- git checkout master
323
- git pull
333
+ $ git checkout master
334
+ $ git pull
324
335
  </shell>
325
336
 
326
337
  Now reapply your patch on top of the latest changes:
327
338
 
328
339
  <shell>
329
- git checkout my_new_branch
330
- git rebase master
340
+ $ git checkout my_new_branch
341
+ $ git rebase master
331
342
  </shell>
332
343
 
333
344
  No conflicts? Tests still pass? Change still seems reasonable to you? Then move on.
334
345
 
335
- h4. Create a Patch
346
+ h4. Fork
336
347
 
337
- Now you can create a patch file to share with other developers (and with the core team). Still in your branch, run
348
+ Navigate to the Rails "GitHub repository":https://github.com/rails/rails and press "Fork" in the upper right hand corner.
349
+
350
+ Add the new remote to your local repository on your local machine:
351
+
352
+ <shell>
353
+ $ git remote add mine git@github.com:<your user name>/rails.git
354
+ </shell>
355
+
356
+ Push to your remote:
338
357
 
339
358
  <shell>
340
- git commit -a
341
- git format-patch master --stdout > my_new_patch.diff
359
+ $ git push mine my_new_branch
342
360
  </shell>
343
361
 
344
- Sanity check the results of this operation: open the diff file in your text editor of choice and make sure that no unintended changes crept in.
362
+ h4. Issue a Pull Request
363
+
364
+ Navigate to the Rails repository you just pushed to (e.g. https://github.com/your-user-name/rails) and press "Pull Request" in the upper right hand corner.
345
365
 
346
- h4. Create a Lighthouse Ticket
366
+ Write your branch name in branch field (is filled with master by default) and press "Update Commit Range"
347
367
 
348
- Now create a ticket with your patch. Go to the "new ticket":http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/new page at Lighthouse. Fill in a reasonable title and description, remember to attach your patch file, and tag the ticket with the ‘patch’ tag and whatever other subject area tags make sense.
368
+ Ensure the changesets you introduced are included in the "Commits" tab and that the "Files Changed" incorporate all of your changes.
369
+
370
+ Fill in some details about your potential patch including a meaningful title. When finished, press "Send pull request." Rails Core will be notified about your submission.
349
371
 
350
372
  h4. Get Some Feedback
351
373
 
352
- Now you need to get other people to look at your patch, just as you've looked at other people's patches. You can use the rubyonrails-core mailing list or the #rails-contrib channel on IRC freenode for this. You might also try just talking to Rails developers that you know.
374
+ Now you need to get other people to look at your patch, just as you've looked at other people's patches. You can use the "rubyonrails-core mailing list":http://groups.google.com/group/rubyonrails-core/ or the #rails-contrib channel on IRC freenode for this. You might also try just talking to Rails developers that you know.
353
375
 
354
376
  h4. Iterate as Necessary
355
377
 
@@ -363,8 +385,10 @@ All contributions, either via master or docrails, get credit in "Rails Contribut
363
385
 
364
386
  h3. Changelog
365
387
 
388
+ * May 12, 2011: Modified to prefer topic branches instead of master branch for users contributions by "Guillermo Iguaran":http://quillarb.org
389
+ * April 29, 2011: Reflect GitHub Issues and Pull Request workflow by "Dan Pickett":http://www.enlightsolutions.com
390
+ * April 14, 2011: Modified Contributing to the Rails Code section to add '[#ticket_number state:commited]' on patches commit messages by "Sebastian Martinez":http://wyeworks.com
366
391
  * December 28, 2010: Complete revision by "Xavier Noria":credits.html#fxn
367
392
  * April 6, 2010: Fixed document to validate XHTML 1.0 Strict. "Jaime Iniesta":http://jaimeiniesta.com
368
393
  * August 1, 2009: Updates/amplifications by "Mike Gunderloy":credits.html#mgunderloy
369
394
  * March 2, 2009: Initial draft by "Mike Gunderloy":credits.html#mgunderloy
370
-
@@ -155,6 +155,8 @@ module Rails
155
155
 
156
156
  class AppGenerator < Base
157
157
  DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db )
158
+ JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc )
159
+ DATABASES.concat(JDBC_DATABASES)
158
160
 
159
161
  attr_accessor :rails_template
160
162
  add_shebang_option!
@@ -204,6 +206,7 @@ module Rails
204
206
  @original_wd = Dir.pwd
205
207
 
206
208
  super
209
+ convert_database_option_for_jruby
207
210
 
208
211
  if !options[:skip_active_record] && !DATABASES.include?(options[:database])
209
212
  raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}."
@@ -394,20 +397,35 @@ module Rails
394
397
  end
395
398
 
396
399
  def gem_for_database
397
- # %w( mysql oracle postgresql sqlite3 frontbase ibm_db )
400
+ # %w( mysql oracle postgresql sqlite3 frontbase ibm_db jdbcmysql jdbcsqlite3 jdbcpostgresql)
398
401
  case options[:database]
399
402
  when "oracle" then "ruby-oci8"
400
403
  when "postgresql" then "pg"
401
404
  when "sqlite3" then "sqlite3"
402
405
  when "frontbase" then "ruby-frontbase"
403
406
  when "mysql" then "mysql2"
407
+ when "jdbcmysql" then "activerecord-jdbcmysql-adapter"
408
+ when "jdbcsqlite3" then "activerecord-jdbcsqlite3-adapter"
409
+ when "jdbcpostgresql" then "activerecord-jdbcpostgresql-adapter"
410
+ when "jdbc" then "activerecord-jdbc-adapter"
404
411
  else options[:database]
405
412
  end
406
413
  end
407
414
 
415
+ def convert_database_option_for_jruby
416
+ if defined?(JRUBY_VERSION)
417
+ case options[:database]
418
+ when "oracle" then options[:database].replace "jdbc"
419
+ when "postgresql" then options[:database].replace "jdbcpostgresql"
420
+ when "mysql" then options[:database].replace "jdbcmysql"
421
+ when "sqlite3" then options[:database].replace "jdbcsqlite3"
422
+ end
423
+ end
424
+ end
425
+
408
426
  def version_constraint_for_database_gem
409
427
  case options[:database]
410
- when "mysql" then "~> 0.2.6"
428
+ when "mysql" then "~> 0.2.11"
411
429
  else nil
412
430
  end
413
431
  end
@@ -7,6 +7,7 @@ gem 'rails', :git => 'git://github.com/rails/rails.git'
7
7
  <%- else -%>
8
8
  gem 'rails', '<%= Rails::VERSION::STRING %>'
9
9
 
10
+ <%= "gem 'jruby-openssl'\n" if defined?(JRUBY_VERSION) -%>
10
11
  # Bundle edge Rails instead:
11
12
  # gem 'rails', :git => 'git://github.com/rails/rails.git'
12
13
  <%- end -%>
@@ -0,0 +1,62 @@
1
+ # If you are using mssql, derby, hsqldb, or h2 with one of the
2
+ # ActiveRecord JDBC adapters, install the appropriate driver, e.g.,:
3
+ # gem install activerecord-jdbcmssql-adapter
4
+ #
5
+ # Configure using Gemfile:
6
+ # gem 'activerecord-jdbcmssql-adapter'
7
+ #
8
+ #development:
9
+ # adapter: mssql
10
+ # username: <%= app_name %>
11
+ # password:
12
+ # host: localhost
13
+ # database: <%= app_name %>_development
14
+ #
15
+ # Warning: The database defined as "test" will be erased and
16
+ # re-generated from your development database when you run "rake".
17
+ # Do not set this db to the same as development or production.
18
+ #
19
+ #test:
20
+ # adapter: mssql
21
+ # username: <%= app_name %>
22
+ # password:
23
+ # host: localhost
24
+ # database: <%= app_name %>_test
25
+ #
26
+ #production:
27
+ # adapter: mssql
28
+ # username: <%= app_name %>
29
+ # password:
30
+ # host: localhost
31
+ # database: <%= app_name %>_production
32
+
33
+ # If you are using oracle, db2, sybase, informix or prefer to use the plain
34
+ # JDBC adapter, configure your database setting as the example below (requires
35
+ # you to download and manually install the database vendor's JDBC driver .jar
36
+ # file). See your driver documentation for the apropriate driver class and
37
+ # connection string:
38
+
39
+ development:
40
+ adapter: jdbc
41
+ username: <%= app_name %>
42
+ password:
43
+ driver:
44
+ url: jdbc:db://localhost/<%= app_name %>_development
45
+
46
+ # Warning: The database defined as "test" will be erased and
47
+ # re-generated from your development database when you run "rake".
48
+ # Do not set this db to the same as development or production.
49
+
50
+ test:
51
+ adapter: jdbc
52
+ username: <%= app_name %>
53
+ password:
54
+ driver:
55
+ url: jdbc:db://localhost/<%= app_name %>_test
56
+
57
+ production:
58
+ adapter: jdbc
59
+ username: <%= app_name %>
60
+ password:
61
+ driver:
62
+ url: jdbc:db://localhost/<%= app_name %>_production
@@ -0,0 +1,30 @@
1
+ # MySQL. Versions 4.1 and 5.0 are recommended.
2
+ #
3
+ # Install the MySQL driver:
4
+ # gem install activerecord-jdbcmysql-adapter
5
+ #
6
+ # And be sure to use new-style password hashing:
7
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
8
+ development:
9
+ adapter: mysql
10
+ database: <%= app_name %>_development
11
+ username: root
12
+ password:
13
+ host: localhost
14
+
15
+ # Warning: The database defined as "test" will be erased and
16
+ # re-generated from your development database when you run "rake".
17
+ # Do not set this db to the same as development or production.
18
+ test:
19
+ adapter: mysql
20
+ database: <%= app_name %>_test
21
+ username: root
22
+ password:
23
+ host: localhost
24
+
25
+ production:
26
+ adapter: mysql
27
+ database: <%= app_name %>_production
28
+ username: root
29
+ password:
30
+ host: localhost
@@ -0,0 +1,43 @@
1
+ # PostgreSQL. Versions 7.4 and 8.x are supported.
2
+ #
3
+ # Configure Using Gemfile
4
+ # gem 'activerecord-jdbcpostgresql-adapter'development:
5
+
6
+ development:
7
+ adapter: postgresql
8
+ encoding: unicode
9
+ database: <%= app_name %>_development
10
+ username: <%= app_name %>
11
+ password:
12
+
13
+ # Connect on a TCP socket. Omitted by default since the client uses a
14
+ # domain socket that doesn't need configuration. Windows does not have
15
+ # domain sockets, so uncomment these lines.
16
+ #host: localhost
17
+ #port: 5432
18
+
19
+ # Schema search path. The server defaults to $user,public
20
+ #schema_search_path: myapp,sharedapp,public
21
+
22
+ # Minimum log levels, in increasing order:
23
+ # debug5, debug4, debug3, debug2, debug1,
24
+ # log, notice, warning, error, fatal, and panic
25
+ # The server defaults to notice.
26
+ #min_messages: warning
27
+
28
+ # Warning: The database defined as "test" will be erased and
29
+ # re-generated from your development database when you run "rake".
30
+ # Do not set this db to the same as development or production.
31
+ test:
32
+ adapter: postgresql
33
+ encoding: unicode
34
+ database: <%= app_name %>_test
35
+ username: <%= app_name %>
36
+ password:
37
+
38
+ production:
39
+ adapter: postgresql
40
+ encoding: unicode
41
+ database: <%= app_name %>_production
42
+ username: <%= app_name %>
43
+ password:
@@ -0,0 +1,17 @@
1
+ # SQLite version 3.x
2
+ # gem 'activerecord-jdbcsqlite3-adapter'
3
+
4
+ development:
5
+ adapter: sqlite3
6
+ database: db/development.sqlite3
7
+
8
+ # Warning: The database defined as "test" will be erased and
9
+ # re-generated from your development database when you run "rake".
10
+ # Do not set this db to the same as development or production.
11
+ test:
12
+ adapter: sqlite3
13
+ database: db/test.sqlite3
14
+
15
+ production:
16
+ adapter: sqlite3
17
+ database: db/production.sqlite3
@@ -19,14 +19,14 @@ namespace :rails do
19
19
  desc "Update both configs and public/javascripts from Rails (or use just update:javascripts or update:configs)"
20
20
  task :update => [ "update:configs", "update:javascripts", "update:scripts", "update:application_controller" ]
21
21
 
22
- desc "Applies the template supplied by LOCATION=/path/to/template"
22
+ desc "Applies the template supplied by LOCATION=(/path/to/template) or URL"
23
23
  task :template do
24
24
  template = ENV["LOCATION"]
25
+ raise "No LOCATION value given. Please set LOCATION either as path to a file or a URL" if template.blank?
25
26
  template = File.expand_path(template) if template !~ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://}
26
-
27
27
  require 'rails/generators'
28
28
  require 'rails/generators/rails/app/app_generator'
29
- generator = Rails::Generators::AppGenerator.new [ Rails.root ], {}, :destination_root => Rails.root
29
+ generator = Rails::Generators::AppGenerator.new [Rails.root], {}, :destination_root => Rails.root
30
30
  generator.apply template, :verbose => false
31
31
  end
32
32
 
@@ -14,7 +14,7 @@ task :secret do
14
14
  end
15
15
 
16
16
  desc 'List versions of all Rails frameworks and the environment'
17
- task :about do
17
+ task :about => :environment do
18
18
  puts Rails::Info
19
19
  end
20
20
 
@@ -103,9 +103,9 @@ namespace :test do
103
103
  Rake::TestTask.new(:uncommitted => "test:prepare") do |t|
104
104
  def t.file_list
105
105
  if File.directory?(".svn")
106
- changed_since_checkin = silence_stderr { `svn status` }.map { |path| path.chomp[7 .. -1] }
106
+ changed_since_checkin = silence_stderr { `svn status` }.split.map { |path| path.chomp[7 .. -1] }
107
107
  elsif File.directory?(".git")
108
- changed_since_checkin = silence_stderr { `git ls-files --modified --others` }.map { |path| path.chomp }
108
+ changed_since_checkin = silence_stderr { `git ls-files --modified --others` }.split.map { |path| path.chomp }
109
109
  else
110
110
  abort "Not a Subversion or Git checkout."
111
111
  end
@@ -2,8 +2,8 @@ module Rails
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 9
6
- PRE = nil
5
+ TINY = 10
6
+ PRE = "rc1"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railties
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease:
4
+ prerelease: true
6
5
  segments:
7
6
  - 3
8
7
  - 0
9
- - 9
10
- version: 3.0.9
8
+ - 10
9
+ - rc1
10
+ version: 3.0.10.rc1
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Heinemeier Hansson
@@ -15,17 +15,16 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-16 00:00:00 Z
18
+ date: 2011-08-04 00:00:00 -07:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rake
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- hash: 49
29
28
  segments:
30
29
  - 0
31
30
  - 8
@@ -37,11 +36,9 @@ dependencies:
37
36
  name: thor
38
37
  prerelease: false
39
38
  requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
39
  requirements:
42
40
  - - ~>
43
41
  - !ruby/object:Gem::Version
44
- hash: 47
45
42
  segments:
46
43
  - 0
47
44
  - 14
@@ -53,11 +50,9 @@ dependencies:
53
50
  name: rdoc
54
51
  prerelease: false
55
52
  requirement: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
53
  requirements:
58
54
  - - ~>
59
55
  - !ruby/object:Gem::Version
60
- hash: 15
61
56
  segments:
62
57
  - 3
63
58
  - 4
@@ -68,32 +63,30 @@ dependencies:
68
63
  name: activesupport
69
64
  prerelease: false
70
65
  requirement: &id004 !ruby/object:Gem::Requirement
71
- none: false
72
66
  requirements:
73
67
  - - "="
74
68
  - !ruby/object:Gem::Version
75
- hash: 21
76
69
  segments:
77
70
  - 3
78
71
  - 0
79
- - 9
80
- version: 3.0.9
72
+ - 10
73
+ - rc1
74
+ version: 3.0.10.rc1
81
75
  type: :runtime
82
76
  version_requirements: *id004
83
77
  - !ruby/object:Gem::Dependency
84
78
  name: actionpack
85
79
  prerelease: false
86
80
  requirement: &id005 !ruby/object:Gem::Requirement
87
- none: false
88
81
  requirements:
89
82
  - - "="
90
83
  - !ruby/object:Gem::Version
91
- hash: 21
92
84
  segments:
93
85
  - 3
94
86
  - 0
95
- - 9
96
- version: 3.0.9
87
+ - 10
88
+ - rc1
89
+ version: 3.0.10.rc1
97
90
  type: :runtime
98
91
  version_requirements: *id005
99
92
  description: "Rails internals: application bootup, plugins, generators, and rake tasks."
@@ -324,6 +317,10 @@ files:
324
317
  - lib/rails/generators/rails/app/templates/config/boot.rb
325
318
  - lib/rails/generators/rails/app/templates/config/databases/frontbase.yml
326
319
  - lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml
320
+ - lib/rails/generators/rails/app/templates/config/databases/jdbc.yml
321
+ - lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml
322
+ - lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml
323
+ - lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml
327
324
  - lib/rails/generators/rails/app/templates/config/databases/mysql.yml
328
325
  - lib/rails/generators/rails/app/templates/config/databases/oracle.yml
329
326
  - lib/rails/generators/rails/app/templates/config/databases/postgresql.yml
@@ -471,6 +468,7 @@ files:
471
468
  - lib/rails/generators/rails/app/templates/test/integration/.empty_directory
472
469
  - lib/rails/generators/rails/app/templates/test/unit/.empty_directory
473
470
  - lib/rails/generators/rails/generator/templates/templates/.empty_directory
471
+ has_rdoc: true
474
472
  homepage: http://www.rubyonrails.org
475
473
  licenses: []
476
474
 
@@ -481,29 +479,27 @@ rdoc_options:
481
479
  require_paths:
482
480
  - lib
483
481
  required_ruby_version: !ruby/object:Gem::Requirement
484
- none: false
485
482
  requirements:
486
483
  - - ">="
487
484
  - !ruby/object:Gem::Version
488
- hash: 57
489
485
  segments:
490
486
  - 1
491
487
  - 8
492
488
  - 7
493
489
  version: 1.8.7
494
490
  required_rubygems_version: !ruby/object:Gem::Requirement
495
- none: false
496
491
  requirements:
497
- - - ">="
492
+ - - ">"
498
493
  - !ruby/object:Gem::Version
499
- hash: 3
500
494
  segments:
501
- - 0
502
- version: "0"
495
+ - 1
496
+ - 3
497
+ - 1
498
+ version: 1.3.1
503
499
  requirements: []
504
500
 
505
501
  rubyforge_project: rails
506
- rubygems_version: 1.8.2
502
+ rubygems_version: 1.3.6
507
503
  signing_key:
508
504
  specification_version: 3
509
505
  summary: Tools for creating, working with, and running Rails applications.