diff options
| author | Xavier Noria <fxn@hashref.com> | 2010-04-28 13:41:21 -0700 |
|---|---|---|
| committer | Xavier Noria <fxn@hashref.com> | 2010-04-28 13:41:21 -0700 |
| commit | b9ab4c780af82c1c60d63c50f040a55da5bfa8db (patch) | |
| tree | 4df8981047957fce17c10ea5c6aac7955aef2a4d /railties/lib/rails/generators | |
| parent | 8f1a5bfee1305f193bb659c010ca7e2272c12051 (diff) | |
| parent | 22184930ea323872c73542767d447bbbd7878c96 (diff) | |
| download | rails-b9ab4c780af82c1c60d63c50f040a55da5bfa8db.tar.gz rails-b9ab4c780af82c1c60d63c50f040a55da5bfa8db.tar.bz2 rails-b9ab4c780af82c1c60d63c50f040a55da5bfa8db.zip | |
Merge commit 'rails/master'
Diffstat (limited to 'railties/lib/rails/generators')
7 files changed, 19 insertions, 20 deletions
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index 7dec4d446a..a31932906d 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -1,5 +1,6 @@ require 'open-uri' require 'active_support/deprecation' +require 'rbconfig' module Rails module Generators @@ -240,7 +241,7 @@ module Rails def rake(command, options={}) log :rake, command env = options[:env] || 'development' - sudo = options[:sudo] && RUBY_PLATFORM !~ /mswin|mingw/ ? 'sudo ' : '' + sudo = options[:sudo] && Config::CONFIG['host_os'] !~ /mswin|mingw/ ? 'sudo ' : '' in_root { run("#{sudo}#{extify(:rake)} #{command} RAILS_ENV=#{env}", :verbose => false) } end @@ -307,7 +308,7 @@ module Rails # Add an extension to the given name based on the platform. # def extify(name) - if RUBY_PLATFORM =~ /mswin|mingw/ + if Config::CONFIG['host_os'] =~ /mswin|mingw/ "#{name}.bat" else name diff --git a/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb index 4dd2e6bf8c..6b3518717a 100644 --- a/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb @@ -1,4 +1,4 @@ -<p class="notice"><%%= notice %></p> +<p id="notice"><%%= notice %></p> <% for attribute in attributes -%> <p> diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 6818fafbe9..aa066fe3c4 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -1,6 +1,7 @@ require 'digest/md5' require 'active_support/secure_random' require 'rails/version' unless defined?(Rails::VERSION) +require 'rbconfig' module Rails::Generators # We need to store the RAILS_DEV_PATH in a constant, otherwise the path @@ -265,7 +266,7 @@ module Rails::Generators "/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4 "/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5 "/opt/lampp/var/mysql/mysql.sock" # xampp for linux - ].find { |f| File.exist?(f) } unless RUBY_PLATFORM =~ /mswin|mingw/ + ].find { |f| File.exist?(f) } unless Config::CONFIG['host_os'] =~ /mswin|mingw/ end def empty_directory_with_gitkeep(destination, config = {}) diff --git a/railties/lib/rails/generators/rails/app/templates/Rakefile b/railties/lib/rails/generators/rails/app/templates/Rakefile index 9cb2046439..13f1f9fa41 100755 --- a/railties/lib/rails/generators/rails/app/templates/Rakefile +++ b/railties/lib/rails/generators/rails/app/templates/Rakefile @@ -2,9 +2,6 @@ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) - require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' Rails::Application.load_tasks diff --git a/railties/lib/rails/generators/rails/app/templates/config/boot.rb b/railties/lib/rails/generators/rails/app/templates/config/boot.rb index 62a8ccc273..ab6cb374de 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb @@ -2,8 +2,12 @@ require 'rubygems' # Set up gems listed in the Gemfile. gemfile = File.expand_path('../../Gemfile', __FILE__) -if File.exist?(gemfile) +begin ENV['BUNDLE_GEMFILE'] = gemfile require 'bundler' Bundler.setup -end
\ No newline at end of file +rescue Bundler::GemNotFound => e + STDERR.puts e.message + STDERR.puts "Try running `bundle install`." + exit! +end if File.exist?(gemfile) diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml index f600e054cf..4e6391e3d6 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml @@ -1,11 +1,11 @@ # PostgreSQL. Versions 7.4 and 8.x are supported. # -# Install the ruby-postgres driver: -# gem install ruby-postgres -# On Mac OS X: -# gem install ruby-postgres -- --include=/usr/local/pgsql +# Install the pg driver: +# gem install pg +# On Mac OS X with macports: +# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config # On Windows: -# gem install ruby-postgres +# gem install pg # Choose the win32 build. # Install PostgreSQL and put its /bin directory on your path. development: diff --git a/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css b/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css index 9f2056a702..1ae7000299 100644 --- a/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css +++ b/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css @@ -20,15 +20,11 @@ div.field, div.actions { margin-bottom: 10px; } -.notice { +#notice { color: green; } -.alert { - color: red; -} - -.fieldWithErrors { +.field_with_errors { padding: 2px; background-color: red; display: table; |
