Sha256: b6c6370ba0262722555742d0de11dfdfde3a674b48cbdc84f32716781411a0bd

Contents?: true

Size: 837 Bytes

Versions: 3

Compression:

Stored size: 837 Bytes

Contents

class Auth::Generators::ViewsGenerator < Rails::Generator::NamedBase
  attr_reader :model
  
  def initialize(model, options = {})
    @model = model
    args = [ model.name ]
    super(args, options)
  end
  
  def manifest
    record do |m|
      m.directory resource_directory = File.join("app/views", model.accounts_controller.underscore)
      m.directory sessions_directory = File.join("app/views", model.sessions_controller.underscore)
      
      %w(edit new show).each do |f|
        m.file "views/sparkly_accounts/#{f}.html.erb", File.join(resource_directory, "#{f}.html.erb")
      end
      
      m.file "views/sparkly_sessions/new.html.erb", File.join(sessions_directory, "new.html.erb")
    end
  end
  
  def spec
    @spec ||= Rails::Generator::Spec.new("views", File.join(Auth.path, "auth/generators"), nil)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sparkly-auth-1.0.2 lib/auth/generators/views_generator.rb
sparkly-auth-1.0.1 lib/auth/generators/views_generator.rb
sparkly-auth-1.0.0 lib/auth/generators/views_generator.rb