souls 1.6.3 → 1.6.7

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: e0b6870319e1ec1a6b819c2b56e817cb9e8d831305388a2d43e047f8244c0916
4
- data.tar.gz: c04a0bcdca122e881b32bf78c29060d078cdb6aa30b7ed674797f2201c740709
3
+ metadata.gz: 25ee0de0f9c28874dc6201e1cbe27644bc7b3f1a8f484eb35f1d09cae66d4490
4
+ data.tar.gz: caa656342e58a8e91c2fd4373ca933da2def2bdf101591e9ccd09bbb1fa9e5ec
5
5
  SHA512:
6
- metadata.gz: d46e174bed964ed2eee82d92d56d8f9c4a051a53713e7ba2a0cc9c3f5ebd04b24885930d2136acdfdfb66d8f6a591c760c5677fc41e3dfd9211db3fafd0a9fb7
7
- data.tar.gz: 9a446715a7e901c7637dd70c34b0739427d123aa3414f6ae361b63bf0ebe31e48e585730cc28b384c0226d883e0d396a0b8a6a399db25c38d1f1c350ce4b6bc3
6
+ metadata.gz: ddc22be57371d30a46d167502f4edd8ba1b680a4f59094428df85c1b4b32f4b863b90b57634064bcf1fb34714ac15a9e1335dfa224eed4b51a2ae9429d1911aa
7
+ data.tar.gz: fccce39e3346db82988f5eb9f1bc23f2e586f83ef8963dca440815c81daec72679d1767abf5fd381c8789b3f957f036ca7f475b4ae724f4c9a57af58dde892cc
data/exe/souls CHANGED
@@ -5,7 +5,7 @@ begin
5
5
  souls_command = ARGV[0]
6
6
  require("./config/souls") unless ["new", "docker", "-v", "help", "", nil].include?(souls_command)
7
7
  rescue StandardError
8
- raise(StandardError, "No confif! Please make `./config/souls.rb` File!")
8
+ raise(StandardError, "No config! Please make `./config/souls.rb` File!")
9
9
  end
10
10
 
11
11
  Souls::CLI.start
@@ -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
- create_job_mutation(class_name)
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 create_job_mutation(class_name)
20
- file_dir = "./app/graphql/mutations/"
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, "Mutation already exist! #{file_path}") if File.exist?(file_path)
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 Mutations
28
- class #{class_name.camelize} < BaseMutation
29
- description "Job Description"
30
- field :response, String, null: false
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/mutations/"
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 exist! #{file_path}") if File.exist?(file_path)
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 Mutations
56
- class #{class_name.camelize} < BaseMutation
57
- description "Mail を送信します。"
58
- field :response, String, null: false
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@YOUR-DOMAIN",
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/mutations/"
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/mutations/jobs/"
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(:mutation) do
19
- %(mutation {
20
- #{singularized_class_name.camelize(:lower)}(input: {}) {
18
+ let(:query) do
19
+ %(query {
20
+ #{singularized_class_name.camelize(:lower)} {
21
21
  response
22
22
  }
23
23
  }
@@ -28,15 +28,12 @@ module Souls
28
28
  SoulsApiSchema.execute(mutation).as_json
29
29
  end
30
30
 
31
- it "return StockSheet Data" do
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
- begin
35
- a1 = result.dig("data", "#{singularized_class_name.camelize(:lower)}")
36
- raise unless a1.present?
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(:mutation) do
53
- %(mutation {
54
- #{singularized_class_name.camelize(:lower)}(input: {}) {
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(mutation).as_json
59
+ SoulsApiSchema.execute(query).as_json
63
60
  end
64
61
 
65
- it "return StockSheet Data" do
66
- begin
67
- a1 = result.dig("data", "#{singularized_class_name.camelize(:lower)}")
68
- raise unless a1.present?
69
- rescue StandardError
70
- raise(StandardError, result)
71
- end
62
+ it "return #{singularized_class_name.camelize} response" do
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
@@ -27,7 +27,7 @@ module Souls
27
27
  SoulsApiSchema.execute(mutation).as_json
28
28
  end
29
29
 
30
- it "return StockSheet Data" do
30
+ it "return User response" do
31
31
  begin
32
32
  a1 = result.dig("data", "#{options[:mutation].singularize.camelize(:lower)}", "response")
33
33
  raise unless a1.present?
@@ -22,6 +22,14 @@ module Souls
22
22
  Souls::Github.new.invoke(:secret_set)
23
23
  end
24
24
 
25
+ desc "watch", "Watch GitHub Actions Workflow"
26
+ def watch
27
+ run_id = `gh run list | grep Mailer | awk '{print $7}'`.strip
28
+ raise(StandardError, "No workflow is running.") if run_id.include?("push")
29
+
30
+ system("gh run watch #{run_id}")
31
+ end
32
+
25
33
  private
26
34
 
27
35
  def update_env_production(key:, value:, dqm: false)
@@ -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,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.6.3".freeze
2
+ VERSION = "1.6.7".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.6.3
1
+ 1.6.7
@@ -1 +1 @@
1
- 1.6.3
1
+ 1.6.7
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.3
4
+ version: 1.6.7
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-09 00:00:00.000000000 Z
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/1.6.3
235
+ changelog_uri: https://github.com/elsoul/souls/releases/tag/v1.6.7
236
236
  post_install_message:
237
237
  rdoc_options: []
238
238
  require_paths: