Skip to content

Loading…

Idioms - Rakefiles shouldn't need to require rake (or rubygems) #117

Closed
wants to merge 1 commit into from

2 participants

@raggi

You might not like the rubygems removal, so feel free to back out of that. On 1.8, rake is installed by rubygems, and on 1.9, gem_prelude provides rubygems loading capabilities through require, so it shouldn't be necessary.

Rake is always loaded prior to loading a rakefile, so require 'rake' is always unnecessary.

@tenderlove
Ruby on Rails member

Applied, thanks! :-D

@tenderlove
Ruby on Rails member

Wait, how can the Rakefile possibly work without requiring Rake?

@tenderlove
Ruby on Rails member

Sorry, forgot to add this in the last comment.

trollface

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
View
2 Rakefile 100644 → 100755
@@ -1,7 +1,7 @@
+#!/usr/bin/env rake
gem 'rdoc', '>= 2.5.10'
require 'rdoc'
-require 'rake'
require 'rdoc/task'
require 'net/http'
View
2 actionmailer/Rakefile 100644 → 100755
@@ -1,4 +1,4 @@
-require 'rake'
+#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
View
2 actionpack/Rakefile 100644 → 100755
@@ -1,4 +1,4 @@
-require 'rake'
+#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
View
0 activemodel/Rakefile 100644 → 100755
File mode changed.
View
2 activerecord/Rakefile 100644 → 100755
@@ -1,4 +1,4 @@
-require 'rake'
+#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
View
2 activeresource/Rakefile 100644 → 100755
@@ -1,4 +1,4 @@
-require 'rake'
+#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
View
0 activesupport/Rakefile 100644 → 100755
File mode changed.
View
2 railties/Rakefile 100644 → 100755
@@ -1,4 +1,4 @@
-require 'rake'
+#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/gempackagetask'
View
2 railties/lib/rails/generators/rails/app/templates/Rakefile 100644 → 100755
@@ -1,7 +1,7 @@
+#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
-require 'rake'
<%= app_const %>.load_tasks
View
2 railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt
@@ -1,4 +1,4 @@
-require 'rake'
+#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/rdoctask'
View
4 railties/lib/rails/generators/rails/plugin_new/templates/Rakefile 100644 → 100755
@@ -1,12 +1,10 @@
-# encoding: UTF-8
-require 'rubygems'
+#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
-require 'rake'
require 'rake/rdoctask'
Rake::RDocTask.new(:rdoc) do |rdoc|
Something went wrong with that request. Please try again.