souls 1.8.4 → 1.8.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ce71081e75906aa301524b7c0868d9d368172c1a09cf432a9387a0db68eeb9d
4
- data.tar.gz: 3977e1cf390f2fdb9dad6cef8169a657682b761a2f138dc6d9e618c9ae21fd38
3
+ metadata.gz: 146c3431004d5b821a5798cd452405ce27ccd81380cedd96be8b19a07cc43878
4
+ data.tar.gz: 6f46af2a1838f22628d171dd43bf86b80ee483ea1ce6276203de0f12c69b3e12
5
5
  SHA512:
6
- metadata.gz: 728cb4d032060cbe75e4147ffa935404d5957485a7543f0e7e4a94e6bf19649728b6bf7b3ecd99b3c5f32c5b5807ff0bcb353326f852d1ddb87b414bb00196f7
7
- data.tar.gz: f5475fe81ceea4312773086ff14f55dd735b1b4311bd25dce18bcbdfa6ba3e39478984f466c0b8dc0cf993d412318cfd6e43a9df696edccf77ded0425f6fe4ef
6
+ metadata.gz: d1128c85a3f8673faa6649407db2205d88c48bd52720e0ef72227a6dc19535c45a46e664dfa655756204cf6a5b666a6bb12642f4c4fdde80433eaf2dd9e71a57
7
+ data.tar.gz: fd40d4dab0b32bfec0ec563405d7e4625f47b5f1eebaf80826d1601a8a0bc6ab6d993c21b0bc555662b67898ff77ba8b8ce6402a28406d430d9a82b03a615e9f
@@ -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
@@ -136,7 +136,8 @@ module Souls
136
136
  params[:relation_params].map do |n|
137
137
  ", #{n[:column_name]}: #{n[:column_name]}"
138
138
  end
139
- f.write(" new_record = { **args #{relation_params.compact.join} }\n")
139
+
140
+ f.write(" new_record = { **args, id: data_id #{relation_params.compact.join} }\n")
140
141
  else
141
142
  f.write(" new_record = args.except(:id)\n")
142
143
  end
@@ -142,7 +142,7 @@ module Souls
142
142
  f.write(<<~TEXT)
143
143
  scope = scope.where("created_at >= ?", value[:start_date]) if value[:start_date]
144
144
  scope = scope.where("created_at <= ?", value[:end_date]) if value[:end_date]
145
- branches << scope
145
+ branches << scope.order(created_at: :desc)
146
146
  value[:OR].inject(branches) { |s, v| normalize_filters(v, s) } if value[:OR].present?
147
147
  branches
148
148
  end
@@ -30,11 +30,28 @@ 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
+ api_request = "gh api -X GET 'repos/#{ENV['GITHUB_REPOSITORY']}/actions/runs'"
34
+ workflows = JSON.parse(`#{api_request}`)
36
35
 
37
- system("gh run watch #{run_id}")
36
+ puts(api_request)
37
+
38
+ wf_info =
39
+ workflows["workflow_runs"].filter_map do |wf|
40
+ { wf["name"].to_sym => wf["id"] } if wf["state"] == "in_progress"
41
+ end
42
+
43
+ wf_id =
44
+ case wf_info.size
45
+ when 0
46
+ raise(CLIException, "No workflow is running.")
47
+ when 1
48
+ wf_info[0].values[0]
49
+ else
50
+ prompt = TTY::Prompt.new
51
+ prompt.select("Which workflow would you like to watch?", wf_info.inject(:merge))
52
+ end
53
+
54
+ system("gh run watch #{wf_id}")
38
55
  end
39
56
 
40
57
  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"
@@ -5,10 +5,17 @@ module Souls
5
5
  def server
6
6
  if options[:all]
7
7
  Dir.chdir(Souls.get_mother_path.to_s) do
8
+ front_path = "apps/console/package.json"
8
9
  system("foreman start -f Procfile.dev")
10
+ system("cd apps/console && yarn dev") if File.exist?(front_path)
9
11
  end
10
12
  else
11
- system("foreman start -f Procfile.dev")
13
+ package_json_path = "package.json"
14
+ if File.exist?(package_json_path)
15
+ system("yarn dev")
16
+ else
17
+ system("foreman start -f Procfile.dev")
18
+ end
12
19
  end
13
20
  end
14
21
  end
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.8.4".freeze
2
+ VERSION = "1.8.9".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.8.4
1
+ 1.8.9
@@ -1 +1 @@
1
- 1.8.4
1
+ 1.8.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.8.4
4
+ version: 1.8.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-18 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