Sha256: e916c47aa7463bcacdec4961589efe959aa2994e5689a0faf01ef94ecfc29f2e

Contents?: true

Size: 648 Bytes

Versions: 7

Compression:

Stored size: 648 Bytes

Contents

require 'rails/generators'

class SimpleCaptchaGenerator < Rails::Generators::Base
  include Rails::Generators::Migration
                          
  def self.source_root
    @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates/'))
  end
  
  def create_partial
    template "partial.erb", File.join('app/views', 'simple_captcha', "_simple_captcha.erb")
  end

  unless defined?(Mongoid)
    def self.next_migration_number(dirname)
      Time.now.strftime("%Y%m%d%H%M%S")
    end
    def create_migration
      migration_template "migration.rb", File.join('db/migrate', "create_simple_captcha_data.rb")
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
glebtv-simple_captcha-0.5.1 lib/generators/simple_captcha_generator.rb
glebtv-simple_captcha-0.4.6 lib/generators/simple_captcha_generator.rb
glebtv-simple_captcha-0.4.5 lib/generators/simple_captcha_generator.rb
glebtv-simple_captcha-0.4.4 lib/generators/simple_captcha_generator.rb
glebtv-simple_captcha-0.4.3 lib/generators/simple_captcha_generator.rb
glebtv-simple_captcha-0.4.1 lib/generators/simple_captcha_generator.rb
glebtv-simple_captcha-0.3.1 lib/generators/simple_captcha_generator.rb