Sha256: 4a391c78a073d56e768555b6c71a794bf9aa5c8687499095a23751d0a10af4ff

Contents?: true

Size: 906 Bytes

Versions: 19

Compression:

Stored size: 906 Bytes

Contents

module DeviseAuthy
  module Generators
    class DeviseAuthyGenerator < Rails::Generators::NamedBase

      namespace "devise_authy"

      desc "Add :authy_authenticatable directive in the given model, plus accessors. Also generate migration for ActiveRecord"

      def inject_devise_authy_content
        path = File.join("app","models","#{file_path}.rb")
        if File.exists?(path) &&
          !File.read(path).include?("authy_authenticatable")
          inject_into_file(path,
                           "authy_authenticatable, :",
                           :after => "devise :")
        end

        if File.exists?(path) &&
          !File.read(path).include?(":authy_id")
          inject_into_file(path,
                           ":authy_id, :last_sign_in_with_authy, ",
                           :after => "attr_accessible ") 
        end
      end

      hook_for :orm

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
devise-authy-1.11.1 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.11.0 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.10.0 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.9.0 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.8.3 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.8.2 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.8.1 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.8.0 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.7.0 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.6.0 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.5.3 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.5.2 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.5.1 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.5.0 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.4.0 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.3.0 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.2.2 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.2.1 lib/generators/devise_authy/devise_authy_generator.rb
devise-authy-1.0.0 lib/generators/devise_authy/devise_authy_generator.rb