souls 0.50.0 → 0.52.0
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/README.md +5 -1
- data/exe/souls +4 -202
- data/lib/souls/api/generate/application.rb +97 -94
- data/lib/souls/api/generate/connection.rb +5 -4
- data/lib/souls/api/generate/edge.rb +5 -4
- data/lib/souls/api/generate/index.rb +0 -1
- data/lib/souls/api/generate/manager.rb +9 -7
- data/lib/souls/api/generate/model.rb +16 -18
- data/lib/souls/api/generate/mutation.rb +217 -218
- data/lib/souls/api/generate/policy.rb +5 -5
- data/lib/souls/api/generate/query.rb +51 -51
- data/lib/souls/api/generate/resolver.rb +115 -115
- data/lib/souls/api/generate/rspec_factory.rb +53 -53
- data/lib/souls/api/generate/rspec_model.rb +5 -5
- data/lib/souls/api/generate/rspec_mutation.rb +178 -178
- data/lib/souls/api/generate/rspec_policy.rb +5 -5
- data/lib/souls/api/generate/rspec_query.rb +111 -111
- data/lib/souls/api/generate/rspec_resolver.rb +163 -163
- data/lib/souls/api/generate/type.rb +66 -66
- data/lib/souls/api/index.rb +7 -4
- data/lib/souls/api/update/index.rb +15 -0
- data/lib/souls/api/update/mutation.rb +68 -64
- data/lib/souls/api/update/resolver.rb +59 -60
- data/lib/souls/api/update/rspec_factory.rb +40 -39
- data/lib/souls/api/update/rspec_mutation.rb +84 -83
- data/lib/souls/api/update/rspec_resolver.rb +70 -69
- data/lib/souls/api/update/type.rb +39 -38
- data/lib/souls/cli/console/index.rb +13 -1
- data/lib/souls/cli/create/index.rb +100 -95
- data/lib/souls/cli/db/index.rb +122 -1
- data/lib/souls/cli/docker/index.rb +30 -38
- data/lib/souls/cli/gcloud/compute/index.rb +100 -93
- data/lib/souls/cli/gcloud/iam/index.rb +84 -69
- data/lib/souls/cli/gcloud/index.rb +36 -35
- data/lib/souls/cli/gcloud/pubsub/subscriptions.rb +40 -27
- data/lib/souls/cli/gcloud/pubsub/topics.rb +16 -10
- data/lib/souls/cli/gcloud/run/index.rb +23 -17
- data/lib/souls/cli/gcloud/sql/index.rb +66 -45
- data/lib/souls/cli/index.rb +3 -20
- data/lib/souls/cli/init/index.rb +140 -138
- data/lib/souls/cli/release/release.rb +106 -105
- data/lib/souls/cli/server/index.rb +12 -1
- data/lib/souls/cli/sync/conf.rb +39 -38
- data/lib/souls/cli/sync/model.rb +19 -20
- data/lib/souls/cli/sync/pubsub.rb +69 -70
- data/lib/souls/cli/upgrade/gemfile.rb +108 -0
- data/lib/souls/cli/upgrade/index.rb +1 -1
- data/lib/souls/cli.rb +57 -0
- data/lib/souls/index.rb +1 -5
- data/lib/souls/version.rb +1 -1
- data/lib/souls/versions/.souls_api_version +1 -1
- data/lib/souls/versions/.souls_worker_version +1 -1
- data/lib/souls/worker/generate/index.rb +1 -1
- data/lib/souls/worker/generate/job.rb +45 -0
- data/lib/souls/worker/generate/mailer.rb +38 -43
- data/lib/souls/worker/index.rb +3 -1
- data/lib/souls.rb +2 -0
- metadata +19 -5
- data/lib/souls/api/generate/migration.rb +0 -51
- data/lib/souls/cli/upgrade/gem_update.rb +0 -107
- data/lib/souls/worker/generate/mutation.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a787225c8c1e3df750cf5de8cd184a3e3380cfbe8b469225ffc69a789634ddaf
|
4
|
+
data.tar.gz: 72adfc131aebcc47923b0f102615d45ac3c41a081f964a259aff5dfa29deffb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a8851074629eca06ca8b3090f5a25c10e0ceb0403df43455faf8d01ed81aae36b7e9967f91e6345a4f8d494df330a3bcebc3a24545790ff8009fbb52e3d1d24
|
7
|
+
data.tar.gz: dbda69409b250dfd73535d46def5352612bb251ec84a3b91cbca450aaffa7b2bf13a4ad4987dbce2421c713f9dbd054081f263660815f1016a824019d9c9226b
|
data/README.md
CHANGED
@@ -82,6 +82,9 @@ And Create Your APP
|
|
82
82
|
$ bundle
|
83
83
|
$ souls s
|
84
84
|
|
85
|
+
Check your GraphQL PlayGround
|
86
|
+
|
87
|
+
(localhost:4000/playground)[localhost:4000/playground]
|
85
88
|
|
86
89
|
|
87
90
|
|
@@ -102,9 +105,10 @@ souls upgrade gemfile
|
|
102
105
|
Souls.configure do |config|
|
103
106
|
config.app = "souls-api"
|
104
107
|
config.project_id = "souls-api"
|
108
|
+
config.region = "asia-northeast1"
|
105
109
|
config.endpoint = "/endpoint"
|
106
110
|
config.strain = "api"
|
107
|
-
config.fixed_gems = ["selenium-webdriver"
|
111
|
+
config.fixed_gems = ["selenium-webdriver"]
|
108
112
|
config.workers = []
|
109
113
|
end
|
110
114
|
```
|
data/exe/souls
CHANGED
@@ -1,208 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require "souls"
|
3
|
+
require "thor"
|
3
4
|
begin
|
4
|
-
|
5
|
-
require("./config/souls") unless ["new", "docker", "-v", "deploy"].include?(souls_command)
|
5
|
+
require("./config/souls")
|
6
6
|
rescue StandardError
|
7
|
-
|
7
|
+
raise(StandardError, "No confif! Please make `./config/souls.rb` File!")
|
8
8
|
end
|
9
|
-
begin
|
10
|
-
case souls_command
|
11
|
-
when "api"
|
12
|
-
api_command = ARGV[1]
|
13
|
-
Dir.chdir(Souls.get_api_path.to_s) do
|
14
|
-
case api_command
|
15
|
-
when "generate", "g"
|
16
|
-
method_name = ARGV[2]
|
17
|
-
class_name = ARGV[3]
|
18
|
-
args = { class_name: class_name }
|
19
|
-
args[:mutation] = ARGV[4] if ARGV.size > 4
|
20
|
-
status = Paint["Running SOULs Generate Commands...", :yellow]
|
21
|
-
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
22
|
-
Whirly.status = status
|
23
|
-
Souls::Api::Generate.public_send(method_name, **args)
|
24
|
-
Whirly.status = "Done!"
|
25
|
-
end
|
26
|
-
when "update"
|
27
|
-
class_name = ARGV[2]
|
28
|
-
status = Paint["Running SOULs Update Commands...", :yellow]
|
29
|
-
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
30
|
-
Whirly.status = status
|
31
|
-
Souls::Api::Update.create_mutation(class_name: class_name)
|
32
|
-
Souls::Api::Update.update_mutation(class_name: class_name)
|
33
|
-
Souls::Api::Update.resolver(class_name: class_name)
|
34
|
-
Souls::Api::Update.type(class_name: class_name)
|
35
|
-
Souls::Api::Update.rspec_factory(class_name: class_name)
|
36
|
-
Souls::Api::Update.rspec_mutation(class_name: class_name)
|
37
|
-
Souls::Api::Update.rspec_resolver(class_name: class_name)
|
38
|
-
Whirly.status = "Done!"
|
39
|
-
end
|
40
|
-
when "d", "delete"
|
41
|
-
class_name = ARGV[2]
|
42
|
-
Souls::Api::Generate.delete_all(class_name: class_name)
|
43
|
-
else
|
44
|
-
puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
|
45
|
-
end
|
46
|
-
end
|
47
|
-
when "worker"
|
48
|
-
api_command = ARGV[1]
|
49
|
-
case api_command
|
50
|
-
when "generate", "g"
|
51
|
-
method_name = ARGV[2]
|
52
|
-
class_name = ARGV[3]
|
53
|
-
args = { class_name: class_name }
|
54
|
-
args[:option] = ARGV[4] if ARGV.size > 4
|
55
|
-
status = Paint["Running SOULs Generate Commands...", :yellow]
|
56
|
-
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
57
|
-
Whirly.status = status
|
58
|
-
Souls::Worker::Generate.public_send(method_name, **args)
|
59
|
-
Whirly.status = "Done!"
|
60
|
-
end
|
61
|
-
else
|
62
|
-
puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
|
63
|
-
end
|
64
|
-
when "new"
|
65
|
-
args = ARGV
|
66
|
-
Souls::Init.start(args)
|
67
|
-
when "bashrc", "zshrc"
|
68
|
-
Souls::Init.generate_cd
|
69
|
-
when "s", "server"
|
70
|
-
all = ARGV[1]
|
71
|
-
case all
|
72
|
-
when "all"
|
73
|
-
Dir.chdir(Souls.get_mother_path.to_s) do
|
74
|
-
system("foreman start -f Procfile.dev")
|
75
|
-
end
|
76
|
-
else
|
77
|
-
system("foreman start -f Procfile.dev")
|
78
|
-
end
|
79
|
-
when "c", "console"
|
80
|
-
strain = Souls.configuration.strain
|
81
|
-
case strain
|
82
|
-
when "media", "admin", "console", "doc"
|
83
|
-
system("yarn dev")
|
84
|
-
else
|
85
|
-
rack_env = ARGV[1]
|
86
|
-
case rack_env
|
87
|
-
when "RACK_ENV=production"
|
88
|
-
system("RACK_ENV=production bundle exec irb")
|
89
|
-
else
|
90
|
-
system("bundle exec irb")
|
91
|
-
end
|
92
|
-
end
|
93
|
-
when "docker"
|
94
|
-
send_method = ARGV[1]
|
95
|
-
Souls::Docker.public_send(send_method)
|
96
|
-
when "gcloud"
|
97
|
-
command = ARGV[1]
|
98
|
-
status = Paint["Running Gcloud Commands...", :yellow]
|
99
|
-
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
100
|
-
Whirly.status = status
|
101
|
-
case command
|
102
|
-
when "get_iam_key"
|
103
|
-
app_name = Souls.configuration.app
|
104
|
-
project_id = Souls.configuration.project_id
|
105
|
-
Souls::Gcloud.auth_login(project_id: project_id)
|
106
|
-
Souls::Gcloud::Iam.create_service_account(service_account: app_name)
|
107
|
-
Souls::Gcloud::Iam.create_service_account_key(service_account: app_name, project_id: project_id)
|
108
|
-
Souls::Gcloud.enable_permissions
|
109
|
-
Souls::Gcloud::Iam.add_permissions(service_account: app_name, project_id: project_id)
|
110
|
-
Souls::Gcloud::Iam.export_key_to_console
|
111
|
-
when "auth_login"
|
112
|
-
project_id = Souls.configuration.project_id
|
113
|
-
Souls::Gcloud.auth_login(project_id: project_id)
|
114
|
-
else
|
115
|
-
module_name = ARGV[1]
|
116
|
-
method_name = ARGV[2]
|
117
|
-
ARGV.shift(3)
|
118
|
-
key_strings = []
|
119
|
-
keys = []
|
120
|
-
ARGV.each_with_index do |n, i|
|
121
|
-
n.include?(":") && i.even? ? keys << n.gsub(":", "").to_sym : key_strings << n
|
122
|
-
end
|
123
|
-
raise(StandardError, "wrong arguments!") unless keys.size == key_strings.size
|
124
9
|
|
125
|
-
|
126
|
-
Object.const_get("Souls::Gcloud::#{module_name.camelize}").public_send(method_name.to_sym, **args)
|
127
|
-
end
|
128
|
-
Whirly.status = "Done!"
|
129
|
-
end
|
130
|
-
when "-v", "--version", "v", "version", "-version", "--v"
|
131
|
-
puts(Paint[Souls::VERSION, :white])
|
132
|
-
when "upgrade"
|
133
|
-
method_command = ARGV[1]
|
134
|
-
case method_command
|
135
|
-
when "gemfile", "gem"
|
136
|
-
status = Paint["Checking for updates...", :yellow]
|
137
|
-
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
138
|
-
Whirly.status = status
|
139
|
-
Souls::Upgrade.update_gemfile
|
140
|
-
Whirly.status = "Done!"
|
141
|
-
end
|
142
|
-
else
|
143
|
-
puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
|
144
|
-
end
|
145
|
-
when "release"
|
146
|
-
Souls::Release.gem_release
|
147
|
-
when "sync"
|
148
|
-
method_name = ARGV[1]
|
149
|
-
status = Paint["Syncing Files...", :yellow]
|
150
|
-
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
151
|
-
Whirly.status = status
|
152
|
-
Souls::Sync.public_send(method_name)
|
153
|
-
Whirly.status = Paint["Synced!", :green]
|
154
|
-
end
|
155
|
-
when "create"
|
156
|
-
service_name = ARGV[1]
|
157
|
-
case service_name
|
158
|
-
when "worker"
|
159
|
-
worker_name = ARGV[2]
|
160
|
-
Souls::Create.worker(worker_name: worker_name)
|
161
|
-
else
|
162
|
-
puts(Paint["Coming Soon...", :green])
|
163
|
-
end
|
164
|
-
when "db:create"
|
165
|
-
rack_env = ARGV[1]
|
166
|
-
case rack_env
|
167
|
-
when "RACK_ENV=production"
|
168
|
-
system("rake db:create RACK_ENV=production")
|
169
|
-
else
|
170
|
-
system("rake db:create && rake db:create RACK_ENV=test")
|
171
|
-
end
|
172
|
-
when "db:migrate"
|
173
|
-
rack_env = ARGV[1]
|
174
|
-
case rack_env
|
175
|
-
when "RACK_ENV=production"
|
176
|
-
system("rake db:migrate RACK_ENV=production")
|
177
|
-
else
|
178
|
-
system("rake db:migrate && rake db:migrate RACK_ENV=test")
|
179
|
-
end
|
180
|
-
when "db:seed"
|
181
|
-
rack_env = ARGV[1]
|
182
|
-
case rack_env
|
183
|
-
when "RACK_ENV=production"
|
184
|
-
system("rake db:seed RACK_ENV=production")
|
185
|
-
else
|
186
|
-
system("rake db:seed")
|
187
|
-
end
|
188
|
-
when "db:migrate:reset"
|
189
|
-
rack_env = ARGV[1]
|
190
|
-
case rack_env
|
191
|
-
when "RACK_ENV=production"
|
192
|
-
system("rake db:migrate:reset RACK_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1")
|
193
|
-
else
|
194
|
-
system("rake db:migrate:reset && rake db:migrate:reset RACK_ENV=test")
|
195
|
-
end
|
196
|
-
when "t", "test"
|
197
|
-
system("rubocop -A")
|
198
|
-
system("bundle exec rspec")
|
199
|
-
when "deploy"
|
200
|
-
project_id = Souls.configuration.project_id
|
201
|
-
system("gcloud builds submit --config=cloudbuild.yml --project #{project_id}")
|
202
|
-
else
|
203
|
-
puts(Paint["Welcome to SOULs!", :green])
|
204
|
-
end
|
205
|
-
rescue StandardError => e
|
206
|
-
puts(e.backtrace)
|
207
|
-
puts(Paint[e, :red])
|
208
|
-
end
|
10
|
+
Souls::CLI.start
|
@@ -1,103 +1,106 @@
|
|
1
1
|
module Souls
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
"./spec/models/#{singularized_class_name}_spec.rb",
|
24
|
-
"./spec/queries/#{singularized_class_name}_spec.rb",
|
25
|
-
"./spec/policies/#{singularized_class_name}_policy_spec.rb",
|
26
|
-
"./spec/resolvers/#{singularized_class_name}_search_spec.rb"
|
27
|
-
]
|
28
|
-
end
|
2
|
+
class Generate < Thor
|
3
|
+
desc "scaffold [CLASS_NAME]", "Generate Scaffold from schema.rb"
|
4
|
+
def scaffold(class_name)
|
5
|
+
singularized_class_name = class_name.singularize
|
6
|
+
model(singularized_class_name)
|
7
|
+
type(singularized_class_name)
|
8
|
+
edge(singularized_class_name)
|
9
|
+
connection(singularized_class_name)
|
10
|
+
resolver(singularized_class_name)
|
11
|
+
rspec_factory(singularized_class_name)
|
12
|
+
rspec_model(singularized_class_name)
|
13
|
+
rspec_mutation(singularized_class_name)
|
14
|
+
rspec_query(singularized_class_name)
|
15
|
+
rspec_resolver(singularized_class_name)
|
16
|
+
query(singularized_class_name)
|
17
|
+
mutation(singularized_class_name)
|
18
|
+
policy(singularized_class_name)
|
19
|
+
rspec_policy(singularized_class_name)
|
20
|
+
rescue Thor::Error => e
|
21
|
+
raise(Thor::Error, e)
|
22
|
+
end
|
29
23
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
FileUtils.mkdir_p("./app/policies")
|
37
|
-
FileUtils.mkdir_p("./spec/factories")
|
38
|
-
FileUtils.mkdir_p("./spec/queries")
|
39
|
-
FileUtils.mkdir_p("./spec/mutations")
|
40
|
-
FileUtils.mkdir_p("./spec/models")
|
41
|
-
FileUtils.mkdir_p("./spec/resolvers")
|
42
|
-
FileUtils.mkdir_p("./spec/policies")
|
43
|
-
FileUtils.mkdir_p("./config")
|
44
|
-
FileUtils.touch("./config/souls.rb")
|
45
|
-
FileUtils.mkdir_p("./db/")
|
46
|
-
FileUtils.touch("./db/schema.rb")
|
47
|
-
puts("test dir created!")
|
24
|
+
desc "scaffold_all", "Generate Scaffold All Tables from schema.rb"
|
25
|
+
def scaffold_all
|
26
|
+
puts(Paint["Let's Go SOULs AUTO CRUD Assist!\n", :cyan])
|
27
|
+
Souls.get_tables.each do |table|
|
28
|
+
Souls::Api::Generate.scaffold(class_name: table.singularize)
|
29
|
+
puts(Paint["Generated #{table.camelize} CRUD Files\n", :yellow])
|
48
30
|
end
|
31
|
+
rescue Thor::Error => e
|
32
|
+
raise(Thor::Error, e)
|
33
|
+
end
|
49
34
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
35
|
+
desc "delete_all [CLASS_NAME]", "Generate Scaffold All Tables from schema.rb"
|
36
|
+
def delete_all(class_name: "user")
|
37
|
+
singularized_class_name = class_name.singularize.underscore
|
38
|
+
pluralized_class_name = class_name.pluralize.underscore
|
39
|
+
FileUtils.rm("./app/models/#{singularized_class_name}.rb")
|
40
|
+
FileUtils.rm("./app/policies/#{singularized_class_name}_policy.rb")
|
41
|
+
FileUtils.rm_rf("./app/graphql/mutations/base/#{singularized_class_name}")
|
42
|
+
FileUtils.rm("./app/graphql/queries/#{singularized_class_name}.rb")
|
43
|
+
FileUtils.rm("./app/graphql/queries/#{pluralized_class_name}.rb")
|
44
|
+
FileUtils.rm("./app/graphql/resolvers/#{singularized_class_name}_search.rb")
|
45
|
+
FileUtils.rm("./app/graphql/types/#{singularized_class_name}_type.rb")
|
46
|
+
FileUtils.rm("./app/graphql/types/edges/#{singularized_class_name}_edge.rb")
|
47
|
+
FileUtils.rm("./app/graphql/types/connections/#{singularized_class_name}_connection.rb")
|
48
|
+
FileUtils.rm("./spec/factories/#{pluralized_class_name}.rb")
|
49
|
+
FileUtils.rm("./spec/mutations/base/#{singularized_class_name}_spec.rb")
|
50
|
+
FileUtils.rm("./spec/models/#{singularized_class_name}_spec.rb")
|
51
|
+
FileUtils.rm("./spec/queries/#{singularized_class_name}_spec.rb")
|
52
|
+
FileUtils.rm("./spec/policies/#{singularized_class_name}_policy_spec.rb")
|
53
|
+
FileUtils.rm("./spec/resolvers/#{singularized_class_name}_search_spec.rb")
|
54
|
+
puts(Paint["deleted #{class_name.camelize} CRUD!", :yellow])
|
55
|
+
rescue Thor::Error => e
|
56
|
+
raise(Thor::Error, e)
|
57
|
+
end
|
70
58
|
|
71
|
-
|
72
|
-
puts(Paint["Let's Go SOULs AUTO CRUD Assist!\n", :cyan])
|
73
|
-
Souls.get_tables.each do |table|
|
74
|
-
Souls::Api::Generate.scaffold(class_name: table.singularize)
|
75
|
-
puts(Paint["Generated #{table.camelize} CRUD Files\n", :yellow])
|
76
|
-
end
|
77
|
-
end
|
59
|
+
private
|
78
60
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
61
|
+
def generated_paths(class_name: "user")
|
62
|
+
singularized_class_name = class_name.singularize.underscore
|
63
|
+
pluralized_class_name = class_name.pluralize.underscore
|
64
|
+
[
|
65
|
+
"./app/models/#{singularized_class_name}.rb",
|
66
|
+
"./app/policies/#{singularized_class_name}_policy.rb",
|
67
|
+
"./app/graphql/mutations/create_#{singularized_class_name}.rb",
|
68
|
+
"./app/graphql/mutations/delete_#{singularized_class_name}.rb",
|
69
|
+
"./app/graphql/mutations/destroy_delete_#{singularized_class_name}.rb",
|
70
|
+
"./app/graphql/mutations/update_#{singularized_class_name}.rb",
|
71
|
+
"./app/graphql/queries/#{singularized_class_name}.rb",
|
72
|
+
"./app/graphql/queries/#{pluralized_class_name}.rb",
|
73
|
+
"./app/graphql/resolvers/#{singularized_class_name}_search.rb",
|
74
|
+
"./app/graphql/types/#{singularized_class_name}_type.rb",
|
75
|
+
"./app/graphql/types/edges/#{singularized_class_name}_edge.rb",
|
76
|
+
"./app/graphql/types/connections/#{singularized_class_name}_connection.rb",
|
77
|
+
"./spec/factories/#{pluralized_class_name}.rb",
|
78
|
+
"./spec/mutations/#{singularized_class_name}_spec.rb",
|
79
|
+
"./spec/models/#{singularized_class_name}_spec.rb",
|
80
|
+
"./spec/queries/#{singularized_class_name}_spec.rb",
|
81
|
+
"./spec/policies/#{singularized_class_name}_policy_spec.rb",
|
82
|
+
"./spec/resolvers/#{singularized_class_name}_search_spec.rb"
|
83
|
+
]
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_dir
|
87
|
+
FileUtils.mkdir_p("./app/graphql/mutations")
|
88
|
+
FileUtils.mkdir_p("./app/graphql/queries")
|
89
|
+
FileUtils.mkdir_p("./app/graphql/types")
|
90
|
+
FileUtils.mkdir_p("./app/graphql/resolvers")
|
91
|
+
FileUtils.mkdir_p("./app/models")
|
92
|
+
FileUtils.mkdir_p("./app/policies")
|
93
|
+
FileUtils.mkdir_p("./spec/factories")
|
94
|
+
FileUtils.mkdir_p("./spec/queries")
|
95
|
+
FileUtils.mkdir_p("./spec/mutations")
|
96
|
+
FileUtils.mkdir_p("./spec/models")
|
97
|
+
FileUtils.mkdir_p("./spec/resolvers")
|
98
|
+
FileUtils.mkdir_p("./spec/policies")
|
99
|
+
FileUtils.mkdir_p("./config")
|
100
|
+
FileUtils.touch("./config/souls.rb")
|
101
|
+
FileUtils.mkdir_p("./db/")
|
102
|
+
FileUtils.touch("./db/schema.rb")
|
103
|
+
puts("test dir created!")
|
101
104
|
end
|
102
105
|
end
|
103
106
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Souls
|
2
|
-
|
3
|
-
|
2
|
+
class Generate < Thor
|
3
|
+
desc "connection [CLASS_NAME]", "Generate GraphQL Connection from schema.rb"
|
4
|
+
def connection(class_name)
|
4
5
|
file_dir = "./app/graphql/types/connections/"
|
5
6
|
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
6
7
|
singularized_class_name = class_name.underscore.singularize
|
@@ -14,8 +15,8 @@ module Souls
|
|
14
15
|
end
|
15
16
|
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
16
17
|
file_path
|
17
|
-
rescue
|
18
|
-
raise(
|
18
|
+
rescue Thor::Error => e
|
19
|
+
raise(Thor::Error, e)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|