Sha256: 56c811e6b3512ee928f66baff6c035b9025080f52abd4f7e11819e5e28596d86

Contents?: true

Size: 969 Bytes

Versions: 1

Compression:

Stored size: 969 Bytes

Contents

 require 'rails/generators'
 require 'rails/generators/migration'     
 
 class CcsCoreGemGenerator < Rails::Generators::Base
   include Rails::Generators::Migration

   def self.source_root
      @source_root ||= File.join(File.dirname(__FILE__), 'templates')
   end

   def self.next_migration_number(dirname)
     sleep 1
     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 create_migration_files
     begin
       migration_template 'create_site_details.rb', 'db/migrate/create_site_details.rb'
     rescue
     end
     begin
       migration_template 'create_site_signups.rb', 'db/migrate/create_site_signups.rb'
     rescue
     end
     begin
       template 'service_locator.rb', 'lib/service_locator.rb'
     rescue
     end
     begin
       template 'services.yml', 'config/services.yml'
     rescue
     end
   end
   
 end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ccs_core_gem-0.0.7 lib/generators/ccs_core_gem/ccs_core_gem_generator.rb