souls 0.29.8 → 0.29.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 850fd970ee0932d65bed38e8bc32570a029ad30f6a936d7cb38e0515659164e2
4
- data.tar.gz: 79c5e659716710e31c369050de2dff5c8c8b36e9ff52f8a54cdbd43dfda4a5b9
3
+ metadata.gz: 0f42d2f3d6688e319d41d7128bf8c8aec080ba33e7639d61d3ac4595f5326da1
4
+ data.tar.gz: 425c1e53138e2a8e3a9d87fb826b1ac1f68d92897df45d61d5051074e7fce6a8
5
5
  SHA512:
6
- metadata.gz: 454d9847007e1390fb7fd0ee3a544a37c2a022e0fefa48b912efde577e2c8f897a03d0e3f5f57399fcefadaa320578090e7a6a0f23ee267caf4a2aaf2847d307
7
- data.tar.gz: a6576810a7fb39d97fbc310039a643fd2dbc65124279965de480863f38163b0fa18bd7d1eb16713f04065834507984178bf5b6f3762de228158acf8ca99a30f1
6
+ metadata.gz: 13e648f545612ff19102ef78b873180fcba30d893973b0217322e9a6aed65898c18fa67fdad23b9395f611cc2e16b267b7ae805ef5b34fb7aa44ec75a524ff11
7
+ data.tar.gz: 0f7856f28928f36bd31f659dc5f7679c7027e2fb1590a8efe6be9a529dced80674055507c87ec245e22f6e1d0b9a811c88e6fa178ba4db14f15f0308da9a4b48
data/exe/souls CHANGED
@@ -26,6 +26,7 @@ begin
26
26
  Souls::Api::Update.update_mutation(class_name: class_name)
27
27
  Souls::Api::Update.rspec_factory(class_name: class_name)
28
28
  Souls::Api::Update.rspec_mutation(class_name: class_name)
29
+ Souls::Api::Update.rspec_resolver(class_name: class_name)
29
30
  else
30
31
  puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
31
32
  end
@@ -3,6 +3,7 @@ require_relative "./update/resolver"
3
3
  require_relative "./update/type"
4
4
  require_relative "./update/rspec_factory"
5
5
  require_relative "./update/rspec_mutation"
6
+ require_relative "./update/rspec_resolver"
6
7
 
7
8
  module Souls
8
9
  module Api::Update
@@ -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 = check__mutation_argument(class_name: class_name)
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
@@ -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 = check__mutation_argument(class_name: class_name, action: "update")
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 check__mutation_argument(class_name: "user", action: "create")
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
@@ -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
@@ -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
@@ -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,85 @@
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_last_migration_type(class_name: singularized_class_name, action: "add")
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
+ new_line.write(" #{col[:column_name].camelize}\n") unless node_args.include?(col[:column_name])
26
+ end
27
+ node_res = false
28
+ elsif test_res && line.include?("=> be_")
29
+ test_args = check_rspec_resolver_argument(class_name: class_name, action: "test_args")
30
+ new_cols.each do |col|
31
+ type = Souls::Api::Generate.type_check(col[:type])
32
+ p type
33
+ text =
34
+ case type
35
+ when "String"
36
+ col[:array] ? "be_all(String)" : "be_a(String)"
37
+ when "Integer", "Float"
38
+ col[:array] ? "be_all(Integer)" : "be_a(Integer)"
39
+ when "Boolean"
40
+ col[:array] ? "be_all([true, false])" : "be_in([true, false])"
41
+ else
42
+ col[:array] ? "be_all(String)" : "be_a(String)"
43
+ end
44
+ unless test_args.include?(col[:column_name])
45
+ new_line.write(" \"#{col[:column_name]}\" => #{text},\n")
46
+ end
47
+ end
48
+ test_res = false
49
+ end
50
+ end
51
+ end
52
+ end
53
+ FileUtils.rm(file_path)
54
+ FileUtils.mv(new_file_path, file_path)
55
+ puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
56
+ end
57
+
58
+ def check_rspec_resolver_argument(class_name: "user", action: "node_args")
59
+ singularized_class_name = class_name.singularize.underscore
60
+ dir_name = "./spec/resolvers"
61
+ file_path = "#{dir_name}/#{singularized_class_name}_search_spec.rb"
62
+ node_res = false
63
+ test_res = false
64
+ args = []
65
+ File.open(file_path) do |f|
66
+ f.each_line do |line|
67
+ node_res = true if line.include?("node {")
68
+ test_res = true if line.include?("include(")
69
+ node_res = false if node_res && line.include?("}")
70
+ test_res = false if test_res && line.strip == ")"
71
+ if action == "node_args"
72
+ args << line.strip.underscore if node_res && !line.include?("{")
73
+ elsif action == "test_args"
74
+ args << line.split("\"")[1].underscore if test_res && line.include?("=> be_")
75
+ elsif line.include?('#{')
76
+ args << line.split(":")[0].strip.underscore
77
+ end
78
+ end
79
+ end
80
+ args
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.29.8".freeze
2
+ VERSION = "0.29.9".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.8.8
1
+ 0.8.9
@@ -1 +1 @@
1
- 0.8.8
1
+ 0.8.9
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.8
4
+ version: 0.29.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
8
8
  - KishiTheMechanic
9
9
  - James Neve
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
13
  date: 2021-08-17 00:00:00.000000000 Z
@@ -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
@@ -151,7 +152,7 @@ metadata:
151
152
  homepage_uri: https://souls.elsoul.nl
152
153
  source_code_uri: https://github.com/elsoul/souls
153
154
  changelog_uri: https://github.com/elsoul/souls
154
- post_install_message:
155
+ post_install_message:
155
156
  rdoc_options: []
156
157
  require_paths:
157
158
  - lib
@@ -167,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
168
  version: '0'
168
169
  requirements: []
169
170
  rubygems_version: 3.2.22
170
- signing_key:
171
+ signing_key:
171
172
  specification_version: 4
172
173
  summary: SOULs is a Serverless Application Framework with Ruby GraphQL. SOULs has
173
174
  3 strains, API, Worker, and Frontend. It can be used in combination according to