souls 1.8.6 → 1.8.8

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: 3008e8f3c693f08dceed2d39e068fded99cd451028fb16cb682dc37ae091727a
4
+ data.tar.gz: d1f43ed9ace0909791ccb69021f0416ff2918ba61f99bc63fd964cf10a96570e
5
5
  SHA512:
6
- metadata.gz: 9d2c89cf636058a73f8d8bfd5c2eefa24fd4fd143efacb67728781a8b0dab24cb9c4dc2353ce04bd53477558f4b9e083565b2fe7c6a369de1afd094af55b14c9
7
- data.tar.gz: 1e38f54b14a0c74785cda717fed20fe846e720e088051cacc906786a9d7445a2ec8c068da09de95cfc66e63a65dad9ab0116e39e75649058026ff402c64f4abb
6
+ metadata.gz: fcd880cbd079096b8f083cc999379d1a5582a6d626bd27b8fcd74bc83a985625cbedae16afb5c153e639a8deb56e0ea49874d268df7c553ab442913b0ee008f7
7
+ data.tar.gz: cf54ecf40cf18dda9203aa54a17b975d4fe570eeff85029305663813e0a11d3575c0c7340c923e5f110fd6e4514b39f538645d21278e32209af9ea7aa6689c9b
@@ -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,11 +30,25 @@ 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
+ workflows = JSON.parse(`gh api -X GET 'repos/#{ENV["GITHUB_REPOSITORY"]}/actions/runs'`)
36
34
 
37
- system("gh run watch #{run_id}")
35
+ wf_info =
36
+ workflows["workflow_runs"].filter_map do |wf|
37
+ { wf["name"].to_sym => wf["id"] } if wf["state"] == "in_progress"
38
+ end
39
+
40
+ wf_id =
41
+ case wf_info.size
42
+ when 0
43
+ raise(CLIException, "No workflow is running.")
44
+ when 1
45
+ wf_info[0].values[0]
46
+ else
47
+ prompt = TTY::Prompt.new
48
+ prompt.select("Which workflow would you like to watch?", wf_info.inject(:merge))
49
+ end
50
+
51
+ system("gh run watch #{wf_id}")
38
52
  end
39
53
 
40
54
  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.8".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.8.6
1
+ 1.8.8
@@ -1 +1 @@
1
- 1.8.6
1
+ 1.8.8
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.8
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