Sha256: 21915869ec189ce40e8f5f8ce1c219d160898ac87e2f58912a959c94c77af50c

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 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
        route do
<<-eos
  namespace :admin do
    root :to => "dashboard#show"
  end
  
eos
        
        end
      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.11 lib/generators/fullstack/admin/install_generator.rb