ruby-xcdm 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ 1.9.3-p392
data/README.md CHANGED
@@ -93,24 +93,55 @@ All the built-in data types are supported:
93
93
 
94
94
  Inverse relationships are generated automatically.
95
95
  If the inverse relationship cannot be derived
96
- from the association name, you can use the :inverse option:
96
+ from the association name, you can use the ```:inverse``` option:
97
97
 
98
98
  ```ruby
99
- schema "001" do
99
+ entity "Game" do
100
+ belongs_to :away_team, inverse: "Team.away_games"
101
+ belongs_to :home_team, inverse: "Team.home_games"
102
+ end
100
103
 
101
- entity "Game" do
102
- belongs_to :away_team, inverse: "Team.away_games"
103
- belongs_to :home_team, inverse: "Team.home_games"
104
- end
104
+ entity "Team" do
105
+ has_many :away_games, inverse: "Game.away_team"
106
+ has_many :home_games, inverse: "Game.home_team"
107
+ end
108
+ ```
105
109
 
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
+ Many-to-many relationships are supported via the ```:plural_inverse``` option:
111
+
112
+ ```ruby
113
+ entity "Person" do
114
+ has_many :threads, plural_inverse: true
115
+ end
116
+
117
+ entity "Thread" do
118
+ has_many :people, plural_inverse: true
119
+ end
120
+ ```
121
+
122
+ In this mode, Core Data will automatically create a relation table behind the
123
+ scenes. If you want more control, you can make the intermediate table yourself:
124
+
125
+ ```ruby
126
+ entity "Person" do
127
+ has_many :postings
128
+ end
129
+
130
+ entity "Thread" do
131
+ has_many :postings
132
+ end
133
+
134
+ entity "Posting" do
135
+ belongs_to :person
136
+ belongs_to :thread
110
137
 
138
+ datetime :joined_at
111
139
  end
112
140
  ```
113
141
 
142
+ Core data has no equivalent of ```:through``` in ActiveRecord, so you'll
143
+ need to handle that relation yourself.
144
+
114
145
  If you need to set some of the more esoteric options on properties or
115
146
  relationships, you can include the raw parameters from
116
147
  NSEntityDescription and NSAttributeDescription, like renamingIdentifier
@@ -56,6 +56,8 @@ module XCDM
56
56
 
57
57
  if !options[:default].nil?
58
58
  property[:defaultValueString] = normalize_value(options.delete(:default))
59
+ elsif options.key?(:default)
60
+ options.delete(:default)
59
61
  elsif [:integer16, :integer32, :integer64].include?(type)
60
62
  property[:defaultValueString] = "0"
61
63
  elsif [:float, :double, :decimal].include?(type)
@@ -1,3 +1,3 @@
1
1
  module XCDM
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -45,6 +45,11 @@ module XCDM
45
45
  assert_equal [{ optional: 'YES', syncable: 'YES', attributeType: 'Integer 32', name: 'count', defaultValueString: '1' }], e.properties
46
46
  end
47
47
 
48
+ def test_property_default_nil
49
+ e.integer32 'count', default: nil
50
+ assert_equal [{ optional: 'YES', syncable: 'YES', attributeType: 'Integer 32', name: 'count' }], e.properties
51
+ end
52
+
48
53
  def test_convert_type
49
54
  assert_equal 'Integer 16', Entity.convert_type(:integer16)
50
55
  assert_equal 'Integer 32', Entity.convert_type(:integer32)
@@ -15,7 +15,7 @@ schema "0.0.1" do
15
15
  entity "Author" do
16
16
  float :fee
17
17
  string :name, optional: false
18
- has_many :articles
18
+ has_many :articles
19
19
  end
20
20
 
21
21
  end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-xcdm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Ken Miller
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-01-24 00:00:00.000000000 Z
12
+ date: 2014-02-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: builder
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: activesupport
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: plist
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: bundler
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ~>
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ~>
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: rake
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ! '>='
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ! '>='
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: turn
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - ! '>='
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - ! '>='
95
108
  - !ruby/object:Gem::Version
@@ -103,8 +116,7 @@ extensions: []
103
116
  extra_rdoc_files: []
104
117
  files:
105
118
  - .gitignore
106
- - .rbenv-version
107
- - .rvmrc
119
+ - .ruby-version
108
120
  - Gemfile
109
121
  - Gemfile.lock
110
122
  - LICENSE.txt
@@ -124,30 +136,30 @@ files:
124
136
  homepage: https://github.com/infinitered/ruby-xcdm
125
137
  licenses:
126
138
  - MIT
127
- metadata: {}
128
139
  post_install_message:
129
140
  rdoc_options: []
130
141
  require_paths:
131
142
  - lib
132
143
  required_ruby_version: !ruby/object:Gem::Requirement
144
+ none: false
133
145
  requirements:
134
146
  - - ! '>='
135
147
  - !ruby/object:Gem::Version
136
148
  version: '0'
137
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
+ none: false
138
151
  requirements:
139
152
  - - ! '>='
140
153
  - !ruby/object:Gem::Version
141
154
  version: '0'
142
155
  requirements: []
143
156
  rubyforge_project:
144
- rubygems_version: 2.1.5
157
+ rubygems_version: 1.8.23
145
158
  signing_key:
146
- specification_version: 4
159
+ specification_version: 3
147
160
  summary: Ruby XCDM
148
161
  test_files:
149
162
  - test/entity_test.rb
150
163
  - test/fixtures/001_baseline.rb
151
164
  - test/fixtures/Article.xcdatamodeld/Article.xcdatamodel/contents
152
165
  - test/schema_test.rb
153
- has_rdoc:
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- Njc1YTAyNTBiYWFmMmMzYWMzYTFmMDk5N2QyMzUzYzg1YTdkYzk4OA==
5
- data.tar.gz: !binary |-
6
- YzUyZTg0YmZkYzA0NDNmYzIyZTU0YjUwNTRiYWRiZDRiMTM5YTAwOA==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- NDBjMDQ4NTEwMjVkYTRiODIzN2Y3YzliN2Y5NTdiN2IzMGVkOGFmMDQ2MDlh
10
- ZjQ5ZDkzOTQ3YWZhMjM1MDNlODczMzg5NTUyNWI4ZTc3YTUyNzljOGQ1ZTQ4
11
- OGZhNWNhMjA4MzNkZGM1NWJhYTljNjgyMmEyZjZjMzRhZjRiNjg=
12
- data.tar.gz: !binary |-
13
- YmVhMTc3OGY1OWVkMjdiZjljMWI5YWU0NjI0OTZmNmUzNDk2OTM0NTZhNmQy
14
- NDNlZDgyNGQ2ZmFjNWRhOWY0ZTMxNGZiY2M5MmY5NmEzY2M1ZGU1ZWVhNTMx
15
- M2U5MzQ2MWFjM2I2OGMyMGE4ZWU3OTcxNDkyNGUzMWIyZTZlNWI=
@@ -1 +0,0 @@
1
- 1.9.3-p286
data/.rvmrc DELETED
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
- # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p392@ir_temple"
10
-
11
- # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.18.14 (stable)" # 1.10.1 seams as a safe start
13
- # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
- # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
- # return 1
16
- # }
17
-
18
- # First we attempt to load the desired environment directly from the environment
19
- # file. This is very fast and efficient compared to running through the entire
20
- # CLI and selector. If you want feedback on which environment was used then
21
- # insert the word 'use' after --create as this triggers verbose mode.
22
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
- then
25
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
- \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
- else
29
- # If the environment file has not yet been created, use the RVM CLI to select.
30
- rvm --create "$environment_id" || {
31
- echo "Failed to create RVM environment '${environment_id}'."
32
- return 1
33
- }
34
- fi
35
-
36
- # If you use bundler, this might be useful to you:
37
- # if [[ -s Gemfile ]] && {
38
- # ! builtin command -v bundle >/dev/null ||
39
- # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
40
- # }
41
- # then
42
- # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
- # gem install bundler
44
- # fi
45
- # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
- # then
47
- # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
48
- # fi