Sha256: 82bcea0070c6b1dbd3067090cb5f2dfc5b490f830e5aafff00bf51f03cc23376

Contents?: true

Size: 1.24 KB

Versions: 7

Compression:

Stored size: 1.24 KB

Contents

require 'rails/generators'

module UnknownAdmin
  module Generators
    class InstallGenerator < ::Rails::Generators::Base

      source_root File.expand_path("../templates", __FILE__)
      desc "This generator installs Twitter Bootstrap to Admin Asset Pipeline"
      argument :stylesheets_type, :type => :string, :default => 'less', :banner => '*less or static'

      def add_assets

        unless File.exist?('app/assets/javascripts/admin/admin.js')
          copy_file "admin.js", "app/assets/javascripts/admin/admin.js"
        end

        unless File.exist?('app/assets/stylesheets/admin/admin.css')
          copy_file "admin.css", "app/assets/stylesheets/admin/admin.css"
        end

        unless File.exist?('app/views/layouts/admin/application.html.erb')
          copy_file "application.html.erb", "app/views/layouts/admin/application.html.erb"
        end

        unless File.exist?('app/controllers/admin/admin_controller.rb')
          copy_file "admin_controller.rb", "app/controllers/admin/admin_controller.rb"
        end

        unless File.exist?('app/controllers/admin/resources_controller.rb')
          copy_file "resources_controller.rb", "app/controllers/admin/resources_controller.rb"
        end
      end
    end
      
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
unknown_admin-0.1.5 lib/generators/unknown_admin/install/install_generator.rb
unknown_admin-0.1.4 lib/generators/unknown_admin/install/install_generator.rb
unknown_admin-0.1.3 lib/generators/unknown_admin/install/install_generator.rb
unknown_admin-0.1.2 lib/generators/unknown_admin/install/install_generator.rb
unknown_admin-0.1.1 lib/generators/unknown_admin/install/install_generator.rb
unknown_admin-0.1.0 lib/generators/unknown_admin/install/install_generator.rb
unknown_admin-0.0.1 lib/generators/unknown_admin/install/install_generator.rb