rails 0.8.5 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails might be problematic. Click here for more details.

Files changed (66) hide show
  1. data/CHANGELOG +86 -0
  2. data/README +48 -8
  3. data/Rakefile +87 -108
  4. data/bin/breakpointer +3 -0
  5. data/bin/breakpointer_for_gem +4 -0
  6. data/bin/console +30 -0
  7. data/bin/generate +41 -0
  8. data/bin/rails +1 -1
  9. data/{dispatches/dispatch.servlet → bin/server} +15 -11
  10. data/configs/apache.conf +12 -27
  11. data/configs/database.yml +9 -2
  12. data/dispatches/dispatch.fcgi +2 -2
  13. data/dispatches/dispatch.rb +2 -2
  14. data/doc/index.html +12 -36
  15. data/environments/development.rb +5 -0
  16. data/environments/production.rb +3 -6
  17. data/environments/shared.rb +46 -20
  18. data/environments/shared_for_gem.rb +41 -8
  19. data/environments/test.rb +3 -6
  20. data/fresh_rakefile +25 -21
  21. data/generators/controller/USAGE +28 -0
  22. data/generators/controller/controller_generator.rb +22 -0
  23. data/generators/controller/templates/controller.rb +10 -0
  24. data/generators/{templates/controller_test.erb → controller/templates/functional_test.rb} +1 -1
  25. data/generators/{templates/helper.erb → controller/templates/helper.rb} +0 -0
  26. data/generators/controller/templates/view.rhtml +2 -0
  27. data/generators/mailer/USAGE +27 -0
  28. data/generators/mailer/mailer_generator.rb +22 -0
  29. data/generators/{templates/mailer_action.rhtml → mailer/templates/fixture.rhtml} +0 -0
  30. data/generators/{templates/mailer.erb → mailer/templates/mailer.rb} +4 -4
  31. data/generators/{templates/mailer_test.erb → mailer/templates/unit_test.rb} +2 -10
  32. data/generators/mailer/templates/view.rhtml +3 -0
  33. data/generators/model/USAGE +17 -0
  34. data/generators/model/model_generator.rb +10 -0
  35. data/generators/model/templates/fixtures.yml +1 -0
  36. data/generators/{templates/model.erb → model/templates/model.rb} +0 -2
  37. data/generators/{templates/model_test.erb → model/templates/unit_test.rb} +2 -3
  38. data/generators/scaffold/USAGE +25 -0
  39. data/generators/scaffold/scaffold_generator.rb +53 -0
  40. data/generators/scaffold/templates/controller.rb +57 -0
  41. data/generators/scaffold/templates/fixtures.yml +7 -0
  42. data/generators/scaffold/templates/functional_test.rb +79 -0
  43. data/generators/scaffold/templates/layout.rhtml +11 -0
  44. data/generators/scaffold/templates/style.css +53 -0
  45. data/generators/scaffold/templates/view_edit.rhtml +7 -0
  46. data/generators/scaffold/templates/view_list.rhtml +24 -0
  47. data/generators/scaffold/templates/view_new.rhtml +6 -0
  48. data/generators/scaffold/templates/view_show.rhtml +8 -0
  49. data/helpers/{abstract_application.rb → application.rb} +1 -4
  50. data/helpers/test_helper.rb +4 -5
  51. data/lib/binding_of_caller.rb +81 -0
  52. data/lib/breakpoint.rb +526 -0
  53. data/lib/breakpoint_client.rb +167 -0
  54. data/lib/dispatcher.rb +43 -12
  55. data/lib/rails_generator.rb +175 -0
  56. data/lib/webrick_server.rb +48 -52
  57. metadata +49 -21
  58. data/gem_snapshot +0 -14
  59. data/generators/new_controller.rb +0 -43
  60. data/generators/new_crud.rb +0 -34
  61. data/generators/new_mailer.rb +0 -43
  62. data/generators/new_model.rb +0 -31
  63. data/generators/templates/controller.erb +0 -24
  64. data/generators/templates/controller_view.rhtml +0 -10
  65. data/generators/templates/mailer_fixture.rhtml +0 -4
  66. data/lib/generator.rb +0 -112
data/CHANGELOG CHANGED
@@ -1,3 +1,89 @@
1
+ *CVS*
2
+
3
+ * Renamed public/dispatch.servlet to script/server -- it wasn't really dispatching anyway as its delegating calls to public/dispatch.rb
4
+
5
+ * Renamed AbstractApplicationController and abstract_application.rb to ApplicationController and application.rb, so that it will be possible
6
+ for the framework to automatically pick up on app/views/layouts/application.rhtml and app/helpers/application.rb
7
+
8
+ * Added script/console that makes it even easier to start an IRB session for interacting with the domain model. Run with no-args to
9
+ see help.
10
+
11
+ * Added breakpoint support through the script/breakpointer client. This means that you can break out of execution at any point in
12
+ the code, investigate and change the model, AND then resume execution! Example:
13
+
14
+ class WeblogController < ActionController::Base
15
+ def index
16
+ @posts = Post.find_all
17
+ breakpoint "Breaking out from the list"
18
+ end
19
+ end
20
+
21
+ So the controller will accept the action, run the first line, then present you with a IRB prompt in the breakpointer window.
22
+ Here you can do things like:
23
+
24
+ Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
25
+
26
+ >> @posts.inspect
27
+ => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
28
+ #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
29
+ >> @posts.first.title = "hello from a breakpoint"
30
+ => "hello from a breakpoint"
31
+
32
+ ...and even better is that you can examine how your runtime objects actually work:
33
+
34
+ >> f = @posts.first
35
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
36
+ >> f.
37
+ Display all 152 possibilities? (y or n)
38
+
39
+ Finally, when you're ready to resume execution, you press CTRL-D
40
+
41
+ * Changed environments to be configurable through an environment variable. By default, the environment is "development", but you
42
+ can change that and set your own by configuring the Apache vhost with a string like (mod_env must be available on the server):
43
+
44
+ SetEnv RAILS_ENV production
45
+
46
+ ...if you're using WEBrick, you can pick the environment to use with the command-line parameters -e/--environment, like this:
47
+
48
+ ruby public/dispatcher.servlet -e production
49
+
50
+ * Added a new default environment called "development", which leaves the production environment to be tuned exclusively for that.
51
+
52
+ * Added a start_server in the root of the Rails application to make it even easier to get started
53
+
54
+ * Fixed public/.htaccess to use RewriteBase and share the same rewrite rules for all the dispatch methods
55
+
56
+ * Fixed webrick_server to handle requests in a serialized manner (the Rails reloading infrastructure is not thread-safe)
57
+
58
+ * Added support for controllers in directories. So you can have:
59
+
60
+ app/controllers/account_controller.rb # URL: /account/
61
+ app/controllers/admin/account_controller.rb # URL: /admin/account/
62
+
63
+ NOTE: You need to update your public/.htaccess with the new rules to pick it up
64
+
65
+ * Added reloading for associations and dependencies under cached environments like FastCGI and mod_ruby. This makes it possible to use
66
+ those environments for development. This is turned on by default, but can be turned off with
67
+ ActiveRecord::Base.reload_associations = false and ActionController::Base.reload_dependencies = false in production environments.
68
+
69
+ * Added support for sub-directories in app/models. So now you can have something like Basecamp with:
70
+
71
+ app/models/accounting
72
+ app/models/project
73
+ app/models/participants
74
+ app/models/settings
75
+
76
+ It's poor man's namespacing, but only for file-system organization. You still require files just like before.
77
+ Nothing changes inside the files themselves.
78
+
79
+
80
+ * Fixed a few references in the tests generated by new_mailer [bitsweat]
81
+
82
+ * Added support for mocks in testing with test/mocks
83
+
84
+ * Cleaned up the environments a bit and added global constant RAILS_ROOT
85
+
86
+
1
87
  *0.8.5* (9)
2
88
 
3
89
  * Made dev-util available to all tests, so you can insert breakpoints in any test case to get an IRB prompt at that point [bitsweat]:
data/README CHANGED
@@ -34,23 +34,21 @@ link:files/vendor/actionpack/README.html.
34
34
 
35
35
  * Apache 1.3.x or 2.x (or any FastCGI-capable webserver with a
36
36
  mod_rewrite-like module)
37
- * FastCGI (or mod_ruby) for production performance (CGI is used for
38
- development)
37
+ * FastCGI (or mod_ruby) for better performance on Apache
39
38
 
40
39
  == Getting started
41
40
 
42
- 1a. Setup Apache for the Rails application (see "Example for Apache conf")
43
- 1b. Run the WEBrick servlet: <tt>ruby public/dispatch.servlet --help</tt>
44
- 2. Go to http://rails/ (or whatever is your ServerName) and check
45
- that you get the "Congratulations, you're on Rails!" screen
46
- 3. Follow the guidelines on the "Congratulations, you're on Rails!" screen
41
+ 1. Run the WEBrick servlet: <tt>ruby script/server</tt>
42
+ (run with --help for options)
43
+ 2. Go to http://localhost:3000/ and get "Congratulations, you've put Ruby on Rails!"
44
+ 3. Follow the guidelines on the "Congratulations, you've put Ruby on Rails!" screen
47
45
 
48
46
 
49
47
  == Example for Apache conf
50
48
 
51
49
  <VirtualHost *:80>
52
50
  ServerName rails
53
- DocumentRoot /path/tapplication/public/
51
+ DocumentRoot /path/application/public/
54
52
  ErrorLog /path/application/log/apache.log
55
53
 
56
54
  <Directory /path/application/public/>
@@ -75,6 +73,48 @@ information to these files. Debugging info will also be shown in the browser
75
73
  on requests from 127.0.0.1.
76
74
 
77
75
 
76
+ == Breakpoints
77
+
78
+ Breakpoint support is available through the script/breakpointer client. This
79
+ means that you can break out of execution at any point in the code, investigate
80
+ and change the model, AND then resume execution! Example:
81
+
82
+ class WeblogController < ActionController::Base
83
+ def index
84
+ @posts = Post.find_all
85
+ breakpoint "Breaking out from the list"
86
+ end
87
+ end
88
+
89
+ So the controller will accept the action, run the first line, then present you
90
+ with a IRB prompt in the breakpointer window. Here you can do things like:
91
+
92
+ Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
93
+
94
+ >> @posts.inspect
95
+ => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
96
+ #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
97
+ >> @posts.first.title = "hello from a breakpoint"
98
+ => "hello from a breakpoint"
99
+
100
+ ...and even better is that you can examine how your runtime objects actually work:
101
+
102
+ >> f = @posts.first
103
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
104
+ >> f.
105
+ Display all 152 possibilities? (y or n)
106
+
107
+ Finally, when you're ready to resume execution, you press CTRL-D
108
+
109
+
110
+ == Console
111
+
112
+ You can interact with the domain model by starting the console through script/console.
113
+ Here you'll have all parts of the application configured, just like it is when the
114
+ application is running. You can inspect domain models, change values, and save to the
115
+ database. Start the script without arguments to see the options.
116
+
117
+
78
118
  == Description of contents
79
119
 
80
120
  app
data/Rakefile CHANGED
@@ -9,21 +9,35 @@ require 'date'
9
9
 
10
10
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
11
11
  PKG_NAME = 'rails'
12
- PKG_VERSION = '0.8.5' + PKG_BUILD
12
+ PKG_VERSION = '0.9.0' + PKG_BUILD
13
13
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
14
14
  PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
15
15
 
16
+
17
+ BASE_DIRS = %w( app config/environments db doc log lib public script test vendor )
18
+ APP_DIRS = %w( models controllers helpers views views/layouts )
19
+ PUBLIC_DIRS = %w( images javascripts stylesheets _doc )
20
+ TEST_DIRS = %w( fixtures unit functional mocks mocks/development mocks/testing )
21
+
22
+ LOG_FILES = %w( apache.log development.log test.log production.log )
23
+ HTML_FILES = %w( 404.html 500.html index.html )
24
+ BIN_FILES = %w( generate breakpointer console server )
25
+ GENERATORS = %w( controller mailer model scaffold )
26
+
27
+ VENDOR_LIBS = %w( actionpack activerecord actionmailer railties )
28
+
29
+
16
30
  desc "Default Task"
17
31
  task :default => [ :fresh_rails ]
18
32
 
19
33
  desc "Generates a fresh Rails package with documentation"
20
- task :fresh_rails => [ :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content, :generate_documentation ]
34
+ task :fresh_rails => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content, :generate_documentation ]
21
35
 
22
36
  desc "Generates a fresh Rails package using GEMs with documentation"
23
- task :fresh_gem_rails => [ :make_dir_structure, :initialize_file_stubs, :copy_ties_content, :copy_gem_environment ]
37
+ task :fresh_gem_rails => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_ties_content, :copy_gem_environment ]
24
38
 
25
39
  desc "Generates a fresh Rails package without documentation (faster)"
26
- task :fresh_rails_without_docs => [ :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content ]
40
+ task :fresh_rails_without_docs => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content ]
27
41
 
28
42
  desc "Packages the fresh Rails package with documentation"
29
43
  task :package => [ :clean, :fresh_rails ] do
@@ -32,90 +46,47 @@ task :package => [ :clean, :fresh_rails ] do
32
46
  end
33
47
 
34
48
  task :clean do
35
- File.rm_rf "#{PKG_DESTINATION}"
49
+ rm_rf PKG_DESTINATION
36
50
  end
37
51
 
38
52
 
39
53
  # Make directory structure ----------------------------------------------------------------
40
54
 
41
- desc "Make the directory structure for the new Rails application"
42
- task :make_dir_structure => [ :make_base_dirs, :make_app_dirs, :make_public_dirs, :make_test_dirs ] do
43
- end
44
-
45
- task :make_base_dirs do
46
- File.rm_rf PKG_DESTINATION
47
- File.mkdir "#{PKG_DESTINATION}"
48
- File.mkdir "#{PKG_DESTINATION}/app"
49
- File.mkdir "#{PKG_DESTINATION}/config"
50
- File.mkdir "#{PKG_DESTINATION}/config/environments"
51
- File.mkdir "#{PKG_DESTINATION}/db"
52
- File.mkdir "#{PKG_DESTINATION}/doc"
53
- File.mkdir "#{PKG_DESTINATION}/log"
54
- File.mkdir "#{PKG_DESTINATION}/lib"
55
- File.mkdir "#{PKG_DESTINATION}/public"
56
- File.mkdir "#{PKG_DESTINATION}/script"
57
- File.mkdir "#{PKG_DESTINATION}/test"
58
- File.mkdir "#{PKG_DESTINATION}/vendor"
55
+ def make_dest_dirs(dirs, path = nil)
56
+ mkdir_p dirs.map { |dir| File.join(PKG_DESTINATION, path, dir) }
59
57
  end
60
58
 
61
- task :make_app_dirs do
62
- File.mkdir "#{PKG_DESTINATION}/app/models"
63
- File.mkdir "#{PKG_DESTINATION}/app/controllers"
64
- File.mkdir "#{PKG_DESTINATION}/app/helpers"
65
- File.mkdir "#{PKG_DESTINATION}/app/views"
66
- File.mkdir "#{PKG_DESTINATION}/app/views/layouts"
67
- end
68
-
69
- task :make_public_dirs do
70
- File.mkdir "#{PKG_DESTINATION}/public/images"
71
- File.mkdir "#{PKG_DESTINATION}/public/javascripts"
72
- File.mkdir "#{PKG_DESTINATION}/public/stylesheets"
73
- File.mkdir "#{PKG_DESTINATION}/public/_doc"
74
- end
59
+ desc "Make the directory structure for the new Rails application"
60
+ task :make_dir_structure => [ :make_base_dirs, :make_app_dirs, :make_public_dirs, :make_test_dirs ]
75
61
 
76
- task :make_test_dirs do
77
- File.mkdir "#{PKG_DESTINATION}/test/fixtures"
78
- File.mkdir "#{PKG_DESTINATION}/test/unit"
79
- File.mkdir "#{PKG_DESTINATION}/test/functional"
80
- end
62
+ task(:make_base_dirs) { make_dest_dirs BASE_DIRS }
63
+ task(:make_app_dirs) { make_dest_dirs APP_DIRS, 'app' }
64
+ task(:make_public_dirs) { make_dest_dirs PUBLIC_DIRS, 'public' }
65
+ task(:make_test_dirs) { make_dest_dirs TEST_DIRS, 'test' }
81
66
 
82
67
 
83
68
  # Initialize file stubs -------------------------------------------------------------------
84
69
 
85
70
  desc "Initialize empty file stubs (such as for logging)"
86
- task :initialize_file_stubs => [ :initialize_log_files ] do
87
- end
71
+ task :initialize_file_stubs => [ :initialize_log_files ]
88
72
 
89
73
  task :initialize_log_files do
90
- chmod 0777, "#{PKG_DESTINATION}/log"
91
-
92
- File.touch "#{PKG_DESTINATION}/log/apache.log"
93
- File.touch "#{PKG_DESTINATION}/log/production.log"
94
-
95
- chmod 0777, "#{PKG_DESTINATION}/log/apache.log"
96
- chmod 0777, "#{PKG_DESTINATION}/log/production.log"
74
+ log_dir = File.join(PKG_DESTINATION, 'log')
75
+ chmod 0777, log_dir
76
+ LOG_FILES.each do |log_file|
77
+ log_path = File.join(log_dir, log_file)
78
+ touch log_path
79
+ chmod 0777, log_path
80
+ end
97
81
  end
98
82
 
99
83
 
100
84
  # Copy Vendors ----------------------------------------------------------------------------
101
85
 
102
86
  desc "Copy in all the Rails packages to vendor"
103
- task :copy_vendor_libraries => [ :copy_action_pack, :copy_active_record, :copy_ties, :copy_action_mailer ]
104
-
105
- task :copy_action_pack do
106
- File.cp_r "../actionpack", "#{PKG_DESTINATION}/vendor/actionpack"
107
- end
108
-
109
- task :copy_active_record do
110
- File.cp_r "../activerecord", "#{PKG_DESTINATION}/vendor/activerecord"
111
- end
112
-
113
- task :copy_action_mailer do
114
- File.cp_r "../actionmailer", "#{PKG_DESTINATION}/vendor/actionmailer"
115
- end
116
-
117
- task :copy_ties do
118
- File.cp_r "../railties", "#{PKG_DESTINATION}/vendor/railties"
87
+ task :copy_vendor_libraries do
88
+ cp_r VENDOR_LIBS.map { |dir| File.join('..', dir) },
89
+ File.join(PKG_DESTINATION, 'vendor')
119
90
  end
120
91
 
121
92
 
@@ -124,85 +95,89 @@ end
124
95
  # :link_apache_config
125
96
  desc "Make copies of all the default content of ties"
126
97
  task :copy_ties_content => [
127
- :copy_rootfiles, :copy_dispatches, :copy_html_files, :copy_abstract_application,
128
- :copy_configs, :copy_generators, :copy_test_helpers, :copy_docs_in_public,
129
- :copy_app_doc_readme ] do
130
- end
98
+ :copy_rootfiles, :copy_dispatches, :copy_html_files, :copy_application,
99
+ :copy_configs, :copy_binfiles, :copy_test_helpers, :copy_docs_in_public,
100
+ :copy_app_doc_readme ]
131
101
 
132
102
  task :copy_dispatches do
133
- File.cp "dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.rb"
103
+ cp "dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.rb"
134
104
  chmod 0755, "#{PKG_DESTINATION}/public/dispatch.rb"
135
105
 
136
- File.cp "dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.cgi"
106
+ cp "dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.cgi"
137
107
  chmod 0755, "#{PKG_DESTINATION}/public/dispatch.cgi"
138
108
 
139
- File.cp "dispatches/dispatch.fcgi", "#{PKG_DESTINATION}/public/dispatch.fcgi"
109
+ cp "dispatches/dispatch.fcgi", "#{PKG_DESTINATION}/public/dispatch.fcgi"
140
110
  chmod 0755, "#{PKG_DESTINATION}/public/dispatch.fcgi"
141
111
 
142
- File.cp "dispatches/dispatch.servlet", "#{PKG_DESTINATION}/public/dispatch.servlet"
112
+ cp "bin/console", "#{PKG_DESTINATION}/script/console"
113
+ chmod 0755, "#{PKG_DESTINATION}/script/console"
143
114
  end
144
115
 
145
116
  task :copy_html_files do
146
- File.cp "html/404.html", "#{PKG_DESTINATION}/public/404.html"
147
- File.cp "html/500.html", "#{PKG_DESTINATION}/public/500.html"
148
- File.cp "html/index.html", "#{PKG_DESTINATION}/public/index.html"
117
+ cp HTML_FILES.map { |dir| File.join('html', dir) },
118
+ File.join(PKG_DESTINATION, 'public')
149
119
  end
150
120
 
151
- task :copy_abstract_application do
152
- File.cp "helpers/abstract_application.rb", "#{PKG_DESTINATION}/app/controllers/abstract_application.rb"
153
- File.cp "helpers/application_helper.rb", "#{PKG_DESTINATION}/app/helpers/application_helper.rb"
121
+ task :copy_application do
122
+ cp "helpers/application.rb", "#{PKG_DESTINATION}/app/controllers/application.rb"
123
+ cp "helpers/application_helper.rb", "#{PKG_DESTINATION}/app/helpers/application_helper.rb"
154
124
  end
155
125
 
156
126
  task :copy_configs do
157
- File.cp "configs/database.yml", "#{PKG_DESTINATION}/config/database.yml"
127
+ cp "configs/database.yml", "#{PKG_DESTINATION}/config/database.yml"
158
128
 
159
- File.cp "configs/apache.conf", "#{PKG_DESTINATION}/public/.htaccess"
129
+ cp "configs/apache.conf", "#{PKG_DESTINATION}/public/.htaccess"
160
130
 
161
- File.cp "environments/shared.rb", "#{PKG_DESTINATION}/config/environments/shared.rb"
162
- File.cp "environments/production.rb", "#{PKG_DESTINATION}/config/environments/production.rb"
163
- File.cp "environments/test.rb", "#{PKG_DESTINATION}/config/environments/test.rb"
131
+ cp "environments/shared.rb", "#{PKG_DESTINATION}/config/environment.rb"
132
+ cp "environments/production.rb", "#{PKG_DESTINATION}/config/environments/production.rb"
133
+ cp "environments/development.rb", "#{PKG_DESTINATION}/config/environments/development.rb"
134
+ cp "environments/test.rb", "#{PKG_DESTINATION}/config/environments/test.rb"
164
135
  end
165
136
 
166
137
  task :copy_generators do
167
- File.cp "generators/new_controller.rb", "#{PKG_DESTINATION}/script/new_controller"
168
- File.cp "generators/new_model.rb", "#{PKG_DESTINATION}/script/new_model"
169
- File.cp "generators/new_mailer.rb", "#{PKG_DESTINATION}/script/new_mailer"
170
- File.cp "generators/new_crud.rb", "#{PKG_DESTINATION}/script/new_crud"
171
- chmod 0755, "#{PKG_DESTINATION}/script/new_controller"
172
- chmod 0755, "#{PKG_DESTINATION}/script/new_model"
173
- chmod 0755, "#{PKG_DESTINATION}/script/new_mailer"
174
- chmod 0755, "#{PKG_DESTINATION}/script/new_crud"
138
+ mkdir_p File.join(PKG_DESTINATION, 'script/generators')
139
+
140
+ GENERATORS.each do |dir|
141
+ cp_r File.join('generators', dir), File.join(PKG_DESTINATION, 'script', 'generators', dir)
142
+ end
143
+ end
144
+
145
+ task :copy_binfiles do
146
+ BIN_FILES.each do |file|
147
+ dest_file = File.join(PKG_DESTINATION, 'script', file)
148
+ cp File.join('bin', file), dest_file
149
+ chmod 0755, dest_file
150
+ end
175
151
  end
176
152
 
177
153
  task :copy_rootfiles do
178
- File.cp "fresh_rakefile", "#{PKG_DESTINATION}/Rakefile"
179
- File.cp "README", "#{PKG_DESTINATION}/README"
154
+ cp "fresh_rakefile", "#{PKG_DESTINATION}/Rakefile"
155
+ cp "README", "#{PKG_DESTINATION}/README"
180
156
  end
181
157
 
182
158
  task :copy_test_helpers do
183
- File.cp "helpers/test_helper.rb", "#{PKG_DESTINATION}/test/test_helper.rb"
159
+ cp "helpers/test_helper.rb", "#{PKG_DESTINATION}/test/test_helper.rb"
184
160
  end
185
161
 
186
162
  task :copy_docs_in_public do
187
- File.cp "doc/index.html", "#{PKG_DESTINATION}/public/_doc/index.html"
163
+ cp "doc/index.html", "#{PKG_DESTINATION}/public/_doc/index.html"
188
164
  end
189
165
 
190
166
  task :copy_app_doc_readme do
191
- File.cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
167
+ cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
192
168
  end
193
169
 
194
170
  task :link_apache_config do
195
- cd "#{PKG_DESTINATION}/config/"
196
- ln_s "../public/.htaccess", "apache.conf"
197
- cd "../../railties"
171
+ chdir(File.join(PKG_DESTINATION, 'config')) {
172
+ ln_s "../public/.htaccess", "apache.conf"
173
+ }
198
174
  end
199
175
 
200
176
 
201
177
  # Generate documentation ------------------------------------------------------------------
202
178
 
203
179
  desc "Generate documentation for the framework and for the empty application"
204
- task :generate_documentation => [ :generate_app_doc, :generate_rails_framework_doc ] do
205
- end
180
+ task :generate_documentation => [ :generate_app_doc, :generate_rails_framework_doc ]
206
181
 
207
182
  task :generate_rails_framework_doc do
208
183
  system %{cd #{PKG_DESTINATION}; rake apidoc}
@@ -217,7 +192,8 @@ end
217
192
  # Generate GEM ----------------------------------------------------------------------------
218
193
 
219
194
  task :copy_gem_environment do
220
- File.cp "environments/shared_for_gem.rb", "#{PKG_DESTINATION}/config/environments/shared.rb"
195
+ cp "environments/shared_for_gem.rb", "#{PKG_DESTINATION}/config/environment.rb"
196
+ cp "bin/breakpointer_for_gem", "#{PKG_DESTINATION}/script/breakpointer"
221
197
  end
222
198
 
223
199
 
@@ -228,8 +204,8 @@ PKG_FILES = FileList[
228
204
  'doc/**/*',
229
205
  'dispatches/**/*',
230
206
  'environments/**/*',
231
- 'generators/**/*',
232
207
  'helpers/**/*',
208
+ 'generators/**/*',
233
209
  'html/**/*',
234
210
  'lib/**/*'
235
211
  ]
@@ -248,7 +224,9 @@ spec = Gem::Specification.new do |s|
248
224
  s.add_dependency('actionpack', '>= 0.9.5')
249
225
  s.add_dependency('actionmailer', '>= 0.4.0')
250
226
 
251
- s.files = PKG_FILES.to_a
227
+ s.has_rdoc = false
228
+
229
+ s.files = PKG_FILES.to_a.delete_if {|f| f.include?('.svn')}
252
230
  s.require_path = 'lib'
253
231
 
254
232
  s.bindir = "bin" # Use these for applications.
@@ -268,4 +246,5 @@ end
268
246
  desc "Publish the API documentation"
269
247
  task :pgem => [:gem] do
270
248
  Rake::SshFilePublisher.new("davidhh@one.textdrive.com", "domains/rubyonrails.org/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
271
- end
249
+ `ssh davidhh@one.textdrive.com './gemupdate.sh'`
250
+ end