Sha256: 8543c96f1f63cab6b9324c0b294affba8d86dd15997953ff21d5c6a6db071e90

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 KB

Contents

module CarnivalDeviseViews
  module Generators
    class InstallGenerator < Rails::Generators::Base
      desc "Install Carnival devise View"
      source_root File.expand_path("../../templates", __FILE__)
      class_option :haml, :type => :boolean, :default => false, :description => "Haml views"
      class_option :sass, :type => :boolean, :default => false, :description => "Sass Css"
      argument :folder_name, :type => :string, :default => "devise"

      def copy_views
        if options.haml?
          views_directory '../../../app/views/haml/devise'
        else
          views_directory '../../../app/views/erb/devise'
        end
      end

      def copy_locale
        copy_file "../../../config/locales/pt-BR.yml", "config/locales/devise.carnival.pt-BR.yml"
        copy_file "../../../config/locales/en.yml", "config/locales/devise.carnival.en.yml"
      end


      def copy_assets
        if options.sass?
          copy_file '../../../app/assets/stylesheets/carnival_devise_views.sass', 'app/assets/stylesheets/carnival_devise_views.sass'
        else
          copy_file '../../../app/assets/stylesheets/carnival_devise_views.css', 'app/assets/stylesheets/carnival_devise_views.css'
        end
      end

      def copy_fonts
        directory  '../../../app/assets/images/', 'app/assets/images/'
      end

      private
      def views_directory source
        directory source, "app/views/#{folder_name}" do |content|
          content.gsub 'devise/shared/links', "#{folder_name}/shared/links"
        end
        
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
carnival_devise_views-0.0.4 lib/generators/carnival_devise_views/install_generator.rb
carnival_devise_views-0.0.3 lib/generators/carnival_devise_views/install_generator.rb
carnival_devise_views-0.0.2 lib/generators/carnival_devise_views/install_generator.rb