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) ⇒ Object
- #route_code(route_options) ⇒ Object
Instance Method Details
#gem_code(gem_options) ⇒ Object
19 20 21 22 |
# File 'lib/generators/generator_extensions.rb', line 19 def gem_code() [:lib] = [:name] unless .key? :lib code = "config.gem '#{gem_options[:name]}', :lib => '#{gem_options[:lib]}'" end |
#gsub_file_check(relative_destination, regexp, *_args) ⇒ Object
13 14 15 16 17 |
# File 'lib/generators/generator_extensions.rb', line 13 def gsub_file_check(relative_destination, regexp, *_args) path = destination_path(relative_destination) content = File.read(path) !(content =~ regexp).nil? end |
#route_code(route_options) ⇒ Object
7 8 9 10 11 |
# File 'lib/generators/generator_extensions.rb', line 7 def route_code() [:path] = [:name] unless .key? :path code = "map.#{route_options[:name]} '#{route_options[:path]}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'" code += ", :conditions => #{route_options[:conditions]}" if .key? :conditions end |