gyro 0.4.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -797
- data/bin/gyro +91 -84
- data/documentation/enum.png +0 -0
- data/documentation/enum_json.png +0 -0
- data/documentation/ignored.png +0 -0
- data/documentation/json.png +0 -0
- data/documentation/primary_key.png +0 -0
- data/documentation/read_only.png +0 -0
- data/documentation/simple_entity.png +0 -0
- data/documentation/support_annotation.png +0 -0
- data/documentation/transformer.png +0 -0
- data/documentation/transformers.png +0 -0
- data/lib/gyro.rb +18 -29
- data/lib/gyro/generator/json.rb +30 -0
- data/lib/gyro/generator/liquid.rb +22 -0
- data/lib/gyro/generator/liquid/filters.rb +53 -0
- data/lib/gyro/generator/liquid/liquid.rb +124 -0
- data/lib/gyro/generator/liquid/whitespace_patch.rb +61 -0
- data/lib/gyro/log.rb +46 -0
- data/lib/gyro/parser/xcdatamodel.rb +20 -0
- data/lib/gyro/parser/xcdatamodel/attribute.rb +129 -0
- data/lib/gyro/parser/xcdatamodel/entity.rb +195 -0
- data/lib/gyro/parser/xcdatamodel/relationship.rb +84 -0
- data/lib/gyro/parser/xcdatamodel/xcdatamodel.rb +65 -0
- data/lib/gyro/template.rb +68 -0
- data/lib/gyro/version.rb +19 -0
- data/lib/templates/android/README.md +164 -0
- data/lib/templates/android/entity.liquid +49 -0
- data/lib/templates/android/entity_filename.liquid +1 -0
- data/lib/templates/android/enum.liquid +44 -0
- data/lib/templates/android/enum_filename.liquid +1 -0
- data/lib/templates/android/inc/_attributes_enum.liquid +17 -0
- data/lib/templates/android/inc/_attributes_getter_setter.liquid +58 -0
- data/lib/templates/android/inc/_attributes_properties.liquid +35 -0
- data/lib/templates/android/inc/_enum_getter_setter.liquid +19 -0
- data/lib/templates/android/inc/_primitives.liquid +30 -0
- data/lib/templates/android/inc/_relationships_enum.liquid +14 -0
- data/lib/templates/android/inc/_relationships_getter_setter.liquid +47 -0
- data/lib/templates/android/inc/_relationships_properties.liquid +27 -0
- data/lib/templates/android/inc/_type_converter.liquid +22 -0
- data/lib/templates/android/inc/_wrapper_type_converter.liquid +22 -0
- data/lib/templates/decodable/README.md +34 -0
- data/lib/templates/decodable/entity.liquid +57 -0
- data/lib/templates/decodable/entity_filename.liquid +1 -0
- data/lib/templates/decodable/enum.liquid +0 -0
- data/lib/templates/decodable/enum_filename.liquid +0 -0
- data/lib/templates/object-mapper/README.md +40 -0
- data/lib/templates/object-mapper/entity.liquid +66 -0
- data/lib/templates/object-mapper/entity_filename.liquid +1 -0
- data/lib/templates/object-mapper/enum.liquid +0 -0
- data/lib/templates/object-mapper/enum_filename.liquid +0 -0
- data/lib/templates/swift3-variant/README.md +60 -0
- data/lib/templates/swift3-variant/entity.liquid +12 -0
- data/lib/templates/swift3-variant/entity_filename.liquid +1 -0
- data/lib/templates/swift3-variant/enum.liquid +15 -0
- data/lib/templates/swift3-variant/enum_filename.liquid +1 -0
- data/lib/templates/swift3-variant/inc/_attributes_enum.liquid +13 -0
- data/lib/templates/swift3-variant/inc/_attributes_properties.liquid +32 -0
- data/lib/templates/swift3-variant/inc/_default_value_converter.liquid +14 -0
- data/lib/templates/swift3-variant/inc/_enum_attribute_property.liquid +26 -0
- data/lib/templates/swift3-variant/inc/_ignored_properties.liquid +24 -0
- data/lib/templates/swift3-variant/inc/_indexed_properties.liquid +19 -0
- data/lib/templates/swift3-variant/inc/_inverse_properties.liquid +11 -0
- data/lib/templates/swift3-variant/inc/_optional_attribute_property.liquid +5 -0
- data/lib/templates/swift3-variant/inc/_primary_key.liquid +5 -0
- data/lib/templates/swift3-variant/inc/_relationship_properties.liquid +9 -0
- data/lib/templates/swift3-variant/inc/_relationships_enum.liquid +17 -0
- data/lib/templates/swift3-variant/inc/_type_converter.liquid +20 -0
- data/lib/templates/swift3/README.md +60 -0
- data/lib/templates/swift3/entity.liquid +12 -0
- data/lib/templates/swift3/entity_filename.liquid +1 -0
- data/lib/templates/swift3/enum.liquid +15 -0
- data/lib/templates/swift3/enum_filename.liquid +1 -0
- data/lib/templates/swift3/inc/_attributes_enum.liquid +13 -0
- data/lib/templates/swift3/inc/_attributes_properties.liquid +32 -0
- data/lib/templates/swift3/inc/_default_value_converter.liquid +14 -0
- data/lib/templates/swift3/inc/_enum_attribute_property.liquid +26 -0
- data/lib/templates/swift3/inc/_ignored_properties.liquid +24 -0
- data/lib/templates/swift3/inc/_indexed_properties.liquid +19 -0
- data/lib/templates/swift3/inc/_inverse_properties.liquid +11 -0
- data/lib/templates/swift3/inc/_optional_attribute_property.liquid +5 -0
- data/lib/templates/swift3/inc/_primary_key.liquid +5 -0
- data/lib/templates/swift3/inc/_relationship_properties.liquid +9 -0
- data/lib/templates/swift3/inc/_relationships_enum.liquid +17 -0
- data/lib/templates/swift3/inc/_type_converter.liquid +20 -0
- metadata +134 -31
- data/lib/gyro/realm/java/converter.rb +0 -63
- data/lib/gyro/realm/java/enum_generator.rb +0 -128
- data/lib/gyro/realm/java/generator.rb +0 -183
- data/lib/gyro/realm/java/templates.rb +0 -67
- data/lib/gyro/realm/objc/converter.rb +0 -63
- data/lib/gyro/realm/objc/enum_generator.rb +0 -86
- data/lib/gyro/realm/objc/generator.rb +0 -373
- data/lib/gyro/realm/objc/json_category_generator.rb +0 -172
- data/lib/gyro/realm/objc/protocol_generator.rb +0 -59
- data/lib/gyro/realm/objc/templates.rb +0 -100
- data/lib/gyro/realm/swift/converter.rb +0 -74
- data/lib/gyro/realm/swift/enum_generator.rb +0 -73
- data/lib/gyro/realm/swift/generator.rb +0 -265
- data/lib/gyro/realm/swift/object_mapper_generator.rb +0 -124
- data/lib/gyro/realm/swift/templates.rb +0 -64
- data/lib/gyro/utils/file_utils.rb +0 -31
- data/lib/gyro/utils/log.rb +0 -68
- data/lib/gyro/utils/raise.rb +0 -23
- data/lib/gyro/utils/string_xcdatamodel.rb +0 -58
- data/lib/gyro/xcdatamodel/parser/attribute.rb +0 -98
- data/lib/gyro/xcdatamodel/parser/entity.rb +0 -234
- data/lib/gyro/xcdatamodel/parser/relationship.rb +0 -70
- data/lib/gyro/xcdatamodel/parser/xcdatamodel.rb +0 -59
@@ -0,0 +1,12 @@
|
|
1
|
+
/* DO NOT EDIT | Generated by gyro */
|
2
|
+
|
3
|
+
import RealmSwift
|
4
|
+
|
5
|
+
final class {{ entity.name }}: Object {
|
6
|
+
{%- include 'inc/attributes_enum' -%}
|
7
|
+
{% include 'inc/relationships_enum' -%}
|
8
|
+
{% include 'inc/attributes_properties' %}
|
9
|
+
{% include 'inc/primary_key' -%}
|
10
|
+
{% include 'inc/indexed_properties' -%}
|
11
|
+
{% include 'inc/ignored_properties' %}
|
12
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{{params.prefix}}{{name}}.swift
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{%- if attribute.enum_type.size > 0 -%}
|
2
|
+
/* DO NOT EDIT | Generated by gyro */
|
3
|
+
|
4
|
+
enum {{ params.prefix }}{{ attribute.enum_type }}: String {
|
5
|
+
{%- for value in attribute.enum_values %}
|
6
|
+
{%- if attribute.enum_values.size > 0 %}
|
7
|
+
{% assign jsonKey = value -%}
|
8
|
+
{%- if attribute.json_values.size > 0 and attribute.json_values[forloop.index0] -%}
|
9
|
+
{%- assign jsonKey = attribute.json_values[forloop.index0] -%}
|
10
|
+
{%- endif -%}
|
11
|
+
case {{ value | uncapitalize }} = "{{ jsonKey | escape_quotes }}"
|
12
|
+
{%- endif %}
|
13
|
+
{%- endfor %}
|
14
|
+
}
|
15
|
+
{% endif %}
|
@@ -0,0 +1 @@
|
|
1
|
+
{{params.prefix}}{{name}}.swift
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
{% if entity.attributes.size > 0 %}
|
3
|
+
enum Attributes: String {
|
4
|
+
{%- for attribute in entity.attributes -%}
|
5
|
+
{%- if attribute.realm_ignored or attribute.realm_read_only.size == 0 -%}
|
6
|
+
{%- if attribute.comment.size > 0 %}
|
7
|
+
/** {{ attribute.comment }} **/
|
8
|
+
{%- endif %}
|
9
|
+
case {{ attribute.name }} = "{{ attribute.name | escape_quotes }}"
|
10
|
+
{%- endif %}
|
11
|
+
{%- endfor %}
|
12
|
+
}
|
13
|
+
{% endif -%}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
{%- for attribute in entity.attributes -%}
|
2
|
+
{%- comment %} ******* DEFAULT VALUE CAPTURE ******* {% endcomment -%}
|
3
|
+
{%- capture default_value -%}
|
4
|
+
{%- include 'inc/default_value_converter' -%}
|
5
|
+
{%- endcapture -%}
|
6
|
+
|
7
|
+
{%- comment %} ******* CONVERT TYPE CAPTURE ******* {% endcomment -%}
|
8
|
+
{%- capture convert_type -%}
|
9
|
+
{%- include 'inc/type_converter' -%}
|
10
|
+
{%- endcapture -%}
|
11
|
+
|
12
|
+
{%- if attribute.realm_read_only.size == 0 -%}
|
13
|
+
{%- if attribute.enum_values.size > 0 -%}
|
14
|
+
{%- comment -%} ******* GENERATE ENUM ATTRIBUTE PROPERTY ******* {% endcomment -%}
|
15
|
+
{%- include 'inc/enum_attribute_property' -%}
|
16
|
+
{%- else -%}
|
17
|
+
{%- if attribute.optional == true -%}
|
18
|
+
{% comment -%} ******* GENERATE OPTIONAL ATTRIBUTE PROPERTY ******* {% endcomment -%}
|
19
|
+
{%- include 'inc/optional_attribute_property' -%}
|
20
|
+
{%- else -%}
|
21
|
+
{%- comment -%} ******* GENERATE DEFAULT ATTRIBUTE PROPERTY ******* {% endcomment %}
|
22
|
+
dynamic var {{ attribute.name }}: {{ convert_type }} = {{ default_value }}
|
23
|
+
{%- endif -%}
|
24
|
+
{%- endif -%}
|
25
|
+
{%- endif -%}
|
26
|
+
{%- endfor -%}
|
27
|
+
|
28
|
+
{%- comment %} ******* GENERATE RELATIONSHIP PROPERTIES ******* {% endcomment %}
|
29
|
+
{%- include 'inc/relationship_properties' -%}
|
30
|
+
|
31
|
+
{%- comment %} ******* GENERATE INVERSE PROPERTIES ******* {% endcomment -%}
|
32
|
+
{%- include 'inc/inverse_properties' -%}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{%- case attribute.type -%}
|
2
|
+
{%- when 'integer_16' or 'integer_32' or 'integer_64' -%}
|
3
|
+
0
|
4
|
+
{%- when 'float' or 'double' or 'decimal' -%}
|
5
|
+
0.0
|
6
|
+
{%- when 'string' -%}
|
7
|
+
""
|
8
|
+
{%- when 'boolean' -%}
|
9
|
+
false
|
10
|
+
{%- when 'date' -%}
|
11
|
+
Date()
|
12
|
+
{%- when 'binary' -%}
|
13
|
+
Data()
|
14
|
+
{%- endcase -%}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{%- if attribute.optional == true %}
|
2
|
+
|
3
|
+
dynamic var {{ attribute.name }}: String?
|
4
|
+
{%- else %}
|
5
|
+
|
6
|
+
dynamic var {{ attribute.name }}: String = ""
|
7
|
+
{%- endif %}
|
8
|
+
{%- assign enum_type = attribute.enum_type %}
|
9
|
+
{%- assign enum_name = attribute.name %}
|
10
|
+
var {{ enum_name }}Enum: {{ enum_type | delete_objc_prefix }}? {
|
11
|
+
get {
|
12
|
+
{%- if attribute.optional == true %}
|
13
|
+
guard let {{ attribute.name }} = {{ attribute.name }},
|
14
|
+
let enumValue = {{ enum_type }}(rawValue: {{ attribute.name }})
|
15
|
+
else { return nil }
|
16
|
+
{%- else %}
|
17
|
+
guard let enumValue = {{ enum_type }}(rawValue: {{ attribute.name }}) else { return nil }
|
18
|
+
{%- endif %}
|
19
|
+
return enumValue
|
20
|
+
}
|
21
|
+
{%- if attribute.optional == true %}
|
22
|
+
set { {{ attribute.name }} = newValue?.rawValue ?? nil }
|
23
|
+
{%- else %}
|
24
|
+
set { {{ attribute.name }} = newValue?.rawValue ?? "" }
|
25
|
+
{%- endif %}
|
26
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{%- if entity.has_ignored == true %}
|
2
|
+
// Specify properties to ignore (Realm won't persist these)
|
3
|
+
override static func ignoredProperties() -> [String] {
|
4
|
+
return [
|
5
|
+
{%- capture enum_ignored_properties -%}
|
6
|
+
{%- for attribute in entity.attributes -%}
|
7
|
+
{%- if attribute.realm_ignored == true -%}
|
8
|
+
"{{ attribute.name }}",
|
9
|
+
{%- endif -%}
|
10
|
+
{%- endfor -%}
|
11
|
+
|
12
|
+
{%- for relationship in entity.relationships -%}
|
13
|
+
{%- if relationship.realm_ignored == true -%}
|
14
|
+
"{{ relationship.name }}",
|
15
|
+
{%- endif -%}
|
16
|
+
{%- endfor -%}
|
17
|
+
{%- endcapture -%}
|
18
|
+
|
19
|
+
{%- assign enum_ignored_properties_array = enum_ignored_properties | split: "," -%}
|
20
|
+
{%- for item in enum_ignored_properties_array -%}
|
21
|
+
{{ item }}{%- if forloop.last == false -%},{%- endif -%}
|
22
|
+
{%- endfor -%}]
|
23
|
+
}
|
24
|
+
{% endif -%}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{%- if entity.has_indexed_attributes == true %}
|
2
|
+
// Specify properties to index
|
3
|
+
override static func indexedProperties() -> [String] {
|
4
|
+
return [
|
5
|
+
{%- capture enum_indexed_properties -%}
|
6
|
+
{%- for attribute in entity.attributes -%}
|
7
|
+
{%- if attribute.is_indexed == true -%}
|
8
|
+
"{{attribute.name}}",
|
9
|
+
{%- endif %}
|
10
|
+
{%- endfor %}
|
11
|
+
{%- endcapture -%}
|
12
|
+
|
13
|
+
{%- assign enum_indexed_properties_array = enum_indexed_properties | split: "," -%}
|
14
|
+
{%- assign enum_indexed_properties_array_size = enum_indexed_properties_array | size | minus: 1 -%}
|
15
|
+
{%- for item in enum_indexed_properties_array limit:enum_indexed_properties_array_size -%}
|
16
|
+
{{ item }}{%- if forloop.last == false -%},{%- endif -%}
|
17
|
+
{%- endfor -%}]
|
18
|
+
}
|
19
|
+
{%- endif -%}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{%- for relationship in entity.relationships -%}
|
2
|
+
{%- if relationship.inverse == true %}
|
3
|
+
{% assign name_size = relationship.name | size | minus: 1 %}
|
4
|
+
{%- if relationship.type == "to_many" %}
|
5
|
+
let {{ relationship.name | truncate: name_size, '' }}s = LinkingObjects(fromType: {{ relationship.inverse_type }}.self, property: "{{ relationship.inverse_name }}")
|
6
|
+
{%- else %}
|
7
|
+
let {{ relationship.name | truncate: name_size, '' }}s = LinkingObjects(fromType: {{ relationship.inverse_type }}.self, property: "{{ relationship.inverse_name }}")
|
8
|
+
var {{ relationship.name | truncate: name_size, '' }}: {{ relationship.inverse_type }}? { return {{ relationship.name | truncate: name_size, '' }}s.first }
|
9
|
+
{%- endif -%}
|
10
|
+
{%- endif -%}
|
11
|
+
{%- endfor -%}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
{%- for relationship in entity.relationships -%}
|
2
|
+
{%- if relationship.inverse == false %}
|
3
|
+
{%- if relationship.type == "to_many" %}
|
4
|
+
let {{ relationship.name }} = List<{{ relationship.inverse_type }}>()
|
5
|
+
{%- else %}
|
6
|
+
dynamic var {{ relationship.name }}: {{ relationship.inverse_type }}?
|
7
|
+
{%- endif %}
|
8
|
+
{%- endif %}
|
9
|
+
{%- endfor -%}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{%- if entity.relationships.size > 0 and entity.has_only_inverse == false %}
|
2
|
+
enum Relationships: String {
|
3
|
+
{%- for relationship in entity.relationships %}
|
4
|
+
{%- capture relationship_name -%}
|
5
|
+
{%- if relationship.inverse == true -%}
|
6
|
+
{%- assign name_size = relationship.name | size | minus: 1 -%}
|
7
|
+
{{ relationship.name | truncate: name_size, '' }}
|
8
|
+
{%- if relationship.type == "to_many" -%}s{%- endif -%}
|
9
|
+
{%- else -%}
|
10
|
+
{{ relationship.name }}
|
11
|
+
{%- endif -%}
|
12
|
+
{%- endcapture -%}
|
13
|
+
{%- assign relationship_name = relationship_name %}
|
14
|
+
case {{ relationship_name | uncapitalize }} = "{{ relationship_name | escape_quotes }}"
|
15
|
+
{%- endfor %}
|
16
|
+
}
|
17
|
+
{% endif -%}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{%- case attribute.type -%}
|
2
|
+
{%- when 'integer_16' -%}
|
3
|
+
Int16
|
4
|
+
{%- when 'integer_32' -%}
|
5
|
+
Int32
|
6
|
+
{%- when 'integer_64' -%}
|
7
|
+
Int64
|
8
|
+
{%- when 'double' or 'decimal' -%}
|
9
|
+
Double
|
10
|
+
{%- when 'float' -%}
|
11
|
+
Float
|
12
|
+
{%- when 'string' -%}
|
13
|
+
String
|
14
|
+
{%- when 'boolean' -%}
|
15
|
+
Bool
|
16
|
+
{%- when 'date' -%}
|
17
|
+
Date
|
18
|
+
{%- when 'binary' -%}
|
19
|
+
Data
|
20
|
+
{%- endcase -%}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gyro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NijiDigital
|
@@ -11,12 +11,56 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
date: 2017-04-10 00:00:00.000000000 Z
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: liquid
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '3.0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: nokogiri
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 1.6.8
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.6.8
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rspec
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.5'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '3.5'
|
57
|
+
description: |2
|
58
|
+
This tools allows you to use the visual Xcode editor to design your DataModels
|
59
|
+
using the xcdatamodel format (originally designed for CoreData) but then
|
60
|
+
generate the code for Realm.io models for Swift, Java & ObjC from that xcdatamodel.
|
61
|
+
|
62
|
+
This way you can take advantage of the xcdatamodel visual editor and Xcode integration
|
63
|
+
while using Realm instead of CoreData.
|
20
64
|
email: contact@niji.fr
|
21
65
|
executables:
|
22
66
|
- gyro
|
@@ -26,31 +70,90 @@ files:
|
|
26
70
|
- LICENSE
|
27
71
|
- README.md
|
28
72
|
- bin/gyro
|
73
|
+
- documentation/enum.png
|
74
|
+
- documentation/enum_json.png
|
75
|
+
- documentation/ignored.png
|
76
|
+
- documentation/json.png
|
77
|
+
- documentation/primary_key.png
|
78
|
+
- documentation/read_only.png
|
79
|
+
- documentation/simple_entity.png
|
80
|
+
- documentation/support_annotation.png
|
81
|
+
- documentation/transformer.png
|
82
|
+
- documentation/transformers.png
|
29
83
|
- lib/gyro.rb
|
30
|
-
- lib/gyro/
|
31
|
-
- lib/gyro/
|
32
|
-
- lib/gyro/
|
33
|
-
- lib/gyro/
|
34
|
-
- lib/gyro/
|
35
|
-
- lib/gyro/
|
36
|
-
- lib/gyro/
|
37
|
-
- lib/gyro/
|
38
|
-
- lib/gyro/
|
39
|
-
- lib/gyro/
|
40
|
-
- lib/gyro/
|
41
|
-
- lib/gyro/
|
42
|
-
- lib/gyro/
|
43
|
-
- lib/
|
44
|
-
- lib/
|
45
|
-
- lib/
|
46
|
-
- lib/
|
47
|
-
- lib/
|
48
|
-
- lib/
|
49
|
-
- lib/
|
50
|
-
- lib/
|
51
|
-
- lib/
|
52
|
-
- lib/
|
53
|
-
|
84
|
+
- lib/gyro/generator/json.rb
|
85
|
+
- lib/gyro/generator/liquid.rb
|
86
|
+
- lib/gyro/generator/liquid/filters.rb
|
87
|
+
- lib/gyro/generator/liquid/liquid.rb
|
88
|
+
- lib/gyro/generator/liquid/whitespace_patch.rb
|
89
|
+
- lib/gyro/log.rb
|
90
|
+
- lib/gyro/parser/xcdatamodel.rb
|
91
|
+
- lib/gyro/parser/xcdatamodel/attribute.rb
|
92
|
+
- lib/gyro/parser/xcdatamodel/entity.rb
|
93
|
+
- lib/gyro/parser/xcdatamodel/relationship.rb
|
94
|
+
- lib/gyro/parser/xcdatamodel/xcdatamodel.rb
|
95
|
+
- lib/gyro/template.rb
|
96
|
+
- lib/gyro/version.rb
|
97
|
+
- lib/templates/android/README.md
|
98
|
+
- lib/templates/android/entity.liquid
|
99
|
+
- lib/templates/android/entity_filename.liquid
|
100
|
+
- lib/templates/android/enum.liquid
|
101
|
+
- lib/templates/android/enum_filename.liquid
|
102
|
+
- lib/templates/android/inc/_attributes_enum.liquid
|
103
|
+
- lib/templates/android/inc/_attributes_getter_setter.liquid
|
104
|
+
- lib/templates/android/inc/_attributes_properties.liquid
|
105
|
+
- lib/templates/android/inc/_enum_getter_setter.liquid
|
106
|
+
- lib/templates/android/inc/_primitives.liquid
|
107
|
+
- lib/templates/android/inc/_relationships_enum.liquid
|
108
|
+
- lib/templates/android/inc/_relationships_getter_setter.liquid
|
109
|
+
- lib/templates/android/inc/_relationships_properties.liquid
|
110
|
+
- lib/templates/android/inc/_type_converter.liquid
|
111
|
+
- lib/templates/android/inc/_wrapper_type_converter.liquid
|
112
|
+
- lib/templates/decodable/README.md
|
113
|
+
- lib/templates/decodable/entity.liquid
|
114
|
+
- lib/templates/decodable/entity_filename.liquid
|
115
|
+
- lib/templates/decodable/enum.liquid
|
116
|
+
- lib/templates/decodable/enum_filename.liquid
|
117
|
+
- lib/templates/object-mapper/README.md
|
118
|
+
- lib/templates/object-mapper/entity.liquid
|
119
|
+
- lib/templates/object-mapper/entity_filename.liquid
|
120
|
+
- lib/templates/object-mapper/enum.liquid
|
121
|
+
- lib/templates/object-mapper/enum_filename.liquid
|
122
|
+
- lib/templates/swift3-variant/README.md
|
123
|
+
- lib/templates/swift3-variant/entity.liquid
|
124
|
+
- lib/templates/swift3-variant/entity_filename.liquid
|
125
|
+
- lib/templates/swift3-variant/enum.liquid
|
126
|
+
- lib/templates/swift3-variant/enum_filename.liquid
|
127
|
+
- lib/templates/swift3-variant/inc/_attributes_enum.liquid
|
128
|
+
- lib/templates/swift3-variant/inc/_attributes_properties.liquid
|
129
|
+
- lib/templates/swift3-variant/inc/_default_value_converter.liquid
|
130
|
+
- lib/templates/swift3-variant/inc/_enum_attribute_property.liquid
|
131
|
+
- lib/templates/swift3-variant/inc/_ignored_properties.liquid
|
132
|
+
- lib/templates/swift3-variant/inc/_indexed_properties.liquid
|
133
|
+
- lib/templates/swift3-variant/inc/_inverse_properties.liquid
|
134
|
+
- lib/templates/swift3-variant/inc/_optional_attribute_property.liquid
|
135
|
+
- lib/templates/swift3-variant/inc/_primary_key.liquid
|
136
|
+
- lib/templates/swift3-variant/inc/_relationship_properties.liquid
|
137
|
+
- lib/templates/swift3-variant/inc/_relationships_enum.liquid
|
138
|
+
- lib/templates/swift3-variant/inc/_type_converter.liquid
|
139
|
+
- lib/templates/swift3/README.md
|
140
|
+
- lib/templates/swift3/entity.liquid
|
141
|
+
- lib/templates/swift3/entity_filename.liquid
|
142
|
+
- lib/templates/swift3/enum.liquid
|
143
|
+
- lib/templates/swift3/enum_filename.liquid
|
144
|
+
- lib/templates/swift3/inc/_attributes_enum.liquid
|
145
|
+
- lib/templates/swift3/inc/_attributes_properties.liquid
|
146
|
+
- lib/templates/swift3/inc/_default_value_converter.liquid
|
147
|
+
- lib/templates/swift3/inc/_enum_attribute_property.liquid
|
148
|
+
- lib/templates/swift3/inc/_ignored_properties.liquid
|
149
|
+
- lib/templates/swift3/inc/_indexed_properties.liquid
|
150
|
+
- lib/templates/swift3/inc/_inverse_properties.liquid
|
151
|
+
- lib/templates/swift3/inc/_optional_attribute_property.liquid
|
152
|
+
- lib/templates/swift3/inc/_primary_key.liquid
|
153
|
+
- lib/templates/swift3/inc/_relationship_properties.liquid
|
154
|
+
- lib/templates/swift3/inc/_relationships_enum.liquid
|
155
|
+
- lib/templates/swift3/inc/_type_converter.liquid
|
156
|
+
homepage: https://github.com/NijiDigital/gyro
|
54
157
|
licenses:
|
55
158
|
- Apache-2.0
|
56
159
|
metadata: {}
|
@@ -1,63 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
Copyright 2016 - Niji
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
=end
|
16
|
-
|
17
|
-
module Gyro
|
18
|
-
module Realm
|
19
|
-
module Java
|
20
|
-
module Converter
|
21
|
-
|
22
|
-
TYPES = {
|
23
|
-
:integer_16 => 'short',
|
24
|
-
:integer_32 => 'int',
|
25
|
-
:integer_64 => 'long',
|
26
|
-
:decimal => 'double',
|
27
|
-
:double => 'double',
|
28
|
-
:float => 'float',
|
29
|
-
:string => 'String',
|
30
|
-
:boolean => 'boolean',
|
31
|
-
:date => 'Date',
|
32
|
-
:binary => 'byte[]'
|
33
|
-
}
|
34
|
-
|
35
|
-
WRAPPER_TYPES = {
|
36
|
-
:integer_16 => 'Short',
|
37
|
-
:integer_32 => 'Integer',
|
38
|
-
:integer_64 => 'Long',
|
39
|
-
:decimal => 'Double',
|
40
|
-
:double => 'Double',
|
41
|
-
:float => 'Float',
|
42
|
-
:string => 'String',
|
43
|
-
:boolean => 'Boolean',
|
44
|
-
:date => 'Date',
|
45
|
-
:binary => 'Byte[]'
|
46
|
-
}
|
47
|
-
|
48
|
-
def convert_type(type, useWrapperClass)
|
49
|
-
if (useWrapperClass)
|
50
|
-
WRAPPER_TYPES[type]
|
51
|
-
else
|
52
|
-
TYPES[type]
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def is_primitive(type_str)
|
57
|
-
TYPES.has_value?(type_str) and type_str != "String" and type_str != "Date"
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|