Sha256: a670ae81308f82ec6d253553aa5862b98c797f72253caae6ac9f51924156254e

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

require 'rails/generators'

module Freeberry
  class BaseGenerator < Rails::Generators::Base

    def self.source_root
      @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
    end  
    
    # copy images
    def copy_images
      directory "images/manage", "public/images/manage"
    end
    
    # copy javascripts
    def copy_javascripts
      directory "javascripts", "public/javascripts"
    end
    
    # copy stylesheets
    def copy_stylesheets
      directory "stylesheets", "public/stylesheets"
    end
    
    # copy views
    def copy_views
      directory "views", "app/views"
    end
    
    # copy sweepers
    def copy_sweepers
      directory "sweepers", "app/sweepers"
    end
    
    def copy_configurations
      copy_file('config/words', 'config/words')
      copy_file('config/authorization_rules.rb', 'config/authorization_rules.rb')
      copy_file('config/seeds.rb', 'db/seeds.rb')
      copy_file('config/freeberry.rb', 'config/initializers/freeberry.rb')
      
      template('config/application.yml', 'config/application.yml.sample')
      template('config/database.yml', 'config/database.yml.sample')
      template('config/logrotate-config', 'config/logrotate-config.sample')
      template('config/nginx-config-passenger', 'config/nginx-config-passenger.sample')
    end
    
    def copy_helpers
      directory('helpers', 'app/helpers')
    end
    
    protected
      
      def app_name
        @app_name ||= File.basename(Rails.root)
        @app_name
      end
      
      def app_path
        @app_path ||= Rails.root.to_s
        @app_path
      end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
freeberry-0.2.7 lib/generators/freeberry/base/base_generator.rb
freeberry-0.2.6 lib/generators/freeberry/base/base_generator.rb
freeberry-0.2.5 lib/generators/freeberry/base/base_generator.rb