README.md in ruby-xcdm-0.0.7 vs README.md in ruby-xcdm-0.0.8

- old
+ new

@@ -4,10 +4,14 @@ does when designing a datamodel for Core Data. It is written in pure ruby, but it will be of particular interest to RubyMotion developers. It offers the essential features that XCode does, plus a text-based workflow and some niceties, like automatic inverse relationships. +[![Dependency Status](https://gemnasium.com/infinitered/ruby-xcdm.png)](https://gemnasium.com/infinitered/ruby-xcdm) +[![Build Status](https://travis-ci.org/infinitered/ruby-xcdm.png?branch=master)](https://travis-ci.org/infinitered/ruby-xcdm) +[![Gem Version](https://badge.fury.io/rb/ruby-xcdm.png)](http://badge.fury.io/rb/ruby-xcdm) + ## Installation Add this line to your application's Gemfile: ```ruby @@ -37,18 +41,25 @@ ```ruby task :"build:simulator" => :"schema:build" ``` +You can override the name of the datamodel file, if you need to, using a config +variable: + +```ruby + app.xcdm.name = "custom" +``` + ## Usage (Plain Ruby) 1. Make a directory to hold your schemas (a.k.a. data model in XCode parlance) 2. Create one schema version per file within the directory 3. Run the command to generate a datamodel: ``` - xcdm MyApplicationName schemadir datamodeldestdir + xcdm MyApplicationName ./schema ./resources ``` ## Schema File Format @@ -60,11 +71,11 @@ entity "Article" do string :body, optional: false integer32 :length boolean :published, default: false - datetime :publishedAt, default: false + datetime :publishedAt string :title, optional: false belongs_to :author end @@ -80,19 +91,21 @@ All the built-in data types are supported: * integer16 * integer32 * integer64 -* decimal +* decimal (See note below) * double * float * string * boolean * datetime * binary * transformable +NSDecimal is not well-supported in RubyMotion as of this writing. They are converted to floats and lose precision. HipByte is aware of the issue and intends to fix it, but until they do, you will need to use something else for storing currency. For an example, see [here](https://github.com/skandragon/stringify_float). + Inverse relationships are generated automatically. If the inverse relationship cannot be derived from the association name, you can use the ```:inverse``` option: ```ruby @@ -137,10 +150,10 @@ datetime :joined_at end ``` -Core data has no equivalent of ```:through``` in ActiveRecord, so you'll +Core Data has no equivalent of ```:through``` in ActiveRecord, so you'll need to handle that relation yourself. If you need to set some of the more esoteric options on properties or relationships, you can include the raw parameters from NSEntityDescription and NSAttributeDescription, like renamingIdentifier