# encoding: UTF-8 class RielesGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) class_option :keep_current_inflections, :type => :boolean, :default => false, :desc => 'Indica si en lugar de tratar de sobreescribir el archivo de inflections, se debe crear un archivo adicional (inflections_es)' def copy_files copy_file 'inflections.rb', "config/initializers/#{file_name}.rb" copy_file 'es.yml', 'config/locales/es.yml' copy_file 'index.html.erb', 'lib/templates/erb/scaffold/index.html.erb' copy_file 'edit.html.erb', 'lib/templates/erb/scaffold/edit.html.erb' copy_file 'new.html.erb', 'lib/templates/erb/scaffold/new.html.erb' copy_file 'show.html.erb', 'lib/templates/erb/scaffold/show.html.erb' copy_file '_form.html.erb', 'lib/templates/erb/scaffold/_form.html.erb' copy_file '_error_messages.html.erb', 'app/views/application/_error_messages.html.erb' end private def file_name file_name = options.keep_current? ? 'inflections_es' : 'inflections' end end