wp-uppercrust 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +119 -0
- data/Rakefile +1 -0
- data/bin/uppercrust +3 -0
- data/features/generator.feature +10 -0
- data/features/support/setup.rb +1 -0
- data/lib/uppercrust.rb +6 -0
- data/lib/uppercrust/cli.rb +13 -0
- data/lib/uppercrust/generator.rb +46 -0
- data/lib/uppercrust/parser.rb +172 -0
- data/lib/uppercrust/tpl/base_header.mustache +18 -0
- data/lib/uppercrust/tpl/base_implementation.mustache +34 -0
- data/lib/uppercrust/tpl/header.mustache +4 -0
- data/lib/uppercrust/tpl/implementation.mustache +5 -0
- data/lib/uppercrust/version.rb +3 -0
- data/spec/application.json +29 -0
- data/spec/job.json +46 -0
- data/spec/sample.json +28 -0
- data/spec/uppercrust_spec.rb +11 -0
- data/tasks/rspec.rake +3 -0
- data/uppercrust.gemspec +29 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6134f4daae0df7f1954f30217b5e494ce7d07afe
|
4
|
+
data.tar.gz: 263237ed5901fb0417de3a8a9f18f6c91715933b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f984349e1cdb00c46f02265f873a2244d216406c296ad12b46a4aa889a9a0201589f0681c75f904888f96f8946f1716f0ca4501ff763c31267e6e658436762ac
|
7
|
+
data.tar.gz: 03f6c118d00e1c0af9517d85d91c553899af45d0ad488aae127e3f17282cc2f78c39d913a94b5d263e27256a75c8e34575680cf5c1ecb279a2227d3e08caf592
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
output/
|
24
|
+
.idea/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Jan Gorman
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# Uppercrust
|
2
|
+
|
3
|
+
Inspired by [jsonschema2pojo](https://github.com/joelittlejohn/jsonschema2pojo "jsonschema2pojo"), uppercrust is your trusty companion to generate [Mantle](https://github.com/github/Mantle "Mantle") compatible model files in Objective-C.
|
4
|
+
|
5
|
+
Uppercrust generates two header and two implementation files for each of your models. One set is prefixed with an underscore and is meant to be overwritten whenever the JSON schema changes. The files without underscore extends these classes and can be used to add custom functionality and custom mappings and should only be generated once.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem as:
|
10
|
+
|
11
|
+
$ gem install uppercrust
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
$ uppercrust generate --path {path} --base_only true|false
|
16
|
+
|
17
|
+
This generate an output folder with all the JSON files mapped to their Objective-C counterparts.
|
18
|
+
|
19
|
+
Say for example, you have a model file named 'article.json'. Running uppercrust will then generate 4 files for you:
|
20
|
+
|
21
|
+
* _Article.h
|
22
|
+
* _Article.m
|
23
|
+
* Article.h
|
24
|
+
* Article.m
|
25
|
+
|
26
|
+
Lets look at the following simple example:
|
27
|
+
|
28
|
+
```json
|
29
|
+
{
|
30
|
+
"type":"object",
|
31
|
+
"$schema":"http://json-schema.org/draft-03/schema",
|
32
|
+
"id":"Article",
|
33
|
+
"description":"Result object that represents an article.",
|
34
|
+
"required":true,
|
35
|
+
"additionalProperties":false,
|
36
|
+
"properties":{
|
37
|
+
"brand":{
|
38
|
+
"type":"string",
|
39
|
+
"id":"brand",
|
40
|
+
"required":true
|
41
|
+
},
|
42
|
+
"sku":{
|
43
|
+
"type":"string",
|
44
|
+
"id":"sku",
|
45
|
+
"required":true
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
```
|
50
|
+
|
51
|
+
_Article.h:
|
52
|
+
|
53
|
+
```objc
|
54
|
+
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
|
55
|
+
// Make changes to article.h instead.
|
56
|
+
//
|
57
|
+
// Result object that represents an article.
|
58
|
+
|
59
|
+
#import <Mantle/Mantle.h>
|
60
|
+
|
61
|
+
|
62
|
+
@interface _Article : MTLModel<MTLJSONSerializing>
|
63
|
+
|
64
|
+
@property(nonatomic, copy, readonly) NSString *brand;
|
65
|
+
@property(nonatomic, copy, readonly) NSString *sku;
|
66
|
+
|
67
|
+
@end
|
68
|
+
```
|
69
|
+
|
70
|
+
_Article.m:
|
71
|
+
```objc
|
72
|
+
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
|
73
|
+
// Make changes to Article.m instead.
|
74
|
+
|
75
|
+
#import "_Article.h"
|
76
|
+
|
77
|
+
@implementation _Article
|
78
|
+
|
79
|
+
+ (NSDictionary *)JSONKeyPathsByPropertyKey {
|
80
|
+
return @{
|
81
|
+
@"brand" : @"brand",
|
82
|
+
@"sku" : @"sku"
|
83
|
+
};
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
@end
|
88
|
+
```
|
89
|
+
|
90
|
+
Article.h:
|
91
|
+
```objc
|
92
|
+
#import "_Article.h"
|
93
|
+
|
94
|
+
@interface Article : _Article
|
95
|
+
@end
|
96
|
+
```
|
97
|
+
|
98
|
+
Article.m:
|
99
|
+
```objc
|
100
|
+
#import "Article.h"
|
101
|
+
|
102
|
+
@implementation Article
|
103
|
+
|
104
|
+
@end
|
105
|
+
```
|
106
|
+
|
107
|
+
## Contributing
|
108
|
+
|
109
|
+
1. Fork it
|
110
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
111
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
112
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
113
|
+
5. Create new Pull Request
|
114
|
+
|
115
|
+
## TODO
|
116
|
+
|
117
|
+
* Add tests!
|
118
|
+
* Add some special types to the schema since Foundation has a richer vocabulary
|
119
|
+
* Add the option to prefix the generated class names
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Dir.glob('tasks/**/*.rake').each(&method(:import))
|
data/bin/uppercrust
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: Generator
|
2
|
+
|
3
|
+
Scenario: I generate .h and .m files
|
4
|
+
When I run `uppercrust generate --path data --base_only true`
|
5
|
+
Then the following files should exist:
|
6
|
+
| output/_Article.h |
|
7
|
+
Then the file "output/_Article.h" should contain:
|
8
|
+
"""
|
9
|
+
Something
|
10
|
+
"""
|
@@ -0,0 +1 @@
|
|
1
|
+
require "aruba/cucumber"
|
data/lib/uppercrust.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "uppercrust"
|
3
|
+
|
4
|
+
module Uppercrust
|
5
|
+
class CLI < Thor
|
6
|
+
desc "generate files", "Generates .h and .m files from the given directory"
|
7
|
+
option :path, :required => true, :aliases => '-p'
|
8
|
+
option :base_only, :type => :boolean, :aliases => '-b'
|
9
|
+
def generate
|
10
|
+
puts Uppercrust::Generator.generate(options[:path], options[:base_only])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'mustache'
|
2
|
+
require 'json'
|
3
|
+
require 'uppercrust/parser'
|
4
|
+
|
5
|
+
module Uppercrust
|
6
|
+
|
7
|
+
class Generator
|
8
|
+
|
9
|
+
def self.generate(path, base_only)
|
10
|
+
unless File.readable?(path)
|
11
|
+
puts "Cannot read path #{path}"
|
12
|
+
return
|
13
|
+
end
|
14
|
+
|
15
|
+
files = read_files(path, base_only)
|
16
|
+
if files.length > 0
|
17
|
+
FileUtils.mkdir_p("output")
|
18
|
+
output = []
|
19
|
+
files.each do |generate|
|
20
|
+
puts "Generate #{generate.file_name}"
|
21
|
+
output << generate.generate_files
|
22
|
+
end
|
23
|
+
output.each do |generated|
|
24
|
+
generated.each { |name, contents| File.open(File.join("output", name), "w") { |f| f.write(contents) } }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.read_files(path, base_only)
|
30
|
+
files = File.file?(File.absolute_path(path)) ? [File.absolute_path(path)] : glob_dir_for_json(path)
|
31
|
+
|
32
|
+
output = []
|
33
|
+
files.each do |json_file|
|
34
|
+
data = JSON.parse(File.open(json_file, 'r') { |f| f.read })
|
35
|
+
output << Parser.new(json_file, data, base_only)
|
36
|
+
end
|
37
|
+
output
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.glob_dir_for_json(path)
|
41
|
+
Dir.glob(File.join(File.absolute_path(path), '**', '*.json'))
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
class Parser
|
4
|
+
|
5
|
+
attr_accessor :file_name
|
6
|
+
|
7
|
+
def initialize(file_name, data, base_only)
|
8
|
+
|
9
|
+
@file_name = file_name
|
10
|
+
@data = data
|
11
|
+
@base_only = base_only
|
12
|
+
|
13
|
+
@generated_class = self.snake_to_camel(File.basename(file_name, '.json'))
|
14
|
+
|
15
|
+
@properties = self.extract_properties(data['properties'])
|
16
|
+
@variable_names = self.extract_variable_names(data['properties'].keys)
|
17
|
+
@extends_class = self.extends_class(data)
|
18
|
+
@import = self.get_import(data)
|
19
|
+
@contains_classes = self.get_contains(data['properties'])
|
20
|
+
@array_converters = self.get_array_converters(data['properties'])
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_files
|
24
|
+
output = {}
|
25
|
+
|
26
|
+
output["_#{@generated_class}.h"] = Mustache.render(read_template('base_header'),
|
27
|
+
:class_name => @generated_class,
|
28
|
+
:extends_class => @extends_class,
|
29
|
+
:import => @import,
|
30
|
+
:contains => @contains_classes,
|
31
|
+
:description => @data['description'],
|
32
|
+
:properties => @properties)
|
33
|
+
|
34
|
+
output["_#{@generated_class}.m"] = Mustache.render(read_template('base_implementation'),
|
35
|
+
:class_name => @generated_class,
|
36
|
+
:properties => @variable_names,
|
37
|
+
:extends => !@import.nil?,
|
38
|
+
:array_converters => @array_converters)
|
39
|
+
|
40
|
+
unless @base_only
|
41
|
+
output["#{@generated_class}.h"] = Mustache.render(read_template('header'),
|
42
|
+
:class_name => @generated_class)
|
43
|
+
|
44
|
+
output["#{@generated_class}.m"] = Mustache.render(read_template('implementation'),
|
45
|
+
:class_name => @generated_class)
|
46
|
+
end
|
47
|
+
|
48
|
+
output
|
49
|
+
end
|
50
|
+
|
51
|
+
def read_template(template_name)
|
52
|
+
File.read("#{File.dirname(__FILE__)}/tpl/#{template_name}.mustache")
|
53
|
+
end
|
54
|
+
|
55
|
+
def get_contains(properties)
|
56
|
+
contains = []
|
57
|
+
|
58
|
+
properties.each do |name, type_info|
|
59
|
+
if self.match_type(type_info['type']) == 'NSArray' && type_info['items']['$ref'] != nil && type_info['items']['$ref'] != '#'
|
60
|
+
contains << "#import \"_#{self.snake_to_camel(Pathname.new(type_info['items']['$ref']).basename('.json').to_s)}.h\""
|
61
|
+
end
|
62
|
+
|
63
|
+
if self.match_type(type_info['type']) == 'NSObject' && type_info['$ref'] != nil && type_info['$ref'] != '#'
|
64
|
+
contains << "#import \"_#{self.snake_to_camel(Pathname.new(type_info['$ref']).basename('.json').to_s)}.h\""
|
65
|
+
end
|
66
|
+
end
|
67
|
+
contains.uniq
|
68
|
+
end
|
69
|
+
|
70
|
+
def get_array_converters(properties)
|
71
|
+
array_converters = []
|
72
|
+
|
73
|
+
properties.each do |name, type_info|
|
74
|
+
if self.match_type(type_info['type']) == 'NSArray' && type_info['items']['$ref'] != nil
|
75
|
+
extends = type_info['items']['$ref'] != '#' ? self.snake_to_camel(Pathname.new(type_info['items']['$ref']).basename('.json').to_s) : @generated_class
|
76
|
+
array_converters << "+ (NSValueTransformer *)#{name}JSONTransformer\n{\n return [NSValueTransformer mtl_JSONArrayTransformerWithModelClass:_#{extends}.class];\n}\n"
|
77
|
+
end
|
78
|
+
|
79
|
+
if self.match_type(type_info['type']) == 'NSObject' && type_info['$ref'] != nil
|
80
|
+
extends = type_info['$ref'] != '#' ? self.snake_to_camel(Pathname.new(type_info['$ref']).basename('.json').to_s) : @generated_class
|
81
|
+
array_converters << "+ (NSValueTransformer *)#{name}JSONTransformer\n{\n return [NSValueTransformer mtl_JSONDictionaryTransformerWithModelClass:_#{extends}.class];\n}\n"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
array_converters
|
86
|
+
end
|
87
|
+
|
88
|
+
def get_import(data)
|
89
|
+
if data['extends'].to_s == ''
|
90
|
+
nil
|
91
|
+
else
|
92
|
+
import = data['extends'].is_a?(String) ? '_' << self.snake_to_camel(data['extends'].sub('.json', '')) : '_' << self.snake_to_camel(File.basename(data['extends']['$ref'], '.json'))
|
93
|
+
"#import \"#{import}.h\""
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def extends_class(data)
|
98
|
+
if data['extends'].to_s == ''
|
99
|
+
'MTLModel<MTLJSONSerializing>'
|
100
|
+
else
|
101
|
+
if data['extends'].is_a? String
|
102
|
+
'_' << self.snake_to_camel(Pathname.new(data['extends']).basename('.json').to_s)
|
103
|
+
else
|
104
|
+
'_' << self.snake_to_camel(Pathname.new(data['extends']['$ref']).basename('.json').to_s)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def extract_variable_names(keys)
|
110
|
+
extracted_variables_names = []
|
111
|
+
|
112
|
+
if keys.length > 1
|
113
|
+
last = keys.pop
|
114
|
+
keys.each { |key| extracted_variables_names << "@\"#{key}\" : @\"#{key}\"," }
|
115
|
+
extracted_variables_names << "@\"#{last}\" : @\"#{last}\""
|
116
|
+
else
|
117
|
+
extracted_variables_names << "@\"#{keys[0]}\" : @\"#{keys[0]}\""
|
118
|
+
end
|
119
|
+
|
120
|
+
extracted_variables_names
|
121
|
+
end
|
122
|
+
|
123
|
+
def extract_properties(properties)
|
124
|
+
extracted_properties = []
|
125
|
+
|
126
|
+
properties.each do |name, type_info|
|
127
|
+
type = match_type(type_info['type'])
|
128
|
+
|
129
|
+
if type == 'NSObject' && type_info['$ref'] != nil
|
130
|
+
extends = type_info['$ref'] != '#' ? self.snake_to_camel(Pathname.new(type_info['$ref']).basename('.json').to_s) : @generated_class
|
131
|
+
extracted_properties << "@property(#{self.copy_type(type) ? 'copy' : 'assign'}, nonatomic, readonly) _#{extends} #{self.copy_type(type) ? '*' : ''}#{name};"
|
132
|
+
elsif type == 'NSString' && type_info['format'] == 'date-time'
|
133
|
+
extracted_properties << "@property(strong, nonatomic, readonly) NSDate *#{name};"
|
134
|
+
else
|
135
|
+
extracted_properties << "@property(#{self.copy_type(type) ? 'copy' : 'assign'}, nonatomic, readonly) #{type} #{self.copy_type(type) ? '*' : ''}#{name};"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
extracted_properties
|
140
|
+
end
|
141
|
+
|
142
|
+
def copy_type(type)
|
143
|
+
type != 'NSInteger' && type != 'BOOL'
|
144
|
+
end
|
145
|
+
|
146
|
+
def match_type(in_type)
|
147
|
+
case in_type
|
148
|
+
when 'string'
|
149
|
+
'NSString'
|
150
|
+
when 'number', 'long'
|
151
|
+
'NSNumber'
|
152
|
+
when 'integer'
|
153
|
+
'NSInteger'
|
154
|
+
when 'boolean'
|
155
|
+
'BOOL'
|
156
|
+
when 'object', 'any'
|
157
|
+
'NSObject'
|
158
|
+
when 'array'
|
159
|
+
'NSArray'
|
160
|
+
when 'null'
|
161
|
+
'NSNull'
|
162
|
+
else
|
163
|
+
'NSObject'
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def snake_to_camel(file_name)
|
168
|
+
prefix = "WP"
|
169
|
+
(file_name.split('_').length > 1) ? file_name.split('_').map { |w| w.capitalize }.join('') : prefix+file_name.capitalize
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
|
2
|
+
// Make changes to {{{class_name}}}.h instead.
|
3
|
+
//
|
4
|
+
// {{{description}}}
|
5
|
+
|
6
|
+
#import <Mantle/Mantle.h>
|
7
|
+
{{{import}}}
|
8
|
+
{{#contains}}
|
9
|
+
{{{.}}}
|
10
|
+
{{/contains}}
|
11
|
+
|
12
|
+
@interface _{{{class_name}}} : {{{extends_class}}}
|
13
|
+
|
14
|
+
{{#properties}}
|
15
|
+
{{{.}}}
|
16
|
+
{{/properties}}
|
17
|
+
|
18
|
+
@end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
|
2
|
+
// Make changes to {{{class_name}}}.m instead.
|
3
|
+
|
4
|
+
#import "_{{{class_name}}}.h"
|
5
|
+
{{#contains}}
|
6
|
+
{{{.}}}
|
7
|
+
{{/contains}}
|
8
|
+
|
9
|
+
@implementation _{{{class_name}}}
|
10
|
+
|
11
|
+
+ (NSDictionary *)JSONKeyPathsByPropertyKey {
|
12
|
+
{{#extends}}
|
13
|
+
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithDictionary:[super JSONKeyPathsByPropertyKey]];
|
14
|
+
[dictionary addEntriesFromDictionary:@{
|
15
|
+
{{#properties}}
|
16
|
+
{{{.}}}
|
17
|
+
{{/properties}}
|
18
|
+
}];
|
19
|
+
return dictionary;
|
20
|
+
{{/extends}}
|
21
|
+
{{^extends}}
|
22
|
+
return @{
|
23
|
+
{{#properties}}
|
24
|
+
{{{.}}}
|
25
|
+
{{/properties}}
|
26
|
+
};
|
27
|
+
{{/extends}}
|
28
|
+
}
|
29
|
+
|
30
|
+
{{#array_converters}}
|
31
|
+
{{{.}}}
|
32
|
+
{{/array_converters}}
|
33
|
+
|
34
|
+
@end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"id": "Application",
|
3
|
+
"title": "Application Schema",
|
4
|
+
"type": "object",
|
5
|
+
"properties": {
|
6
|
+
"_id": {
|
7
|
+
"description": "id of application",
|
8
|
+
"type": "string"
|
9
|
+
},
|
10
|
+
"jobId": {
|
11
|
+
"description": "id of job for application",
|
12
|
+
"type": "string"
|
13
|
+
},
|
14
|
+
"legacyApplicationId": {
|
15
|
+
"description": "legacy id of application",
|
16
|
+
"type": "string"
|
17
|
+
},
|
18
|
+
"log": {
|
19
|
+
"description": "logs of updates to application",
|
20
|
+
"type": "array",
|
21
|
+
"items": { "$ref": "applicationLog.json" }
|
22
|
+
},
|
23
|
+
"candidateId": {
|
24
|
+
"description": "user id of applicant",
|
25
|
+
"type": "string"
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"required": []
|
29
|
+
}
|
data/spec/job.json
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
{
|
2
|
+
"id": "Job",
|
3
|
+
"title": "Job Schema",
|
4
|
+
"type": "object",
|
5
|
+
"properties": {
|
6
|
+
"_id": {
|
7
|
+
"description": "id of job",
|
8
|
+
"type": "string"
|
9
|
+
},
|
10
|
+
"description": {
|
11
|
+
"properties": {
|
12
|
+
"position": {
|
13
|
+
"type": "string"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"employer": {
|
18
|
+
"properties": {
|
19
|
+
"name": {
|
20
|
+
"type": "string"
|
21
|
+
},
|
22
|
+
"location": {
|
23
|
+
"properties": {
|
24
|
+
"city": {
|
25
|
+
"type": "string"
|
26
|
+
},
|
27
|
+
"postal_code": {
|
28
|
+
"type": "string"
|
29
|
+
},
|
30
|
+
"state_code": {
|
31
|
+
"type": "string"
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
},
|
37
|
+
"hiringManager": {
|
38
|
+
"properties": {
|
39
|
+
"_id": {
|
40
|
+
"type": "string"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
},
|
45
|
+
"required": []
|
46
|
+
}
|
data/spec/sample.json
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
{
|
2
|
+
"id": "Tags",
|
3
|
+
"title": "MessageTags Schema",
|
4
|
+
"type": "object",
|
5
|
+
"properties": {
|
6
|
+
"jobs": {
|
7
|
+
"type": "array",
|
8
|
+
"items": { "$ref": "/job.json" }
|
9
|
+
},
|
10
|
+
"applications": {
|
11
|
+
"type": "array",
|
12
|
+
"items": { "$ref": "/application.json" }
|
13
|
+
},
|
14
|
+
"applicationStatus": {
|
15
|
+
"type": "string"
|
16
|
+
},
|
17
|
+
"employerName": {
|
18
|
+
"type": "string"
|
19
|
+
},
|
20
|
+
"position": {
|
21
|
+
"type": "string"
|
22
|
+
},
|
23
|
+
"locationCity": {
|
24
|
+
"type": "string"
|
25
|
+
}
|
26
|
+
},
|
27
|
+
"required": []
|
28
|
+
}
|
data/tasks/rspec.rake
ADDED
data/uppercrust.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'uppercrust/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "wp-uppercrust"
|
8
|
+
spec.version = Uppercrust::VERSION
|
9
|
+
spec.authors = ["Jan Gorman"]
|
10
|
+
spec.email = ["gorman.jan@gmail.com"]
|
11
|
+
spec.summary = %q{Convert your JSON schema files to Mantle compatible Objective-C models}
|
12
|
+
spec.description = %q{Convert your JSON schema files to Mantle compatible Objective-C models}
|
13
|
+
spec.homepage = "https://github.com/JanGorman/uppercrust/"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "thor"
|
22
|
+
spec.add_dependency "mustache"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rspec", "~> 2.6"
|
27
|
+
spec.add_development_dependency "cucumber"
|
28
|
+
spec.add_development_dependency "aruba"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wp-uppercrust
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jan Gorman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mustache
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.6'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.6'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: cucumber
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: aruba
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Convert your JSON schema files to Mantle compatible Objective-C models
|
112
|
+
email:
|
113
|
+
- gorman.jan@gmail.com
|
114
|
+
executables:
|
115
|
+
- uppercrust
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- Gemfile
|
121
|
+
- LICENSE.txt
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- bin/uppercrust
|
125
|
+
- features/generator.feature
|
126
|
+
- features/support/setup.rb
|
127
|
+
- lib/uppercrust.rb
|
128
|
+
- lib/uppercrust/cli.rb
|
129
|
+
- lib/uppercrust/generator.rb
|
130
|
+
- lib/uppercrust/parser.rb
|
131
|
+
- lib/uppercrust/tpl/base_header.mustache
|
132
|
+
- lib/uppercrust/tpl/base_implementation.mustache
|
133
|
+
- lib/uppercrust/tpl/header.mustache
|
134
|
+
- lib/uppercrust/tpl/implementation.mustache
|
135
|
+
- lib/uppercrust/version.rb
|
136
|
+
- spec/application.json
|
137
|
+
- spec/job.json
|
138
|
+
- spec/sample.json
|
139
|
+
- spec/uppercrust_spec.rb
|
140
|
+
- tasks/rspec.rake
|
141
|
+
- uppercrust.gemspec
|
142
|
+
homepage: https://github.com/JanGorman/uppercrust/
|
143
|
+
licenses:
|
144
|
+
- MIT
|
145
|
+
metadata: {}
|
146
|
+
post_install_message:
|
147
|
+
rdoc_options: []
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
requirements: []
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 2.5.1
|
163
|
+
signing_key:
|
164
|
+
specification_version: 4
|
165
|
+
summary: Convert your JSON schema files to Mantle compatible Objective-C models
|
166
|
+
test_files:
|
167
|
+
- features/generator.feature
|
168
|
+
- features/support/setup.rb
|
169
|
+
- spec/application.json
|
170
|
+
- spec/job.json
|
171
|
+
- spec/sample.json
|
172
|
+
- spec/uppercrust_spec.rb
|