ginny 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.vscode/settings.json +13 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/README.md +11 -10
- data/Rakefile +36 -0
- data/lib/ginny/models/class.rb +9 -2
- data/lib/ginny/version.rb +1 -1
- data/schema/attr.schema.json +32 -0
- data/schema/attr.schema.yml +23 -0
- data/schema/class.schema.json +54 -0
- data/schema/class.schema.yml +39 -0
- data/schema/func.schema.json +42 -0
- data/schema/func.schema.yml +30 -0
- data/schema/param.schema.json +36 -0
- data/schema/param.schema.yml +26 -0
- metadata +12 -5
- data/schema/ginny.json +0 -146
- data/schema/ginny.schema.yml +0 -107
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4722f6a584bcdf1a633f45f8ccac654d0df98bc09628049aa9b85f8c2b75508d
|
4
|
+
data.tar.gz: c04c92002b3108a6e5ef68409e8a0f7c91bbb869972f2a9ce8813ccb40411b69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69cd9320460faf929662696199ed79cd4d69463c7e0d7627ba716e16385eb42d3bd4a8e1e491429c20d0b9924ccc70808a50c737cc2b861c69bbe9a70cc48315
|
7
|
+
data.tar.gz: 8322f2ff0ae9419a3ecdcf09b71aa58f7eeb5f92643a91e210831a68cb7ba6384f7808e5dd50f73e69e4c8875f1402a6ffc1484e9f06fe935ff6fe001cf5ceb0
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
<!-- ## master (unreleased) -->
|
4
4
|
|
5
|
+
## 0.6.2 (2019-12-16)
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- Add `classify_name` option for `Ginny::Class`, which can disable the use of [`Dry::Inflector#classify`](https://github.com/dry-rb/dry-inflector#usage) on the class name.
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
|
13
|
+
- Updated JSON schemas.
|
14
|
+
|
5
15
|
## 0.6.1 (2019-12-14)
|
6
16
|
|
7
17
|
### Added
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
[rubygems]: https://rubygems.org/gems/ginny
|
10
10
|
[travis-ci]: https://travis-ci.org/tcd/ginny
|
11
11
|
[coveralls-ci]: https://coveralls.io/github/tcd/ginny?branch=master
|
12
|
-
[rubydoc-gem]: https://www.rubydoc.info/gems/ginny/0.6.
|
12
|
+
[rubydoc-gem]: https://www.rubydoc.info/gems/ginny/0.6.2
|
13
13
|
[license]: https://github.com/tcd/ginny/blob/master/LICENSE.txt
|
14
14
|
|
15
15
|
|
@@ -109,15 +109,16 @@ end
|
|
109
109
|
|
110
110
|
### `Ginny::Class`
|
111
111
|
|
112
|
-
| Name | Type |
|
113
|
-
| ------------------- | -------------------- |
|
114
|
-
| name (required) | `String` | Name of the class.
|
115
|
-
| description | `String` | Description of the class. [Markdown][markdown] is supported.
|
116
|
-
| body | `String` | String to write into the body of the class.
|
117
|
-
| parent | `String` | Name of a class to inherit from. (Ex: `YourNewClass < Parent`)
|
118
|
-
| modules | `Array<String>` | List of modules to declare the class inside of
|
119
|
-
| default_constructor | `Boolean` | If `true`, a method similar to [ActiveRecord::Base.create][create_method_link] will be generated for the class.
|
120
|
-
| attrs | `Array<Ginny::Attr>` | An array of
|
112
|
+
| Name | Type | Description |
|
113
|
+
| ------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
114
|
+
| name (required) | `String` | Name of the class. |
|
115
|
+
| description | `String` | Description of the class. [Markdown][markdown] is supported. |
|
116
|
+
| body | `String` | String to write into the body of the class. |
|
117
|
+
| parent | `String` | Name of a class to inherit from. (Ex: `YourNewClass < Parent`) |
|
118
|
+
| modules | `Array<String>` | List of modules to declare the class inside of |
|
119
|
+
| default_constructor | `Boolean` | If `true`, a method similar to [ActiveRecord::Base.create][create_method_link] will be generated for the class. |
|
120
|
+
| attrs | `Array<Ginny::Attr>` | An array of instance attributes. |
|
121
|
+
| classify_name | `Boolean` | By default, names are *classified* using [Dry::Inflector#classify](https://github.com/dry-rb/dry-inflector#usage). Set this to `false` to disable *classification* and use raw `name` input. |
|
121
122
|
|
122
123
|
[create_method_link]: https://apidock.com/rails/ActiveRecord/Persistence/ClassMethods/create
|
123
124
|
|
data/Rakefile
CHANGED
@@ -8,3 +8,39 @@ Rake::TestTask.new(:test) do |t|
|
|
8
8
|
end
|
9
9
|
|
10
10
|
task(default: :test)
|
11
|
+
|
12
|
+
require "json"
|
13
|
+
require "yaml"
|
14
|
+
|
15
|
+
# Convert a YAML file to JSON and write it out to a new file.
|
16
|
+
#
|
17
|
+
# @param path [String]
|
18
|
+
# @return [String]
|
19
|
+
def yaml2json(path, pretty: true)
|
20
|
+
path = File.expand_path(path)
|
21
|
+
ext = case File.extname(path).downcase
|
22
|
+
when ".yml" then ".yml"
|
23
|
+
when ".yaml" then ".yaml"
|
24
|
+
else ""
|
25
|
+
end
|
26
|
+
base_name = File.basename(path, ext)
|
27
|
+
dir = File.dirname(path)
|
28
|
+
out_file = File.join(dir, "#{base_name}.json")
|
29
|
+
input = YAML.load_file(path)
|
30
|
+
output = pretty ? JSON.pretty_generate(input) : input.to_json
|
31
|
+
File.open(out_file, "a") { |f| f.write(output) }
|
32
|
+
return out_file
|
33
|
+
end
|
34
|
+
|
35
|
+
task :yaml2json, [:path] do |_, arg|
|
36
|
+
yaml2json(arg[:path])
|
37
|
+
end
|
38
|
+
|
39
|
+
task :schema do |t|
|
40
|
+
[
|
41
|
+
"schema/class.schema.yml",
|
42
|
+
"schema/attr.schema.yml",
|
43
|
+
"schema/func.schema.yml",
|
44
|
+
"schema/param.schema.yml",
|
45
|
+
].each { |f| yaml2json(f) }
|
46
|
+
end
|
data/lib/ginny/models/class.rb
CHANGED
@@ -28,6 +28,10 @@ module Ginny
|
|
28
28
|
# String to prepend to the name of the generated file.
|
29
29
|
# @return [String]
|
30
30
|
attr_accessor :file_prefix
|
31
|
+
# By default, names are *classified* using [Dry::Inflector#classify](https://github.com/dry-rb/dry-inflector#usage).
|
32
|
+
# Set this to `false` to disable *classification* and use raw `name` input.
|
33
|
+
# @return [Boolean]
|
34
|
+
attr_accessor :classify_name
|
31
35
|
|
32
36
|
# @return [void]
|
33
37
|
def initialize()
|
@@ -36,6 +40,7 @@ module Ginny
|
|
36
40
|
self.file_prefix = ""
|
37
41
|
self.body = ""
|
38
42
|
self.default_constructor = false
|
43
|
+
self.classify_name = true
|
39
44
|
end
|
40
45
|
|
41
46
|
# Constructor for a Class. Use `create`, not `new`.
|
@@ -51,6 +56,7 @@ module Ginny
|
|
51
56
|
c.attrs = Ginny::Attr.from_array(args[:attrs]) if args[:attrs]&.is_a?(Array)
|
52
57
|
c.body = args[:body] unless args[:body].nil?
|
53
58
|
c.file_prefix = args[:file_prefix] || ""
|
59
|
+
c.classify_name = args[:classify_name] unless args[:classify_name].nil?
|
54
60
|
c.default_constructor = args[:default_constructor]
|
55
61
|
return c
|
56
62
|
end
|
@@ -74,7 +80,6 @@ module Ginny
|
|
74
80
|
parts << (self.parent.nil? ? "class #{self.class_name()}" : "class #{self.class_name()} < #{self.parent}")
|
75
81
|
parts << self.render_attributes()
|
76
82
|
parts << self.render_body()
|
77
|
-
# parts << (self.body&.length&.positive? ? self.body.indent(2) : nil)
|
78
83
|
parts << "end"
|
79
84
|
if self.modules.length > 0
|
80
85
|
body = parts.compact.join("\n").gsub(/([[:blank:]]+)$/, "")
|
@@ -91,7 +96,6 @@ module Ginny
|
|
91
96
|
end
|
92
97
|
return self.body.indent(2)
|
93
98
|
end
|
94
|
-
# binding.pry
|
95
99
|
return "\n" + self.constructor().indent(2) if self.default_constructor
|
96
100
|
return nil
|
97
101
|
end
|
@@ -104,6 +108,9 @@ module Ginny
|
|
104
108
|
|
105
109
|
# @return [String]
|
106
110
|
def class_name()
|
111
|
+
return self.name if !self.classify_name
|
112
|
+
# Don't classify two letter names.
|
113
|
+
# return self.name if self.name =~ /\A^[A-Za-z]{2}$\Z/
|
107
114
|
inflector = Dry::Inflector.new do |inflections|
|
108
115
|
inflections.plural("data", "data")
|
109
116
|
inflections.singular(/([t])a\z/i, '\1a')
|
data/lib/ginny/version.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"$id": "https://raw.githubusercontent.com/tcd/ginny/master/schema/attr.schema.json",
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
4
|
+
"title": "Ginny Attr Definition",
|
5
|
+
"description": "Used to generate an instance variable with getters/setters.",
|
6
|
+
"type": "object",
|
7
|
+
"required": [
|
8
|
+
"name"
|
9
|
+
],
|
10
|
+
"properties": {
|
11
|
+
"default": {
|
12
|
+
"description": "Default value for the attribute; set in it's Class's `initialize` function.",
|
13
|
+
"type": "string"
|
14
|
+
},
|
15
|
+
"description": {
|
16
|
+
"description": "Description of the attribute. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.",
|
17
|
+
"type": "string"
|
18
|
+
},
|
19
|
+
"name": {
|
20
|
+
"description": "Name of the attribute.",
|
21
|
+
"type": "string"
|
22
|
+
},
|
23
|
+
"read_only": {
|
24
|
+
"description": "If `true`, an `attr_reader` will be generated for the attribute instead of an `attr_accessor`.",
|
25
|
+
"type": "boolean"
|
26
|
+
},
|
27
|
+
"type": {
|
28
|
+
"description": "[Type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the attribute.",
|
29
|
+
"type": "string"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
"$id": https://raw.githubusercontent.com/tcd/ginny/master/schema/attr.schema.json
|
3
|
+
"$schema": http://json-schema.org/draft-07/schema#
|
4
|
+
title: Ginny Attr Definition
|
5
|
+
description: Used to generate an instance variable with getters/setters.
|
6
|
+
type: object
|
7
|
+
required: [name]
|
8
|
+
properties:
|
9
|
+
default:
|
10
|
+
description: Default value for the attribute; set in it's Class's `initialize` function.
|
11
|
+
type: string
|
12
|
+
description:
|
13
|
+
description: Description of the attribute. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.
|
14
|
+
type: string
|
15
|
+
name:
|
16
|
+
description: Name of the attribute.
|
17
|
+
type: string
|
18
|
+
read_only:
|
19
|
+
description: If `true`, an `attr_reader` will be generated for the attribute instead of an `attr_accessor`.
|
20
|
+
type: boolean
|
21
|
+
type:
|
22
|
+
description: "[Type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the attribute."
|
23
|
+
type: string
|
@@ -0,0 +1,54 @@
|
|
1
|
+
{
|
2
|
+
"$id": "https://raw.githubusercontent.com/tcd/ginny/master/schema/class.schema.json",
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
4
|
+
"title": "Ginny Class Definition",
|
5
|
+
"description": "Used to generate a [class](https://ruby-doc.org/core-2.6.5/Class.html).",
|
6
|
+
"type": "object",
|
7
|
+
"required": [
|
8
|
+
"name"
|
9
|
+
],
|
10
|
+
"properties": {
|
11
|
+
"attrs": {
|
12
|
+
"description": "An array of `Ginny::Attr`s.",
|
13
|
+
"type": "array",
|
14
|
+
"items": {
|
15
|
+
"$ref": "https://raw.githubusercontent.com/tcd/ginny/master/schema/attr.schema.json"
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"body": {
|
19
|
+
"description": "String to write into the body of the class.",
|
20
|
+
"type": "string"
|
21
|
+
},
|
22
|
+
"classify_name": {
|
23
|
+
"description": "Set this to `false` to disable *classification* and use raw `name` input.",
|
24
|
+
"type": "string"
|
25
|
+
},
|
26
|
+
"default_constructor": {
|
27
|
+
"description": "If `true`, a method similar to [ActiveRecord::Base.create](https://apidock.com/rails/ActiveRecord/Persistence/ClassMethods/create) will be generated for the class.",
|
28
|
+
"type": "boolean"
|
29
|
+
},
|
30
|
+
"description": {
|
31
|
+
"description": "Description of the class. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.",
|
32
|
+
"type": "string"
|
33
|
+
},
|
34
|
+
"file_prefix": {
|
35
|
+
"description": "String to prepend to the name of the generated file.",
|
36
|
+
"type": "string"
|
37
|
+
},
|
38
|
+
"modules": {
|
39
|
+
"description": "List of modules to declare the class inside.",
|
40
|
+
"type": "array",
|
41
|
+
"items": {
|
42
|
+
"type": "string"
|
43
|
+
}
|
44
|
+
},
|
45
|
+
"name": {
|
46
|
+
"description": "Name of the class.",
|
47
|
+
"type": "string"
|
48
|
+
},
|
49
|
+
"parent": {
|
50
|
+
"description": "Name of a class to inherit from. (Ex: `YourNewClass < Parent`)",
|
51
|
+
"type": "string"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
"$id": https://raw.githubusercontent.com/tcd/ginny/master/schema/class.schema.json
|
3
|
+
"$schema": http://json-schema.org/draft-07/schema#
|
4
|
+
title: Ginny Class Definition
|
5
|
+
description: Used to generate a [class](https://ruby-doc.org/core-2.6.5/Class.html).
|
6
|
+
type: object
|
7
|
+
required: [name]
|
8
|
+
properties:
|
9
|
+
attrs:
|
10
|
+
description: An array of `Ginny::Attr`s.
|
11
|
+
type: array
|
12
|
+
items:
|
13
|
+
"$ref": https://raw.githubusercontent.com/tcd/ginny/master/schema/attr.schema.json
|
14
|
+
body:
|
15
|
+
description: String to write into the body of the class.
|
16
|
+
type: string
|
17
|
+
classify_name:
|
18
|
+
description: Set this to `false` to disable *classification* and use raw `name` input.
|
19
|
+
type: string
|
20
|
+
default_constructor:
|
21
|
+
description: If `true`, a method similar to [ActiveRecord::Base.create](https://apidock.com/rails/ActiveRecord/Persistence/ClassMethods/create) will be generated for the class.
|
22
|
+
type: boolean
|
23
|
+
description:
|
24
|
+
description: Description of the class. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.
|
25
|
+
type: string
|
26
|
+
file_prefix:
|
27
|
+
description: String to prepend to the name of the generated file.
|
28
|
+
type: string
|
29
|
+
modules:
|
30
|
+
description: List of modules to declare the class inside.
|
31
|
+
type: array
|
32
|
+
items:
|
33
|
+
type: string
|
34
|
+
name:
|
35
|
+
description: Name of the class.
|
36
|
+
type: string
|
37
|
+
parent:
|
38
|
+
description: "Name of a class to inherit from. (Ex: `YourNewClass < Parent`)"
|
39
|
+
type: string
|
@@ -0,0 +1,42 @@
|
|
1
|
+
{
|
2
|
+
"$id": "https://raw.githubusercontent.com/tcd/ginny/master/schema/func.schema.json",
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
4
|
+
"title": "Ginny Func Definition",
|
5
|
+
"description": "Used to generate a [method](https://ruby-doc.org/core-2.6.5/doc/syntax/methods_rdoc.html).",
|
6
|
+
"type": "object",
|
7
|
+
"required": [
|
8
|
+
"name"
|
9
|
+
],
|
10
|
+
"properties": {
|
11
|
+
"body": {
|
12
|
+
"description": "String to write into the body of the function.",
|
13
|
+
"type": "string"
|
14
|
+
},
|
15
|
+
"description": {
|
16
|
+
"description": "Description of the function. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.",
|
17
|
+
"type": "string"
|
18
|
+
},
|
19
|
+
"modules": {
|
20
|
+
"description": "List of modules to declare the function inside of.",
|
21
|
+
"type": "array",
|
22
|
+
"items": {
|
23
|
+
"type": "string"
|
24
|
+
}
|
25
|
+
},
|
26
|
+
"name": {
|
27
|
+
"description": "Name of the function.",
|
28
|
+
"type": "string"
|
29
|
+
},
|
30
|
+
"params": {
|
31
|
+
"description": "An array of `Ginny::Param`s.",
|
32
|
+
"type": "array",
|
33
|
+
"items": {
|
34
|
+
"$ref": "https://raw.githubusercontent.com/tcd/ginny/master/schema/param.schema.json"
|
35
|
+
}
|
36
|
+
},
|
37
|
+
"return_type": {
|
38
|
+
"description": "Return [type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the function.",
|
39
|
+
"type": "string"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
"$id": https://raw.githubusercontent.com/tcd/ginny/master/schema/func.schema.json
|
3
|
+
"$schema": http://json-schema.org/draft-07/schema#
|
4
|
+
title: Ginny Func Definition
|
5
|
+
description: Used to generate a [method](https://ruby-doc.org/core-2.6.5/doc/syntax/methods_rdoc.html).
|
6
|
+
type: object
|
7
|
+
required: [name]
|
8
|
+
properties:
|
9
|
+
body:
|
10
|
+
description: String to write into the body of the function.
|
11
|
+
type: string
|
12
|
+
description:
|
13
|
+
description: Description of the function. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.
|
14
|
+
type: string
|
15
|
+
modules:
|
16
|
+
description: List of modules to declare the function inside of.
|
17
|
+
type: array
|
18
|
+
items:
|
19
|
+
type: string
|
20
|
+
name:
|
21
|
+
description: Name of the function.
|
22
|
+
type: string
|
23
|
+
params:
|
24
|
+
description: An array of `Ginny::Param`s.
|
25
|
+
type: array
|
26
|
+
items:
|
27
|
+
"$ref": https://raw.githubusercontent.com/tcd/ginny/master/schema/param.schema.json
|
28
|
+
return_type:
|
29
|
+
description: Return [type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the function.
|
30
|
+
type: string
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"$id": "https://raw.githubusercontent.com/tcd/ginny/master/schema/param.schema.json",
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
4
|
+
"title": "Ginny Param Definition",
|
5
|
+
"description": "Used to generate a function [parameter](https://ruby-doc.org/core-2.6.5/doc/syntax/methods_rdoc.html#label-Arguments).",
|
6
|
+
"type": "object",
|
7
|
+
"required": [
|
8
|
+
"name"
|
9
|
+
],
|
10
|
+
"properties": {
|
11
|
+
"name": {
|
12
|
+
"description": "Name of the param.",
|
13
|
+
"type": "string"
|
14
|
+
},
|
15
|
+
"description": {
|
16
|
+
"description": "Description of the param. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.",
|
17
|
+
"type": "string"
|
18
|
+
},
|
19
|
+
"type": {
|
20
|
+
"description": "[Type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the param.",
|
21
|
+
"type": "string"
|
22
|
+
},
|
23
|
+
"default": {
|
24
|
+
"description": "Default value for the Param. Set `optional` as `true` for a default `nil` value.",
|
25
|
+
"type": "string"
|
26
|
+
},
|
27
|
+
"optional": {
|
28
|
+
"description": "If `true`, the default value will be `nil`.",
|
29
|
+
"type": "boolean"
|
30
|
+
},
|
31
|
+
"keyword": {
|
32
|
+
"description": "If `true`, the param will be generated as a [keyword argument](https://bugs.ruby-lang.org/issues/14183).",
|
33
|
+
"type": "boolean"
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
"$id": https://raw.githubusercontent.com/tcd/ginny/master/schema/param.schema.json
|
3
|
+
"$schema": http://json-schema.org/draft-07/schema#
|
4
|
+
title: Ginny Param Definition
|
5
|
+
description: Used to generate a function [parameter](https://ruby-doc.org/core-2.6.5/doc/syntax/methods_rdoc.html#label-Arguments).
|
6
|
+
type: object
|
7
|
+
required: [name]
|
8
|
+
properties:
|
9
|
+
name:
|
10
|
+
description: Name of the param.
|
11
|
+
type: string
|
12
|
+
description:
|
13
|
+
description: Description of the param. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.
|
14
|
+
type: string
|
15
|
+
type:
|
16
|
+
description: "[Type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the param."
|
17
|
+
type: string
|
18
|
+
default:
|
19
|
+
description: Default value for the Param. Set `optional` as `true` for a default `nil` value.
|
20
|
+
type: string
|
21
|
+
optional:
|
22
|
+
description: If `true`, the default value will be `nil`.
|
23
|
+
type: boolean
|
24
|
+
keyword:
|
25
|
+
description: If `true`, the param will be generated as a [keyword argument](https://bugs.ruby-lang.org/issues/14183).
|
26
|
+
type: boolean
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ginny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clay Dunston
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- ".rubocop.yml"
|
163
163
|
- ".solargraph.yml"
|
164
164
|
- ".travis.yml"
|
165
|
+
- ".vscode/settings.json"
|
165
166
|
- ".yardopts"
|
166
167
|
- CHANGELOG.md
|
167
168
|
- Gemfile
|
@@ -183,15 +184,21 @@ files:
|
|
183
184
|
- lib/ginny/models/func.rb
|
184
185
|
- lib/ginny/models/param.rb
|
185
186
|
- lib/ginny/version.rb
|
186
|
-
- schema/
|
187
|
-
- schema/
|
187
|
+
- schema/attr.schema.json
|
188
|
+
- schema/attr.schema.yml
|
189
|
+
- schema/class.schema.json
|
190
|
+
- schema/class.schema.yml
|
191
|
+
- schema/func.schema.json
|
192
|
+
- schema/func.schema.yml
|
193
|
+
- schema/param.schema.json
|
194
|
+
- schema/param.schema.yml
|
188
195
|
homepage: https://github.com/tcd/ginny
|
189
196
|
licenses:
|
190
197
|
- MIT
|
191
198
|
metadata:
|
192
199
|
homepage_uri: https://github.com/tcd/ginny
|
193
200
|
source_code_uri: https://github.com/tcd/ginny
|
194
|
-
documentation_uri: https://www.rubydoc.info/gems/ginny/0.6.
|
201
|
+
documentation_uri: https://www.rubydoc.info/gems/ginny/0.6.2
|
195
202
|
changelog_uri: https://github.com/tcd/ginny/blob/master/CHANGELOG.md
|
196
203
|
yard.run: yri
|
197
204
|
post_install_message:
|
data/schema/ginny.json
DELETED
@@ -1,146 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"$id": "https://github.com/tcd/ginny/blob/master/schema/ginny.json",
|
3
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
4
|
-
"title": "Files used by `Ginny` to generate ruby code.",
|
5
|
-
"type": "object",
|
6
|
-
"definitions": {
|
7
|
-
"class": {
|
8
|
-
"description": "Used to generate a [class](https://ruby-doc.org/core-2.6.5/Class.html).",
|
9
|
-
"type": "object",
|
10
|
-
"required": [
|
11
|
-
"name"
|
12
|
-
],
|
13
|
-
"properties": {
|
14
|
-
"name": {
|
15
|
-
"description": "Name of the class.",
|
16
|
-
"type": "string"
|
17
|
-
},
|
18
|
-
"description": {
|
19
|
-
"description": "Description of the class. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.",
|
20
|
-
"type": "string"
|
21
|
-
},
|
22
|
-
"parent": {
|
23
|
-
"description": "Name of a class to inherit from. (Ex: `YourNewClass < Parent`)",
|
24
|
-
"type": "string"
|
25
|
-
},
|
26
|
-
"modules": {
|
27
|
-
"description": "List of modules to declare the class inside.",
|
28
|
-
"type": "string"
|
29
|
-
},
|
30
|
-
"attrs": {
|
31
|
-
"description": "An array of `Ginny::Attr`s.",
|
32
|
-
"type": "array",
|
33
|
-
"items": {
|
34
|
-
"$ref": "#/definitions/attr"
|
35
|
-
}
|
36
|
-
},
|
37
|
-
"body": {
|
38
|
-
"description": "String to write into the body of the class.",
|
39
|
-
"type": "string"
|
40
|
-
},
|
41
|
-
"file_prefix": {
|
42
|
-
"description": "String to prepend to the name of the generated file.",
|
43
|
-
"type": "string"
|
44
|
-
}
|
45
|
-
}
|
46
|
-
},
|
47
|
-
"attr": {
|
48
|
-
"description": "Used to generate an instance variable with getters/setters.",
|
49
|
-
"type": "object",
|
50
|
-
"required": [
|
51
|
-
"name"
|
52
|
-
],
|
53
|
-
"properties": {
|
54
|
-
"name": {
|
55
|
-
"description": "Name of the attribute.",
|
56
|
-
"type": "string"
|
57
|
-
},
|
58
|
-
"description": {
|
59
|
-
"description": "Description of the attribute. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.",
|
60
|
-
"type": "string"
|
61
|
-
},
|
62
|
-
"type": {
|
63
|
-
"description": "[Type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the attribute.",
|
64
|
-
"type": "string"
|
65
|
-
},
|
66
|
-
"default": {
|
67
|
-
"description": "Default value for the attribute; set in it's Class's `initialize` function.",
|
68
|
-
"type": "string"
|
69
|
-
},
|
70
|
-
"read_only": {
|
71
|
-
"description": "If `true`, an `attr_reader` will be generated for the attribute instead of an `attr_accessor`.",
|
72
|
-
"type": "boolean"
|
73
|
-
}
|
74
|
-
}
|
75
|
-
},
|
76
|
-
"func": {
|
77
|
-
"description": "Used to generate a [method](https://ruby-doc.org/core-2.6.5/doc/syntax/methods_rdoc.html).",
|
78
|
-
"type": "object",
|
79
|
-
"required": [
|
80
|
-
"name"
|
81
|
-
],
|
82
|
-
"properties": {
|
83
|
-
"name": {
|
84
|
-
"description": "Name of the function.",
|
85
|
-
"type": "string"
|
86
|
-
},
|
87
|
-
"description": {
|
88
|
-
"description": "Description of the function. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.",
|
89
|
-
"type": "string"
|
90
|
-
},
|
91
|
-
"return_type": {
|
92
|
-
"description": "Return [type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the function.",
|
93
|
-
"type": "string"
|
94
|
-
},
|
95
|
-
"body": {
|
96
|
-
"description": "String to write into the body of the function.",
|
97
|
-
"type": "string"
|
98
|
-
},
|
99
|
-
"modules": {
|
100
|
-
"description": "List of modules to declare the function inside of.",
|
101
|
-
"type": "string"
|
102
|
-
},
|
103
|
-
"params": {
|
104
|
-
"description": "An array of `Ginny::Param`s.",
|
105
|
-
"type": "array",
|
106
|
-
"items": {
|
107
|
-
"$ref": "#/definitions/param"
|
108
|
-
}
|
109
|
-
}
|
110
|
-
}
|
111
|
-
},
|
112
|
-
"param": {
|
113
|
-
"description": "Used to generate a function [parameter](https://ruby-doc.org/core-2.6.5/doc/syntax/methods_rdoc.html#label-Arguments).",
|
114
|
-
"type": "object",
|
115
|
-
"required": [
|
116
|
-
"name"
|
117
|
-
],
|
118
|
-
"properties": {
|
119
|
-
"name": {
|
120
|
-
"description": "Name of the param.",
|
121
|
-
"type": "string"
|
122
|
-
},
|
123
|
-
"description": {
|
124
|
-
"description": "Description of the param. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.",
|
125
|
-
"type": "string"
|
126
|
-
},
|
127
|
-
"type": {
|
128
|
-
"description": "[Type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the param.",
|
129
|
-
"type": "string"
|
130
|
-
},
|
131
|
-
"default": {
|
132
|
-
"description": "Default value for the Param. Set `optional` as `true` for a default `nil` value.",
|
133
|
-
"type": "string"
|
134
|
-
},
|
135
|
-
"optional": {
|
136
|
-
"description": "If `true`, the default value will be `nil`.",
|
137
|
-
"type": "boolean"
|
138
|
-
},
|
139
|
-
"keyword": {
|
140
|
-
"description": "If `true`, the param will be generated as a [keyword argument](https://bugs.ruby-lang.org/issues/14183).",
|
141
|
-
"type": "boolean"
|
142
|
-
}
|
143
|
-
}
|
144
|
-
}
|
145
|
-
}
|
146
|
-
}
|
data/schema/ginny.schema.yml
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
---
|
2
|
-
"$id": https://github.com/tcd/ginny/blob/master/schema/ginny.json
|
3
|
-
"$schema": http://json-schema.org/draft-07/schema#
|
4
|
-
title: Files used by `Ginny` to generate ruby code.
|
5
|
-
type: object
|
6
|
-
|
7
|
-
definitions:
|
8
|
-
|
9
|
-
class:
|
10
|
-
description: Used to generate a [class](https://ruby-doc.org/core-2.6.5/Class.html).
|
11
|
-
type: object
|
12
|
-
required: [name]
|
13
|
-
properties:
|
14
|
-
name:
|
15
|
-
description: Name of the class.
|
16
|
-
type: string
|
17
|
-
description:
|
18
|
-
description: Description of the class. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.
|
19
|
-
type: string
|
20
|
-
parent:
|
21
|
-
description: "Name of a class to inherit from. (Ex: `YourNewClass < Parent`)"
|
22
|
-
type: string
|
23
|
-
modules:
|
24
|
-
description: List of modules to declare the class inside.
|
25
|
-
type: string
|
26
|
-
attrs:
|
27
|
-
description: An array of `Ginny::Attr`s.
|
28
|
-
type: array
|
29
|
-
items:
|
30
|
-
"$ref": "#/definitions/attr"
|
31
|
-
body:
|
32
|
-
description: String to write into the body of the class.
|
33
|
-
type: string
|
34
|
-
file_prefix:
|
35
|
-
description: String to prepend to the name of the generated file.
|
36
|
-
type: string
|
37
|
-
|
38
|
-
attr:
|
39
|
-
description: Used to generate an instance variable with getters/setters.
|
40
|
-
type: object
|
41
|
-
required: [name]
|
42
|
-
properties:
|
43
|
-
name:
|
44
|
-
description: Name of the attribute.
|
45
|
-
type: string
|
46
|
-
description:
|
47
|
-
description: Description of the attribute. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.
|
48
|
-
type: string
|
49
|
-
type:
|
50
|
-
description: "[Type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the attribute."
|
51
|
-
type: string
|
52
|
-
default:
|
53
|
-
description: Default value for the attribute; set in it's Class's `initialize` function.
|
54
|
-
type: string
|
55
|
-
read_only:
|
56
|
-
description: If `true`, an `attr_reader` will be generated for the attribute instead of an `attr_accessor`.
|
57
|
-
type: boolean
|
58
|
-
|
59
|
-
func:
|
60
|
-
description: Used to generate a [method](https://ruby-doc.org/core-2.6.5/doc/syntax/methods_rdoc.html).
|
61
|
-
type: object
|
62
|
-
required: [name]
|
63
|
-
properties:
|
64
|
-
name:
|
65
|
-
description: Name of the function.
|
66
|
-
type: string
|
67
|
-
description:
|
68
|
-
description: Description of the function. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.
|
69
|
-
type: string
|
70
|
-
return_type:
|
71
|
-
description: Return [type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the function.
|
72
|
-
type: string
|
73
|
-
body:
|
74
|
-
description: String to write into the body of the function.
|
75
|
-
type: string
|
76
|
-
modules:
|
77
|
-
description: List of modules to declare the function inside of.
|
78
|
-
type: string
|
79
|
-
params:
|
80
|
-
description: An array of `Ginny::Param`s.
|
81
|
-
type: array
|
82
|
-
items:
|
83
|
-
"$ref": "#/definitions/param"
|
84
|
-
|
85
|
-
param:
|
86
|
-
description: Used to generate a function [parameter](https://ruby-doc.org/core-2.6.5/doc/syntax/methods_rdoc.html#label-Arguments).
|
87
|
-
type: object
|
88
|
-
required: [name]
|
89
|
-
properties:
|
90
|
-
name:
|
91
|
-
description: Name of the param.
|
92
|
-
type: string
|
93
|
-
description:
|
94
|
-
description: Description of the param. [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is supported.
|
95
|
-
type: string
|
96
|
-
type:
|
97
|
-
description: "[Type](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Declaring_Types) of the param."
|
98
|
-
type: string
|
99
|
-
default:
|
100
|
-
description: Default value for the Param. Set `optional` as `true` for a default `nil` value.
|
101
|
-
type: string
|
102
|
-
optional:
|
103
|
-
description: If `true`, the default value will be `nil`.
|
104
|
-
type: boolean
|
105
|
-
keyword:
|
106
|
-
description: If `true`, the param will be generated as a [keyword argument](https://bugs.ruby-lang.org/issues/14183).
|
107
|
-
type: boolean
|