Class: Auth::Generators::ViewsGenerator
- Inherits:
-
Rails::Generator::NamedBase
- Object
- Rails::Generator::NamedBase
- Auth::Generators::ViewsGenerator
- Defined in:
- lib/auth/generators/views_generator.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(model, options = {}) ⇒ ViewsGenerator
constructor
A new instance of ViewsGenerator.
- #manifest ⇒ Object
- #spec ⇒ Object
Constructor Details
#initialize(model, options = {}) ⇒ ViewsGenerator
Returns a new instance of ViewsGenerator.
4 5 6 7 8 |
# File 'lib/auth/generators/views_generator.rb', line 4 def initialize(model, = {}) @model = model args = [ model.name ] super(args, ) end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
2 3 4 |
# File 'lib/auth/generators/views_generator.rb', line 2 def model @model end |
Instance Method Details
#manifest ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/auth/generators/views_generator.rb', line 10 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) resource_directory = File.join("app/views", model.accounts_controller.underscore) sessions_directory = File.join("app/views", model.sessions_controller.underscore) base = File.join(source_root, "views/sparkly_accounts") Dir[File.join(base, "**/*")].each do |fi| fi.gsub!(/^#{Regexp::escape base}/, '') m.file(File.join("views/sparkly_accounts", fi), File.join(resource_directory, fi)) end base = File.join(source_root, "views/sparkly_sessions") Dir[File.join(base, "**/*")].each do |fi| fi.gsub!(/^#{Regexp::escape base}/, '') m.file(File.join("views/sparkly_sessions", fi), File.join(sessions_directory, fi)) end end end |