1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Removing ==Examples and last blank lines of docs from railties

This commit is contained in:
Francesco Rodriguez 2012-05-14 10:50:40 -05:00
parent 888383e0ac
commit 17059a4868
6 changed files with 0 additions and 61 deletions

View file

@ -107,14 +107,11 @@ module Rails
# * The environment variable RAILS_GROUPS; # * The environment variable RAILS_GROUPS;
# * The optional envs given as argument and the hash with group dependencies; # * The optional envs given as argument and the hash with group dependencies;
# #
# == Examples
#
# groups :assets => [:development, :test] # groups :assets => [:development, :test]
# #
# # Returns # # Returns
# # => [:default, :development, :assets] for Rails.env == "development" # # => [:default, :development, :assets] for Rails.env == "development"
# # => [:default, :production] for Rails.env == "production" # # => [:default, :production] for Rails.env == "production"
#
def groups(*groups) def groups(*groups)
hash = groups.extract_options! hash = groups.extract_options!
env = Rails.env env = Rails.env

View file

@ -39,8 +39,6 @@ module Rails
# and <tt>autoload_once_paths</tt>, which, differently from a <tt>Railtie</tt>, are scoped to # and <tt>autoload_once_paths</tt>, which, differently from a <tt>Railtie</tt>, are scoped to
# the current engine. # the current engine.
# #
# Example:
#
# class MyEngine < Rails::Engine # class MyEngine < Rails::Engine
# # Add a load path for this specific Engine # # Add a load path for this specific Engine
# config.autoload_paths << File.expand_path("../lib/some/path", __FILE__) # config.autoload_paths << File.expand_path("../lib/some/path", __FILE__)
@ -336,11 +334,8 @@ module Rails
# It will affect the priority of loading views, helpers, assets and all the other files # It will affect the priority of loading views, helpers, assets and all the other files
# related to engine or application. # related to engine or application.
# #
# Example:
#
# # load Blog::Engine with highest priority, followed by application and other railties # # load Blog::Engine with highest priority, followed by application and other railties
# config.railties_order = [Blog::Engine, :main_app, :all] # config.railties_order = [Blog::Engine, :main_app, :all]
#
class Engine < Railtie class Engine < Railtie
autoload :Configuration, "rails/engine/configuration" autoload :Configuration, "rails/engine/configuration"
autoload :Railties, "rails/engine/railties" autoload :Railties, "rails/engine/railties"

View file

@ -95,7 +95,6 @@ module Rails
# some of them are not available by adding a fallback: # some of them are not available by adding a fallback:
# #
# Rails::Generators.fallbacks[:shoulda] = :test_unit # Rails::Generators.fallbacks[:shoulda] = :test_unit
#
def self.fallbacks def self.fallbacks
@fallbacks ||= {} @fallbacks ||= {}
end end
@ -115,8 +114,6 @@ module Rails
# Generators names must end with "_generator.rb". This is required because Rails # Generators names must end with "_generator.rb". This is required because Rails
# looks in load paths and loads the generator just before it's going to be used. # looks in load paths and loads the generator just before it's going to be used.
# #
# ==== Examples
#
# find_by_namespace :webrat, :rails, :integration # find_by_namespace :webrat, :rails, :integration
# #
# Will search for the following generators: # Will search for the following generators:
@ -125,7 +122,6 @@ module Rails
# #
# Notice that "rails:generators:webrat" could be loaded as well, what # Notice that "rails:generators:webrat" could be loaded as well, what
# Rails looks for is the first and last parts of the namespace. # Rails looks for is the first and last parts of the namespace.
#
def self.find_by_namespace(name, base=nil, context=nil) #:nodoc: def self.find_by_namespace(name, base=nil, context=nil) #:nodoc:
lookups = [] lookups = []
lookups << "#{base}:#{name}" if base lookups << "#{base}:#{name}" if base

View file

@ -8,12 +8,9 @@ module Rails
# Adds an entry into Gemfile for the supplied gem. If env # Adds an entry into Gemfile for the supplied gem. If env
# is specified, add the gem to the given environment. # is specified, add the gem to the given environment.
# #
# ==== Example
#
# gem "rspec", :group => :test # gem "rspec", :group => :test
# gem "technoweenie-restful-authentication", :lib => "restful-authentication", :source => "http://gems.github.com/" # gem "technoweenie-restful-authentication", :lib => "restful-authentication", :source => "http://gems.github.com/"
# gem "rails", "3.0", :git => "git://github.com/rails/rails" # gem "rails", "3.0", :git => "git://github.com/rails/rails"
#
def gem(*args) def gem(*args)
options = args.extract_options! options = args.extract_options!
name, version = args name, version = args
@ -43,12 +40,9 @@ module Rails
# Wraps gem entries inside a group. # Wraps gem entries inside a group.
# #
# ==== Example
#
# gem_group :development, :test do # gem_group :development, :test do
# gem "rspec-rails" # gem "rspec-rails"
# end # end
#
def gem_group(*names, &block) def gem_group(*names, &block)
name = names.map(&:inspect).join(", ") name = names.map(&:inspect).join(", ")
log :gemfile, "group #{name}" log :gemfile, "group #{name}"
@ -66,10 +60,7 @@ module Rails
# Add the given source to Gemfile # Add the given source to Gemfile
# #
# ==== Example
#
# add_source "http://gems.github.com/" # add_source "http://gems.github.com/"
#
def add_source(source, options={}) def add_source(source, options={})
log :source, source log :source, source
@ -83,8 +74,6 @@ module Rails
# If options :env is specified, the line is appended to the corresponding # If options :env is specified, the line is appended to the corresponding
# file in config/environments. # file in config/environments.
# #
# ==== Examples
#
# environment do # environment do
# "config.autoload_paths += %W(#{config.root}/extras)" # "config.autoload_paths += %W(#{config.root}/extras)"
# end # end
@ -92,7 +81,6 @@ module Rails
# environment(nil, :env => "development") do # environment(nil, :env => "development") do
# "config.active_record.observers = :cacher" # "config.active_record.observers = :cacher"
# end # end
#
def environment(data=nil, options={}, &block) def environment(data=nil, options={}, &block)
sentinel = /class [a-z_:]+ < Rails::Application/i sentinel = /class [a-z_:]+ < Rails::Application/i
env_file_sentinel = /::Application\.configure do/ env_file_sentinel = /::Application\.configure do/
@ -112,12 +100,9 @@ module Rails
# Run a command in git. # Run a command in git.
# #
# ==== Examples
#
# git :init # git :init
# git :add => "this.file that.rb" # git :add => "this.file that.rb"
# git :add => "onefile.rb", :rm => "badfile.cxx" # git :add => "onefile.rb", :rm => "badfile.cxx"
#
def git(commands={}) def git(commands={})
if commands.is_a?(Symbol) if commands.is_a?(Symbol)
run "git #{commands}" run "git #{commands}"
@ -131,15 +116,12 @@ module Rails
# Create a new file in the vendor/ directory. Code can be specified # Create a new file in the vendor/ directory. Code can be specified
# in a block or a data string can be given. # in a block or a data string can be given.
# #
# ==== Examples
#
# vendor("sekrit.rb") do # vendor("sekrit.rb") do
# sekrit_salt = "#{Time.now}--#{3.years.ago}--#{rand}--" # sekrit_salt = "#{Time.now}--#{3.years.ago}--#{rand}--"
# "salt = '#{sekrit_salt}'" # "salt = '#{sekrit_salt}'"
# end # end
# #
# vendor("foreign.rb", "# Foreign code is fun") # vendor("foreign.rb", "# Foreign code is fun")
#
def vendor(filename, data=nil, &block) def vendor(filename, data=nil, &block)
log :vendor, filename log :vendor, filename
create_file("vendor/#{filename}", data, :verbose => false, &block) create_file("vendor/#{filename}", data, :verbose => false, &block)
@ -148,14 +130,11 @@ module Rails
# Create a new file in the lib/ directory. Code can be specified # Create a new file in the lib/ directory. Code can be specified
# in a block or a data string can be given. # in a block or a data string can be given.
# #
# ==== Examples
#
# lib("crypto.rb") do # lib("crypto.rb") do
# "crypted_special_value = '#{rand}--#{Time.now}--#{rand(1337)}--'" # "crypted_special_value = '#{rand}--#{Time.now}--#{rand(1337)}--'"
# end # end
# #
# lib("foreign.rb", "# Foreign code is fun") # lib("foreign.rb", "# Foreign code is fun")
#
def lib(filename, data=nil, &block) def lib(filename, data=nil, &block)
log :lib, filename log :lib, filename
create_file("lib/#{filename}", data, :verbose => false, &block) create_file("lib/#{filename}", data, :verbose => false, &block)
@ -163,8 +142,6 @@ module Rails
# Create a new Rakefile with the provided code (either in a block or a string). # Create a new Rakefile with the provided code (either in a block or a string).
# #
# ==== Examples
#
# rakefile("bootstrap.rake") do # rakefile("bootstrap.rake") do
# project = ask("What is the UNIX name of your project?") # project = ask("What is the UNIX name of your project?")
# #
@ -178,7 +155,6 @@ module Rails
# end # end
# #
# rakefile('seed.rake', 'puts "Planting seeds"') # rakefile('seed.rake', 'puts "Planting seeds"')
#
def rakefile(filename, data=nil, &block) def rakefile(filename, data=nil, &block)
log :rakefile, filename log :rakefile, filename
create_file("lib/tasks/#{filename}", data, :verbose => false, &block) create_file("lib/tasks/#{filename}", data, :verbose => false, &block)
@ -186,8 +162,6 @@ module Rails
# Create a new initializer with the provided code (either in a block or a string). # Create a new initializer with the provided code (either in a block or a string).
# #
# ==== Examples
#
# initializer("globals.rb") do # initializer("globals.rb") do
# data = "" # data = ""
# #
@ -199,7 +173,6 @@ module Rails
# end # end
# #
# initializer("api.rb", "API_KEY = '123456'") # initializer("api.rb", "API_KEY = '123456'")
#
def initializer(filename, data=nil, &block) def initializer(filename, data=nil, &block)
log :initializer, filename log :initializer, filename
create_file("config/initializers/#{filename}", data, :verbose => false, &block) create_file("config/initializers/#{filename}", data, :verbose => false, &block)
@ -209,10 +182,7 @@ module Rails
# The second parameter is the argument string that is passed to # The second parameter is the argument string that is passed to
# the generator or an Array that is joined. # the generator or an Array that is joined.
# #
# ==== Example
#
# generate(:authenticated, "user session") # generate(:authenticated, "user session")
#
def generate(what, *args) def generate(what, *args)
log :generate, what log :generate, what
argument = args.map {|arg| arg.to_s }.flatten.join(" ") argument = args.map {|arg| arg.to_s }.flatten.join(" ")
@ -222,12 +192,9 @@ module Rails
# Runs the supplied rake task # Runs the supplied rake task
# #
# ==== Example
#
# rake("db:migrate") # rake("db:migrate")
# rake("db:migrate", :env => "production") # rake("db:migrate", :env => "production")
# rake("gems:install", :sudo => true) # rake("gems:install", :sudo => true)
#
def rake(command, options={}) def rake(command, options={})
log :rake, command log :rake, command
env = options[:env] || ENV["RAILS_ENV"] || 'development' env = options[:env] || ENV["RAILS_ENV"] || 'development'
@ -237,10 +204,7 @@ module Rails
# Just run the capify command in root # Just run the capify command in root
# #
# ==== Example
#
# capify! # capify!
#
def capify! def capify!
log :capify, "" log :capify, ""
in_root { run("#{extify(:capify)} .", :verbose => false) } in_root { run("#{extify(:capify)} .", :verbose => false) }
@ -248,10 +212,7 @@ module Rails
# Make an entry in Rails routing file config/routes.rb # Make an entry in Rails routing file config/routes.rb
# #
# === Example
#
# route "root :to => 'welcome#index'" # route "root :to => 'welcome#index'"
#
def route(routing_code) def route(routing_code)
log :route, routing_code log :route, routing_code
sentinel = /\.routes\.draw do\s*$/ sentinel = /\.routes\.draw do\s*$/
@ -263,10 +224,7 @@ module Rails
# Reads the given file at the source root and prints it in the console. # Reads the given file at the source root and prints it in the console.
# #
# === Example
#
# readme "README" # readme "README"
#
def readme(path) def readme(path)
log File.read(find_in_source_paths(path)) log File.read(find_in_source_paths(path))
end end

View file

@ -187,10 +187,7 @@ module Rails
# Remove a previously added hook. # Remove a previously added hook.
# #
# ==== Examples
#
# remove_hook_for :orm # remove_hook_for :orm
#
def self.remove_hook_for(*names) def self.remove_hook_for(*names)
remove_invocation(*names) remove_invocation(*names)

View file

@ -3,7 +3,6 @@ module Rails
# Holds common methods for migrations. It assumes that migrations has the # Holds common methods for migrations. It assumes that migrations has the
# [0-9]*_name format and can be used by another frameworks (like Sequel) # [0-9]*_name format and can be used by another frameworks (like Sequel)
# just by implementing the next migration version method. # just by implementing the next migration version method.
#
module Migration module Migration
attr_reader :migration_number, :migration_file_name, :migration_class_name attr_reader :migration_number, :migration_file_name, :migration_class_name
@ -38,10 +37,7 @@ module Rails
# The migration version, migration file name, migration class name are # The migration version, migration file name, migration class name are
# available as instance variables in the template to be rendered. # available as instance variables in the template to be rendered.
# #
# ==== Examples
#
# migration_template "migration.rb", "db/migrate/add_foo_to_bar.rb" # migration_template "migration.rb", "db/migrate/add_foo_to_bar.rb"
#
def migration_template(source, destination=nil, config={}) def migration_template(source, destination=nil, config={})
destination = File.expand_path(destination || source, self.destination_root) destination = File.expand_path(destination || source, self.destination_root)