souls 0.29.8 → 0.30.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/exe/souls +10 -4
- data/lib/souls/api/generate/rspec_mutation.rb +2 -2
- data/lib/souls/api/update.rb +1 -0
- data/lib/souls/api/update/mutation.rb +7 -7
- data/lib/souls/api/update/resolver.rb +3 -3
- data/lib/souls/api/update/rspec_factory.rb +2 -2
- data/lib/souls/api/update/rspec_mutation.rb +2 -2
- data/lib/souls/api/update/rspec_resolver.rb +86 -0
- data/lib/souls/api/update/type.rb +1 -1
- 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
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeb1d10d6473bd7f8ca2cadc783485f74d42bd0e9b90ce2206b08041dcdbf546
|
4
|
+
data.tar.gz: eff44e2e5adcb4a545a336fb4c7600be28a8f85ddea03e475e58bf72a8dac0e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5eab8bc9b90e26757ed3369305cc92de003edf4335a19cf36aae5e5f245bbc45a23b41a41e8525df4ef8d051413213f1a0db166092fab3e2b57fc9063683e3c
|
7
|
+
data.tar.gz: 1fb92dc68e9bd8674f9b749c1a8d043fdaaea54cb4cffd9bfa1bc8833fa6499a47e0013888d30e229f4f7ed362dfe89ef7e87b4f162566af5e896bff6b4b5b22
|
data/exe/souls
CHANGED
@@ -22,10 +22,16 @@ begin
|
|
22
22
|
end
|
23
23
|
when "schema:update"
|
24
24
|
class_name = ARGV[2]
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
status = Paint["Running SOULs Update Commands...", :yellow]
|
26
|
+
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
27
|
+
Whirly.status = status
|
28
|
+
Souls::Api::Update.create_mutation(class_name: class_name)
|
29
|
+
Souls::Api::Update.update_mutation(class_name: class_name)
|
30
|
+
Souls::Api::Update.rspec_factory(class_name: class_name)
|
31
|
+
Souls::Api::Update.rspec_mutation(class_name: class_name)
|
32
|
+
Souls::Api::Update.rspec_resolver(class_name: class_name)
|
33
|
+
Whirly.status = "Done!"
|
34
|
+
end
|
29
35
|
else
|
30
36
|
puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
|
31
37
|
end
|
@@ -92,10 +92,10 @@ module Souls
|
|
92
92
|
" #{camel}: \"\#{#{class_name.singularize}[:#{name.singularize.underscore}]}\"\n"
|
93
93
|
)
|
94
94
|
else
|
95
|
+
camel = name.singularize.camelize(:lower)
|
96
|
+
camels = name.pluralize.camelize(:lower)
|
95
97
|
case type
|
96
98
|
when "string", "text", "date", "datetime"
|
97
|
-
camel = name.singularize.camelize(:lower)
|
98
|
-
camels = name.pluralize.camelize(:lower)
|
99
99
|
if array_true
|
100
100
|
new_line.write(
|
101
101
|
" #{camels}: \#{#{class_name.singularize}[:#{name.pluralize.underscore}]}\n"
|
data/lib/souls/api/update.rb
CHANGED
@@ -4,7 +4,7 @@ module Souls
|
|
4
4
|
class << self
|
5
5
|
def create_mutation(class_name: "user")
|
6
6
|
singularized_class_name = class_name.singularize.underscore
|
7
|
-
new_cols = Souls.
|
7
|
+
new_cols = Souls.get_columns_num(class_name: singularized_class_name)
|
8
8
|
dir_name = "./app/graphql/mutations/base/#{singularized_class_name}"
|
9
9
|
new_file_path = "tmp/create_mutation.rb"
|
10
10
|
file_path = "#{dir_name}/create_#{singularized_class_name}.rb"
|
@@ -17,7 +17,7 @@ module Souls
|
|
17
17
|
|
18
18
|
new_cols.each do |col|
|
19
19
|
type = col[:array] ? "[#{col[:type].camelize}]" : col[:type].camelize
|
20
|
-
args =
|
20
|
+
args = check_mutation_argument(class_name: class_name)
|
21
21
|
unless args.include?(col[:column_name])
|
22
22
|
new_line.write(" argument :#{col[:column_name]}, #{type}, required: false\n")
|
23
23
|
end
|
@@ -31,9 +31,9 @@ module Souls
|
|
31
31
|
puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
34
|
+
def update_mutation(class_name: "user")
|
35
35
|
singularized_class_name = class_name.singularize.underscore
|
36
|
-
new_cols = Souls.
|
36
|
+
new_cols = Souls.get_columns_num(class_name: singularized_class_name)
|
37
37
|
dir_name = "./app/graphql/mutations/base/#{singularized_class_name}"
|
38
38
|
new_file_path = "tmp/update_mutation.rb"
|
39
39
|
file_path = "#{dir_name}/update_#{singularized_class_name}.rb"
|
@@ -47,7 +47,7 @@ module Souls
|
|
47
47
|
new_cols.each do |col|
|
48
48
|
type = Souls::Api::Generate.type_check(col[:type])
|
49
49
|
type = "[#{type}]" if col[:array]
|
50
|
-
args =
|
50
|
+
args = check_mutation_argument(class_name: class_name, action: "update")
|
51
51
|
unless args.include?(col[:column_name])
|
52
52
|
new_line.write(" argument :#{col[:column_name]}, #{type}, required: false\n")
|
53
53
|
end
|
@@ -61,14 +61,14 @@ module Souls
|
|
61
61
|
puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
62
62
|
end
|
63
63
|
|
64
|
-
def
|
64
|
+
def check_mutation_argument(class_name: "user", action: "create")
|
65
65
|
singularized_class_name = class_name.singularize.underscore
|
66
66
|
dir_name = "./app/graphql/mutations/base/#{singularized_class_name}"
|
67
67
|
file_path = "#{dir_name}/#{action}_#{singularized_class_name}.rb"
|
68
68
|
args = []
|
69
69
|
File.open(file_path) do |f|
|
70
70
|
f.each_line do |line|
|
71
|
-
args << line.split(",")[0].gsub("argument :", "").strip if line.include?("argument")
|
71
|
+
args << line.split(",")[0].gsub("argument :", "").strip.underscore if line.include?("argument")
|
72
72
|
end
|
73
73
|
end
|
74
74
|
args
|
@@ -4,7 +4,7 @@ module Souls
|
|
4
4
|
class << self
|
5
5
|
def resolver(class_name: "user")
|
6
6
|
singularized_class_name = class_name.singularize.underscore
|
7
|
-
new_cols = Souls.
|
7
|
+
new_cols = Souls.get_columns_num(class_name: singularized_class_name)
|
8
8
|
dir_name = "./app/graphql/resolvers"
|
9
9
|
new_file_path = "tmp/update_resolver.rb"
|
10
10
|
file_path = "#{dir_name}/#{singularized_class_name}_search.rb"
|
@@ -57,10 +57,10 @@ module Souls
|
|
57
57
|
args << if line.include?("is_deleted")
|
58
58
|
"is_deleted"
|
59
59
|
else
|
60
|
-
line.to_s.match(/if value\[:(.+)\]/)[1]
|
60
|
+
line.to_s.match(/if value\[:(.+)\]/)[1].underscore
|
61
61
|
end
|
62
62
|
elsif action == "argument" && line.include?("argument")
|
63
|
-
args << line.split(",")[0].gsub("argument :", "").strip
|
63
|
+
args << line.split(",")[0].gsub("argument :", "").strip.underscore
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -5,7 +5,7 @@ module Souls
|
|
5
5
|
def rspec_factory(class_name: "user")
|
6
6
|
singularized_class_name = class_name.singularize.underscore
|
7
7
|
pluralized_class_name = class_name.pluralize.underscore
|
8
|
-
new_cols = Souls.
|
8
|
+
new_cols = Souls.get_columns_num(class_name: singularized_class_name)
|
9
9
|
dir_name = "./spec/factories"
|
10
10
|
new_file_path = "tmp/create_factory.rb"
|
11
11
|
file_path = "#{dir_name}/#{pluralized_class_name}.rb"
|
@@ -39,7 +39,7 @@ module Souls
|
|
39
39
|
args = []
|
40
40
|
File.open(file_path) do |f|
|
41
41
|
f.each_line do |line|
|
42
|
-
args << line.split("{")[0].strip if line.include?("{")
|
42
|
+
args << line.split("{")[0].strip.underscore if line.include?("{")
|
43
43
|
end
|
44
44
|
end
|
45
45
|
args
|
@@ -4,7 +4,7 @@ module Souls
|
|
4
4
|
class << self
|
5
5
|
def rspec_mutation(class_name: "user")
|
6
6
|
singularized_class_name = class_name.singularize.underscore
|
7
|
-
new_cols = Souls.
|
7
|
+
new_cols = Souls.get_columns_num(class_name: singularized_class_name)
|
8
8
|
dir_name = "./spec/mutations/base"
|
9
9
|
new_file_path = "tmp/rspec_mutation.rb"
|
10
10
|
file_path = "#{dir_name}/#{singularized_class_name}_spec.rb"
|
@@ -83,7 +83,7 @@ module Souls
|
|
83
83
|
if action == "node_args"
|
84
84
|
args << line.strip.underscore if node_res && !line.include?("{")
|
85
85
|
elsif action == "test_args"
|
86
|
-
args << line.split("\"")[1] if test_res && line.include?("=> be_")
|
86
|
+
args << line.split("\"")[1].underscore if test_res && line.include?("=> be_")
|
87
87
|
elsif line.include?('#{')
|
88
88
|
args << line.split(":")[0].strip.underscore
|
89
89
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module Souls
|
2
|
+
module Api
|
3
|
+
module Update
|
4
|
+
class << self
|
5
|
+
def rspec_resolver(class_name: "user")
|
6
|
+
singularized_class_name = class_name.singularize.underscore
|
7
|
+
new_cols = Souls.get_columns_num(class_name: singularized_class_name)
|
8
|
+
dir_name = "./spec/resolvers"
|
9
|
+
new_file_path = "tmp/rspec_resolver.rb"
|
10
|
+
file_path = "#{dir_name}/#{singularized_class_name}_search_spec.rb"
|
11
|
+
node_res = false
|
12
|
+
test_res = false
|
13
|
+
File.open(file_path) do |f|
|
14
|
+
File.open(new_file_path, "w") do |new_line|
|
15
|
+
f.each_line do |line|
|
16
|
+
new_line.write(line)
|
17
|
+
node_res = true if line.include?("node {")
|
18
|
+
test_res = true if line.include?("include(")
|
19
|
+
node_res = false if node_res && line.include?("}")
|
20
|
+
test_res = false if test_res && line.strip == ")"
|
21
|
+
|
22
|
+
if node_res && !line.include?("{")
|
23
|
+
node_args = check_rspec_resolver_argument(class_name: class_name, action: "node_args")
|
24
|
+
new_cols.each do |col|
|
25
|
+
unless node_args.include?(col[:column_name])
|
26
|
+
new_line.write(" #{col[:column_name].camelize}\n")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
node_res = false
|
30
|
+
elsif test_res && line.include?("=> be_")
|
31
|
+
test_args = check_rspec_resolver_argument(class_name: class_name, action: "test_args")
|
32
|
+
new_cols.each do |col|
|
33
|
+
type = Souls::Api::Generate.type_check(col[:type])
|
34
|
+
text =
|
35
|
+
case type
|
36
|
+
when "String"
|
37
|
+
col[:array] ? "be_all(String)" : "be_a(String)"
|
38
|
+
when "Integer", "Float"
|
39
|
+
col[:array] ? "be_all(Integer)" : "be_a(Integer)"
|
40
|
+
when "Boolean"
|
41
|
+
col[:array] ? "be_all([true, false])" : "be_in([true, false])"
|
42
|
+
else
|
43
|
+
col[:array] ? "be_all(String)" : "be_a(String)"
|
44
|
+
end
|
45
|
+
unless test_args.include?(col[:column_name])
|
46
|
+
new_line.write(" \"#{col[:column_name]}\" => #{text},\n")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
test_res = false
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
FileUtils.rm(file_path)
|
55
|
+
FileUtils.mv(new_file_path, file_path)
|
56
|
+
puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
57
|
+
end
|
58
|
+
|
59
|
+
def check_rspec_resolver_argument(class_name: "user", action: "node_args")
|
60
|
+
singularized_class_name = class_name.singularize.underscore
|
61
|
+
dir_name = "./spec/resolvers"
|
62
|
+
file_path = "#{dir_name}/#{singularized_class_name}_search_spec.rb"
|
63
|
+
node_res = false
|
64
|
+
test_res = false
|
65
|
+
args = []
|
66
|
+
File.open(file_path) do |f|
|
67
|
+
f.each_line do |line|
|
68
|
+
node_res = true if line.include?("node {")
|
69
|
+
test_res = true if line.include?("include(")
|
70
|
+
node_res = false if node_res && line.include?("}")
|
71
|
+
test_res = false if test_res && line.strip == ")"
|
72
|
+
if action == "node_args"
|
73
|
+
args << line.strip.underscore if node_res && !line.include?("{")
|
74
|
+
elsif action == "test_args"
|
75
|
+
args << line.split("\"")[1].underscore if test_res && line.include?("=> be_")
|
76
|
+
elsif line.include?('#{')
|
77
|
+
args << line.split(":")[0].strip.underscore
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
args
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -4,7 +4,7 @@ module Souls
|
|
4
4
|
class << self
|
5
5
|
def type(class_name: "user")
|
6
6
|
singularized_class_name = class_name.singularize.underscore
|
7
|
-
new_cols = Souls.
|
7
|
+
new_cols = Souls.get_columns_num(class_name: singularized_class_name)
|
8
8
|
dir_name = "./app/graphql/types"
|
9
9
|
new_file_path = "tmp/create_type.rb"
|
10
10
|
file_path = "#{dir_name}/#{singularized_class_name}_type.rb"
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.1
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.1
|
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.30.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-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- lib/souls/api/update/resolver.rb
|
126
126
|
- lib/souls/api/update/rspec_factory.rb
|
127
127
|
- lib/souls/api/update/rspec_mutation.rb
|
128
|
+
- lib/souls/api/update/rspec_resolver.rb
|
128
129
|
- lib/souls/api/update/type.rb
|
129
130
|
- lib/souls/docker.rb
|
130
131
|
- lib/souls/docker/docker.rb
|