Sha256: ee60fefc7ca453e6fb26b7a422d18a69a808deef8aaa773378f4797f7f3bbe16

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 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/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

2 entries across 2 versions & 1 rubygems

Version Path
freeberry-0.3.0 lib/generators/freeberry/base/base_generator.rb
freeberry-0.2.9 lib/generators/freeberry/base/base_generator.rb