Module: TsSchema

Defined in:
lib/ts_schema.rb,
lib/ts_schema/railtie.rb,
lib/ts_schema/version.rb,
lib/ts_schema/configuration.rb,
lib/ts_schema/schema_generator.rb,
lib/generators/install_generator.rb

Defined Under Namespace

Modules: Generators Classes: Configuration, Railtie, SchemaGenerator

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Class Method Details

.configurationObject



15
16
17
# File 'lib/ts_schema.rb', line 15

def configuration
  @configuration ||= Configuration.new
end

.generateObject



19
20
21
22
23
24
25
# File 'lib/ts_schema.rb', line 19

def generate
  if ActiveRecord::Base.connection.migration_context.needs_migration?
    puts "Aborting: There are pending migrations"
  else
    SchemaGenerator.new(@configuration).generate
  end
end

.output_fileObject



27
28
29
30
31
32
33
# File 'lib/ts_schema.rb', line 27

def output_file
  if ActiveRecord::Base.connection.migration_context.needs_migration?
    puts "Aborting: There are pending migrations"
  else
    SchemaGenerator.new(@configuration).output_file
  end
end

.setup(&block) ⇒ Object



11
12
13
# File 'lib/ts_schema.rb', line 11

def setup(&block)
  configuration.assign(&block)
end