graphql_scaffold 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/graphql_scaffold_common_methods.rb +75 -14
- data/lib/generators/graphql_scaffold_generator.rb +71 -37
- data/lib/generators/templates/app/graphql/mutations/base_mutation.rb +14 -10
- data/lib/generators/templates/test/integration/graphql_table_test.rb +24 -26
- data/lib/graphql_scaffold/version.rb +1 -1
- data/readme.md +45 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03cc09538fcbd889926ea9d1e18dd7c531109417ccac26ad81e050492a246351
|
4
|
+
data.tar.gz: 8269d11ad04fc5717f18d8e90673e49e3bef00c6cfe2a8a9b204806c38f8ce41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4afa80b52977dd92a8af6fbbd654308c262047dbd68f27d361d49c90704759d46f2f5e51317a08876bcbc9e567be54401d0b667d9d0b9f2e3b05f29793a200e
|
7
|
+
data.tar.gz: 28552729cf367e789992eba226328d58a5ade7bfe8ba2a215d1943bfb7f9e349ad875b104106ca43bd7b9a2de548c30b43804ce1bc186a21fced04ed3bf707eb
|
@@ -7,6 +7,10 @@ module GraphqlScaffoldCommonMethods
|
|
7
7
|
ActiveRecord::Base.connection.tables.include?(plural_name)
|
8
8
|
end
|
9
9
|
|
10
|
+
def name
|
11
|
+
"#{namespace.nil? ? '' : 'namespace' + ' '}#{model_name}"
|
12
|
+
end
|
13
|
+
|
10
14
|
def singular_name
|
11
15
|
name.underscore.singularize
|
12
16
|
end
|
@@ -15,8 +19,8 @@ module GraphqlScaffoldCommonMethods
|
|
15
19
|
singular_name.gsub(' ', '_')
|
16
20
|
end
|
17
21
|
|
18
|
-
def singular_name_camelized
|
19
|
-
singular_name_snaked.camelcase
|
22
|
+
def singular_name_camelized(type = :upper)
|
23
|
+
singular_name_snaked.camelcase(type)
|
20
24
|
end
|
21
25
|
|
22
26
|
def plural_name
|
@@ -27,8 +31,8 @@ module GraphqlScaffoldCommonMethods
|
|
27
31
|
plural_name.gsub(' ', '_')
|
28
32
|
end
|
29
33
|
|
30
|
-
def plural_name_camelized
|
31
|
-
plural_name_snaked.camelcase
|
34
|
+
def plural_name_camelized(type = :upper)
|
35
|
+
plural_name_snaked.camelcase(type)
|
32
36
|
end
|
33
37
|
|
34
38
|
def list_many
|
@@ -51,6 +55,26 @@ module GraphqlScaffoldCommonMethods
|
|
51
55
|
"destroy_#{singular_name_snaked}"
|
52
56
|
end
|
53
57
|
|
58
|
+
def list_many_camelized(type = :upper)
|
59
|
+
list_many.camelcase(type)
|
60
|
+
end
|
61
|
+
|
62
|
+
def list_one_camelized(type = :upper)
|
63
|
+
list_one.camelcase(type)
|
64
|
+
end
|
65
|
+
|
66
|
+
def create_one_camelized(type = :upper)
|
67
|
+
create_one.camelcase(type)
|
68
|
+
end
|
69
|
+
|
70
|
+
def change_one_camelized(type = :upper)
|
71
|
+
change_one.camelcase(type)
|
72
|
+
end
|
73
|
+
|
74
|
+
def destroy_one_camelized(type = :upper)
|
75
|
+
destroy_one.camelcase(type)
|
76
|
+
end
|
77
|
+
|
54
78
|
def model_name
|
55
79
|
name.gsub('_', ' ').titlecase.gsub(' ', '')
|
56
80
|
end
|
@@ -117,24 +141,61 @@ module GraphqlScaffoldCommonMethods
|
|
117
141
|
Time.now.strftime("%d/%m/%Y %H:%M:%S")
|
118
142
|
when 'references', 'integer', 'float'
|
119
143
|
rand(1..10).to_s
|
144
|
+
when 'boolean'
|
145
|
+
['true', 'false'].sample
|
120
146
|
else
|
121
|
-
the_type.to_s.titlecase
|
147
|
+
'"' + the_type.to_s.titlecase + '"'
|
122
148
|
end
|
123
149
|
end
|
124
150
|
|
125
|
-
def
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
151
|
+
def queries
|
152
|
+
options['queries']
|
153
|
+
end
|
154
|
+
|
155
|
+
def mutations
|
156
|
+
options['mutations']
|
157
|
+
end
|
158
|
+
|
159
|
+
def subscriptions
|
160
|
+
options['subscriptions']
|
161
|
+
end
|
162
|
+
|
163
|
+
def tests
|
164
|
+
options['tests']
|
165
|
+
end
|
131
166
|
|
167
|
+
def required_gems
|
168
|
+
# {
|
169
|
+
# 'graphql' => '1.9.15',
|
170
|
+
# 'search_object' => '1.2.3',
|
171
|
+
# 'search_object_graphql' => '0.3'
|
172
|
+
# }
|
173
|
+
[
|
174
|
+
{name: 'graphql', version: '1.9.15'},
|
175
|
+
{name: 'search_object', version: '1.2.3'},
|
176
|
+
{name: 'search_object_graphql', version: '0.3'}
|
177
|
+
]
|
178
|
+
end
|
179
|
+
|
180
|
+
def check_gem_versions
|
181
|
+
required_gems.map{ |gem_item|
|
182
|
+
if Gem.loaded_specs[gem_item[:name]].nil?
|
183
|
+
"This version of Graphql Scaffold requires the gem #{gem_item[:name]}, version #{gem_item[:version]}. Please add the following line in your Gemfile:\n\n gem '#{gem_item[:name]}', '#{gem_item[:version]}'\n"
|
184
|
+
elsif (Gem.loaded_specs[gem_item[:name]].version <=> Gem::Version.new(gem_item[:version])) < 0
|
185
|
+
"The version of the gem #{gem_item[:name]} is not compatible with this version of Graphql Scaffold. We need at least version #{gem_item[:version]}."
|
186
|
+
else
|
187
|
+
nil
|
188
|
+
end
|
189
|
+
}.compact
|
190
|
+
end
|
191
|
+
|
192
|
+
def require_gems
|
132
193
|
if !Dir.glob('./*.gemspec').empty?
|
133
|
-
puts "============> Engine : You must add gems to your main app \n #{
|
194
|
+
puts "============> Engine : You must add gems to your main app \n #{required_gems.to_a.map{ |a| "gem '#{a[0]}'#{(a[1].nil? ? '' : ", '#{a[1]}'")} " }.join("\n")}"
|
134
195
|
end
|
135
196
|
|
136
|
-
|
197
|
+
required_gems.each{ |gem_to_add, version|
|
137
198
|
gem(gem_to_add, version)
|
138
199
|
}
|
139
200
|
end
|
140
|
-
end
|
201
|
+
end
|
@@ -8,18 +8,37 @@ class GraphqlScaffoldGenerator < Rails::Generators::Base
|
|
8
8
|
|
9
9
|
source_root File.expand_path('../templates', __FILE__)
|
10
10
|
|
11
|
-
argument :
|
11
|
+
argument :model_name, type: :string, desc: 'Name of model (singular)'
|
12
12
|
argument :myattributes, type: :array, default: [], banner: 'field:type field:type'
|
13
13
|
|
14
|
-
class_option :namespace, default: nil
|
15
|
-
class_option :
|
16
|
-
class_option :
|
14
|
+
class_option :namespace, default: nil, desc: 'Create a namespace for the Model and GraphQL.'
|
15
|
+
class_option :queries, type: :boolean, default: true, desc: 'Create the GraphQL Queries.'
|
16
|
+
class_option :mutations, type: :boolean, default: true, desc: 'Create the GraphQL Mutations.'
|
17
|
+
class_option :subscriptions, type: :boolean, default: true, desc: 'Create the GraphQL Subscriptions.'
|
18
|
+
class_option :tests, type: :boolean, default: true, desc: 'Create the GraphQL Tests.'
|
19
|
+
|
20
|
+
def check_what_to_do
|
21
|
+
if !queries && !mutations && !subscriptions
|
22
|
+
puts "\n ** What do you want me to do? Nothing??? No queries, no mutations, no subscriptions...\n\n"
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def install_gems
|
28
|
+
if check_gem_versions.present?
|
29
|
+
puts '='*80
|
30
|
+
puts ' ATENTION!!! ATENTION!!! ATENTION!!!'
|
31
|
+
puts '='*80
|
32
|
+
puts check_gem_versions.join("\n")
|
33
|
+
puts '='*80
|
34
|
+
end
|
35
|
+
end
|
17
36
|
|
18
37
|
def check_model_existence
|
19
38
|
unless model_exists?
|
20
39
|
if myattributes.present?
|
21
40
|
puts 'Generating model...'
|
22
|
-
generate('model', "#{name} #{myattributes.join(' ')}")
|
41
|
+
generate('model', "#{namespace.nil? ? '' : namespace+'::'}#{name} #{myattributes.join(' ')}")
|
23
42
|
else
|
24
43
|
puts "The model #{name} wasn't found. You can add attributes and generate the model with Graphql Scaffold."
|
25
44
|
exit
|
@@ -27,51 +46,66 @@ class GraphqlScaffoldGenerator < Rails::Generators::Base
|
|
27
46
|
end
|
28
47
|
end
|
29
48
|
|
30
|
-
def
|
31
|
-
|
49
|
+
def copy_files
|
50
|
+
copy_file 'app/graphql/types/date_time_type.rb', 'app/graphql/types/date_time_type.rb'
|
51
|
+
# copy_file 'app/graphql/types/base_field.rb', 'app/graphql/types/base_field.rb'
|
32
52
|
|
33
|
-
|
34
|
-
|
53
|
+
if queries
|
54
|
+
copy_file 'app/graphql/resolvers/base_search_resolver.rb', 'app/graphql/resolvers/base_search_resolver.rb'
|
55
|
+
copy_file 'app/graphql/types/enums/operator.rb', 'app/graphql/types/enums/operator.rb'
|
56
|
+
copy_file 'app/graphql/types/enums/sort_dir.rb', 'app/graphql/types/enums/sort_dir.rb'
|
35
57
|
end
|
36
58
|
|
37
|
-
if
|
38
|
-
|
39
|
-
run 'bundle install'
|
59
|
+
if mutations
|
60
|
+
copy_file 'app/graphql/mutations/base_mutation.rb', 'app/graphql/mutations/base_mutation.rb'
|
40
61
|
end
|
41
|
-
end
|
42
62
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
copy_file 'app/graphql/mutations/base_mutation.rb', 'app/graphql/mutations/base_mutation.rb'
|
50
|
-
copy_file 'test/integration/graphql_1st_test.rb', 'test/integration/graphql_1st_test.rb'
|
63
|
+
if subscriptions
|
64
|
+
end
|
65
|
+
|
66
|
+
if tests && (queries || mutations || subscriptions)
|
67
|
+
copy_file 'test/integration/graphql_1st_test.rb', 'test/integration/graphql_1st_test.rb'
|
68
|
+
end
|
51
69
|
end
|
52
70
|
|
53
71
|
def generate_graphql_query
|
54
72
|
template 'app/graphql/types/enums/table_field.rb', "app/graphql/types/enums/#{plural_name_snaked}_field.rb"
|
55
73
|
template 'app/graphql/types/table_type.rb', "app/graphql/types/#{singular_name_snaked}_type.rb"
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
74
|
+
|
75
|
+
if queries
|
76
|
+
template 'app/graphql/resolvers/table_search.rb', "app/graphql/resolvers/#{plural_name_snaked}_search.rb"
|
77
|
+
end
|
78
|
+
|
79
|
+
if mutations
|
80
|
+
template 'app/graphql/mutations/change_table.rb', "app/graphql/mutations/change_#{singular_name_snaked}.rb"
|
81
|
+
template 'app/graphql/mutations/create_table.rb', "app/graphql/mutations/create_#{singular_name_snaked}.rb"
|
82
|
+
template 'app/graphql/mutations/destroy_table.rb', "app/graphql/mutations/destroy_#{singular_name_snaked}.rb"
|
83
|
+
end
|
84
|
+
|
85
|
+
if subscriptions
|
86
|
+
end
|
87
|
+
|
88
|
+
if tests && (queries || mutations || subscriptions)
|
89
|
+
template 'test/integration/graphql_table_test.rb', "test/integration/graphql_#{singular_name_snaked}_test.rb"
|
90
|
+
end
|
61
91
|
end
|
62
92
|
|
63
93
|
def add_in_query_type
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
94
|
+
if queries
|
95
|
+
inject_into_file(
|
96
|
+
'app/graphql/types/query_type.rb',
|
97
|
+
" field :#{list_many}, function: Resolvers::#{plural_name_camelized}Search\n",
|
98
|
+
after: "class QueryType < Types::BaseObject\n")
|
99
|
+
end
|
100
|
+
|
101
|
+
if mutations
|
102
|
+
inject_into_file(
|
103
|
+
'app/graphql/types/mutation_type.rb',
|
104
|
+
"\n field :#{create_one}, mutation: Mutations::Create#{singular_name_camelized}" +
|
105
|
+
"\n field :#{change_one}, mutation: Mutations::Change#{singular_name_camelized}" +
|
106
|
+
"\n field :#{destroy_one}, mutation: Mutations::Destroy#{singular_name_camelized}\n",
|
107
|
+
after: "class MutationType < Types::BaseObject\n")
|
108
|
+
end
|
75
109
|
end
|
76
110
|
|
77
111
|
end
|
@@ -1,11 +1,15 @@
|
|
1
|
-
|
2
|
-
# Add your custom classes if you have them:
|
3
|
-
# This is used for generating payload types
|
4
|
-
object_class Types::BaseObject
|
5
|
-
|
6
|
-
# This is used for return fields on the mutation's payload
|
7
|
-
field_class Types::BaseField
|
1
|
+
# frozen_string_literal: true
|
8
2
|
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
module Mutations
|
4
|
+
class BaseMutation < GraphQL::Schema::RelayClassicMutation
|
5
|
+
# Add your custom classes if you have them:
|
6
|
+
# This is used for generating payload types
|
7
|
+
object_class Types::BaseObject
|
8
|
+
|
9
|
+
# This is used for return fields on the mutation's payload
|
10
|
+
field_class Types::BaseField
|
11
|
+
|
12
|
+
# This is used for generating the `input: { ... }` object type
|
13
|
+
input_object_class Types::BaseInputObject
|
14
|
+
end
|
15
|
+
end
|
@@ -8,9 +8,9 @@ class Graphql<%= plural_name_camelized %>Test < ActionDispatch::IntegrationTest
|
|
8
8
|
test "can see a result" do
|
9
9
|
gql = <<-GRAPHQL
|
10
10
|
{
|
11
|
-
<%=
|
11
|
+
<%= list_many_camelized(:lower) %>(first: 10, sort_by: {field: <%= columns_type_without_primary_key.sample[:name] %>, sortDirection: asc}) {
|
12
12
|
<% for attribute in columns_types -%>
|
13
|
-
<%= attribute[:name] %>
|
13
|
+
<%= attribute[:name].camelcase(:lower) %>
|
14
14
|
<% end -%>
|
15
15
|
}
|
16
16
|
}
|
@@ -20,22 +20,22 @@ class Graphql<%= plural_name_camelized %>Test < ActionDispatch::IntegrationTest
|
|
20
20
|
assert_response :success
|
21
21
|
json = JSON.parse(response.body)
|
22
22
|
assert_not_empty json['data']
|
23
|
-
assert_not_empty json['data']['<%=
|
23
|
+
assert_not_empty json['data']['<%= list_many_camelized(:lower) %>']
|
24
24
|
end
|
25
25
|
|
26
26
|
test "can add a record" do
|
27
27
|
gql = <<-GRAPHQL
|
28
28
|
mutation a {
|
29
|
-
<%=
|
29
|
+
<%= create_one_camelized(:lower) %>(input: {
|
30
30
|
<% for attribute in columns_type_without_primary_key -%>
|
31
|
-
<%= attribute[:name] %>:
|
31
|
+
<%= attribute[:name].camelcase(:lower) %>: <%= attribute[:sample] %>,
|
32
32
|
<% end -%>
|
33
33
|
clientMutationId: "test-1"
|
34
34
|
} )
|
35
35
|
{
|
36
|
-
<%=
|
36
|
+
<%= singular_name_camelized(:lower) %> {
|
37
37
|
<% for attribute in columns_types -%>
|
38
|
-
<%= attribute[:name] %>
|
38
|
+
<%= attribute[:name].camelcase(:lower) %>
|
39
39
|
<% end -%>
|
40
40
|
}
|
41
41
|
clientMutationId
|
@@ -46,14 +46,13 @@ class Graphql<%= plural_name_camelized %>Test < ActionDispatch::IntegrationTest
|
|
46
46
|
post '/graphql', params: {query: gql}
|
47
47
|
assert_response :success
|
48
48
|
json = JSON.parse(response.body)
|
49
|
-
#puts response.body
|
50
49
|
|
51
50
|
assert_not_empty json['data']
|
52
|
-
assert_not_empty json['data']['<%=
|
53
|
-
assert_not_empty json['data']['<%=
|
54
|
-
|
51
|
+
assert_not_empty json['data']['<%= create_one_camelized(:lower) %>']
|
52
|
+
assert_not_empty json['data']['<%= create_one_camelized(:lower) %>']['<%= singular_name_camelized(:lower) %>']
|
53
|
+
assert_equal json['data']['<%= create_one_camelized(:lower) %>']['errors'], []
|
55
54
|
|
56
|
-
<%= primary_key %> = json['data']['<%=
|
55
|
+
<%= primary_key %> = json['data']['<%= create_one_camelized(:lower) %>']['<%= singular_name_camelized(:lower) %>']['<%= primary_key.camelcase(:lower) %>']
|
57
56
|
assert_not_empty <%= singular_name_camelized %>.where(<%= primary_key %>: <%= primary_key %>)
|
58
57
|
end
|
59
58
|
|
@@ -61,16 +60,16 @@ class Graphql<%= plural_name_camelized %>Test < ActionDispatch::IntegrationTest
|
|
61
60
|
<%= primary_key %> = <%= singular_name_camelized %>.last.<%= primary_key %>
|
62
61
|
gql = <<-GRAPHQL
|
63
62
|
mutation a {
|
64
|
-
<%=
|
65
|
-
<%= primary_key %>: "#{<%= primary_key %>}",
|
63
|
+
<%= change_one_camelized(:lower) %>(input: {
|
64
|
+
<%= primary_key.camelcase(:lower) %>: "#{<%= primary_key %>}",
|
66
65
|
<% for attribute in columns_type_without_primary_key -%>
|
67
|
-
<%= attribute[:name] %>:
|
66
|
+
<%= attribute[:name].camelcase(:lower) %>: <%= attribute[:sample] %>,
|
68
67
|
<% end -%>
|
69
68
|
clientMutationId: "test-2"} )
|
70
69
|
{
|
71
|
-
<%=
|
70
|
+
<%= singular_name_camelized(:lower) %> {
|
72
71
|
<% for attribute in columns_types -%>
|
73
|
-
<%= attribute[:name] %>
|
72
|
+
<%= attribute[:name].camelcase(:lower) %>
|
74
73
|
<% end -%>
|
75
74
|
}
|
76
75
|
clientMutationId
|
@@ -83,21 +82,20 @@ class Graphql<%= plural_name_camelized %>Test < ActionDispatch::IntegrationTest
|
|
83
82
|
assert_response :success
|
84
83
|
json = JSON.parse(response.body)
|
85
84
|
assert_not_empty json['data']
|
86
|
-
assert_not_empty json['data']['<%=
|
87
|
-
|
88
|
-
|
89
|
-
assert_equal <%= singular_name_camelized %>.find(id).url, json['data']['<%= change_one %>']['<%= singular_name_snaked %>']['url']
|
85
|
+
assert_not_empty json['data']['<%= change_one_camelized(:lower) %>']
|
86
|
+
assert_equal json['data']['<%= change_one_camelized(:lower) %>']['errors'], []
|
87
|
+
assert_equal <%= singular_name_camelized %>.find(id).<%= columns_type_without_primary_key.first[:name] %>, json['data']['<%= change_one_camelized(:lower) %>']['<%= singular_name_camelized(:lower) %>']['<%= columns_type_without_primary_key.first[:name].camelcase(:lower) %>']
|
90
88
|
end
|
91
89
|
|
92
90
|
test "can destroy a record" do
|
93
91
|
<%= primary_key %> = <%= singular_name_camelized %>.last.<%= primary_key %>
|
94
92
|
gql = <<-GRAPHQL
|
95
93
|
mutation a {
|
96
|
-
<%=
|
94
|
+
<%= destroy_one_camelized(:lower) %>(input: {<%= primary_key.camelcase(:lower) %>: "#{<%= primary_key %>}", clientMutationId: "test-3"} )
|
97
95
|
{
|
98
|
-
<%=
|
96
|
+
<%= singular_name_camelized(:lower) %> {
|
99
97
|
<% for attribute in columns_types -%>
|
100
|
-
<%= attribute[:name] %>
|
98
|
+
<%= attribute[:name].camelcase(:lower) %>
|
101
99
|
<% end -%>
|
102
100
|
}
|
103
101
|
clientMutationId
|
@@ -110,8 +108,8 @@ class Graphql<%= plural_name_camelized %>Test < ActionDispatch::IntegrationTest
|
|
110
108
|
assert_response :success
|
111
109
|
json = JSON.parse(response.body)
|
112
110
|
assert_not_empty json['data']
|
113
|
-
assert_not_empty json['data']['<%=
|
114
|
-
|
111
|
+
assert_not_empty json['data']['<%= destroy_one_camelized(:lower) %>']
|
112
|
+
assert_equal json['data']['<%= destroy_one_camelized(:lower) %>']['errors'], []
|
115
113
|
|
116
114
|
assert_empty <%= singular_name_camelized %>.where(<%= primary_key %>: <%= primary_key %>)
|
117
115
|
end
|
data/readme.md
CHANGED
@@ -8,17 +8,39 @@ Rails generator for scaffolding models with [GraphQL-Ruby](https://github.com/rm
|
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
Install from RubyGems by adding it to your `Gemfile
|
11
|
+
Install from RubyGems by adding it to your `Gemfile`:
|
12
12
|
|
13
13
|
```ruby
|
14
14
|
# Gemfile
|
15
15
|
gem 'graphql_scaffold'
|
16
16
|
```
|
17
|
+
And then execute:
|
17
18
|
|
18
19
|
```
|
19
20
|
$ bundle install
|
20
21
|
```
|
21
22
|
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
```
|
26
|
+
$ gem install graphql_scaffold
|
27
|
+
```
|
28
|
+
|
29
|
+
## Dependencies
|
30
|
+
|
31
|
+
The scaffolded graphql queries, mutations and subscriptions depend on:
|
32
|
+
|
33
|
+
- `SearchObjectGraphql` >= 0.3
|
34
|
+
- `SearchObject` >= 1.2.3
|
35
|
+
- `Graphql` >= 1.9.5
|
36
|
+
|
37
|
+
Besides this you may need to run the following command to begin with Graphql:
|
38
|
+
|
39
|
+
```
|
40
|
+
$ rails generate graphql:install
|
41
|
+
```
|
42
|
+
|
43
|
+
|
22
44
|
## Usage
|
23
45
|
|
24
46
|
If you have a model already created:
|
@@ -34,3 +56,25 @@ $ rails generate graphql_scaffold model_example field1 field2:integer field3
|
|
34
56
|
```
|
35
57
|
|
36
58
|
After this, you may need to run `rails db:migrate`. The format for fields are the same as rails generate model.
|
59
|
+
|
60
|
+
### Example
|
61
|
+
|
62
|
+
## Todo
|
63
|
+
|
64
|
+
- Create subscription scaffold
|
65
|
+
- Better tests
|
66
|
+
|
67
|
+
## Contributing
|
68
|
+
|
69
|
+
1. Fork it
|
70
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
71
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
72
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
73
|
+
5. Run the tests (`rake`)
|
74
|
+
6. Create new Pull Request
|
75
|
+
|
76
|
+
## License
|
77
|
+
|
78
|
+
**[MIT License](https://github.com/arthurmolina/graphql_scaffold/blob/master/LICENSE)**
|
79
|
+
|
80
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arthur Molina
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -37,7 +37,7 @@ files:
|
|
37
37
|
- lib/graphql_scaffold.rb
|
38
38
|
- lib/graphql_scaffold/version.rb
|
39
39
|
- readme.md
|
40
|
-
homepage: https://github.com/arthurmolina/
|
40
|
+
homepage: https://github.com/arthurmolina/graphql_scaffold
|
41
41
|
licenses:
|
42
42
|
- MIT
|
43
43
|
metadata: {}
|