souls 0.59.1 → 0.60.2

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: 56b456c1559798f49b0e0c7804bea985816f077e5ca90d41678ab64a57c143a6
4
- data.tar.gz: c7faba385e7615c85b2a8f1dadcbc057b3bf6d98cd5ece76975ec125b29b3270
3
+ metadata.gz: 9d2a12904fa0b9dd7fc558dcb8bff291ea14302fa9aa14cf87ade8092e27f6cc
4
+ data.tar.gz: 9142fb468c45f4fd65930bba9f29f1c796c85a0d62c29059f3fc0184ba7c1956
5
5
  SHA512:
6
- metadata.gz: d151483cfab1cc36b0cf2d90657a575c8812403a9c53585899ff7830ab0b820f64312c0e1cd1c5078118c73bb187c32f48b8815a889fa476c50ce68d3c2e7fe2
7
- data.tar.gz: f38d7ea5c80f1c4ae127a9b40c77d83a59f8635c36256bdcdc4355776cb8788d76084ec233726026d8e6f33774d243872e3d780372b149ca10abeb8c328c176c
6
+ metadata.gz: 2448ff57ad0c5e940994d81217de376f669d7a33fccf1c8fa0eb65f53a091e8ee0ca9a5aa29521596173554c820ac6584ed2d02071841c9709aca0a5e8781ebb
7
+ data.tar.gz: ca45ef93f5db68edffec37f2dd5b915b4070d9ec8204342085da5c3c42a1544075c1b29cbeac3fb0682f9dd8e0971e9c0625d5f558e900223ea1c9163c309cee
@@ -31,6 +31,7 @@ module Souls
31
31
  TEXT
32
32
  end
33
33
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
34
+ Souls::Generate.new.invoke(:manager_rbs, [singularized_class_name], { mutation: options[:mutation] })
34
35
  file_path
35
36
  rescue Thor::Error => e
36
37
  raise(Thor::Error, e)
@@ -0,0 +1,32 @@
1
+ module Souls
2
+ class Generate < Thor
3
+ desc "manager_rbs [CLASS_NAME]", "Generate SOULs Manager RBS Template"
4
+ method_option :mutation, aliases: "--mutation", required: true, desc: "Mutation File Name"
5
+ def manager_rbs(class_name)
6
+ file_path = ""
7
+ singularized_class_name = class_name.underscore.singularize
8
+ file_dir = "./sig/api/app/graphql/mutations/managers/#{singularized_class_name}_manager"
9
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
10
+ file_path = "#{file_dir}/#{options[:mutation]}.rbs"
11
+ File.open(file_path, "w") do |f|
12
+ f.write(<<~TEXT)
13
+ module Mutations
14
+ module Managers
15
+ module #{singularized_class_name.camelize}Manager
16
+ class #{singularized_class_name.camelize}Login
17
+ def self.description: (String)-> untyped
18
+ def self.argument: (untyped, untyped, untyped)-> untyped
19
+ def self.field: (untyped, untyped, untyped)-> untyped
20
+ end
21
+ end
22
+ end
23
+ end
24
+ TEXT
25
+ puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
26
+ end
27
+ file_path
28
+ rescue Thor::Error => e
29
+ raise(Thor::Error, e)
30
+ end
31
+ end
32
+ end
@@ -19,6 +19,9 @@ module Souls
19
19
  procfile(worker_name: options[:name], port: port)
20
20
  mother_procfile(worker_name: options[:name])
21
21
  souls_config_init(worker_name: options[:name])
22
+ steepfile(worker_name: options[:name])
23
+ souls_helper_rbs(worker_name: options[:name])
24
+ souls_worker_credit(worker_name: options[:name])
22
25
  end
23
26
  true
24
27
  rescue Thor::Error => e
@@ -27,6 +30,26 @@ module Souls
27
30
 
28
31
  private
29
32
 
33
+ def steepfile(worker_name: "mailer")
34
+ file_path = "./Steepfile"
35
+ new_file_path = "config/Steepfile"
36
+ File.open(new_file_path, "w") do |new_line|
37
+ File.open(file_path, "r") do |f|
38
+ f.each_line do |line|
39
+ case line.strip.to_s
40
+ when "end"
41
+ ["app", "db", "constants", "app.rb"].each do |path|
42
+ new_line.write(" check \"apps/#{worker_name}/#{path}\"\n")
43
+ end
44
+ new_line.write("end\n")
45
+ else
46
+ new_line.write(line)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
30
53
  def procfile(worker_name: "mailer", port: 3000)
31
54
  file_dir = "apps/#{worker_name}"
32
55
  file_path = "#{file_dir}/Procfile.dev"
@@ -212,6 +235,47 @@ end
212
235
  puts(e)
213
236
  end
214
237
 
238
+ def souls_helper_rbs(worker_name: "mailer")
239
+ file_dir = "./sig/#{worker_name}/app/utils/"
240
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
241
+ file_path = "#{file_dir}/souls_helper.rbs"
242
+ File.open(file_path, "w") do |f|
243
+ f.write(<<~TEXT)
244
+ module SoulsHelper
245
+ def self.export_csv: (untyped model_name) -> (String? | StandardError )
246
+ def self.export_model_to_csv: (untyped model_name) -> (untyped | StandardError )
247
+ def self.upload_to_gcs: (String file_path, String upload_path) -> untyped
248
+ def self.get_selenium_driver: (?:chrome mode) -> untyped
249
+ end
250
+ module CSV
251
+ def self.open: (*untyped){(untyped) -> nil} -> untyped
252
+ end
253
+ module Selenium
254
+ module WebDriver
255
+ def self.for: (*untyped) -> untyped
256
+ module Chrome
257
+ module Options
258
+ def self.new: ()-> untyped
259
+ end
260
+ end
261
+ module Remote
262
+ module Capabilities
263
+ def self.firefox: ()-> untyped
264
+ end
265
+ end
266
+ end
267
+ end
268
+ module Google
269
+ module Cloud
270
+ module Storage
271
+ def self.new: ()-> untyped
272
+ end
273
+ end
274
+ end
275
+ TEXT
276
+ end
277
+ end
278
+
215
279
  def download_worker(worker_name: "mailer")
216
280
  version = Souls.get_latest_version_txt(service_name: "worker").join(".")
217
281
  file_name = "worker-v#{version}.tgz"
@@ -14,6 +14,7 @@ module Souls
14
14
  download_github_actions(app_name: app_name)
15
15
  initial_config_init(app_name: app_name, service_name: service_name)
16
16
  system("cd #{app_name} && souls add_submodule")
17
+ system("cd #{app_name} && git init")
17
18
  souls_api_credit(app_name: app_name, service_name: service_name)
18
19
  end
19
20
 
@@ -161,10 +162,10 @@ module Souls
161
162
  system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Procfile.dev")
162
163
  system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Procfile")
163
164
  system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Steepfile")
164
- system("cd #{app_name} && git init")
165
165
  system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/gitignore")
166
166
  system("cd #{app_name} && mv gitignore .gitignore")
167
167
  system("cd #{app_name} && bundle")
168
+ system("cd #{app_name}/apps/api && bundle")
168
169
  FileUtils.rm(sig_name)
169
170
  end
170
171
 
@@ -195,7 +196,8 @@ module Souls
195
196
  Easy to Run
196
197
  $ cd #{app_name}
197
198
  $ souls check
198
- $ cd apps/api && souls s
199
+ $ cd apps/api
200
+ $ souls s
199
201
  Go To : http://localhost:4000
200
202
 
201
203
  Doc: https://souls.elsoul.nl
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.59.1".freeze
2
+ VERSION = "0.60.2".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.38.1
1
+ 0.39.2
@@ -1 +1 @@
1
- 0.38.1
1
+ 0.39.2
@@ -1,2 +1,2 @@
1
- require_relative "./mailer"
2
1
  require_relative "./job"
2
+ require_relative "./job_rbs"
@@ -1,8 +1,14 @@
1
1
  module Souls
2
2
  class Generate < Thor
3
3
  desc "job [CLASS_NAME]", "Generate Job File in Worker"
4
+ method_option :mutation, type: :boolean, aliases: "--mailer", default: false, desc: "Mailer Option"
4
5
  def job(class_name)
5
- create_mutation(class_name: class_name)
6
+ if options[:mailer]
7
+ mailgun_mailer(class_name: class_name)
8
+ else
9
+ create_mutation(class_name: class_name)
10
+ end
11
+ Souls::Generate.new.invoke(:job_rbs, [class_name], {})
6
12
  rescue Thor::Error => e
7
13
  raise(Thor::Error, e)
8
14
  end
@@ -36,5 +42,44 @@ module Souls
36
42
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
37
43
  file_path
38
44
  end
45
+
46
+ def mailgun_mailer(class_name: "mailer")
47
+ file_dir = "./app/graphql/mutations/"
48
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
49
+ file_path = "#{file_dir}#{class_name.singularize}.rb"
50
+ raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
51
+
52
+ File.open(file_path, "w") do |f|
53
+ f.write(<<~TEXT)
54
+ module Mutations
55
+ class #{class_name.camelize} < BaseMutation
56
+ description "Mail を送信します。"
57
+ field :response, String, null: false
58
+
59
+ def resolve
60
+ # First, instantiate the Mailgun Client with your API key
61
+ mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
62
+
63
+ # Define your message parameters
64
+ message_params = {
65
+ from: "postmaster@YOUR-DOMAIN",
66
+ to: "sending@to.mail.com",
67
+ subject: "SOULs Mailer test!",
68
+ text: "It is really easy to send a message!"
69
+ }
70
+
71
+ # Send your message through the client
72
+ mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
73
+ { response: "Job done!" }
74
+ rescue StandardError => e
75
+ GraphQL::ExecutionError.new(e.to_s)
76
+ end
77
+ end
78
+ end
79
+ TEXT
80
+ end
81
+ puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
82
+ file_path
83
+ end
39
84
  end
40
85
  end
@@ -0,0 +1,32 @@
1
+ module Souls
2
+ class Generate < Thor
3
+ desc "job_rbs [CLASS_NAME]", "Generate SOULs Job Mutation RBS Template"
4
+ def job_rbs(class_name)
5
+ file_path = ""
6
+ worker_name = FileUtils.pwd.split("/").last
7
+ Dir.chdir(Souls.get_mother_path.to_s) do
8
+ singularized_class_name = class_name.underscore.singularize
9
+ file_dir = "./sig/#{worker_name}/app/graphql/mutations/"
10
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
11
+ file_path = "#{file_dir}#{singularized_class_name}.rbs"
12
+ File.open(file_path, "w") do |f|
13
+ f.write(<<~TEXT)
14
+ module Types
15
+ module Mutations
16
+ String: String
17
+ class #{singularized_class_name.camelize} < BaseMutation
18
+ def self.description: (String) -> untyped
19
+ def self.field: (:response, String, null: false) -> untyped
20
+ end
21
+ end
22
+ end
23
+ TEXT
24
+ end
25
+ puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
26
+ end
27
+ file_path
28
+ rescue Thor::Error => e
29
+ raise(Thor::Error, e)
30
+ end
31
+ end
32
+ end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.59.1
4
+ version: 0.60.2
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
- date: 2021-09-26 00:00:00.000000000 Z
13
+ date: 2021-09-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -134,6 +134,7 @@ files:
134
134
  - lib/souls/api/generate/edge_rbs.rb
135
135
  - lib/souls/api/generate/index.rb
136
136
  - lib/souls/api/generate/manager.rb
137
+ - lib/souls/api/generate/manager_rbs.rb
137
138
  - lib/souls/api/generate/model.rb
138
139
  - lib/souls/api/generate/model_rbs.rb
139
140
  - lib/souls/api/generate/mutation.rb
@@ -191,7 +192,7 @@ files:
191
192
  - lib/souls/versions/.souls_worker_version
192
193
  - lib/souls/worker/generate/index.rb
193
194
  - lib/souls/worker/generate/job.rb
194
- - lib/souls/worker/generate/mailer.rb
195
+ - lib/souls/worker/generate/job_rbs.rb
195
196
  - lib/souls/worker/index.rb
196
197
  homepage: https://souls.elsoul.nl
197
198
  licenses:
@@ -200,7 +201,7 @@ metadata:
200
201
  homepage_uri: https://souls.elsoul.nl
201
202
  source_code_uri: https://github.com/elsoul/souls
202
203
  changelog_uri: https://github.com/elsoul/souls
203
- post_install_message:
204
+ post_install_message:
204
205
  rdoc_options: []
205
206
  require_paths:
206
207
  - lib
@@ -216,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
217
  version: '0'
217
218
  requirements: []
218
219
  rubygems_version: 3.2.22
219
- signing_key:
220
+ signing_key:
220
221
  specification_version: 4
221
222
  summary: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
222
223
  クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
@@ -1,51 +0,0 @@
1
- module Souls
2
- class Generate < Thor
3
- desc "mailer [MAILER_NAME]", "Generate Mailer Template in Worker"
4
- def mailer(class_name)
5
- mailgun_mailer(class_name: class_name)
6
- rescue Thor::Error => e
7
- raise(Thor::Error, e)
8
- end
9
-
10
- private
11
-
12
- def mailgun_mailer(class_name: "mailer")
13
- file_dir = "./app/graphql/mutations/"
14
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
15
- file_path = "#{file_dir}#{class_name.singularize}.rb"
16
- raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
17
-
18
- File.open(file_path, "w") do |f|
19
- f.write(<<~TEXT)
20
- module Mutations
21
- class #{class_name.camelize} < BaseMutation
22
- description "Mail を送信します。"
23
- field :response, String, null: false
24
-
25
- def resolve
26
- # First, instantiate the Mailgun Client with your API key
27
- mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
28
-
29
- # Define your message parameters
30
- message_params = {
31
- from: "postmaster@YOUR-DOMAIN",
32
- to: "sending@to.mail.com",
33
- subject: "SOULs Mailer test!",
34
- text: "It is really easy to send a message!"
35
- }
36
-
37
- # Send your message through the client
38
- mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
39
- { response: "Job done!" }
40
- rescue StandardError => e
41
- GraphQL::ExecutionError.new(e.to_s)
42
- end
43
- end
44
- end
45
- TEXT
46
- end
47
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
48
- file_path
49
- end
50
- end
51
- end