Sha256: 944c9b26bf7ff7af9307653c8e19d62875b66e57f9beb052550192c91bec4dfc

Contents?: true

Size: 1.79 KB

Versions: 4

Compression:

Stored size: 1.79 KB

Contents

module Casein
  class InstallGenerator < Rails::Generators::Base
    
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)
  
     def self.next_migration_number dirname
        if ActiveRecord::Base.timestamped_migrations
          Time.now.utc.strftime("%Y%m%d%H%M%S")
        else
          "%.3d" % (current_migration_number(dirname) + 1)
        end
      end
  
      def generate_files
        puts "*** WARNING - Generating configuration files. Make sure you have backed up any files before overwriting them. ***"
  
        #config helper
        copy_file "app/helpers/casein/config_helper.rb", "app/helpers/casein/config_helper.rb"
      
        #initial view partials
        copy_file "app/views/casein/layouts/_tab_navigation.html.erb", "app/views/casein/layouts/_tab_navigation.html.erb"
        copy_file "app/views/casein/layouts/_top_navigation.html.erb", "app/views/casein/layouts/_top_navigation.html.erb"
      
        #robots.txt
        puts " ** Overwrite if you haven't yet modified your robots.txt, otherwise add disallow rules for /casein and /admin manually **"
        copy_file "public/robots.txt", "public/robots.txt"
      
        #blank stylesheets and JavaScript files
  			copy_file "app/assets/stylesheets/casein/custom.scss", "app/assets/stylesheets/casein/custom.scss"
  			copy_file "app/assets/javascripts/casein/custom.js", "app/assets/javascripts/casein/custom.js"
				copy_file "app/assets/stylesheets/casein/auth_custom.scss", "app/assets/stylesheets/casein/auth_custom.scss"
				copy_file "app/assets/javascripts/casein/auth_custom.js", "app/assets/javascripts/casein/auth_custom.js"

  			#migrations
  			migration_template 'db/migrate/casein_create_admin_users.rb', "db/migrate/casein_create_admin_users.rb"
      end  
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
casein-5.3.2.0 lib/generators/casein/install/install_generator.rb
casein-5.3.1.0 lib/generators/casein/install/install_generator.rb
casein-5.3.0.0 lib/generators/casein/install/install_generator.rb
casein-5.2.0.0 lib/generators/casein/install/install_generator.rb