Sha256: c72572c88fabd3e46a4b5936f6fa65ad9e4eee207ccec05a05240c3bec4c0f96

Contents?: true

Size: 544 Bytes

Versions: 7

Compression:

Stored size: 544 Bytes

Contents

module Ninsho
  module Generators
    module OrmHelpers

      def model_exists?
        File.exists?(File.join(destination_root, model_path))
      end

      def migration_exists?(table_name)
        Dir.glob("#{File.join(destination_root, migration_path)}/[0-9]*_*.rb").grep(/\d+_add_ninsho_to_#{table_name}.rb$/).first
      end

      def migration_path
        @migration_path ||= File.join("db", "migrate")
      end

      def model_path
        @model_path ||= File.join("app", "models", "#{file_path}.rb")
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ninsho-0.1.3 lib/generators/ninsho/orm_helpers.rb
ninsho-0.1.2 lib/generators/ninsho/orm_helpers.rb
ninsho-0.1.1 lib/generators/ninsho/orm_helpers.rb
ninsho-0.1.0 lib/generators/ninsho/orm_helpers.rb
ninsho-0.0.3 lib/generators/ninsho/orm_helpers.rb
ninsho-0.0.2 lib/generators/ninsho/orm_helpers.rb
ninsho-0.0.1 lib/generators/ninsho/orm_helpers.rb