souls 0.30.11 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f38dfac57a8b3a98a3ae32b48998897daa2b28261a6122f32f7304150b2b8823
4
- data.tar.gz: f8a82211d490d1fd8b1e66ef9d73f4a706dfdd13e39a4a813f897ac3df8612aa
3
+ metadata.gz: 378a3ef40cd5cbc43e093f65d122236ea79c69a26fb823a7666296f87b36221e
4
+ data.tar.gz: 4396ee4d17f3c1dfeeaf68ba394cfa8252da1269cb8423438242387f4399dd93
5
5
  SHA512:
6
- metadata.gz: 8e1c020a1ffba4bf351ac780d49d2bcf718bcc5e751285d90c837cf3f650ae1271e451c87e9a31f7c13ec209aeb78d7b4e2fa7b77ccf103f56a4246e4466b155
7
- data.tar.gz: 222e487819450db435505e66b282ae8aabba487ecd50de08ffeb33a071e612aa843c1d6e148f17613b9e25ffa27b08a6f49ce2a864dff1d08827343b5490c2df
6
+ metadata.gz: 2686058accaf16fd46e5e54acd294f33296340812417af70c8c2a5730f05082e1bfa6837b60521b4f322b8352f7121094585007b360006ec997a5189958c3046
7
+ data.tar.gz: e9730f1a4824de288bdb98385cfbb43e05ecd0353a9a49fd6079f5130bb958a238960ee73518e2dc0eaf424e9457ea111e945fa80567314fc93292fc20f8cfda
data/exe/souls CHANGED
@@ -20,7 +20,7 @@ begin
20
20
  Souls::Api::Generate.public_send(method_name, class_name: class_name)
21
21
  Whirly.status = "Done!"
22
22
  end
23
- when "schema:update"
23
+ when "update"
24
24
  class_name = ARGV[2]
25
25
  status = Paint["Running SOULs Update Commands...", :yellow]
26
26
  Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
@@ -34,6 +34,9 @@ begin
34
34
  Souls::Api::Update.rspec_resolver(class_name: class_name)
35
35
  Whirly.status = "Done!"
36
36
  end
37
+ when "d", "delete"
38
+ class_name = ARGV[2]
39
+ Souls::Api::Generate.delete_all(class_name: class_name)
37
40
  else
38
41
  puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
39
42
  end
@@ -73,7 +76,7 @@ begin
73
76
  system("bundle exec irb")
74
77
  end
75
78
  end
76
- when "i", "infra", "docker"
79
+ when "docker"
77
80
  send_method = ARGV[1]
78
81
  Souls::Docker.public_send(send_method)
79
82
  when "gcloud"
@@ -86,49 +89,42 @@ begin
86
89
  end
87
90
  when "-v", "--version", "v", "version", "-version", "--v"
88
91
  puts(Paint[Souls::VERSION, :white])
89
- when "gem:update", "gemfile:update"
90
- status = Paint["Checking for updates...", :yellow]
91
- Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
92
- Whirly.status = status
93
- Souls.update_gemfile
94
- Whirly.status = "Done!"
92
+ when "upgrade"
93
+ method_command = ARGV[1]
94
+ case method_command
95
+ when "gemfile", "gem"
96
+ status = Paint["Checking for updates...", :yellow]
97
+ Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
98
+ Whirly.status = status
99
+ Souls.update_gemfile
100
+ Whirly.status = "Done!"
101
+ end
102
+ else
103
+ puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
95
104
  end
96
105
  when "release"
97
106
  Souls::Release.gem_release
98
- when "model:update"
99
- status = Paint["Syncing Models...", :yellow]
100
- Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
101
- Whirly.status = status
102
- Souls.update_models
103
- Whirly.status = "API and Worker Both Models Synced!"
104
- end
105
- when "add"
106
- graphql_class = ARGV[1]
107
- case graphql_class
108
- when "mutation"
109
- Souls::Init.add_mutation(class_name: "user", file_name: "hoi")
110
- when "type"
111
- Souls::Init.add_type(class_name: "user", file_name: "hoi")
112
- when "connection"
113
- Souls::Init.add_connection(class_name: "user", file_name: "hoi")
114
- when "edge"
115
- Souls::Init.add_edge(class_name: "user", file_name: "hoi")
116
- when "rspec_mutation"
117
- Souls::Init.add_rspec_mutation(class_name: "user", file_name: "hoi")
107
+ when "sync"
108
+ target = ARGV[1]
109
+ case target
110
+ when "model", "m"
111
+ status = Paint["Syncing Models...", :yellow]
112
+ Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
113
+ Whirly.status = status
114
+ Souls::Sync.model
115
+ Whirly.status = "API and Worker Both Models Synced!"
116
+ end
118
117
  else
119
- puts(Paint["Wrong Argument!", :red])
118
+ puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
120
119
  end
121
- when "g", "generate"
122
- g_command = ARGV[1]
123
- case g_command
120
+ when "create"
121
+ service_name = ARGV[1]
122
+ case service_name
124
123
  when "worker"
125
124
  Souls::Init.download_worker
126
125
  else
127
126
  puts(Paint["Coming Soon...", :green])
128
127
  end
129
- when "d", "delete"
130
- class_name = ARGV[1]
131
- Souls::Api::Generate.delete_all(class_name: class_name)
132
128
  when "db:create"
133
129
  rack_env = ARGV[1]
134
130
  case rack_env
@@ -164,9 +160,6 @@ begin
164
160
  when "t", "test"
165
161
  system("rubocop -A")
166
162
  system("bundle exec rspec")
167
- when "run"
168
- system("docker build . -t souls -f Dockerfile.dev")
169
- system("docker run --rm --env-file .env -p 3000:3000 souls:latest")
170
163
  when "deploy"
171
164
  project_id = Souls.configuration.project_id
172
165
  system("gcloud builds submit --config=cloudbuild.yml --project #{project_id}")
data/lib/souls.rb CHANGED
@@ -249,68 +249,6 @@ module Souls
249
249
  puts(Paint["\nSuccessfully Updated #{service_name} Gemfile!", :green])
250
250
  end
251
251
 
252
- def update_models
253
- current_dir_name = FileUtils.pwd.to_s.match(%r{/([^/]+)/?$})[1]
254
- permitted_dirs = %w[worker api]
255
- unless permitted_dirs.include?(current_dir_name)
256
- raise(StandardError, "You are at wrong directory!Go to API or Worker Directory!")
257
- end
258
-
259
- cp_dir = get_models_path(service_name: current_dir_name)
260
- cp_dir.each do |path|
261
- cp_and_dl_files(api_dir: path[:api], worker_dir: path[:worker])
262
- end
263
- end
264
-
265
- def cp_and_dl_files(api_dir: "", worker_dir: "")
266
- if Dir["#{worker_dir}/*.rb"].blank?
267
-
268
- api_latest_date = 1
269
- worker_latest_date = 0
270
- else
271
- api_file_data = file_diff(Dir["#{api_dir}/*.rb"])
272
- worker_file_data = file_diff(Dir["#{worker_dir}/*.rb"])
273
-
274
- api_latest_date = Date.parse(api_file_data.max)
275
- worker_latest_date = Date.parse(worker_file_data.max)
276
- end
277
-
278
- if api_latest_date < worker_latest_date
279
- FileUtils.rm_rf(api_dir) if Dir.exist?(api_dir)
280
- FileUtils.mkdir(api_dir) unless Dir.exist?(api_dir)
281
- system("cp -r #{worker_dir}/* #{api_dir}")
282
- else
283
- FileUtils.rm_rf(worker_dir) if Dir.exist?(worker_dir)
284
- FileUtils.mkdir(worker_dir) unless Dir.exist?(worker_dir)
285
- system("cp -r #{api_dir}/* #{worker_dir}")
286
- end
287
- end
288
-
289
- def get_models_path(service_name: "api")
290
- case service_name
291
- when "api"
292
- api_path = "."
293
- worker_path = "../worker"
294
- when "worker"
295
- api_path = "../api"
296
- worker_path = "."
297
- end
298
- [
299
- {
300
- api: "#{api_path}/db",
301
- worker: "#{worker_path}/db"
302
- },
303
- {
304
- api: "#{api_path}/app/models",
305
- worker: "#{worker_path}/app/models"
306
- },
307
- {
308
- api: "#{api_path}/spec/factories",
309
- worker: "#{worker_path}/spec/factories"
310
- }
311
- ]
312
- end
313
-
314
252
  def file_diff(paths = [])
315
253
  paths.map do |path|
316
254
  stat(path)[:last_update]
@@ -109,7 +109,7 @@ module Souls
109
109
  false
110
110
  end
111
111
 
112
- def self.migrate(class_name: "souls")
112
+ def self.scaffold(class_name: "souls")
113
113
  singularized_class_name = class_name.singularize
114
114
  model(class_name: singularized_class_name)
115
115
  type(class_name: singularized_class_name)
@@ -130,10 +130,10 @@ module Souls
130
130
  raise(StandardError, e)
131
131
  end
132
132
 
133
- def self.migrate_all
133
+ def self.scaffold_all
134
134
  puts(Paint["Let's Go SOULs AUTO CRUD Assist!\n", :cyan])
135
135
  Souls::Api::Generate.get_tables.each do |table|
136
- Souls::Api::Generate.migrate(class_name: table.singularize)
136
+ Souls::Api::Generate.scaffold(class_name: table.singularize)
137
137
  puts(Paint["Generated #{table.camelize} CRUD Files\n", :yellow])
138
138
  end
139
139
  end
@@ -160,23 +160,5 @@ module Souls
160
160
  rescue StandardError => e
161
161
  raise(StandardError, e)
162
162
  end
163
-
164
- def self.update_delete(class_name: "souls")
165
- singularized_class_name = class_name.singularize.underscore
166
- pluralized_class_name = class_name.pluralize.underscore
167
- FileUtils.rm_rf("./app/graphql/mutations/#{singularized_class_name}")
168
- FileUtils.rm("./app/graphql/queries/#{singularized_class_name}.rb")
169
- FileUtils.rm("./app/graphql/queries/#{pluralized_class_name}.rb")
170
- FileUtils.rm("./app/graphql/resolvers/#{singularized_class_name}_search.rb")
171
- FileUtils.rm("./app/graphql/types/#{singularized_class_name}_type.rb")
172
- FileUtils.rm("./app/graphql/types/edges/#{singularized_class_name}_edge.rb")
173
- FileUtils.rm("./app/graphql/types/connections/#{singularized_class_name}_connection.rb")
174
- FileUtils.rm("./spec/mutations/#{singularized_class_name}_spec.rb")
175
- FileUtils.rm("./spec/queries/#{singularized_class_name}_spec.rb")
176
- FileUtils.rm("./spec/resolvers/#{singularized_class_name}_search_spec.rb")
177
- puts("deleted #{class_name.camelize} CRUD!")
178
- rescue StandardError => e
179
- raise(StandardError, e)
180
- end
181
163
  end
182
164
  end
@@ -49,8 +49,6 @@ module Souls
49
49
  type = Souls::Api::Generate.type_check(col[:type])
50
50
  text =
51
51
  case type
52
- when "String"
53
- col[:array] ? "be_all(String)" : "be_a(String)"
54
52
  when "Integer", "Float"
55
53
  col[:array] ? "be_all(Integer)" : "be_a(Integer)"
56
54
  when "Boolean"
@@ -59,7 +57,7 @@ module Souls
59
57
  col[:array] ? "be_all(String)" : "be_a(String)"
60
58
  end
61
59
  unless test_args.include?(col[:column_name])
62
- new_line.write(" \"#{col[:column_name].camelize(:lower)}\" => #{text},\n")
60
+ new_line.write(" \"#{col[:column_name].camelize(:lower)}\" => #{text},\n")
63
61
  end
64
62
  end
65
63
  test_res = false
@@ -33,8 +33,6 @@ module Souls
33
33
  type = Souls::Api::Generate.type_check(col[:type])
34
34
  text =
35
35
  case type
36
- when "String"
37
- col[:array] ? "be_all(String)" : "be_a(String)"
38
36
  when "Integer", "Float"
39
37
  col[:array] ? "be_all(Integer)" : "be_a(Integer)"
40
38
  when "Boolean"
data/lib/souls/cli.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require_relative "./cli/docker"
2
2
  require_relative "./cli/gcloud"
3
3
  require_relative "./cli/release"
4
+ require_relative "./cli/sync"
4
5
 
5
6
  module Souls
6
7
  end
@@ -26,6 +26,18 @@ module Souls
26
26
  )
27
27
  system("docker ps")
28
28
  end
29
+
30
+ def run
31
+ current_dir_name = FileUtils.pwd.to_s.match(%r{/([^/]+)/?$})[1]
32
+ port =
33
+ if current_dir_name == "api"
34
+ "4000:4000"
35
+ else
36
+ "3000:3000"
37
+ end
38
+ system("docker build . -t souls-app -f Dockerfile.dev")
39
+ system("docker run --name souls-app --rm --env-file .env -p #{port} souls-app:latest")
40
+ end
29
41
  end
30
42
  end
31
43
  end
@@ -0,0 +1,6 @@
1
+ require_relative "./sync/model"
2
+
3
+ module Souls
4
+ module Sync
5
+ end
6
+ end
@@ -0,0 +1,69 @@
1
+ module Souls
2
+ module Sync
3
+ class << self
4
+ def model
5
+ current_dir_name = FileUtils.pwd.to_s.match(%r{/([^/]+)/?$})[1]
6
+ permitted_dirs = %w[worker api]
7
+ unless permitted_dirs.include?(current_dir_name)
8
+ raise(StandardError, "You are at wrong directory!Go to API or Worker Directory!")
9
+ end
10
+
11
+ cp_dir = get_models_path(service_name: current_dir_name)
12
+ cp_dir.each do |path|
13
+ cp_and_dl_files(api_dir: path[:api], worker_dir: path[:worker])
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def cp_and_dl_files(api_dir: "", worker_dir: "")
20
+ if Dir["#{worker_dir}/*.rb"].blank?
21
+
22
+ api_latest_date = 1
23
+ worker_latest_date = 0
24
+ else
25
+ api_file_data = file_diff(Dir["#{api_dir}/*.rb"])
26
+ worker_file_data = file_diff(Dir["#{worker_dir}/*.rb"])
27
+
28
+ api_latest_date = Date.parse(api_file_data.max)
29
+ worker_latest_date = Date.parse(worker_file_data.max)
30
+ end
31
+
32
+ if api_latest_date < worker_latest_date
33
+ FileUtils.rm_rf(api_dir) if Dir.exist?(api_dir)
34
+ FileUtils.mkdir(api_dir) unless Dir.exist?(api_dir)
35
+ system("cp -r #{worker_dir}/* #{api_dir}")
36
+ else
37
+ FileUtils.rm_rf(worker_dir) if Dir.exist?(worker_dir)
38
+ FileUtils.mkdir(worker_dir) unless Dir.exist?(worker_dir)
39
+ system("cp -r #{api_dir}/* #{worker_dir}")
40
+ end
41
+ end
42
+
43
+ def get_models_path(service_name: "api")
44
+ case service_name
45
+ when "api"
46
+ api_path = "."
47
+ worker_path = "../worker"
48
+ when "worker"
49
+ api_path = "../api"
50
+ worker_path = "."
51
+ end
52
+ [
53
+ {
54
+ api: "#{api_path}/db",
55
+ worker: "#{worker_path}/db"
56
+ },
57
+ {
58
+ api: "#{api_path}/app/models",
59
+ worker: "#{worker_path}/app/models"
60
+ },
61
+ {
62
+ api: "#{api_path}/spec/factories",
63
+ worker: "#{worker_path}/spec/factories"
64
+ }
65
+ ]
66
+ end
67
+ end
68
+ end
69
+ end
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.30.11".freeze
2
+ VERSION = "0.31.0".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.9.11
1
+ 0.10.0
@@ -1 +1 @@
1
- 0.9.11
1
+ 0.10.0
@@ -1,4 +1,3 @@
1
- require_relative "./generate/application"
2
1
  require_relative "./generate/mailer"
3
2
 
4
3
  module Souls
@@ -3,7 +3,6 @@ module Souls
3
3
  module Generate
4
4
  class << self
5
5
  def mailer(class_name: "mailer", option: "")
6
- puts(option)
7
6
  if option.to_sym == :sendgrid
8
7
  sendgrid_mailer(class_name: class_name)
9
8
  else
@@ -52,10 +51,6 @@ module Souls
52
51
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
53
52
  file_path
54
53
  end
55
-
56
- def sendgrid_mailer(class_name: "mailer")
57
- p("Coming Soon..")
58
- end
59
54
  end
60
55
  end
61
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.11
4
+ version: 0.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
@@ -82,8 +82,9 @@ dependencies:
82
82
  - - '='
83
83
  - !ruby/object:Gem::Version
84
84
  version: 0.3.0
85
- description: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。クラウド環境への自動デプロイ、CI/CD
86
- ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
85
+ description: |-
86
+ SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
87
+ クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
87
88
  email:
88
89
  - f.kawasaki@elsoul.nl
89
90
  - s.kishi@elsoul.nl
@@ -135,13 +136,14 @@ files:
135
136
  - lib/souls/cli/gcloud/run.rb
136
137
  - lib/souls/cli/release.rb
137
138
  - lib/souls/cli/release/release.rb
139
+ - lib/souls/cli/sync.rb
140
+ - lib/souls/cli/sync/model.rb
138
141
  - lib/souls/init.rb
139
142
  - lib/souls/version.rb
140
143
  - lib/souls/versions/.souls_api_version
141
144
  - lib/souls/versions/.souls_worker_version
142
145
  - lib/souls/worker.rb
143
146
  - lib/souls/worker/generate.rb
144
- - lib/souls/worker/generate/application.rb
145
147
  - lib/souls/worker/generate/mailer.rb
146
148
  homepage: https://souls.elsoul.nl
147
149
  licenses:
@@ -168,6 +170,6 @@ requirements: []
168
170
  rubygems_version: 3.2.22
169
171
  signing_key:
170
172
  specification_version: 4
171
- summary: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。クラウド環境への自動デプロイ、CI/CD
172
- ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
173
+ summary: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
174
+ クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
173
175
  test_files: []
@@ -1,150 +0,0 @@
1
- module Souls
2
- module Worker
3
- module Generate
4
- ## Common Methods
5
- def self.generated_paths(class_name: "user")
6
- singularized_class_name = class_name.singularize.underscore
7
- pluralized_class_name = class_name.pluralize.underscore
8
- [
9
- "./app/models/#{singularized_class_name}.rb",
10
- "./app/policies/#{singularized_class_name}_policy.rb",
11
- "./app/graphql/mutations/create_#{singularized_class_name}.rb",
12
- "./app/graphql/mutations/delete_#{singularized_class_name}.rb",
13
- "./app/graphql/mutations/destroy_delete_#{singularized_class_name}.rb",
14
- "./app/graphql/mutations/update_#{singularized_class_name}.rb",
15
- "./app/graphql/queries/#{singularized_class_name}.rb",
16
- "./app/graphql/queries/#{pluralized_class_name}.rb",
17
- "./app/graphql/resolvers/#{singularized_class_name}_search.rb",
18
- "./app/graphql/types/#{singularized_class_name}_type.rb",
19
- "./app/graphql/types/edges/#{singularized_class_name}_edge.rb",
20
- "./app/graphql/types/connections/#{singularized_class_name}_connection.rb",
21
- "./spec/factories/#{pluralized_class_name}.rb",
22
- "./spec/mutations/#{singularized_class_name}_spec.rb",
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
29
-
30
- def self.get_type_and_name(line)
31
- line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
32
- end
33
-
34
- def self.get_tables
35
- path = "./db/schema.rb"
36
- tables = []
37
- File.open(path, "r") do |f|
38
- f.each_line.with_index do |line, _i|
39
- tables << line.split("\"")[1] if line.include?("create_table")
40
- end
41
- end
42
- tables
43
- end
44
-
45
- def self.type_check(type)
46
- {
47
- bigint: "Integer",
48
- string: "String",
49
- float: "Float",
50
- text: "String",
51
- datetime: "String",
52
- date: "String",
53
- boolean: "Boolean",
54
- integer: "Integer"
55
- }[type.to_sym]
56
- end
57
-
58
- def self.get_test_type(type)
59
- {
60
- bigint: 1,
61
- float: 4.2,
62
- string: '"MyString"',
63
- text: '"MyString"',
64
- datetime: "Time.now",
65
- date: "Time.now",
66
- boolean: false,
67
- integer: 1
68
- }[type.to_sym]
69
- end
70
-
71
- def self.table_check(line: "", class_name: "")
72
- if line.include?("create_table") && (line.split[1].gsub("\"", "").gsub(",", "") == class_name.pluralize.to_s)
73
-
74
- return true
75
- end
76
-
77
- false
78
- end
79
-
80
- def self.migrate(class_name: "souls")
81
- singularized_class_name = class_name.singularize
82
- model(class_name: singularized_class_name)
83
- type(class_name: singularized_class_name)
84
- edge(class_name: singularized_class_name)
85
- connection(class_name: singularized_class_name)
86
- resolver(class_name: singularized_class_name)
87
- rspec_factory(class_name: singularized_class_name)
88
- rspec_model(class_name: singularized_class_name)
89
- rspec_mutation(class_name: singularized_class_name)
90
- rspec_query(class_name: singularized_class_name)
91
- rspec_resolver(class_name: singularized_class_name)
92
- query(class_name: singularized_class_name)
93
- mutation(class_name: singularized_class_name)
94
- policy(class_name: singularized_class_name)
95
- rspec_policy(class_name: singularized_class_name)
96
- rescue StandardError => e
97
- raise(StandardError, e)
98
- end
99
-
100
- def self.migrate_all
101
- puts(Paint["Let's Go SOULs AUTO CRUD Assist!\n", :cyan])
102
- Souls::Api::Generate.get_tables.each do |table|
103
- Souls::Api::Generate.migrate(class_name: table.singularize)
104
- puts(Paint["Generated #{table.camelize} CRUD Files\n", :yellow])
105
- end
106
- end
107
-
108
- def self.delete_all(class_name: "souls")
109
- singularized_class_name = class_name.singularize.underscore
110
- pluralized_class_name = class_name.pluralize.underscore
111
- FileUtils.rm("./app/models/#{singularized_class_name}.rb")
112
- FileUtils.rm("./app/policies/#{singularized_class_name}_policy.rb")
113
- FileUtils.rm_rf("./app/graphql/mutations/base/#{singularized_class_name}")
114
- FileUtils.rm("./app/graphql/queries/#{singularized_class_name}.rb")
115
- FileUtils.rm("./app/graphql/queries/#{pluralized_class_name}.rb")
116
- FileUtils.rm("./app/graphql/resolvers/#{singularized_class_name}_search.rb")
117
- FileUtils.rm("./app/graphql/types/#{singularized_class_name}_type.rb")
118
- FileUtils.rm("./app/graphql/types/edges/#{singularized_class_name}_edge.rb")
119
- FileUtils.rm("./app/graphql/types/connections/#{singularized_class_name}_connection.rb")
120
- FileUtils.rm("./spec/factories/#{pluralized_class_name}.rb")
121
- FileUtils.rm("./spec/mutations/base/#{singularized_class_name}_spec.rb")
122
- FileUtils.rm("./spec/models/#{singularized_class_name}_spec.rb")
123
- FileUtils.rm("./spec/queries/#{singularized_class_name}_spec.rb")
124
- FileUtils.rm("./spec/policies/#{singularized_class_name}_policy_spec.rb")
125
- FileUtils.rm("./spec/resolvers/#{singularized_class_name}_search_spec.rb")
126
- puts(Paint["deleted #{class_name.camelize} CRUD!", :yellow])
127
- rescue StandardError => e
128
- raise(StandardError, e)
129
- end
130
-
131
- def self.update_delete(class_name: "souls")
132
- singularized_class_name = class_name.singularize.underscore
133
- pluralized_class_name = class_name.pluralize.underscore
134
- FileUtils.rm_rf("./app/graphql/mutations/#{singularized_class_name}")
135
- FileUtils.rm("./app/graphql/queries/#{singularized_class_name}.rb")
136
- FileUtils.rm("./app/graphql/queries/#{pluralized_class_name}.rb")
137
- FileUtils.rm("./app/graphql/resolvers/#{singularized_class_name}_search.rb")
138
- FileUtils.rm("./app/graphql/types/#{singularized_class_name}_type.rb")
139
- FileUtils.rm("./app/graphql/types/edges/#{singularized_class_name}_edge.rb")
140
- FileUtils.rm("./app/graphql/types/connections/#{singularized_class_name}_connection.rb")
141
- FileUtils.rm("./spec/mutations/#{singularized_class_name}_spec.rb")
142
- FileUtils.rm("./spec/queries/#{singularized_class_name}_spec.rb")
143
- FileUtils.rm("./spec/resolvers/#{singularized_class_name}_search_spec.rb")
144
- puts("deleted #{class_name.camelize} CRUD!")
145
- rescue StandardError => e
146
- raise(StandardError, e)
147
- end
148
- end
149
- end
150
- end