mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added a generator file responsable for loading generator files.
This commit is contained in:
parent
1845675822
commit
301c48c15c
7 changed files with 40 additions and 18 deletions
|
@ -14,8 +14,10 @@ else ARGV.size == 1
|
|||
ARGV << "--help"
|
||||
end
|
||||
|
||||
Dir[File.dirname(__FILE__) + '/../lib/generator/generators/*/*_generator.rb'].each do |file|
|
||||
require file
|
||||
require File.dirname(__FILE__) + '/../lib/generator'
|
||||
|
||||
Rails::Generators.builtin.each do |name|
|
||||
require "generator/generators/#{name}/#{name}_generator"
|
||||
end
|
||||
|
||||
name = ARGV.shift
|
||||
|
|
|
@ -9,5 +9,7 @@ end
|
|||
|
||||
ARGV << "--help" if ARGV.empty?
|
||||
|
||||
require File.dirname(__FILE__) + '/../lib/generator/generators/app/app_generator'
|
||||
require File.dirname(__FILE__) + '/../lib/generator'
|
||||
require 'generator/generators/app/app_generator'
|
||||
|
||||
Rails::Generators::AppGenerator.start
|
||||
|
|
24
railties/lib/generator.rb
Normal file
24
railties/lib/generator.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
|
||||
$:.unshift(activesupport_path) if File.directory?(activesupport_path)
|
||||
require 'active_support/all'
|
||||
|
||||
# TODO Use vendored Thor
|
||||
require 'rubygems'
|
||||
gem 'josevalim-thor'
|
||||
require 'thor'
|
||||
|
||||
$:.unshift(File.dirname(__FILE__))
|
||||
require 'rails/version' unless defined?(Rails::VERSION)
|
||||
|
||||
require 'generator/base'
|
||||
require 'generator/named_base'
|
||||
|
||||
module Rails
|
||||
module Generators
|
||||
def self.builtin
|
||||
Dir[File.dirname(__FILE__) + '/generator/generators/*'].collect do |file|
|
||||
File.basename(file)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,15 +1,4 @@
|
|||
# Load ActiveSupport mini
|
||||
activesupport_path = "#{File.dirname(__FILE__)}/../../../activesupport/lib"
|
||||
$:.unshift(activesupport_path) if File.directory?(activesupport_path)
|
||||
require 'active_support/all'
|
||||
|
||||
# TODO Use vendored Thor
|
||||
require 'rubygems'
|
||||
gem 'josevalim-thor'
|
||||
require 'thor'
|
||||
|
||||
require File.dirname(__FILE__) + '/../rails/version' unless defined?(Rails::VERSION)
|
||||
require File.dirname(__FILE__) + '/actions'
|
||||
require 'generator/actions'
|
||||
|
||||
module Rails
|
||||
module Generators
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
require File.dirname(__FILE__) + '/../../base'
|
||||
require 'digest/md5'
|
||||
require 'active_support/secure_random'
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
require File.dirname(__FILE__) + '/../../base'
|
||||
|
||||
module Rails::Generators
|
||||
class MetalGenerator < Base
|
||||
argument :file_name, :type => :string
|
||||
|
|
8
railties/lib/generator/named_base.rb
Normal file
8
railties/lib/generator/named_base.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
require 'generator/base'
|
||||
|
||||
module Rails
|
||||
module Generators
|
||||
class NamedBase < Base
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue