Class: Rails::Generator::Commands::Base
- Inherits:
-
Object
- Object
- Rails::Generator::Commands::Base
- Defined in:
- lib/generators/generator_extensions.rb
Instance Method Summary collapse
- #gem_code(gem_options) ⇒ Object
- #gsub_file_check(relative_destination, regexp, *args, &block) ⇒ Object
- #route_code(route_options) ⇒ Object
Instance Method Details
#gem_code(gem_options) ⇒ Object
20 21 22 23 |
# File 'lib/generators/generator_extensions.rb', line 20 def gem_code() [:lib] = [:name] unless .has_key? :lib code = "config.gem '#{gem_options[:name]}', :lib => '#{gem_options[:lib]}'" end |
#gsub_file_check(relative_destination, regexp, *args, &block) ⇒ Object
14 15 16 17 18 |
# File 'lib/generators/generator_extensions.rb', line 14 def gsub_file_check(relative_destination, regexp, *args, &block) path = destination_path(relative_destination) content = File.read(path) !(content =~ regexp).nil? end |
#route_code(route_options) ⇒ Object
8 9 10 11 12 |
# File 'lib/generators/generator_extensions.rb', line 8 def route_code() [:path] = [:name] unless .has_key? :path code = "map.#{route_options[:name]} '#{route_options[:path]}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'" code += ", :conditions => #{route_options[:conditions]}" if .has_key? :conditions end |