ruby-xcdm 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +66 -15
- data/lib/xcdm/entity.rb +1 -1
- data/lib/xcdm/version.rb +1 -1
- data/test/entity_test.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Njc1YTAyNTBiYWFmMmMzYWMzYTFmMDk5N2QyMzUzYzg1YTdkYzk4OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzUyZTg0YmZkYzA0NDNmYzIyZTU0YjUwNTRiYWRiZDRiMTM5YTAwOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDBjMDQ4NTEwMjVkYTRiODIzN2Y3YzliN2Y5NTdiN2IzMGVkOGFmMDQ2MDlh
|
10
|
+
ZjQ5ZDkzOTQ3YWZhMjM1MDNlODczMzg5NTUyNWI4ZTc3YTUyNzljOGQ1ZTQ4
|
11
|
+
OGZhNWNhMjA4MzNkZGM1NWJhYTljNjgyMmEyZjZjMzRhZjRiNjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmVhMTc3OGY1OWVkMjdiZjljMWI5YWU0NjI0OTZmNmUzNDk2OTM0NTZhNmQy
|
14
|
+
NDNlZDgyNGQ2ZmFjNWRhOWY0ZTMxNGZiY2M5MmY5NmEzY2M1ZGU1ZWVhNTMx
|
15
|
+
M2U5MzQ2MWFjM2I2OGMyMGE4ZWU3OTcxNDkyNGUzMWIyZTZlNWI=
|
data/README.md
CHANGED
@@ -1,24 +1,30 @@
|
|
1
1
|
# ruby-xcdm
|
2
2
|
|
3
|
-
This is a tool for generating the same xcdatamodeld files that XCode
|
4
|
-
designing a datamodel for Core Data. It is written in pure
|
5
|
-
be of particular interest to RubyMotion developers.
|
6
|
-
features that XCode does, plus a text-based
|
7
|
-
|
3
|
+
This is a tool for generating the same xcdatamodeld files that XCode
|
4
|
+
does when designing a datamodel for Core Data. It is written in pure
|
5
|
+
ruby, but it will be of particular interest to RubyMotion developers.
|
6
|
+
It offers the essential features that XCode does, plus a text-based
|
7
|
+
workflow and some niceties, like automatic inverse relationships.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
11
|
Add this line to your application's Gemfile:
|
12
12
|
|
13
|
-
|
13
|
+
```ruby
|
14
|
+
gem 'ruby-xcdm'
|
15
|
+
```
|
14
16
|
|
15
17
|
And then execute:
|
16
18
|
|
17
|
-
|
19
|
+
```
|
20
|
+
$ bundle
|
21
|
+
```
|
18
22
|
|
19
23
|
Or install it yourself as:
|
20
24
|
|
21
|
-
|
25
|
+
```
|
26
|
+
$ gem install ruby-xcdm
|
27
|
+
```
|
22
28
|
|
23
29
|
## Usage (RubyMotion)
|
24
30
|
|
@@ -26,8 +32,8 @@ Or install it yourself as:
|
|
26
32
|
2. Create one schema version per file within the directory
|
27
33
|
3. To build the schema, run `rake schema:build`
|
28
34
|
|
29
|
-
If you want to build the schema every time you run the simulator, add
|
30
|
-
your Rakefile:
|
35
|
+
If you want to build the schema every time you run the simulator, add
|
36
|
+
this to your Rakefile:
|
31
37
|
|
32
38
|
```ruby
|
33
39
|
task :"build:simulator" => :"schema:build"
|
@@ -39,7 +45,9 @@ task :"build:simulator" => :"schema:build"
|
|
39
45
|
2. Create one schema version per file within the directory
|
40
46
|
3. Run the command to generate a datamodel:
|
41
47
|
|
48
|
+
```
|
42
49
|
xcdm MyApplicationName schemadir datamodeldestdir
|
50
|
+
```
|
43
51
|
|
44
52
|
|
45
53
|
## Schema File Format
|
@@ -47,7 +55,7 @@ task :"build:simulator" => :"schema:build"
|
|
47
55
|
Here's a sample schema file:
|
48
56
|
|
49
57
|
```ruby
|
50
|
-
schema "
|
58
|
+
schema "001" do
|
51
59
|
|
52
60
|
entity "Article" do
|
53
61
|
|
@@ -69,10 +77,53 @@ Here's a sample schema file:
|
|
69
77
|
end
|
70
78
|
```
|
71
79
|
|
72
|
-
All the built-in data types are supported
|
73
|
-
|
74
|
-
|
75
|
-
|
80
|
+
All the built-in data types are supported:
|
81
|
+
|
82
|
+
* integer16
|
83
|
+
* integer32
|
84
|
+
* integer64
|
85
|
+
* decimal
|
86
|
+
* double
|
87
|
+
* float
|
88
|
+
* string
|
89
|
+
* boolean
|
90
|
+
* datetime
|
91
|
+
* binary
|
92
|
+
* transformable
|
93
|
+
|
94
|
+
Inverse relationships are generated automatically.
|
95
|
+
If the inverse relationship cannot be derived
|
96
|
+
from the association name, you can use the :inverse option:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
schema "001" do
|
100
|
+
|
101
|
+
entity "Game" do
|
102
|
+
belongs_to :away_team, inverse: "Team.away_games"
|
103
|
+
belongs_to :home_team, inverse: "Team.home_games"
|
104
|
+
end
|
105
|
+
|
106
|
+
entity "Team" do
|
107
|
+
has_many :away_games, inverse: "Game.away_team"
|
108
|
+
has_many :home_games, inverse: "Game.home_team"
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
```
|
113
|
+
|
114
|
+
If you need to set some of the more esoteric options on properties or
|
115
|
+
relationships, you can include the raw parameters from
|
116
|
+
NSEntityDescription and NSAttributeDescription, like renamingIdentifier
|
117
|
+
or defaultValueString.
|
118
|
+
|
119
|
+
## Versioning
|
120
|
+
|
121
|
+
To create new versions, simply copy the old version, increase the
|
122
|
+
version string (the last one in sort order is always interpreted to be
|
123
|
+
the current version) and make your changes. So long as they conform
|
124
|
+
to the [automatic versioning
|
125
|
+
rules](https://developer.apple.com/library/ios/documentation/cocoa/conceptual/CoreDataVersioning/Articles/vmLightweightMigration.html#//apple_ref/doc/uid/TP40004399-CH4-SW2),
|
126
|
+
everything should work seamlessly.
|
76
127
|
|
77
128
|
## Contributing
|
78
129
|
|
data/lib/xcdm/entity.rb
CHANGED
data/lib/xcdm/version.rb
CHANGED
data/test/entity_test.rb
CHANGED
@@ -55,7 +55,7 @@ module XCDM
|
|
55
55
|
assert_equal 'String', Entity.convert_type(:string)
|
56
56
|
assert_equal 'Boolean', Entity.convert_type(:boolean)
|
57
57
|
assert_equal 'Date', Entity.convert_type(:datetime)
|
58
|
-
assert_equal 'Binary
|
58
|
+
assert_equal 'Binary', Entity.convert_type(:binary)
|
59
59
|
assert_equal 'Transformable', Entity.convert_type(:transformable)
|
60
60
|
end
|
61
61
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-xcdm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Miller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|