souls 1.6.5 → 1.6.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 +4 -4
- data/lib/souls/cli/db/index.rb +0 -1
- data/lib/souls/cli/generate/job.rb +79 -24
- data/lib/souls/cli/generate/job_rbs.rb +1 -1
- data/lib/souls/cli/generate/rspec_job.rb +13 -20
- data/lib/souls/cli/release/release.rb +5 -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
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa32054209e5863c894e11a0ce98e18980db87bf16073d358823534df3f5b094
|
4
|
+
data.tar.gz: c16aabeb346be73735ada774b29d0ade014989b3ad9d4cf3abef136722991852
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 612fd4196a2df781bcfc95e5b1f7a2a09c74dd6fd0e01c147e892f42053565f074aceca4c38603a5415fd1da8f5c4f2e5b31d033d2d8d8aa66cb99d25789877e
|
7
|
+
data.tar.gz: '0449bc1ca1495a818bbdf89b67f83d4a7e8cc9196b22e06a070f3c2de44df6f458a8942a0589292934343a94e558a43986e6403cba474f93eada2437a4cb1689'
|
data/lib/souls/cli/db/index.rb
CHANGED
@@ -4,10 +4,13 @@ module Souls
|
|
4
4
|
method_option :mailer, type: :boolean, aliases: "--mailer", default: false, desc: "Mailer Option"
|
5
5
|
def job(class_name)
|
6
6
|
if options[:mailer]
|
7
|
+
create_job_mailer_type(class_name)
|
7
8
|
mailgun_mailer(class_name)
|
8
9
|
else
|
9
|
-
|
10
|
+
create_job_type(class_name)
|
11
|
+
create_job(class_name)
|
10
12
|
end
|
13
|
+
update_query_type(class_name)
|
11
14
|
Souls::Generate.new.invoke(:job_rbs, [class_name], {})
|
12
15
|
Souls::Generate.new.invoke(:rspec_job, [class_name], { mailer: options[:mailer] })
|
13
16
|
rescue Thor::Error => e
|
@@ -16,25 +19,20 @@ module Souls
|
|
16
19
|
|
17
20
|
private
|
18
21
|
|
19
|
-
def
|
20
|
-
file_dir = "./app/graphql/
|
22
|
+
def create_job(class_name)
|
23
|
+
file_dir = "./app/graphql/queries/"
|
21
24
|
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
22
25
|
file_path = "#{file_dir}#{class_name.singularize}.rb"
|
23
|
-
raise(StandardError, "
|
26
|
+
raise(StandardError, "Query already exist! #{file_path}") if File.exist?(file_path)
|
24
27
|
|
25
28
|
File.open(file_path, "w") do |f|
|
26
29
|
f.write(<<~TEXT)
|
27
|
-
module
|
28
|
-
class #{class_name.camelize} <
|
29
|
-
description "
|
30
|
-
|
31
|
-
|
30
|
+
module Queries
|
31
|
+
class #{class_name.camelize} < BaseQuery
|
32
|
+
description ""
|
33
|
+
type Types::#{class_name.camelize}Type, null: false
|
34
|
+
|
32
35
|
def resolve
|
33
|
-
# Define Job Here
|
34
|
-
|
35
|
-
{ response: "Job done!" }
|
36
|
-
rescue StandardError => e
|
37
|
-
GraphQL::ExecutionError.new(e.to_s)
|
38
36
|
end
|
39
37
|
end
|
40
38
|
end
|
@@ -43,32 +41,50 @@ module Souls
|
|
43
41
|
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
44
42
|
file_path
|
45
43
|
end
|
44
|
+
|
45
|
+
def create_job_type(class_name)
|
46
|
+
file_dir = "./app/graphql/types/"
|
47
|
+
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
48
|
+
file_path = "#{file_dir}#{class_name.singularize}_type.rb"
|
49
|
+
raise(StandardError, "Type already exists! #{file_path}") if File.exist?(file_path)
|
50
|
+
|
51
|
+
File.open(file_path, "w") do |f|
|
52
|
+
f.write(<<~TEXT)
|
53
|
+
module Types
|
54
|
+
class #{class_name.camelize}Type < BaseObject
|
55
|
+
end
|
56
|
+
end
|
57
|
+
TEXT
|
58
|
+
end
|
59
|
+
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
60
|
+
file_path
|
61
|
+
end
|
46
62
|
|
47
63
|
def mailgun_mailer(class_name)
|
48
|
-
file_dir = "./app/graphql/
|
64
|
+
file_dir = "./app/graphql/queries/"
|
49
65
|
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
50
66
|
file_path = "#{file_dir}#{class_name.singularize}.rb"
|
51
|
-
raise(StandardError, "Mailer already
|
67
|
+
raise(StandardError, "Mailer already exists! #{file_path}") if File.exist?(file_path)
|
52
68
|
|
53
69
|
File.open(file_path, "w") do |f|
|
54
70
|
f.write(<<~TEXT)
|
55
|
-
module
|
56
|
-
class #{class_name.camelize} <
|
57
|
-
description "
|
58
|
-
|
59
|
-
|
71
|
+
module Queries
|
72
|
+
class #{class_name.camelize} < BaseQuery
|
73
|
+
description ""
|
74
|
+
type Types::#{class_name.camelize}Type, null: false
|
75
|
+
|
60
76
|
def resolve
|
61
77
|
# First, instantiate the Mailgun Client with your API key
|
62
78
|
mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
|
63
|
-
|
79
|
+
|
64
80
|
# Define your message parameters
|
65
81
|
message_params = {
|
66
|
-
from: "postmaster@
|
82
|
+
from: "postmaster@from.mail.com",
|
67
83
|
to: "sending@to.mail.com",
|
68
84
|
subject: "SOULs Mailer test!",
|
69
85
|
text: "It is really easy to send a message!"
|
70
86
|
}
|
71
|
-
|
87
|
+
|
72
88
|
# Send your message through the client
|
73
89
|
mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
|
74
90
|
{ response: "Job done!" }
|
@@ -82,5 +98,44 @@ module Souls
|
|
82
98
|
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
83
99
|
file_path
|
84
100
|
end
|
101
|
+
|
102
|
+
def create_job_mailer_type(class_name)
|
103
|
+
file_dir = "./app/graphql/types/"
|
104
|
+
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
105
|
+
file_path = "#{file_dir}#{class_name.singularize}_type.rb"
|
106
|
+
raise(StandardError, "Type already exists! #{file_path}") if File.exist?(file_path)
|
107
|
+
|
108
|
+
File.open(file_path, "w") do |f|
|
109
|
+
f.write(<<~TEXT)
|
110
|
+
module Types
|
111
|
+
class #{class_name.camelize}Type < BaseObject
|
112
|
+
field :response, String, null: true
|
113
|
+
end
|
114
|
+
end
|
115
|
+
TEXT
|
116
|
+
end
|
117
|
+
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
118
|
+
file_path
|
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
|
85
140
|
end
|
86
141
|
end
|
@@ -6,7 +6,7 @@ module Souls
|
|
6
6
|
worker_name = FileUtils.pwd.split("/").last
|
7
7
|
Dir.chdir(Souls.get_mother_path.to_s) do
|
8
8
|
singularized_class_name = class_name.underscore.singularize
|
9
|
-
file_dir = "./sig/#{worker_name}/app/graphql/
|
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
12
|
File.open(file_path, "w") do |f|
|
@@ -4,7 +4,7 @@ module Souls
|
|
4
4
|
method_option :mailer, type: :boolean, aliases: "--mailer", default: false, desc: "Mailgun Template"
|
5
5
|
def rspec_job(class_name)
|
6
6
|
singularized_class_name = class_name.underscore.singularize
|
7
|
-
file_dir = "./spec/
|
7
|
+
file_dir = "./spec/queries/jobs/"
|
8
8
|
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
9
9
|
file_path = "#{file_dir}/#{singularized_class_name}_spec.rb"
|
10
10
|
return "RspecJob already exist! #{file_path}" if File.exist?(file_path)
|
@@ -15,9 +15,9 @@ module Souls
|
|
15
15
|
RSpec.describe("#{singularized_class_name.camelize}") do
|
16
16
|
describe "Define #{singularized_class_name.camelize}" do
|
17
17
|
|
18
|
-
let(:
|
19
|
-
%(
|
20
|
-
#{singularized_class_name.camelize(:lower)}
|
18
|
+
let(:query) do
|
19
|
+
%(query {
|
20
|
+
#{singularized_class_name.camelize(:lower)} {
|
21
21
|
response
|
22
22
|
}
|
23
23
|
}
|
@@ -31,12 +31,9 @@ module Souls
|
|
31
31
|
it "return #{singularized_class_name.camelize} response" do
|
32
32
|
stub_request(:post, "https://api.mailgun.net/v3/YOUR-MAILGUN-DOMAIN/messages")
|
33
33
|
.to_return(status: 200, body: "", headers: {})
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
rescue StandardError
|
38
|
-
raise(StandardError, result)
|
39
|
-
end
|
34
|
+
|
35
|
+
a1 = result.dig("data", "#{singularized_class_name.camelize(:lower)}")
|
36
|
+
expect(a1).not_to be_empty
|
40
37
|
expect(a1).to(include("response" => be_a(String)))
|
41
38
|
end
|
42
39
|
end
|
@@ -49,9 +46,9 @@ module Souls
|
|
49
46
|
RSpec.describe("#{singularized_class_name.camelize}") do
|
50
47
|
describe "Define #{singularized_class_name.camelize}" do
|
51
48
|
|
52
|
-
let(:
|
53
|
-
%(
|
54
|
-
#{singularized_class_name.camelize(:lower)}
|
49
|
+
let(:query) do
|
50
|
+
%(query {
|
51
|
+
#{singularized_class_name.camelize(:lower)} {
|
55
52
|
response
|
56
53
|
}
|
57
54
|
}
|
@@ -59,16 +56,12 @@ module Souls
|
|
59
56
|
end
|
60
57
|
|
61
58
|
subject(:result) do
|
62
|
-
SoulsApiSchema.execute(
|
59
|
+
SoulsApiSchema.execute(query).as_json
|
63
60
|
end
|
64
61
|
|
65
62
|
it "return #{singularized_class_name.camelize} response" do
|
66
|
-
|
67
|
-
|
68
|
-
raise unless a1.present?
|
69
|
-
rescue StandardError
|
70
|
-
raise(StandardError, result)
|
71
|
-
end
|
63
|
+
a1 = result.dig("data", "#{singularized_class_name.camelize(:lower)}")
|
64
|
+
expect(a1).not_to be_empty
|
72
65
|
expect(a1).to(include("response" => be_a(String)))
|
73
66
|
end
|
74
67
|
end
|
@@ -33,6 +33,11 @@ module Souls
|
|
33
33
|
puts("before build")
|
34
34
|
system("rake build")
|
35
35
|
system("rake release")
|
36
|
+
system(
|
37
|
+
"git -c log.ShowSignature=false log v#{current_souls_ver}...v#{souls_new_ver} \
|
38
|
+
--reverse --merges --grep='Merge pull request' --pretty=format:%B > ./CHANGELOG.md"
|
39
|
+
)
|
40
|
+
system("gh release create v#{souls_new_ver} -t v#{souls_new_ver} -F ./CHANGELOG.md")
|
36
41
|
system("gsutil -m -q cp -r coverage gs://souls-bucket/souls-coverage")
|
37
42
|
Whirly.status = Paint["soul-v#{souls_new_ver} successfully updated!"]
|
38
43
|
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.9
|
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.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.6.
|
4
|
+
version: 1.6.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-
|
13
|
+
date: 2021-11-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -232,7 +232,7 @@ licenses:
|
|
232
232
|
metadata:
|
233
233
|
homepage_uri: https://souls.elsoul.nl
|
234
234
|
source_code_uri: https://github.com/elsoul/souls
|
235
|
-
changelog_uri: https://github.com/elsoul/souls/releases/tag/v1.6.
|
235
|
+
changelog_uri: https://github.com/elsoul/souls/releases/tag/v1.6.9
|
236
236
|
post_install_message:
|
237
237
|
rdoc_options: []
|
238
238
|
require_paths:
|