Sha256: 3367bb75090162ea5ad2d9ae06a649bc1e11297e0f4d4f85dd7d9e580108301c

Contents?: true

Size: 738 Bytes

Versions: 7

Compression:

Stored size: 738 Bytes

Contents

module TokenMaster
  module Generators
    class InstallGenerator < Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)

      desc 'Creates a TokenMaster initializer in your application.'

      argument :attributes, type: :array, default: [], banner: "field:type field:type"

      def copy_initializer
        copy_file 'initializer.rb', 'config/initializers/token_master.rb', skip: true
      end

      def add_options
        attributes.each do |tokenable|
          inject_into_file 'config/initializers/token_master.rb', before: 'end' do <<-RUBY
  config.add_tokenable_options :#{tokenable}, TokenMaster::Config::DEFAULT_VALUES
          RUBY
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
token_master-1.1.0 lib/generators/token_master/install_generator.rb
token_master-1.0.1 lib/generators/token_master/install_generator.rb
token_master-1.0.0 lib/generators/token_master/install_generator.rb
token_master-0.1.3 lib/generators/token_master/install_generator.rb
token_master-0.1.2 lib/generators/token_master/install_generator.rb
token_master-0.1.0 lib/generators/token_master/install_generator.rb
token_master-0.0.1 lib/generators/token_master/install_generator.rb