Sha256: 859e7a4eec25779d330f8357e596ed7bf87f4c9062bb02921e95a461da2a71b8

Contents?: true

Size: 883 Bytes

Versions: 6

Compression:

Stored size: 883 Bytes

Contents

module Roomer
  module Helpers
    module GeneratorHelper

      # Check to see if the model file exists, should be used in a Generator
      # @return [True,False] 
      def model_exists?
        File.exists?(File.join(destination_root, model_path))
      end

      # Returns the path of the model
      # @return [String] model_path string representing the model location
      def model_path
        @model_path ||= File.join("app", "models", "#{file_path}.rb")
      end

      # Reads the --shared option specified when running "rails generate roomer:model"
      # @return [True,False]
      def shared?
        @shared ||= options[:shared]
      end

      # Fetchs the migration directory for the migrations
      def migration_dir
        return Roomer.shared_migrations_directory if shared?
        return Roomer.tenanted_migrations_directory
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
roomer-1.0.1 lib/roomer/helpers/generator_helper.rb
roomer-1.0.0 lib/roomer/helpers/generator_helper.rb
roomer-0.0.11 lib/roomer/helpers/generator_helper.rb
roomer-0.0.10 lib/roomer/helpers/generator_helper.rb
roomer-0.0.9 lib/roomer/helpers/generator_helper.rb
roomer-0.0.8 lib/roomer/helpers/generator_helper.rb