Sha256: a2c3b3577a8a8d89d98d879f936a636ffffc0754745cf45fd5ecb182b062c8ca

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

module Fullstack
  module Admin
    class InstallGenerator < Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)
        
      class_option :fullstack, :type => :boolean, :default => true
    
      class_option :host, :default => "remotehost"
      class_option :user, :default => "ror"
      class_option :title, :default => "title"
      class_option :slogan, :default => "slogan"
    
      def install_fullstack
        if options[:fullstack]
          generate "fullstack:install  --host='#{host}' --user='#{user}'  --title='#{title}' --slogan='#{slogan}'"
        end
      end

      def copy_templates
        directory "root", Rails.root
      end
        
      def assets
        append_to_file "config/assets.yml" do
<<-eos
- admin/admin.css
- admin/admin.js          
eos
          
        end
      end
      
      def append_routes
        src = <<-eos

  namespace :admin do
    root :to => "dashboard#show"
  end
  
eos
        route(src)
        
        route("\n  devise_for :users\n")
      end
      
      def english_localizations
        generate "fullstack:admin:locale en"
      end

      protected
      

      def host
        options[:host]
      end
    
      def user
         options[:user]
      end
    
      def app
        Rails.application.class.to_s.split("::").first.underscore      
      end
    
      def email
        "info@#{host}"
      end
    
      def title
        options[:title]      
      end
    
      def slogan
        options[:slogan]
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fullstack-admin-0.1.12 lib/generators/fullstack/admin/install_generator.rb