moblues 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63ffc43b95cab00391237903c9cdb9c03ce3002f
4
- data.tar.gz: 932ed263a5e7900c913932c027c0f3203d14797b
3
+ metadata.gz: d32bb05d4237f02286567db790547390d8431821
4
+ data.tar.gz: 721d8b7a87e709a8cf588a3f6b089970ac435e5b
5
5
  SHA512:
6
- metadata.gz: 6f2cb4dea535e1899b663b50e2e031ecda8a940fc92856c4e8b73da638dc82862c444fc40dce30f8eef15b51d5d1faf1bee06d7c1107835b93aade56b9bc2857
7
- data.tar.gz: cce4791eb9ab6b26281f04687b0b5fb940219d259b08228694a9c9cb5f7a1b523e61ce9e8ad86139fd972e29b8c54150286a0cf046e8a25e69c703bf1afaa95f
6
+ metadata.gz: 58174f584358d44b99fdd8f137af13533a0e81ca439550902f6d9ed2efa76d441a12417b36de4058b883caf5c931673306439e9cd9ac08498379dc2e8435ec41
7
+ data.tar.gz: e2dd468fe9495fadaee61306ff7357004eb75676a4cb71602c6389a2fedc89f9b08d67a97b8cfdc778f43252d0f4144bc9287953b9a486a3f8d2e13474c01726
@@ -2,12 +2,15 @@ require 'extensions/hash'
2
2
 
3
3
  module Moblues
4
4
  module DataModel
5
- class Attribute < Struct.new(:name, :type)
5
+ class Attribute < Struct.new(:name, :type, :optional)
6
6
  def initialize(params)
7
7
  p = params.compact
8
+ optional = false
9
+ optional = p.fetch(:optional) if p.key?(:optional)
8
10
  super(
9
11
  p.fetch(:name),
10
- p.fetch(:type)
12
+ p.fetch(:type),
13
+ optional
11
14
  )
12
15
  end
13
16
  end
@@ -9,14 +9,19 @@ module Moblues
9
9
  end
10
10
 
11
11
  def property_attributes(attribute)
12
+ attributes = []
12
13
  case attribute.type
13
14
  when :string
14
- %w{nonatomic copy}
15
+ attributes = %w{nonatomic copy}
15
16
  when :number, :decimal, :date, :data, :id
16
- %w{nonatomic strong}
17
+ attributes = %w{nonatomic strong}
17
18
  else
18
19
  raise ArgumentError.new("unknown type #{type}")
19
20
  end
21
+ if attribute.optional
22
+ attributes << "nullable"
23
+ end
24
+ attributes
20
25
  end
21
26
  end
22
27
  end
@@ -12,7 +12,8 @@ module Moblues
12
12
  def attribute(xml)
13
13
  DataModel::Attribute.new(
14
14
  name: xml.attributes['name'],
15
- type: type_reader.map_type_str(xml.attributes['attributeType'])
15
+ type: type_reader.map_type_str(xml.attributes['attributeType']),
16
+ optional: xml.attributes['optional'] == 'YES'
16
17
  )
17
18
  end
18
19
 
@@ -1,3 +1,3 @@
1
1
  module Moblues
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
  @interface _Playable : NSManagedObject
6
- @property (nonatomic, copy) NSString *permalink;
7
- @property (nonatomic, copy) NSString *title;
6
+ @property (nonatomic, copy, nullable) NSString *permalink;
7
+ @property (nonatomic, copy, nullable) NSString *title;
8
8
 
9
9
  @end
@@ -7,7 +7,7 @@
7
7
  @class User;
8
8
 
9
9
  @interface _Track : Playable
10
- @property (nonatomic, strong) NSNumber *duration;
10
+ @property (nonatomic, strong, nullable) NSNumber *duration;
11
11
 
12
12
  @property (nonatomic, strong) Playlist *playlist;
13
13
  @property (nonatomic, strong) User *user;
@@ -5,8 +5,8 @@
5
5
  @class Track;
6
6
 
7
7
  @interface _User : NSManagedObject
8
- @property (nonatomic, strong) NSDate *dob;
9
- @property (nonatomic, copy) NSString *name;
8
+ @property (nonatomic, strong, nullable) NSDate *dob;
9
+ @property (nonatomic, copy, nullable) NSString *name;
10
10
 
11
11
  @property (nonatomic, strong) NSSet *playlists;
12
12
  @property (nonatomic, strong) NSSet *tracks;
@@ -6,6 +6,7 @@ FactoryGirl.define do
6
6
  factory :attribute, class: Moblues::DataModel::Attribute do
7
7
  name 'attribute'
8
8
  type :string
9
+ optional false
9
10
 
10
11
  trait :string do
11
12
  type :string
@@ -35,6 +36,10 @@ FactoryGirl.define do
35
36
  type :unknown
36
37
  end
37
38
 
38
- initialize_with { new(name: name, type: type) }
39
+ trait :optional do
40
+ type :boolean
41
+ end
42
+
43
+ initialize_with { new(name: name, type: type, optional: optional) }
39
44
  end
40
45
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moblues
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Garrigues
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-29 00:00:00.000000000 Z
11
+ date: 2017-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.19'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.19'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: plist
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.7'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.7'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '10.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '3.1'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: factory_girl
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '4.5'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '4.5'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: codeclimate-test-reporter
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.4.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.4.1
111
111
  description: |2
@@ -120,8 +120,8 @@ executables:
120
120
  extensions: []
121
121
  extra_rdoc_files: []
122
122
  files:
123
- - .gitignore
124
- - .travis.yml
123
+ - ".gitignore"
124
+ - ".travis.yml"
125
125
  - Gemfile
126
126
  - LICENSE.txt
127
127
  - README.md
@@ -238,17 +238,17 @@ require_paths:
238
238
  - lib
239
239
  required_ruby_version: !ruby/object:Gem::Requirement
240
240
  requirements:
241
- - - '>='
241
+ - - ">="
242
242
  - !ruby/object:Gem::Version
243
243
  version: '0'
244
244
  required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  requirements:
246
- - - '>='
246
+ - - ">="
247
247
  - !ruby/object:Gem::Version
248
248
  version: '0'
249
249
  requirements: []
250
250
  rubyforge_project:
251
- rubygems_version: 2.0.14
251
+ rubygems_version: 2.6.11
252
252
  signing_key:
253
253
  specification_version: 4
254
254
  summary: Generates Objective-C files for entities defined in a Core Data model