class Object

Public Instance Methods

add_app_files(app) click to toggle source
# File lib/swiss_db.rb, line 20
def add_app_files(app)
  lib_dir_path = File.dirname(__FILE__)
  insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0

  # Specify which folders to put into the app
  swiss_db_files = Dir.glob(File.join(lib_dir_path, "/swiss_db/**/**.rb"))
  motion_files = Dir.glob(File.join(lib_dir_path, "/motion-support/**/*.rb"))

  (swiss_db_files + motion_files).each do |file|
    app.files.insert(insert_point, file)
  end
end
building_app?(args) click to toggle source
# File lib/swiss_db.rb, line 14
def building_app?(args)
  # Don't write the schema to sql unless we're building the app
  intersection = (args & %w(device archive build release emulator newclear))
  !intersection.empty? || args == ""
end
setup_schema(app) click to toggle source

SwissDB by jsilverMDX

# File lib/swiss_db.rb, line 3
def setup_schema(app)
  require 'schema_tools/schema_builder'
  require 'schema_tools/writer'
  schema, version = SchemaTools::SchemaBuilder.build_schema(app)
  SchemaTools::Writer.create_schema_sql(schema, app)
  SchemaTools::Writer.write_version_file(version, app)
  # TODO
  # migrations = SwissDB::MigrationsBuilder.build_migrations
  # SwissDB::SQLWriter.create_migration_sql(migrations)
end