souls 1.8.6 → 1.8.12

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: b7ced5c593ab0800c80f23f80f69c695ab152aea777526801fb5dc5a2f660442
4
- data.tar.gz: 3f05b4a5414f8aac43e93b6205f4787657651af44930f3dc2a017535adfb5cd5
3
+ metadata.gz: 6c1ba3aa74c5c645b4b967cd05f5a7c6b5b162a49da104325af8d97f0e9b47c2
4
+ data.tar.gz: a8963851cfe5a371b6d32a33e0c0eb7ab432de32629c133e70780c87d240d9f3
5
5
  SHA512:
6
- metadata.gz: 9d2c89cf636058a73f8d8bfd5c2eefa24fd4fd143efacb67728781a8b0dab24cb9c4dc2353ce04bd53477558f4b9e083565b2fe7c6a369de1afd094af55b14c9
7
- data.tar.gz: 1e38f54b14a0c74785cda717fed20fe846e720e088051cacc906786a9d7445a2ec8c068da09de95cfc66e63a65dad9ab0116e39e75649058026ff402c64f4abb
6
+ metadata.gz: 230fb2d6dc29cfce296e74e98b84081de18aac2ab47a4252ffd0f795d508f897786455ce926cbd346638c1e0aa3cb128a833934ccf84513a36f5814fb4d81d2a
7
+ data.tar.gz: 0b503f9f9a4d5c2966af65092a5e352a8b5250ef6cea7eae2b2c3e5664543efcbd9ac9631f63a08ca7f4cd7ef97dab5625ba2f901a50c619b53774e501e21918
@@ -195,6 +195,7 @@ end
195
195
  --set-env-vars="SOULS_DB_USER=${{ secrets.SOULS_DB_USER }}" \\
196
196
  --set-env-vars="SOULS_DB_PW=${{ secrets.SOULS_DB_PW }}" \\
197
197
  --set-env-vars="SOULS_DB_HOST=${{ secrets.SOULS_DB_HOST }}" \\
198
+ --set-env-vars="GITHUB_REPOSITORY=$GITHUB_REPOSITORY" \\
198
199
  --set-env-vars="SOULS_TZ=${{ secrets.SOULS_TZ }}" \\
199
200
  --set-env-vars="SOULS_SECRET_KEY_BASE=${{ secrets.SOULS_SECRET_KEY_BASE }}" \\
200
201
  --set-env-vars="SOULS_PROJECT_ID=${{ secrets.SOULS_GCP_PROJECT_ID }}"
@@ -17,11 +17,7 @@ module Souls
17
17
  def scaffold_all
18
18
  puts(Paint["Delete All Scaffold Files!\n", :cyan])
19
19
  Souls.get_tables.each do |table|
20
- if options[:rbs]
21
- Souls::Delete.new.invoke(:scaffold, [table.singularize], { rbs: options[:rbs] })
22
- else
23
- Souls::Delete.new.invoke(:scaffold, [table.singularize], {})
24
- end
20
+ Souls::Delete.new.invoke(:scaffold, [table.singularize], { rbs: options[:rbs] })
25
21
  end
26
22
  true
27
23
  end
@@ -30,21 +26,16 @@ module Souls
30
26
 
31
27
  def run_scaffold(class_name: "user")
32
28
  type(class_name)
33
- type_rbs(class_name)
34
29
  query(class_name)
35
- query_rbs(class_name)
36
30
  mutation(class_name)
37
- mutation_rbs(class_name)
38
31
  edge(class_name)
39
- edge_rbs(class_name)
40
32
  connection(class_name)
41
- connection_rbs(class_name)
42
33
  resolver(class_name)
43
- resolver_rbs(class_name)
44
34
  rspec_factory(class_name)
45
35
  rspec_mutation(class_name)
46
36
  rspec_query(class_name)
47
37
  rspec_resolver(class_name)
38
+ run_rbs_scaffold(class_name: class_name)
48
39
  end
49
40
 
50
41
  def run_rbs_scaffold(class_name: "user")
@@ -3,10 +3,9 @@ module Souls
3
3
  desc "connection [CLASS_NAME]", "Delete GraphQL Connection"
4
4
  def connection(class_name)
5
5
  file_dir = "./app/graphql/types/connections/"
6
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
7
6
  singularized_class_name = class_name.underscore.singularize
8
- file_path = "./app/graphql/types/connections/#{singularized_class_name}_connection.rb"
9
- FileUtils.rm(file_path)
7
+ file_path = "#{file_dir}#{singularized_class_name}_connection.rb"
8
+ FileUtils.rm_f(file_path)
10
9
  puts(Paint % ["Delete file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
11
10
  file_path
12
11
  end
@@ -4,11 +4,10 @@ module Souls
4
4
  def connection_rbs(class_name)
5
5
  file_path = ""
6
6
  Dir.chdir(Souls.get_mother_path.to_s) do
7
- file_dir = "./sig/api/app/graphql/types/connections/"
8
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
9
7
  singularized_class_name = class_name.underscore.singularize
8
+ file_dir = "./sig/api/app/graphql/types/connections/"
10
9
  file_path = "#{file_dir}#{singularized_class_name}_connection.rbs"
11
- FileUtils.rm(file_path)
10
+ FileUtils.rm_f(file_path)
12
11
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
13
12
  end
14
13
  file_path
@@ -2,11 +2,10 @@ module Souls
2
2
  class Delete < Thor
3
3
  desc "edge [CLASS_NAME]", "Delete GraphQL Edge"
4
4
  def edge(class_name)
5
- file_dir = "./app/graphql/types/edges"
6
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
5
+ file_dir = "./app/graphql/types/edges/"
7
6
  singularized_class_name = class_name.underscore.singularize
8
- file_path = "./app/graphql/types/edges/#{singularized_class_name}_edge.rb"
9
- FileUtils.rm(file_path)
7
+ file_path = "#{file_dir}#{singularized_class_name}_edge.rb"
8
+ FileUtils.rm_f(file_path)
10
9
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
11
10
  file_path
12
11
  end
@@ -2,16 +2,14 @@ module Souls
2
2
  class Delete < Thor
3
3
  desc "edge_rbs [CLASS_NAME]", "Delete GraphQL Edge RBS"
4
4
  def edge_rbs(class_name)
5
- file_path = ""
6
5
  Dir.chdir(Souls.get_mother_path.to_s) do
7
6
  file_dir = "./sig/api/app/graphql/types/edges/"
8
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
9
7
  singularized_class_name = class_name.underscore.singularize
10
8
  file_path = "#{file_dir}#{singularized_class_name}_edge.rbs"
11
- FileUtils.rm(file_path)
9
+ FileUtils.rm_f(file_path)
12
10
  puts(Paint % ["Delete file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
11
+ file_path
13
12
  end
14
- file_path
15
13
  end
16
14
  end
17
15
  end
@@ -3,35 +3,13 @@ module Souls
3
3
  desc "job [CLASS_NAME]", "Delete Job File in Worker"
4
4
  method_option :mailer, type: :boolean, aliases: "--mailer", default: false, desc: "Mailer Option"
5
5
  def job(class_name)
6
- if options[:mailer]
7
- mailgun_mailer(class_name: class_name)
8
- else
9
- delete_job_mutation(class_name: class_name)
10
- end
11
- Souls::Delete.new.invoke(:job_rbs, [class_name], {})
12
- Souls::Delete.new.invoke(:rspec_job, [class_name], {})
13
- end
14
-
15
- private
16
-
17
- def delete_job_mutation(class_name: "send-mailer")
18
- file_dir = "./app/graphql/mutations/"
19
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
20
- file_path = "#{file_dir}#{class_name.singularize}.rb"
21
-
22
- FileUtils.rm(file_path)
23
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
24
- file_path
25
- end
26
-
27
- def mailgun_mailer(class_name: "mailer")
28
- file_dir = "./app/graphql/mutations/"
29
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
6
+ file_dir = "./app/graphql/queries/"
30
7
  file_path = "#{file_dir}#{class_name.singularize}.rb"
31
8
 
32
- FileUtils.rm(file_path)
9
+ FileUtils.rm_f(file_path)
33
10
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
34
- file_path
11
+ Souls::Delete.new.invoke(:job_rbs, [class_name], {})
12
+ Souls::Delete.new.invoke(:rspec_job, [class_name], {})
35
13
  end
36
14
  end
37
15
  end
@@ -4,12 +4,16 @@ module Souls
4
4
  def job_rbs(class_name)
5
5
  file_path = ""
6
6
  worker_name = FileUtils.pwd.split("/").last
7
+ if worker_name == "api" || FileUtils.pwd.split("/")[-2] != "apps"
8
+ raise(Souls::CLIException, "This task must be run from within a worker directory")
9
+ end
10
+
7
11
  Dir.chdir(Souls.get_mother_path.to_s) do
8
12
  singularized_class_name = class_name.underscore.singularize
9
- file_dir = "./sig/#{worker_name}/app/graphql/mutations/"
13
+ file_dir = "./sig/#{worker_name}/app/graphql/queries/"
10
14
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
11
15
  file_path = "#{file_dir}#{singularized_class_name}.rbs"
12
- FileUtils.rm(file_path)
16
+ FileUtils.rm_f(file_path)
13
17
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
14
18
  end
15
19
  file_path
@@ -5,10 +5,10 @@ module Souls
5
5
  def manager(class_name)
6
6
  singularized_class_name = class_name.underscore.singularize
7
7
  file_dir = "./app/graphql/mutations/managers/#{singularized_class_name}_manager"
8
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
9
8
  file_path = "#{file_dir}/#{options[:mutation]}.rb"
9
+ puts(file_path)
10
10
 
11
- FileUtils.rm(file_path)
11
+ FileUtils.rm_f(file_path)
12
12
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
13
13
  Souls::Delete.new.invoke(:manager_rbs, [singularized_class_name], { mutation: options[:mutation] })
14
14
  Souls::Delete.new.invoke(:rspec_manager, [singularized_class_name], { mutation: options[:mutation] })
@@ -7,9 +7,8 @@ module Souls
7
7
  singularized_class_name = class_name.underscore.singularize
8
8
  Dir.chdir(Souls.get_mother_path.to_s) do
9
9
  file_dir = "./sig/api/app/graphql/mutations/managers/#{singularized_class_name}_manager"
10
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
11
10
  file_path = "#{file_dir}/#{options[:mutation]}.rbs"
12
- FileUtils.rm(file_path)
11
+ FileUtils.rm_f(file_path)
13
12
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
14
13
  end
15
14
  file_path
@@ -4,7 +4,7 @@ module Souls
4
4
  def query(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./app/graphql/queries/#{singularized_class_name}*.rb"
7
- FileUtils.rm(file_path)
7
+ FileUtils.rm_f(file_path)
8
8
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
9
  file_path
10
10
  end
@@ -7,7 +7,7 @@ module Souls
7
7
  file_dir = "./sig/api/app/graphql/queries/"
8
8
  singularized_class_name = class_name.underscore.singularize
9
9
  file_path = "#{file_dir}#{singularized_class_name}*.rbs"
10
- FileUtils.rm(file_path)
10
+ FileUtils.rm_f(file_path)
11
11
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
12
12
  file_path
13
13
  end
@@ -4,7 +4,7 @@ module Souls
4
4
  def resolver(class_name)
5
5
  singularized_class_name = class_name.singularize.underscore
6
6
  file_path = "./app/graphql/resolvers/#{singularized_class_name}_search.rb"
7
- FileUtils.rm(file_path)
7
+ FileUtils.rm_f(file_path)
8
8
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
9
  file_path
10
10
  end
@@ -6,9 +6,8 @@ module Souls
6
6
  file_path = ""
7
7
  Dir.chdir(Souls.get_mother_path.to_s) do
8
8
  file_dir = "./sig/api/app/graphql/resolvers"
9
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
10
9
  file_path = "#{file_dir}/#{singularized_class_name}_search.rbs"
11
- FileUtils.rm(file_path)
10
+ FileUtils.rm_f(file_path)
12
11
  end
13
12
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
14
13
  file_path
@@ -3,7 +3,7 @@ module Souls
3
3
  desc "rspec_factory [CLASS_NAME]", "Delete Rspec Factory Test from schema.rb"
4
4
  def rspec_factory(class_name)
5
5
  file_path = "./spec/factories/#{class_name.pluralize}.rb"
6
- FileUtils.rm(file_path)
6
+ FileUtils.rm_f(file_path)
7
7
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
8
8
  file_path
9
9
  end
@@ -2,9 +2,10 @@ module Souls
2
2
  class Delete < Thor
3
3
  desc "rspec_job [CLASS_NAME]", "Delete Rspec Job Test Template"
4
4
  def rspec_job(class_name)
5
+ file_dir = "./spec/jobs"
5
6
  singularized_class_name = class_name.underscore.singularize
6
7
  file_path = "#{file_dir}/#{singularized_class_name}_spec.rb"
7
- FileUtils.rm(file_path)
8
+ FileUtils.rm_f(file_path)
8
9
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
10
  file_path
10
11
  end
@@ -30,6 +30,7 @@ module Souls
30
30
  SOULS_DB_USER=postgres
31
31
  SOULS_GCP_PROJECT_ID=#{project_id}
32
32
  SOULS_SECRET_KEY_BASE='#{SecureRandom.base64(64)}'
33
+ GITHUB_REPOSITORY='elsoul/souls'
33
34
  TZ="#{region_to_timezone(region: region)}"
34
35
  TEXT
35
36
  end
@@ -46,6 +47,7 @@ module Souls
46
47
  SOULS_GCP_REGION=#{region}
47
48
  SOULS_GCLOUDSQL_INSTANCE="#{project_id}:#{region}:#{instance_name}"
48
49
  SOULS_SECRET_KEY_BASE='#{SecureRandom.base64(64)}'
50
+ GITHUB_REPOSITORY='elsoul/souls'
49
51
  TZ="#{region_to_timezone(region: region)}"
50
52
  TEXT
51
53
  end
@@ -30,11 +30,36 @@ module Souls
30
30
 
31
31
  desc "watch", "Watch GitHub Actions Workflow"
32
32
  def watch
33
- run_list = `gh run list | grep in_progress | awk '{print $8}'`
34
- run_id = run_list.split("\n")
35
- raise(StandardError, "No workflow is running.") if run_id.empty?
33
+ remote_url = `git remote get-url origin`
34
+ split_url = %r{\A(git@github.com:)(.+/.+)(\.git)}.match(remote_url)
35
+ if split_url.nil? || split_url.size != 4
36
+ raise(CLIException, "Cannot access Github, please check your credentials")
37
+ end
38
+
39
+ api_request = "gh api -X GET 'repos/#{split_url[2]}/actions/runs'"
40
+ workflows = JSON.parse(`#{api_request}`)
41
+
42
+ if workflows.nil? || !workflows.key?("workflow_runs")
43
+ raise(CLIException, "Failed to parse JSON response from Github")
44
+ end
45
+
46
+ wf_info =
47
+ workflows["workflow_runs"].filter_map do |wf|
48
+ { wf["name"].to_sym => wf["id"] } if wf["state"] == "in_progress"
49
+ end
50
+
51
+ wf_id =
52
+ case wf_info.size
53
+ when 0
54
+ raise(CLIException, "No workflow is running")
55
+ when 1
56
+ wf_info[0].values[0]
57
+ else
58
+ prompt = TTY::Prompt.new
59
+ prompt.select("Which workflow would you like to watch?", wf_info.inject(:merge))
60
+ end
36
61
 
37
- system("gh run watch #{run_id}")
62
+ system("gh run watch #{wf_id}")
38
63
  end
39
64
 
40
65
  private
@@ -1,3 +1,4 @@
1
+ require_relative "./cli_exception"
1
2
  require_relative "./console/index"
2
3
  require_relative "./generate/index"
3
4
  require_relative "./github/index"
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.8.6".freeze
2
+ VERSION = "1.8.12".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.8.6
1
+ 1.8.12
@@ -1 +1 @@
1
- 1.8.6
1
+ 1.8.12
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.8.6
4
+ version: 1.8.12
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-19 00:00:00.000000000 Z
13
+ date: 2021-11-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport