souls 1.7.5 → 1.7.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: 8d89f149b6ed7303f89fb3e269b599458b03632ef231ea4e5e16f759b89b20ac
4
- data.tar.gz: fd0db8f94f5e15ff8530e620c99b2a58f0b1be080a5fe63656defb7314af9b61
3
+ metadata.gz: e561e4f0d34242b5c9038a1891be6e8afdfac703895e9f877e188f3de285d83c
4
+ data.tar.gz: 8efaf89f3c7c17f14e18e6d5d5e617d536a935a1642b60c630acfa1bea0caf75
5
5
  SHA512:
6
- metadata.gz: ee48301b8981aa979ba83b87365e1a5c16486314b15b3908fb04e27ffede40ace96790b98085099df00a1aed8576e0b39761970e201a629e7ffadc27869a83d6
7
- data.tar.gz: 9cabccc639b40edeb0f2d65af212cc3fcd4185bf07d78f87bdb7dfad4bc6433c493ca097faee81f8fcf4a80904650074f94af21fe0f2a2c8e9b538932e8c387a
6
+ metadata.gz: cd18288e94e51ad2264cb67bda1fab5904d9e1fb45a9c60e763e243564dabe6378560d9ec7c0e0f0ae2d3a7b5844c66cf24cd68f34cf72f951a63a4e0174523d
7
+ data.tar.gz: 87c3514e482f00d977031778778ee61557be85142b2eae12b52ee3e6ecfd8a443f34bc8c7a0f0717a3760d52246767113d1d003d5597809348d7ecd10a46e6a2
@@ -131,10 +131,11 @@ module Souls
131
131
  end
132
132
  puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [api_workflow_path.to_s, :white] }])
133
133
  worker_workflow_paths.each do |file_path|
134
- File.open(file_path, "a") do |line|
135
- line.write(" \\ --vpc-connector=#{app_name}-connector \\")
136
- line.write("\n --vpc-egress=all")
137
- end
134
+ worker_workflow = File.readlines(file_path)
135
+ worker_workflow[worker_workflow.size - 1] = worker_workflow.last.chomp
136
+ worker_workflow << " \\ \n --vpc-connector=#{app_name}-connector \\"
137
+ worker_workflow << "\n --vpc-egress=all"
138
+ File.open(file_path, "w") { |f| f.write(worker_workflow.join) }
138
139
  puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
139
140
  end
140
141
  end
@@ -10,7 +10,6 @@ module Souls
10
10
  create_job_type(class_name)
11
11
  create_job(class_name)
12
12
  end
13
- update_query_type(class_name)
14
13
  Souls::Generate.new.invoke(:job_rbs, [class_name], {})
15
14
  Souls::Generate.new.invoke(:rspec_job, [class_name], { mailer: options[:mailer] })
16
15
  rescue Thor::Error => e
@@ -31,7 +30,7 @@ module Souls
31
30
  class #{class_name.camelize} < BaseQuery
32
31
  description ""
33
32
  type Types::#{class_name.camelize}Type, null: false
34
-
33
+
35
34
  def resolve
36
35
  end
37
36
  end
@@ -41,7 +40,7 @@ module Souls
41
40
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
42
41
  file_path
43
42
  end
44
-
43
+
45
44
  def create_job_type(class_name)
46
45
  file_dir = "./app/graphql/types/"
47
46
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
@@ -52,6 +51,7 @@ module Souls
52
51
  f.write(<<~TEXT)
53
52
  module Types
54
53
  class #{class_name.camelize}Type < BaseObject
54
+ field :response, String, null: true
55
55
  end
56
56
  end
57
57
  TEXT
@@ -72,11 +72,11 @@ module Souls
72
72
  class #{class_name.camelize} < BaseQuery
73
73
  description ""
74
74
  type Types::#{class_name.camelize}Type, null: false
75
-
75
+
76
76
  def resolve
77
77
  # First, instantiate the Mailgun Client with your API key
78
78
  mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
79
-
79
+
80
80
  # Define your message parameters
81
81
  message_params = {
82
82
  from: "postmaster@from.mail.com",
@@ -84,7 +84,7 @@ module Souls
84
84
  subject: "SOULs Mailer test!",
85
85
  text: "It is really easy to send a message!"
86
86
  }
87
-
87
+
88
88
  # Send your message through the client
89
89
  mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
90
90
  { response: "Job done!" }
@@ -117,25 +117,5 @@ module Souls
117
117
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
118
118
  file_path
119
119
  end
120
-
121
- def update_query_type(class_name)
122
- file_dir = "./app/graphql/types/base/"
123
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
124
- file_path = "#{file_dir}query_type.rb"
125
- raise(StandardError, "Query type doesn't exist, please re-create it") unless File.exist?(file_path)
126
-
127
- lines = File.readlines(file_path)
128
- unless lines[-1].strip == "end" and lines[-2].strip == "end"
129
- puts(Paint % ["Base query file has changed significantly and cannot be modified automatically, please update routes manually"], :yellow)
130
- return
131
- end
132
-
133
- insert_string = " field :#{class_name.singularize}, resolver: Queries::#{class_name.camelize}\n"
134
- lines.insert(-3, insert_string)
135
- File.open(file_path, "w") { |f| f.write(lines.join) }
136
-
137
- puts(Paint % ["Updated file : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
138
- file_path
139
- end
140
120
  end
141
121
  end
@@ -9,18 +9,30 @@ module Souls
9
9
  file_dir = "./sig/#{worker_name}/app/graphql/queries/"
10
10
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
11
11
  file_path = "#{file_dir}#{singularized_class_name}.rbs"
12
+ type_file_path = "./sig/#{worker_name}/app/graphql/types/#{singularized_class_name}_type.rbs"
12
13
  File.open(file_path, "w") do |f|
13
14
  f.write(<<~TEXT)
14
- module Mutations
15
+ module Queries
15
16
  String: String
16
- class #{singularized_class_name.camelize} < BaseMutation
17
+ class #{singularized_class_name.camelize} < BaseQuery
17
18
  def self.description: (String) -> untyped
18
19
  def self.field: (:response, String, null: false) -> untyped
20
+ def self.type: (untyped, null: false) -> untyped
21
+ end
22
+ end
23
+ TEXT
24
+ end
25
+ File.open(type_file_path, "w") do |f|
26
+ f.write(<<~TEXT)
27
+ module Types
28
+ class #{singularized_class_name.camelize}Type < BaseObject
29
+ def self.field: (:response, String, null: true) -> untyped
19
30
  end
20
31
  end
21
32
  TEXT
22
33
  end
23
34
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
35
+ puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [type_file_path.to_s, :white] }])
24
36
  end
25
37
  file_path
26
38
  rescue Thor::Error => e
@@ -79,8 +79,6 @@ module Souls
79
79
  raise(StandardError, data.errors.full_messages) unless data.save
80
80
 
81
81
  { #{singularized_class_name}_edge: { node: data } }
82
- rescue StandardError => error
83
- GraphQL::ExecutionError.new(error.message)
84
82
  end
85
83
  end
86
84
  end
@@ -152,8 +150,6 @@ module Souls
152
150
  raise(StandardError, data.errors.full_messages) unless data.save
153
151
 
154
152
  { #{singularized_class_name}_edge: { node: data } }
155
- rescue StandardError => error
156
- GraphQL::ExecutionError.new(error.message)
157
153
  end
158
154
  end
159
155
  end
@@ -182,8 +178,6 @@ module Souls
182
178
  #{class_name} = ::#{class_name.camelize}.find data_id
183
179
  #{class_name}.update(is_deleted: true)
184
180
  { #{class_name}: ::#{class_name.camelize}.find(data_id) }
185
- rescue StandardError => error
186
- GraphQL::ExecutionError.new(error.message)
187
181
  end
188
182
  end
189
183
  end
@@ -212,8 +206,6 @@ module Souls
212
206
  #{class_name} = ::#{class_name.camelize}.find data_id
213
207
  #{class_name}.destroy
214
208
  { #{class_name}: #{class_name} }
215
- rescue StandardError => error
216
- GraphQL::ExecutionError.new(error.message)
217
209
  end
218
210
  end
219
211
  end
@@ -5,15 +5,15 @@ module Souls
5
5
  file_dir = "./app/graphql/queries/"
6
6
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
7
7
  singularized_class_name = class_name.singularize
8
- create_query(class_name: singularized_class_name)
9
- create_queries(class_name: singularized_class_name)
8
+ create_individual_query(class_name: singularized_class_name)
9
+ create_index_query(class_name: singularized_class_name)
10
10
  rescue Thor::Error => e
11
11
  raise(Thor::Error, e)
12
12
  end
13
13
 
14
14
  private
15
15
 
16
- def create_queries(class_name: "user")
16
+ def create_index_query(class_name: "user")
17
17
  file_path = "./app/graphql/queries/#{class_name.pluralize}.rb"
18
18
  return "Query already exist! #{file_path}" if File.exist?(file_path)
19
19
 
@@ -25,8 +25,6 @@ module Souls
25
25
 
26
26
  def resolve
27
27
  ::#{class_name.camelize}.all
28
- rescue StandardError => error
29
- GraphQL::ExecutionError.new(error.message)
30
28
  end
31
29
  end
32
30
  end
@@ -38,7 +36,7 @@ module Souls
38
36
  raise(StandardError, e)
39
37
  end
40
38
 
41
- def create_query(class_name: "user")
39
+ def create_individual_query(class_name: "user")
42
40
  file_path = "./app/graphql/queries/#{class_name}.rb"
43
41
  return "Query already exist! #{file_path}" if File.exist?(file_path)
44
42
 
@@ -52,8 +50,6 @@ module Souls
52
50
  def resolve args
53
51
  _, data_id = SoulsApiSchema.from_global_id args[:id]
54
52
  ::#{class_name.camelize}.find(data_id)
55
- rescue StandardError => error
56
- GraphQL::ExecutionError.new(error.message)
57
53
  end
58
54
  end
59
55
  end
@@ -1,5 +1,9 @@
1
1
  module Souls
2
2
  class Sync < Thor
3
+ # rubocop:disable Style/StringHashKeys
4
+ map "models" => :model
5
+ # rubocop:enable Style/StringHashKeys
6
+
3
7
  desc "model", "Sync Model, DB, Factory Files with API"
4
8
  def model
5
9
  cp_dir = %w[db app/models spec/factories]
@@ -90,10 +90,10 @@ module Souls
90
90
  Dir.chdir(Souls.get_mother_path.to_s) do
91
91
  worker_paths.each do |worker|
92
92
  workers =
93
- Dir["apps/#{worker}/app/graphql/mutations/*.rb"].map do |file|
94
- file.gsub("apps/#{worker}/app/graphql/mutations/", "").gsub(".rb", "")
93
+ Dir["apps/#{worker}/app/graphql/queries/*.rb"].map do |file|
94
+ file.gsub("apps/#{worker}/app/graphql/queries/", "").gsub(".rb", "")
95
95
  end
96
- workers.delete("base_mutation")
96
+ workers.delete("base_query")
97
97
  workers.each do |file|
98
98
  response[:"souls_#{worker}_#{file}"] = 1
99
99
  end
@@ -8,58 +8,53 @@ module Souls
8
8
  new_cols = Souls.get_columns_num(class_name: singularized_class_name)
9
9
  end
10
10
  dir_name = "./sig/api/app/graphql/mutations/base/#{singularized_class_name}"
11
- new_file_path = "config/create_mutation.rbs"
12
11
  file_path = "#{dir_name}/create_#{singularized_class_name}.rbs"
13
12
  argument = false
14
13
  resolve = false
15
- File.open(file_path) do |f|
16
- File.open(new_file_path, "w") do |new_line|
17
- f.each_line do |line|
18
- next if line.include?("| (:") && argument
14
+ write_txt = ""
15
+ File.open(file_path, "r") do |f|
16
+ f.each_line do |line|
17
+ next if line.include?("| (:") && argument
19
18
 
20
- if line.include?("{ :node => String } } | ::GraphQL::ExecutionError )")
21
- new_line.write(line)
22
- resolve = false
23
- elsif resolve
24
- next
25
- elsif line.include?("def resolve:") && !resolve
26
- new_cols.each_with_index do |col, i|
27
- type = Souls.type_check(col[:type])
28
- type = "[#{type}]" if col[:array]
29
- next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
19
+ if line.include?("{ :node => String } } | ::GraphQL::ExecutionError )")
20
+ write_txt += line
21
+ resolve = false
22
+ elsif resolve
23
+ next
24
+ elsif line.include?("def resolve:") && !resolve
25
+ new_cols.each_with_index do |col, i|
26
+ type = Souls.type_check(col[:type])
27
+ type = "[#{type}]" if col[:array]
28
+ next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
30
29
 
31
- if i.zero?
32
- new_line.write(line)
33
- else
34
- new_line.write(" #{col[:column_name]}: #{type}?,\n")
35
- end
30
+ if i.zero?
31
+ write_txt += line
32
+ else
33
+ write_txt += " #{col[:column_name]}: #{type}?,\n"
36
34
  end
37
- resolve = true
38
- elsif line.include?("def self.argument:") && !argument
39
- new_cols.each_with_index do |col, i|
40
- type = Souls.type_check(col[:type])
41
- type = "[#{type}]" if col[:array]
42
- next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
35
+ end
36
+ resolve = true
37
+ elsif line.include?("def self.argument:") && !argument
38
+ new_cols.each_with_index do |col, i|
39
+ type = Souls.type_check(col[:type])
40
+ type = "[#{type}]" if col[:array]
41
+ next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
43
42
 
44
- if i.zero?
45
- new_line.write(
46
- " def self.argument: (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
47
- )
48
- else
49
- new_line.write(
50
- " | (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
51
- )
52
- end
43
+ if i.zero?
44
+ write_txt +=
45
+ " def self.argument: (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
46
+ else
47
+ write_txt +=
48
+ " | (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
53
49
  end
54
- argument = true
55
- else
56
- new_line.write(line)
57
50
  end
51
+ argument = true
52
+ else
53
+ write_txt += line
58
54
  end
59
55
  end
60
56
  end
61
- FileUtils.rm(file_path)
62
- FileUtils.mv(new_file_path, file_path)
57
+ File.open(file_path, "w") { |f| f.write(write_txt) }
63
58
  puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
64
59
  rescue Thor::Error => e
65
60
  raise(Thor::Error, e)
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.7.5".freeze
2
+ VERSION = "1.7.9".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.7.5
1
+ 1.7.9
@@ -1 +1 @@
1
- 1.7.5
1
+ 1.7.9
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: 1.7.5
4
+ version: 1.7.9
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-11-12 00:00:00.000000000 Z
13
+ date: 2021-11-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -226,7 +226,7 @@ licenses:
226
226
  metadata:
227
227
  homepage_uri: https://souls.elsoul.nl
228
228
  source_code_uri: https://github.com/elsoul/souls
229
- changelog_uri: https://github.com/elsoul/souls/releases/tag/v1.7.5
229
+ changelog_uri: https://github.com/elsoul/souls/releases/tag/v1.7.9
230
230
  post_install_message:
231
231
  rdoc_options: []
232
232
  require_paths: