Sha256: 5eaf35c8950bd748a50a9db09ea0273e38c79fbeafa2c25b8e06baeff36a166e
Contents?: true
Size: 1.91 KB
Versions: 2
Compression:
Stored size: 1.91 KB
Contents
class TartarusGenerator < Rails::Generator::NamedBase default_options :skip_migration => false def initialize(runtime_args, runtime_options = {}) runtime_args << 'LoggedException' if runtime_args.empty? super end def manifest record do |m| puts "\nGenerated files:\n" # Directories m.directory "app/views/exceptions" m.directory "spec/models" m.directory "spec/controllers" # Configuration m.template 'config/exceptions.yml', 'config/exceptions.yml' #Migration m.migration_template "db/migrate/add_logged_exceptions.rb", "db/migrate", :migration_file_name => "add_#{singular_name}_table" # Controllers m.template 'app/controllers/exceptions_controller.rb', "app/controllers/exceptions_controller.rb" # Views Dir.glob( File.dirname(__FILE__) + '/templates/app/views/exceptions/*.html.erb').each do |path| view = File.basename( path ) m.file "app/views/exceptions/#{view}", "app/views/exceptions/#{view}" end # Models m.template 'app/models/logged_exception.rb', "app/models/#{file_name}.rb" # Specs m.template 'spec/models/logged_exception_spec.rb', "spec/models/#{file_name}_spec.rb" m.template 'spec/controllers/exceptions_controller_spec.rb', 'spec/controllers/exceptions_controller_spec.rb' # Public m.file 'public/javascripts/tartarus.jquery.js', 'public/javascripts/tartarus.jquery.js' m.file 'public/stylesheets/tartarus.css', 'public/stylesheets/tartarus.css' end end def after_generate puts "\nIn order for exceptional to function properly, you'll need to complete the following steps to complete the installation process: \n\n" puts " 1) Run 'rake db:migrate' to generate the logging table for your model.\n" puts " 2) Add '/javascripts/tartarus.jquery.js', and 'stylesheets/tartarus.css' to your applications layout.\n" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tartarus-1.0.3 | generators/tartarus/tartarus_generator.rb |
tartarus-1.0.1 | generators/tartarus/tartarus_generator.rb |