Sha256: 952b7319ba37d53128a30b8cb316ee73e05542a653145207904646088e1dee5e

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

class StateSessionGenerator < Rails::Generator::Base
  default_options :skip_migration => false

  def manifest
    record do |m|
      # Controller class, functional test, helper, and views.
      m.directory 'app/controllers/backend'
      m.directory 'test/functional/backend'
      m.template 'controller.rb', 'app/controllers/backend/state_sessions_controller.rb'
      m.template 'functional_test.rb', 'test/functional/backend/state_sessions_controller_test.rb'

      unless options[:skip_migration]
        m.migration_template("migration.rb", "db/migrate", :migration_file_name => "create_state_sessions")
      end

      m.template('model.rb', 'app/models/state_session.rb')
      # Adding a new route
      m.append("config/routes.rb", "    backend.resources :state_sessions", "map.namespace(:backend) do |backend|")
      m.readme "../REMEMBER"
    end
  end


  protected
    def banner
      "Usage: #{$0} state_session_migration [--skip-migration]"
    end

    def add_options!(opt)
      opt.separator ''
      opt.separator 'Options:'
      opt.on("--skip-migration",
             "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
    end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lipsiadmin-5.1.9 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-5.1.8 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-5.1.7 lipsiadmin_generators/state_session/state_session_generator.rb