Sha256: b03d0d6e17324aeb03b18f21ce3a4586f0cd075857cd000a35018b15583e2ef9

Contents?: true

Size: 816 Bytes

Versions: 5

Compression:

Stored size: 816 Bytes

Contents

require 'rails/generators'
require 'rails/generators/migration'
module Governor
  class AddThinkingSphinxGenerator < Rails::Generators::Base
    include Rails::Generators::Migration
    source_root File.expand_path('../templates', __FILE__)
    argument :resource, :type => :string, :default => Governor.default_resource.plural.to_s
  
    def self.next_migration_number(dirname)
      if ActiveRecord::Base.timestamped_migrations
        Time.new.utc.strftime("%Y%m%d%H%M%S")
      else
        "%.3d" % (current_migration_number(dirname) + 1)
      end
    end
  
    def create_migration_file
      migration_template 'migrations/add_thinking_sphinx.rb', "db/migrate/governor_add_thinking_sphinx.rb", :skip => true
    end
    
    def mapping
      Governor.resources[resource.pluralize.to_sym]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
governor_thinking_sphinx-0.1.4 lib/generators/governor/add_thinking_sphinx_generator.rb
governor_thinking_sphinx-0.1.3 lib/generators/governor/add_thinking_sphinx_generator.rb
governor_thinking_sphinx-0.1.2 lib/generators/governor/add_thinking_sphinx_generator.rb
governor_thinking_sphinx-0.1.1 lib/generators/governor/add_thinking_sphinx_generator.rb
governor_thinking_sphinx-0.1.0 lib/generators/governor/add_thinking_sphinx_generator.rb