Class: Padrino::FormErrors::Generators::Defaults

Inherits:
Thor::Group
  • Object
show all
Includes:
Generators::Actions, Thor::Actions
Defined in:
lib/padrino-form-errors/generators/defaults.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



10
# File 'lib/padrino-form-errors/generators/defaults.rb', line 10

def self.banner; "padrino-gen form_errors"; end

.source_rootObject

Define the source template root



9
# File 'lib/padrino-form-errors/generators/defaults.rb', line 9

def self.source_root; File.expand_path(File.dirname(__FILE__)); end

Instance Method Details

#create_viewsObject

Create default views.



19
20
21
22
23
24
25
26
27
28
# File 'lib/padrino-form-errors/generators/defaults.rb', line 19

def create_views
  ext = fetch_component_choice(:renderer)
  self.destination_root = options[:root]
  if in_app_root?
    template "templates/#{ext}/_error_messages.#{ext}.tt", destination_root("/app/views/shared/_error_messages.html.#{ext}")
    template "templates/#{ext}/_error_message.#{ext}.tt",  destination_root("/app/views/shared/_error_message.html.#{ext}")
  else
    say "You are not at the root of a Padrino application! (config/boot.rb not found)"
  end
end