souls 0.30.9 → 0.31.1
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 +13 -9
- data/exe/souls +31 -38
- data/lib/souls.rb +1 -186
- data/lib/souls/api/generate/application.rb +3 -21
- data/lib/souls/api/update/resolver.rb +1 -1
- data/lib/souls/api/update/rspec_mutation.rb +1 -3
- data/lib/souls/api/update/rspec_resolver.rb +0 -2
- data/lib/souls/cli.rb +8 -0
- data/lib/souls/{docker.rb → cli/docker.rb} +0 -0
- data/lib/souls/{docker → cli/docker}/docker.rb +12 -0
- data/lib/souls/{gcloud.rb → cli/gcloud.rb} +0 -0
- data/lib/souls/{gcloud → cli/gcloud}/compute.rb +0 -0
- data/lib/souls/{gcloud → cli/gcloud}/iam.rb +0 -0
- data/lib/souls/{gcloud → cli/gcloud}/methods.rb +0 -0
- data/lib/souls/{gcloud → cli/gcloud}/pubsub.rb +0 -0
- data/lib/souls/{gcloud → cli/gcloud}/run.rb +0 -0
- data/lib/souls/{release.rb → cli/release.rb} +0 -0
- data/lib/souls/{release → cli/release}/release.rb +0 -0
- data/lib/souls/cli/sync.rb +6 -0
- data/lib/souls/cli/sync/model.rb +87 -0
- data/lib/souls/cli/upgrade.rb +5 -0
- data/lib/souls/cli/upgrade/gem_update.rb +107 -0
- 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.rb +0 -1
- data/lib/souls/worker/generate/mailer.rb +0 -5
- metadata +24 -24
- data/lib/souls/worker/generate/application.rb +0 -150
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6efcfd5a262a33c5d1323e9e2e423a8abf4d4e8f86783ce13bd1332bfe4c7fa7
|
4
|
+
data.tar.gz: 1553a17298b0c55dc273f6b18eacd3165868346501c2431f85ecc7e4444519b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e3b02ca9c947f4a9784ee07500fc2ed470e7d77f8a47e6d6ffe846860f8a769aa7a27d4ad84d735029445cd80e8e1f697959039049f771c00061948825d52ac
|
7
|
+
data.tar.gz: 6f4649ee64d7ccb0300a51ed87c0107ed12b696e4f212a4fac088b588766c709fe660f88fb6b3dc1b23452b0cedb8218e7e2f675ec62aee6065164e0a8ca0ab6
|
data/README.md
CHANGED
@@ -21,12 +21,18 @@
|
|
21
21
|
|
22
22
|
Welcome to SOULs Serverless Application Framework!
|
23
23
|
|
24
|
-
SOULs
|
25
|
-
|
26
|
-
|
24
|
+
SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
|
25
|
+
クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
|
26
|
+
|
27
|
+
SOULs バックエンドには `API` と `Worker` の 2 つのタイプがあります。
|
28
|
+
`API` は主にデータをフロントエンドへ提供します。`Worker` は主に `タスク` の処理を行います
|
27
29
|
|
28
30
|

|
29
31
|
|
32
|
+
現在のバージョンでは SOULs `API` と `Worker` を Github Actions を使って Google Cloud Run へそれぞれデプロイします。
|
33
|
+
|
34
|
+
SOULs フレームワークでは [Monorepo](https://en.wikipedia.org/wiki/Monorepo) によって一つのパッケージでアプリケーションを管理します。
|
35
|
+
|
30
36
|
SOULs creates 3 types of framework.
|
31
37
|
|
32
38
|
1. API - GraphQL (Ruby) - Simple API - Cloud Run
|
@@ -72,13 +78,11 @@ Or install it yourself as:
|
|
72
78
|
And Create Your APP
|
73
79
|
|
74
80
|
$ souls new app_name
|
81
|
+
$ cd apps/api/app_name
|
82
|
+
$ bundle
|
83
|
+
$ souls s
|
75
84
|
|
76
|
-
## Choose SOULs Type:
|
77
85
|
|
78
|
-
Select Strain:
|
79
|
-
1. SOULs GraphQL API
|
80
|
-
2. SOULs Worker
|
81
|
-
3. SOULs Frontend Web
|
82
86
|
|
83
87
|
|
84
88
|
## Gemfile 自動更新アップデート
|
@@ -99,7 +103,7 @@ Souls.configure do |config|
|
|
99
103
|
config.app = "souls-api"
|
100
104
|
config.project_id = "souls-api"
|
101
105
|
config.strain = "api"
|
102
|
-
config.
|
106
|
+
config.github_repo = "elsoul/souls"
|
103
107
|
config.fixed_gems = ["selenium-webdriver", "pg"]
|
104
108
|
end
|
105
109
|
```
|
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 "
|
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 "
|
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 "
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
Whirly.
|
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::Upgrade.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 "
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
Whirly.
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
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["
|
118
|
+
puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
|
120
119
|
end
|
121
|
-
when "
|
122
|
-
|
123
|
-
case
|
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
@@ -3,11 +3,8 @@ require "active_support/core_ext/string/inflections"
|
|
3
3
|
require_relative "souls/init"
|
4
4
|
require_relative "souls/api"
|
5
5
|
require_relative "souls/worker"
|
6
|
-
require_relative "souls/
|
7
|
-
require_relative "souls/release"
|
8
|
-
require_relative "souls/docker"
|
6
|
+
require_relative "souls/cli"
|
9
7
|
require "date"
|
10
|
-
require "dotenv/load"
|
11
8
|
require "json"
|
12
9
|
require "fileutils"
|
13
10
|
require "net/http"
|
@@ -35,108 +32,6 @@ module Souls
|
|
35
32
|
class << self
|
36
33
|
attr_accessor :configuration
|
37
34
|
|
38
|
-
def gemfile_latest_version
|
39
|
-
file_path = "./Gemfile"
|
40
|
-
updated_gems = []
|
41
|
-
updated_gem_versions = []
|
42
|
-
updated_lines = []
|
43
|
-
from_dev = false
|
44
|
-
File.open(file_path, "r") do |f|
|
45
|
-
f.each_line do |line|
|
46
|
-
from_dev = true if line.include?("group")
|
47
|
-
next unless line.include?("gem ")
|
48
|
-
|
49
|
-
gem = line.gsub("gem ", "").gsub("\"", "").gsub("\n", "").gsub(" ", "").split(",")
|
50
|
-
url = URI("https://rubygems.org/api/v1/versions/#{gem[0]}/latest.json")
|
51
|
-
res = Net::HTTP.get_response(url)
|
52
|
-
data = JSON.parse(res.body)
|
53
|
-
next if Souls.configuration.fixed_gems.include?(gem[0].to_s)
|
54
|
-
next if data["version"].to_s == gem[1].to_s
|
55
|
-
|
56
|
-
updated_lines << if from_dev
|
57
|
-
" gem \"#{gem[0]}\", \"#{data['version']}\""
|
58
|
-
else
|
59
|
-
"gem \"#{gem[0]}\", \"#{data['version']}\""
|
60
|
-
end
|
61
|
-
updated_gems << (gem[0]).to_s
|
62
|
-
updated_gem_versions << data["version"]
|
63
|
-
system("gem update #{gem[0]}")
|
64
|
-
end
|
65
|
-
end
|
66
|
-
{
|
67
|
-
gems: updated_gems,
|
68
|
-
lines: updated_lines,
|
69
|
-
updated_gem_versions: updated_gem_versions
|
70
|
-
}
|
71
|
-
end
|
72
|
-
|
73
|
-
def update_gemfile
|
74
|
-
file_path = "./Gemfile"
|
75
|
-
tmp_file = "./tmp/Gemfile"
|
76
|
-
new_gems = gemfile_latest_version
|
77
|
-
logs = []
|
78
|
-
message = Paint["\nAlready Up to date!", :green]
|
79
|
-
return "Already Up to date!" && puts(message) if new_gems[:gems].blank?
|
80
|
-
|
81
|
-
@i = 0
|
82
|
-
File.open(file_path, "r") do |f|
|
83
|
-
File.open(tmp_file, "w") do |new_line|
|
84
|
-
f.each_line do |line|
|
85
|
-
gem = line.gsub("gem ", "").gsub("\"", "").gsub("\n", "").gsub(" ", "").split(",")
|
86
|
-
if new_gems[:gems].include?(gem[0])
|
87
|
-
old_ver = gem[1].split(".")
|
88
|
-
new_ver = new_gems[:updated_gem_versions][@i].split(".")
|
89
|
-
if old_ver[0] < new_ver[0]
|
90
|
-
logs << Paint % [
|
91
|
-
"#{gem[0]} v#{gem[1]} → %{red_text}",
|
92
|
-
:white,
|
93
|
-
{
|
94
|
-
red_text: ["v#{new_gems[:updated_gem_versions][@i]}", :red]
|
95
|
-
}
|
96
|
-
]
|
97
|
-
elsif old_ver[1] < new_ver[1]
|
98
|
-
logs << Paint % [
|
99
|
-
"#{gem[0]} v#{gem[1]} → v#{new_ver[0]}.%{yellow_text}",
|
100
|
-
:white,
|
101
|
-
{
|
102
|
-
yellow_text: ["#{new_ver[1]}.#{new_ver[2]}", :yellow]
|
103
|
-
}
|
104
|
-
]
|
105
|
-
elsif old_ver[2] < new_ver[2]
|
106
|
-
logs << Paint % [
|
107
|
-
"#{gem[0]} v#{gem[1]} → v#{new_ver[0]}.#{new_ver[1]}.%{green_text}",
|
108
|
-
:white,
|
109
|
-
{
|
110
|
-
green_text: [(new_ver[2]).to_s, :green]
|
111
|
-
}
|
112
|
-
]
|
113
|
-
end
|
114
|
-
if gem[0] == "souls"
|
115
|
-
logs << Paint % [
|
116
|
-
"\nSOULs Doc: %{cyan_text}",
|
117
|
-
:white,
|
118
|
-
{ cyan_text: ["https://souls.elsoul.nl\n", :cyan] }
|
119
|
-
]
|
120
|
-
end
|
121
|
-
new_line.write("#{new_gems[:lines][@i]}\n")
|
122
|
-
@i += 1
|
123
|
-
else
|
124
|
-
new_line.write(line)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
FileUtils.rm("./Gemfile")
|
130
|
-
FileUtils.rm("./Gemfile.lock")
|
131
|
-
FileUtils.mv("./tmp/Gemfile", "./Gemfile")
|
132
|
-
system("bundle update")
|
133
|
-
success = Paint["\n\nSuccessfully Updated These Gems!\n", :green]
|
134
|
-
puts(success)
|
135
|
-
logs.each do |line|
|
136
|
-
puts(line)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
35
|
def update_repo(service_name: "api", update_kind: "patch")
|
141
36
|
current_dir_name = FileUtils.pwd.to_s.match(%r{/([^/]+)/?$})[1]
|
142
37
|
current_ver = get_latest_version_txt(service_name: service_name)
|
@@ -252,86 +147,6 @@ module Souls
|
|
252
147
|
puts(Paint["\nSuccessfully Updated #{service_name} Gemfile!", :green])
|
253
148
|
end
|
254
149
|
|
255
|
-
def update_models
|
256
|
-
current_dir_name = FileUtils.pwd.to_s.match(%r{/([^/]+)/?$})[1]
|
257
|
-
permitted_dirs = %w[worker api]
|
258
|
-
unless permitted_dirs.include?(current_dir_name)
|
259
|
-
raise(StandardError, "You are at wrong directory!Go to API or Worker Directory!")
|
260
|
-
end
|
261
|
-
|
262
|
-
cp_dir = get_models_path(service_name: current_dir_name)
|
263
|
-
cp_dir.each do |path|
|
264
|
-
cp_and_dl_files(api_dir: path[:api], worker_dir: path[:worker])
|
265
|
-
end
|
266
|
-
end
|
267
|
-
|
268
|
-
def cp_and_dl_files(api_dir: "", worker_dir: "")
|
269
|
-
if Dir["#{worker_dir}/*.rb"].blank?
|
270
|
-
|
271
|
-
api_latest_date = 1
|
272
|
-
worker_latest_date = 0
|
273
|
-
else
|
274
|
-
api_file_data = file_diff(Dir["#{api_dir}/*.rb"])
|
275
|
-
worker_file_data = file_diff(Dir["#{worker_dir}/*.rb"])
|
276
|
-
|
277
|
-
api_latest_date = Date.parse(api_file_data.max)
|
278
|
-
worker_latest_date = Date.parse(worker_file_data.max)
|
279
|
-
end
|
280
|
-
|
281
|
-
if api_latest_date < worker_latest_date
|
282
|
-
FileUtils.rm_rf(api_dir) if Dir.exist?(api_dir)
|
283
|
-
FileUtils.mkdir(api_dir) unless Dir.exist?(api_dir)
|
284
|
-
system("cp -r #{worker_dir}/* #{api_dir}")
|
285
|
-
else
|
286
|
-
FileUtils.rm_rf(worker_dir) if Dir.exist?(worker_dir)
|
287
|
-
FileUtils.mkdir(worker_dir) unless Dir.exist?(worker_dir)
|
288
|
-
system("cp -r #{api_dir}/* #{worker_dir}")
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
def get_models_path(service_name: "api")
|
293
|
-
case service_name
|
294
|
-
when "api"
|
295
|
-
api_path = "."
|
296
|
-
worker_path = "../worker"
|
297
|
-
when "worker"
|
298
|
-
api_path = "../api"
|
299
|
-
worker_path = "."
|
300
|
-
end
|
301
|
-
[
|
302
|
-
{
|
303
|
-
api: "#{api_path}/db",
|
304
|
-
worker: "#{worker_path}/db"
|
305
|
-
},
|
306
|
-
{
|
307
|
-
api: "#{api_path}/app/models",
|
308
|
-
worker: "#{worker_path}/app/models"
|
309
|
-
},
|
310
|
-
{
|
311
|
-
api: "#{api_path}/spec/factories",
|
312
|
-
worker: "#{worker_path}/spec/factories"
|
313
|
-
}
|
314
|
-
]
|
315
|
-
end
|
316
|
-
|
317
|
-
def file_diff(paths = [])
|
318
|
-
paths.map do |path|
|
319
|
-
stat(path)[:last_update]
|
320
|
-
end
|
321
|
-
end
|
322
|
-
|
323
|
-
def stat(path)
|
324
|
-
s = File::Stat.new(path)
|
325
|
-
last_update = s.mtime.to_s
|
326
|
-
last_status_change = s.ctime.to_s
|
327
|
-
last_access = s.atime.to_s
|
328
|
-
{
|
329
|
-
last_update: last_update,
|
330
|
-
last_status_change: last_status_change,
|
331
|
-
last_access: last_access
|
332
|
-
}
|
333
|
-
end
|
334
|
-
|
335
150
|
def check_schema(class_name: "user")
|
336
151
|
schema_data = get_columns_num(class_name: class_name)
|
337
152
|
create_migration_data = get_create_migration_type(class_name: class_name)
|
@@ -109,7 +109,7 @@ module Souls
|
|
109
109
|
false
|
110
110
|
end
|
111
111
|
|
112
|
-
def self.
|
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.
|
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.
|
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
|
@@ -45,7 +45,7 @@ module Souls
|
|
45
45
|
FileUtils.mv(new_file_path, file_path)
|
46
46
|
puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
47
47
|
rescue StandardError => e
|
48
|
-
p(e
|
48
|
+
p(e)
|
49
49
|
end
|
50
50
|
|
51
51
|
def check_resolver_argument(class_name: "user", action: "argument")
|
@@ -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("
|
60
|
+
new_line.write(" \"#{col[:column_name].camelize(:lower)}\" => #{text},\n")
|
63
61
|
end
|
64
62
|
end
|
65
63
|
test_res = false
|
data/lib/souls/cli.rb
ADDED
File without changes
|
@@ -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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,87 @@
|
|
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 file_diff(paths = [])
|
20
|
+
paths.map do |path|
|
21
|
+
stat(path)[:last_update]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def stat(path)
|
26
|
+
s = File::Stat.new(path)
|
27
|
+
last_update = s.mtime.to_s
|
28
|
+
last_status_change = s.ctime.to_s
|
29
|
+
last_access = s.atime.to_s
|
30
|
+
{
|
31
|
+
last_update: last_update,
|
32
|
+
last_status_change: last_status_change,
|
33
|
+
last_access: last_access
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def cp_and_dl_files(api_dir: "", worker_dir: "")
|
38
|
+
if Dir["#{worker_dir}/*.rb"].blank?
|
39
|
+
|
40
|
+
api_latest_date = 1
|
41
|
+
worker_latest_date = 0
|
42
|
+
else
|
43
|
+
api_file_data = file_diff(Dir["#{api_dir}/*.rb"])
|
44
|
+
worker_file_data = file_diff(Dir["#{worker_dir}/*.rb"])
|
45
|
+
|
46
|
+
api_latest_date = Date.parse(api_file_data.max)
|
47
|
+
worker_latest_date = Date.parse(worker_file_data.max)
|
48
|
+
end
|
49
|
+
|
50
|
+
if api_latest_date < worker_latest_date
|
51
|
+
FileUtils.rm_rf(api_dir) if Dir.exist?(api_dir)
|
52
|
+
FileUtils.mkdir(api_dir) unless Dir.exist?(api_dir)
|
53
|
+
system("cp -r #{worker_dir}/* #{api_dir}")
|
54
|
+
else
|
55
|
+
FileUtils.rm_rf(worker_dir) if Dir.exist?(worker_dir)
|
56
|
+
FileUtils.mkdir(worker_dir) unless Dir.exist?(worker_dir)
|
57
|
+
system("cp -r #{api_dir}/* #{worker_dir}")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_models_path(service_name: "api")
|
62
|
+
case service_name
|
63
|
+
when "api"
|
64
|
+
api_path = "."
|
65
|
+
worker_path = "../worker"
|
66
|
+
when "worker"
|
67
|
+
api_path = "../api"
|
68
|
+
worker_path = "."
|
69
|
+
end
|
70
|
+
[
|
71
|
+
{
|
72
|
+
api: "#{api_path}/db",
|
73
|
+
worker: "#{worker_path}/db"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
api: "#{api_path}/app/models",
|
77
|
+
worker: "#{worker_path}/app/models"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
api: "#{api_path}/spec/factories",
|
81
|
+
worker: "#{worker_path}/spec/factories"
|
82
|
+
}
|
83
|
+
]
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
module Souls
|
2
|
+
module Upgrade
|
3
|
+
class << self
|
4
|
+
def gemfile_latest_version
|
5
|
+
file_path = "./Gemfile"
|
6
|
+
updated_gems = []
|
7
|
+
updated_gem_versions = []
|
8
|
+
updated_lines = []
|
9
|
+
from_dev = false
|
10
|
+
File.open(file_path, "r") do |f|
|
11
|
+
f.each_line do |line|
|
12
|
+
from_dev = true if line.include?("group")
|
13
|
+
next unless line.include?("gem ")
|
14
|
+
|
15
|
+
gem = line.gsub("gem ", "").gsub("\"", "").gsub("\n", "").gsub(" ", "").split(",")
|
16
|
+
url = URI("https://rubygems.org/api/v1/versions/#{gem[0]}/latest.json")
|
17
|
+
res = Net::HTTP.get_response(url)
|
18
|
+
data = JSON.parse(res.body)
|
19
|
+
next if Souls.configuration.fixed_gems.include?(gem[0].to_s)
|
20
|
+
next if data["version"].to_s == gem[1].to_s
|
21
|
+
|
22
|
+
updated_lines << if from_dev
|
23
|
+
" gem \"#{gem[0]}\", \"#{data['version']}\""
|
24
|
+
else
|
25
|
+
"gem \"#{gem[0]}\", \"#{data['version']}\""
|
26
|
+
end
|
27
|
+
updated_gems << (gem[0]).to_s
|
28
|
+
updated_gem_versions << data["version"]
|
29
|
+
system("gem update #{gem[0]}")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
{
|
33
|
+
gems: updated_gems,
|
34
|
+
lines: updated_lines,
|
35
|
+
updated_gem_versions: updated_gem_versions
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def update_gemfile
|
40
|
+
file_path = "./Gemfile"
|
41
|
+
tmp_file = "./tmp/Gemfile"
|
42
|
+
new_gems = gemfile_latest_version
|
43
|
+
logs = []
|
44
|
+
message = Paint["\nAlready Up to date!", :green]
|
45
|
+
return "Already Up to date!" && puts(message) if new_gems[:gems].blank?
|
46
|
+
|
47
|
+
@i = 0
|
48
|
+
File.open(file_path, "r") do |f|
|
49
|
+
File.open(tmp_file, "w") do |new_line|
|
50
|
+
f.each_line do |line|
|
51
|
+
gem = line.gsub("gem ", "").gsub("\"", "").gsub("\n", "").gsub(" ", "").split(",")
|
52
|
+
if new_gems[:gems].include?(gem[0])
|
53
|
+
old_ver = gem[1].split(".")
|
54
|
+
new_ver = new_gems[:updated_gem_versions][@i].split(".")
|
55
|
+
if old_ver[0] < new_ver[0]
|
56
|
+
logs << Paint % [
|
57
|
+
"#{gem[0]} v#{gem[1]} → %{red_text}",
|
58
|
+
:white,
|
59
|
+
{
|
60
|
+
red_text: ["v#{new_gems[:updated_gem_versions][@i]}", :red]
|
61
|
+
}
|
62
|
+
]
|
63
|
+
elsif old_ver[1] < new_ver[1]
|
64
|
+
logs << Paint % [
|
65
|
+
"#{gem[0]} v#{gem[1]} → v#{new_ver[0]}.%{yellow_text}",
|
66
|
+
:white,
|
67
|
+
{
|
68
|
+
yellow_text: ["#{new_ver[1]}.#{new_ver[2]}", :yellow]
|
69
|
+
}
|
70
|
+
]
|
71
|
+
elsif old_ver[2] < new_ver[2]
|
72
|
+
logs << Paint % [
|
73
|
+
"#{gem[0]} v#{gem[1]} → v#{new_ver[0]}.#{new_ver[1]}.%{green_text}",
|
74
|
+
:white,
|
75
|
+
{
|
76
|
+
green_text: [(new_ver[2]).to_s, :green]
|
77
|
+
}
|
78
|
+
]
|
79
|
+
end
|
80
|
+
if gem[0] == "souls"
|
81
|
+
logs << Paint % [
|
82
|
+
"\nSOULs Doc: %{cyan_text}",
|
83
|
+
:white,
|
84
|
+
{ cyan_text: ["https://souls.elsoul.nl\n", :cyan] }
|
85
|
+
]
|
86
|
+
end
|
87
|
+
new_line.write("#{new_gems[:lines][@i]}\n")
|
88
|
+
@i += 1
|
89
|
+
else
|
90
|
+
new_line.write(line)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
FileUtils.rm("./Gemfile")
|
96
|
+
FileUtils.rm("./Gemfile.lock")
|
97
|
+
FileUtils.mv("./tmp/Gemfile", "./Gemfile")
|
98
|
+
system("bundle update")
|
99
|
+
success = Paint["\n\nSuccessfully Updated These Gems!\n", :green]
|
100
|
+
puts(success)
|
101
|
+
logs.each do |line|
|
102
|
+
puts(line)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.1
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.1
|
@@ -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.
|
4
|
+
version: 0.31.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- POPPIN-FUMI
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-08-
|
13
|
+
date: 2021-08-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -27,19 +27,19 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: 6.1.4
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: foreman
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: 0.87.2
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 0.87.2
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: paint
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,10 +83,8 @@ dependencies:
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: 0.3.0
|
85
85
|
description: |-
|
86
|
-
SOULs
|
87
|
-
|
88
|
-
SOULs Ruby GraphQL API / Worker and Easy to deploy to Google Cloud. No more routing for Backends!
|
89
|
-
You can focus on your business logic.
|
86
|
+
SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
|
87
|
+
クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
|
90
88
|
email:
|
91
89
|
- f.kawasaki@elsoul.nl
|
92
90
|
- s.kishi@elsoul.nl
|
@@ -127,23 +125,27 @@ files:
|
|
127
125
|
- lib/souls/api/update/rspec_mutation.rb
|
128
126
|
- lib/souls/api/update/rspec_resolver.rb
|
129
127
|
- lib/souls/api/update/type.rb
|
130
|
-
- lib/souls/
|
131
|
-
- lib/souls/
|
132
|
-
- lib/souls/
|
133
|
-
- lib/souls/gcloud
|
134
|
-
- lib/souls/gcloud/
|
135
|
-
- lib/souls/gcloud/
|
136
|
-
- lib/souls/gcloud/
|
137
|
-
- lib/souls/gcloud/
|
128
|
+
- lib/souls/cli.rb
|
129
|
+
- lib/souls/cli/docker.rb
|
130
|
+
- lib/souls/cli/docker/docker.rb
|
131
|
+
- lib/souls/cli/gcloud.rb
|
132
|
+
- lib/souls/cli/gcloud/compute.rb
|
133
|
+
- lib/souls/cli/gcloud/iam.rb
|
134
|
+
- lib/souls/cli/gcloud/methods.rb
|
135
|
+
- lib/souls/cli/gcloud/pubsub.rb
|
136
|
+
- lib/souls/cli/gcloud/run.rb
|
137
|
+
- lib/souls/cli/release.rb
|
138
|
+
- lib/souls/cli/release/release.rb
|
139
|
+
- lib/souls/cli/sync.rb
|
140
|
+
- lib/souls/cli/sync/model.rb
|
141
|
+
- lib/souls/cli/upgrade.rb
|
142
|
+
- lib/souls/cli/upgrade/gem_update.rb
|
138
143
|
- lib/souls/init.rb
|
139
|
-
- lib/souls/release.rb
|
140
|
-
- lib/souls/release/release.rb
|
141
144
|
- lib/souls/version.rb
|
142
145
|
- lib/souls/versions/.souls_api_version
|
143
146
|
- lib/souls/versions/.souls_worker_version
|
144
147
|
- lib/souls/worker.rb
|
145
148
|
- lib/souls/worker/generate.rb
|
146
|
-
- lib/souls/worker/generate/application.rb
|
147
149
|
- lib/souls/worker/generate/mailer.rb
|
148
150
|
homepage: https://souls.elsoul.nl
|
149
151
|
licenses:
|
@@ -170,8 +172,6 @@ requirements: []
|
|
170
172
|
rubygems_version: 3.2.22
|
171
173
|
signing_key:
|
172
174
|
specification_version: 4
|
173
|
-
summary: SOULs
|
174
|
-
|
175
|
-
the purpose. SOULs Ruby GraphQL API / Worker and Easy to deploy to Google Cloud.
|
176
|
-
No more routing for Backends! You can focus on your business logic.
|
175
|
+
summary: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
|
176
|
+
クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
|
177
177
|
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
|