Sha256: 7fa2946627c7423d303a23ed99b1b9f158f933f140d97cbf257b4b803aa801a6

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 Bytes

Contents

module Cream
  module GeneratorHelper
    module Strategy 
      def validate_strategy
         if !valid_strategies.include?(strategy.to_sym)
           say "ERROR: Strategy '#{strategy}' is not currently supported by Cream. Please use one of: #{valid_strategies_list}", :red
           return false
         end
         true
      end

      def valid_strategies_list
        valid_strategies.map(&:to_s).join(', ')
      end

      def valid_strategies
        @strategies ||= basic_strategies
        @strategies << document_store_strategies if document_store?
        @strategies
      end
      
      def basic_strategies
        [:admin_flag, :role_string, :one_role, :many_roles, :roles_mask, :roles_string]
      end
      
      def document_store_strategies 
        [:embed_one_role, :embed_many_roles, :role_strings]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cream-0.8.6 lib/generators/cream/helpers/strategy_helper.rb