KMQToolKitGem 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +50 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/KMQToolKitGem.gemspec +36 -0
- data/LICENSE.txt +21 -0
- data/README.md +38 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/kmqtoolkitcodegen +5 -0
- data/bin/setup +7 -0
- data/lib/KMQToolKitGem.rb +6 -0
- data/lib/KMQToolKitGem/cli.rb +38 -0
- data/lib/KMQToolKitGem/error_plist_generator.rb +119 -0
- data/lib/KMQToolKitGem/helper.rb +17 -0
- data/lib/KMQToolKitGem/version.rb +3 -0
- data/sample/errors.plist +136 -0
- data/templates/NSError+ErrorCode.h.erb +13 -0
- data/templates/NSError+ErrorCode.m.erb +13 -0
- data/templates/NSError+ErrorDomain.h.erb +7 -0
- data/templates/NSError+ErrorDomain.m.erb +7 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c5352c3f79c80929eef89773c0766314eaec0a01
|
4
|
+
data.tar.gz: f341741164d2584ad54c6deec511574dbd5f17c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9afb54d8846f530d84d998993d4bd072d7ebcce41269ab5ea7305869ffb42dbb2a0976de4ea2a0b62fc841fbda8b9fbc1f660b0635603c077152082f6a2c408d
|
7
|
+
data.tar.gz: 9c1a8293727ac9890352184c95658610a30dd5133b739a1746c3a59287c7d08714505d3b0fb82e1a50361393021cbb8c849c8c7f42497a74795a1dcfc26e312e
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
|
11
|
+
# Created by https://www.gitignore.io/api/ruby
|
12
|
+
|
13
|
+
### Ruby ###
|
14
|
+
*.gem
|
15
|
+
*.rbc
|
16
|
+
/.config
|
17
|
+
/coverage/
|
18
|
+
/InstalledFiles
|
19
|
+
/pkg/
|
20
|
+
/spec/reports/
|
21
|
+
/spec/examples.txt
|
22
|
+
/test/tmp/
|
23
|
+
/test/version_tmp/
|
24
|
+
/tmp/
|
25
|
+
|
26
|
+
## Specific to RubyMotion:
|
27
|
+
.dat*
|
28
|
+
.repl_history
|
29
|
+
build/
|
30
|
+
|
31
|
+
## Documentation cache and generated files:
|
32
|
+
/.yardoc/
|
33
|
+
/_yardoc/
|
34
|
+
/doc/
|
35
|
+
/rdoc/
|
36
|
+
|
37
|
+
## Environment normalisation:
|
38
|
+
/.bundle/
|
39
|
+
/vendor/bundle
|
40
|
+
/lib/bundler/man/
|
41
|
+
|
42
|
+
# for a library or gem, you might want to ignore these files since the code is
|
43
|
+
# intended to run in multiple environments; otherwise, check them in:
|
44
|
+
# Gemfile.lock
|
45
|
+
# .ruby-version
|
46
|
+
# .ruby-gemset
|
47
|
+
|
48
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
49
|
+
.rvmrc
|
50
|
+
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'KMQToolKitGem/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "KMQToolKitGem"
|
8
|
+
spec.version = KMQToolKitGem::VERSION
|
9
|
+
spec.authors = ["Weinan Qiu"]
|
10
|
+
spec.email = ["davidiamyou@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Code generation support for KMQToolKit}
|
13
|
+
spec.description = %q{Generate necessary Objective-C headers and implementation files to support development using KMQToolKit}
|
14
|
+
spec.homepage = "https://github.com/davidiamyou/KMQToolKitGem"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# # delete this section to allow pushing this gem to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
# end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_dependency 'thor'
|
31
|
+
spec.add_dependency 'plist', '~> 3.1'
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "rspec"
|
36
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Weinan Qiu
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# KMQToolKitGem
|
2
|
+
|
3
|
+
[![CI Status](https://travis-ci.org/davidiamyou/KMQToolKitGem.svg?branch=master)](https://travis-ci.org/davidiamyou/KMQToolKitGem)
|
4
|
+
[![Version](https://img.shields.io/gem/v/KMQToolKitGem.svg?style=flat)](https://github.com/davidiamyou/KMQToolKitGem)
|
5
|
+
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/davidiamyou/KMQToolKitGem)
|
6
|
+
|
7
|
+
Code generation assistant for [KMQToolKit](https://github.com/davidiamyou/KMQToolKit)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'KMQToolKitGem'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install KMQToolKitGem
|
24
|
+
|
25
|
+
## Example Usage
|
26
|
+
|
27
|
+
```bash
|
28
|
+
kmqtoolkitcodegen errorgen --prefix KMQ --path ~/Desktop sample/errors.plist
|
29
|
+
```
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/KMQToolKitGem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
34
|
+
|
35
|
+
|
36
|
+
## License
|
37
|
+
|
38
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "KMQToolKitGem"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'plist'
|
3
|
+
require_relative 'error_plist_generator'
|
4
|
+
|
5
|
+
module KMQToolKitCodeGen
|
6
|
+
|
7
|
+
class CodeGeneration < Thor
|
8
|
+
|
9
|
+
# ---------------------------
|
10
|
+
# Error plist code generation
|
11
|
+
# ---------------------------
|
12
|
+
desc "errorgen PLIST", "This will generate files based on the provided error plist"
|
13
|
+
long_desc <<-EOF
|
14
|
+
TODO
|
15
|
+
EOF
|
16
|
+
method_options :prefix => :string, :path => :string
|
17
|
+
def errorgen( plist )
|
18
|
+
prefix = options[:prefix] || ""
|
19
|
+
base_path = options[:path] || "./"
|
20
|
+
plist_hash = Plist::parse_xml(plist)
|
21
|
+
|
22
|
+
generator = ErrorPlistGenerator.new plist_hash, prefix, base_path
|
23
|
+
generator.generate_domain
|
24
|
+
generator.generate_error_code
|
25
|
+
end
|
26
|
+
|
27
|
+
# ---------------------------
|
28
|
+
# Color plist code generation
|
29
|
+
# ---------------------------
|
30
|
+
desc "colorgen PLIST", "This will generate files based on provided color plist"
|
31
|
+
method_options :prefix => :string, :path => :string
|
32
|
+
def colorgen(plist)
|
33
|
+
puts "Hello World"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
class ErrorPlistGenerator
|
5
|
+
attr_reader :plist_hash, :prefix, :base_path
|
6
|
+
|
7
|
+
def initialize(plist_hash, prefix, base_path)
|
8
|
+
@plist_hash = plist_hash
|
9
|
+
@prefix = prefix
|
10
|
+
@base_path = base_path
|
11
|
+
check
|
12
|
+
end
|
13
|
+
|
14
|
+
# Check the input
|
15
|
+
def check
|
16
|
+
if !@plist_hash.is_a?(Hash)
|
17
|
+
raise RuntimeError, 'Invalid plist format'
|
18
|
+
end
|
19
|
+
|
20
|
+
@plist_hash.each do |domain_key, errors_hash|
|
21
|
+
if !errors_hash.is_a?(Hash)
|
22
|
+
raise RuntimeError, 'Invalid plist format'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Generate the NSError+ErrorCode files
|
28
|
+
def generate_error_code
|
29
|
+
numeric_keys = extract_numeric_keys
|
30
|
+
if numeric_keys.empty?
|
31
|
+
numeric_keys << 99
|
32
|
+
end
|
33
|
+
|
34
|
+
codes = extract_and_allocate_text_keys_to_numeric numeric_keys
|
35
|
+
create_error_code_file codes, 'h'
|
36
|
+
create_error_code_file codes, 'm'
|
37
|
+
end
|
38
|
+
|
39
|
+
# Generic NSError+ErrorCode.h and NSError+ErrorCode.m
|
40
|
+
def create_error_code_file(codes, type)
|
41
|
+
file_name = "NSError+#{@prefix}ErrorCode.#{type}"
|
42
|
+
template_path = "#{Dir.pwd}/templates/NSError+ErrorCode.#{type}.erb"
|
43
|
+
absolute_file_path = "#{@base_path}/#{file_name}"
|
44
|
+
variables = OpenStruct.new(codes: codes, prefix: @prefix)
|
45
|
+
Helper.write_to_file(absolute_file_path, template_path, variables.instance_eval{ binding })
|
46
|
+
end
|
47
|
+
|
48
|
+
# Generate NSError+ErrorDomain files
|
49
|
+
def generate_domain
|
50
|
+
domains = @plist_hash.keys
|
51
|
+
create_error_domain_file domains, 'h'
|
52
|
+
create_error_domain_file domains, 'm'
|
53
|
+
end
|
54
|
+
|
55
|
+
# Generic NSError+ErrorDomain.h and NSError+ErrorDomain.m
|
56
|
+
def create_error_domain_file(domains, type)
|
57
|
+
file_name = "NSError+#{@prefix}ErrorDomain.#{type}"
|
58
|
+
template_path = "#{Dir.pwd}/templates/NSError+ErrorDomain.#{type}.erb"
|
59
|
+
absolute_file_path = "#{@base_path}/#{file_name}"
|
60
|
+
variables = OpenStruct.new(domains: domains, prefix: @prefix)
|
61
|
+
Helper.write_to_file(absolute_file_path, template_path, variables.instance_eval{ binding })
|
62
|
+
end
|
63
|
+
|
64
|
+
# Extract numeric error key out. It will serve as a reference when we generate
|
65
|
+
# numeric key for textual error keys.
|
66
|
+
#
|
67
|
+
# Returns: extracted numeric keys from plist
|
68
|
+
def extract_numeric_keys
|
69
|
+
numeric_keys = []
|
70
|
+
@plist_hash.each do |domain_key, errors_hash|
|
71
|
+
errors_hash.each do |error_key, error_user_info|
|
72
|
+
error_key_name = error_key.split(":")[0]
|
73
|
+
if Helper.is_integer? error_key_name
|
74
|
+
numeric_keys << error_key_name.to_i
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
return numeric_keys
|
79
|
+
end
|
80
|
+
|
81
|
+
# Extract the textual keys from input and assign them numeric values, using
|
82
|
+
# the already extacted numeric error keys as a reference. The assigned numeric
|
83
|
+
# keys shall be greater than the minimum extracted numeric key and does not
|
84
|
+
# collide with already used numeric key
|
85
|
+
#
|
86
|
+
# Returns: A hash keyed by the textual key and an array containing error domain
|
87
|
+
# and generated numeric key as value.
|
88
|
+
def extract_and_allocate_text_keys_to_numeric(numeric_keys)
|
89
|
+
codes = {}
|
90
|
+
@plist_hash.each do |domain_key, errors_hash|
|
91
|
+
text_keys = []
|
92
|
+
errors_hash.each do |error_key, error_user_info|
|
93
|
+
error_key_name = error_key.split(":")[0]
|
94
|
+
if !Helper.is_integer?(error_key_name)
|
95
|
+
text_keys << error_key_name
|
96
|
+
end
|
97
|
+
end
|
98
|
+
text_keys.each do |text_key|
|
99
|
+
code = next_available_numeric numeric_keys
|
100
|
+
codes[text_key] = [domain_key, code]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
return codes
|
104
|
+
end
|
105
|
+
|
106
|
+
# Find the next availblae numeric given a numeric array. The found numeric
|
107
|
+
# shall be greater than the minimum and does not collide with existing numeric.
|
108
|
+
#
|
109
|
+
# Return: the next available numeric
|
110
|
+
def next_available_numeric(numeric_keys)
|
111
|
+
i = numeric_keys.min
|
112
|
+
while numeric_keys.include?(i) do
|
113
|
+
i += 1
|
114
|
+
end
|
115
|
+
numeric_keys << i
|
116
|
+
return i
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
class Helper
|
4
|
+
|
5
|
+
def self.is_integer?(string)
|
6
|
+
true if Integer(string) rescue false
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.write_to_file(absolute_file_path, template_path, bindings)
|
10
|
+
template = ERB.new File.new(template_path).read, nil, "%"
|
11
|
+
File.open(absolute_file_path, 'w') do |f|
|
12
|
+
text = template.result bindings
|
13
|
+
f.write text
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/sample/errors.plist
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<!--
|
4
|
+
Error.plist
|
5
|
+
BlocQuery
|
6
|
+
|
7
|
+
Created by Weinan Qiu on 2015-10-16.
|
8
|
+
Copyright (c) 2015 Kumiq. All rights reserved.
|
9
|
+
-->
|
10
|
+
<plist version="1.0">
|
11
|
+
<dict>
|
12
|
+
<key>Parse</key>
|
13
|
+
<dict>
|
14
|
+
<key>101:login</key>
|
15
|
+
<dict>
|
16
|
+
<key>description</key>
|
17
|
+
<string>Login failed.</string>
|
18
|
+
<key>reason</key>
|
19
|
+
<string>Login parameters are invalid.</string>
|
20
|
+
<key>recovery</key>
|
21
|
+
<string>Oops! We did not find your account. Please make sure email and password are correct.</string>
|
22
|
+
</dict>
|
23
|
+
<key>200:*</key>
|
24
|
+
<dict>
|
25
|
+
<key>description</key>
|
26
|
+
<string>Username is missing.</string>
|
27
|
+
<key>reason</key>
|
28
|
+
<string>Username is missing.</string>
|
29
|
+
<key>recovery</key>
|
30
|
+
<string>Please provide a username.</string>
|
31
|
+
</dict>
|
32
|
+
<key>201:*</key>
|
33
|
+
<dict>
|
34
|
+
<key>description</key>
|
35
|
+
<string>Password is missing.</string>
|
36
|
+
<key>reason</key>
|
37
|
+
<string>Password is missing.</string>
|
38
|
+
<key>recovery</key>
|
39
|
+
<string>Please provide a password.</string>
|
40
|
+
</dict>
|
41
|
+
<key>202:*</key>
|
42
|
+
<dict>
|
43
|
+
<key>description</key>
|
44
|
+
<string>Username is taken.</string>
|
45
|
+
<key>reason</key>
|
46
|
+
<string>Username is taken.</string>
|
47
|
+
<key>recovery</key>
|
48
|
+
<string>Username is taken. Please choose another username.</string>
|
49
|
+
</dict>
|
50
|
+
<key>203:*</key>
|
51
|
+
<dict>
|
52
|
+
<key>description</key>
|
53
|
+
<string>Email is taken.</string>
|
54
|
+
<key>reason</key>
|
55
|
+
<string>Email is taken.</string>
|
56
|
+
<key>recovery</key>
|
57
|
+
<string>Email is taken. Please log in if you have already registered.</string>
|
58
|
+
</dict>
|
59
|
+
<key>204:*</key>
|
60
|
+
<dict>
|
61
|
+
<key>description</key>
|
62
|
+
<string>Email is missing.</string>
|
63
|
+
<key>reason</key>
|
64
|
+
<string>Email is missing.</string>
|
65
|
+
<key>recovery</key>
|
66
|
+
<string>Email is missing. Please provide your email.</string>
|
67
|
+
</dict>
|
68
|
+
<key>205:*</key>
|
69
|
+
<dict>
|
70
|
+
<key>description</key>
|
71
|
+
<string>User with email not found.</string>
|
72
|
+
<key>reason</key>
|
73
|
+
<string>User with email not found.</string>
|
74
|
+
<key>recovery</key>
|
75
|
+
<string>We don't have a user with this email on record.</string>
|
76
|
+
</dict>
|
77
|
+
</dict>
|
78
|
+
<key>BlocQuery</key>
|
79
|
+
<dict>
|
80
|
+
<key>EmailValidationFailed:*</key>
|
81
|
+
<dict>
|
82
|
+
<key>description</key>
|
83
|
+
<string>Email validation failed.</string>
|
84
|
+
<key>reason</key>
|
85
|
+
<string>Email does not pass regular expression test.</string>
|
86
|
+
<key>recovery</key>
|
87
|
+
<string>Please provide a valid email address.</string>
|
88
|
+
</dict>
|
89
|
+
<key>PasswordValidationFailed:*</key>
|
90
|
+
<dict>
|
91
|
+
<key>description</key>
|
92
|
+
<string>Password validation failed.</string>
|
93
|
+
<key>reason</key>
|
94
|
+
<string>Password does not pass regular expression test.</string>
|
95
|
+
<key>recovery</key>
|
96
|
+
<string>Please provide a password of 8 to 16 characters in length and contains at least one numeric character.</string>
|
97
|
+
</dict>
|
98
|
+
<key>FirstNameValidationFailed:*</key>
|
99
|
+
<dict>
|
100
|
+
<key>description</key>
|
101
|
+
<string>FirstName validation failed.</string>
|
102
|
+
<key>reason</key>
|
103
|
+
<string>FirstName cannot be null.</string>
|
104
|
+
<key>recovery</key>
|
105
|
+
<string>Please tell us your first name.</string>
|
106
|
+
</dict>
|
107
|
+
<key>LastNameValidationFailed:*</key>
|
108
|
+
<dict>
|
109
|
+
<key>description</key>
|
110
|
+
<string>LastName validation failed.</string>
|
111
|
+
<key>reason</key>
|
112
|
+
<string>LastName cannot be null.</string>
|
113
|
+
<key>recovery</key>
|
114
|
+
<string>Please tell us your last name.</string>
|
115
|
+
</dict>
|
116
|
+
<key>TextInsufficientLength:*</key>
|
117
|
+
<dict>
|
118
|
+
<key>description</key>
|
119
|
+
<string>Text validation failed</string>
|
120
|
+
<key>reason</key>
|
121
|
+
<string>Insufficient length</string>
|
122
|
+
<key>recovery</key>
|
123
|
+
<string>Please provide a question of at least {{count}} characters.</string>
|
124
|
+
</dict>
|
125
|
+
<key>GetGravatarFailed:*</key>
|
126
|
+
<dict>
|
127
|
+
<key>description</key>
|
128
|
+
<string>Get Gravatar failed</string>
|
129
|
+
<key>reason</key>
|
130
|
+
<string>Gravatar.com did not return any data</string>
|
131
|
+
<key>recovery</key>
|
132
|
+
<string>We couldn't locate your Gravatar. Please make sure you have registered gravatar.com with the same email you registered with us.</string>
|
133
|
+
</dict>
|
134
|
+
</dict>
|
135
|
+
</dict>
|
136
|
+
</plist>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
|
3
|
+
typedef NS_ENUM(NSInteger, <%= prefix %>ErrorCode) {
|
4
|
+
<% codes.each do |k, v| %>
|
5
|
+
k<%= v[0] %>Error<%= k %> = <%= v[1] %>,
|
6
|
+
<% end %>
|
7
|
+
};
|
8
|
+
|
9
|
+
@interface NSError (<%= prefix %>ErrorCode)
|
10
|
+
|
11
|
+
+ (NSDictionary *)errorNameCodeMapping;
|
12
|
+
|
13
|
+
@end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: KMQToolKitGem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Weinan Qiu
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-27 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: plist
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.1'
|
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.10'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.10'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.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: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Generate necessary Objective-C headers and implementation files to support
|
84
|
+
development using KMQToolKit
|
85
|
+
email:
|
86
|
+
- davidiamyou@gmail.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- .rspec
|
93
|
+
- .travis.yml
|
94
|
+
- CODE_OF_CONDUCT.md
|
95
|
+
- Gemfile
|
96
|
+
- KMQToolKitGem.gemspec
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- bin/console
|
101
|
+
- bin/kmqtoolkitcodegen
|
102
|
+
- bin/setup
|
103
|
+
- lib/KMQToolKitGem.rb
|
104
|
+
- lib/KMQToolKitGem/cli.rb
|
105
|
+
- lib/KMQToolKitGem/error_plist_generator.rb
|
106
|
+
- lib/KMQToolKitGem/helper.rb
|
107
|
+
- lib/KMQToolKitGem/version.rb
|
108
|
+
- sample/errors.plist
|
109
|
+
- templates/NSError+ErrorCode.h.erb
|
110
|
+
- templates/NSError+ErrorCode.m.erb
|
111
|
+
- templates/NSError+ErrorDomain.h.erb
|
112
|
+
- templates/NSError+ErrorDomain.m.erb
|
113
|
+
homepage: https://github.com/davidiamyou/KMQToolKitGem
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.0.14
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Code generation support for KMQToolKit
|
137
|
+
test_files: []
|