Sha256: d228f29a0a324d4634c2cbdee513a998a6c79b7a68652b7574a22b030416f021

Contents?: true

Size: 1000 Bytes

Versions: 7

Compression:

Stored size: 1000 Bytes

Contents

require 'rails/generators'
require 'rails/generators/migration'
require 'active_record'
require 'rails/generators/active_record'

module ActsAsCleo
  class UpdateGenerator < Rails::Generators::Base
    include Rails::Generators::Migration

    source_root File.expand_path("../../install/templates", __FILE__)

    def copy_migration_and_config
      #Resque workers
      %w{update create delete}.each do |life|
        remove_file "app/jobs/#{life}.rb"
      end

      #new general processor
      copy_file "jobs/cleo_processor.rb", "app/jobs/cleo_processor.rb"

      #create migration
      migration_template 'update.rb', 'db/migrate/update_acts_as_cleo.rb'
    end

    def self.next_migration_number(dirname)
      next_migration_number = current_migration_number(dirname) + 1
      if ActiveRecord::Base.timestamped_migrations
        [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
      else
        "%.3d" % next_migration_number
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
acts_as_cleo-3.0.0 lib/generators/acts_as_cleo/update/update_generator.rb
acts_as_cleo-2.4.5 lib/generators/acts_as_cleo/update/update_generator.rb
acts_as_cleo-2.4.4 lib/generators/acts_as_cleo/update/update_generator.rb
acts_as_cleo-2.4.3 lib/generators/acts_as_cleo/update/update_generator.rb
acts_as_cleo-2.4.2 lib/generators/acts_as_cleo/update/update_generator.rb
acts_as_cleo-2.4.1 lib/generators/acts_as_cleo/update/update_generator.rb
acts_as_cleo-2.4.0 lib/generators/acts_as_cleo/update/update_generator.rb