souls 1.7.26 → 1.7.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/souls/cli/create/index.rb +0 -1
- data/lib/souls/cli/db/create_migration.rb +28 -0
- data/lib/souls/cli/db/index.rb +1 -45
- data/lib/souls/cli/gcloud/sql/index.rb +1 -0
- data/lib/souls/cli/generate/job_rbs.rb +3 -1
- data/lib/souls/cli/github/index.rb +28 -10
- 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 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80dfee065bf6d86083af944a33c78e40be35e56bce803f508b6a9ee1bdd09414
|
4
|
+
data.tar.gz: 52e08753467723afeb3daa1c691c0e8470f31023d04100a296ec3c3bb79a0ce8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74823ff46d148f8bb6892d16c7fa0b222d33a805bafba3c092eb5104b96babe63e337aa1bd91246dec7e6686bf48de01e6d69d20ff8ef4438b01db9609443d92
|
7
|
+
data.tar.gz: bf7c3ee0a09bec5de9230b60025efe439b0710bc1c6ad401b57a74c8d5e8542b1956ff7d016924e6a359c4243fa12d80858beb45bb237588daf559f2e9837c3c
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
<img alt="" src="https://badgen.net/rubygems/dt/souls">
|
17
17
|
</a>
|
18
18
|
<a aria-label="Test" href="https://rubygems.org/gems/souls">
|
19
|
-
<img alt="" src="https://github.com/elsoul/souls/actions/workflows/
|
19
|
+
<img alt="" src="https://github.com/elsoul/souls/actions/workflows/test.yml/badge.svg">
|
20
20
|
</a>
|
21
21
|
<a aria-label="License" href="https://github.com/elsoul/souls/blob/master/LICENSE.txt">
|
22
22
|
<img alt="" src="https://badgen.net/badge/license/Apache/blue">
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Souls
|
2
|
+
class DB < Thor
|
3
|
+
desc "create_migration [CLASS_NAME]", "Create ActiveRecord Migration File"
|
4
|
+
def create_migration(class_name)
|
5
|
+
pluralized_class_name = class_name.underscore.pluralize
|
6
|
+
singularized_class_name = class_name.underscore.singularize
|
7
|
+
Souls::DB.new.invoke(:model, [singularized_class_name], {})
|
8
|
+
Souls::DB.new.invoke(:rspec_model, [singularized_class_name], {})
|
9
|
+
Souls::DB.new.invoke(:model_rbs, [singularized_class_name], {})
|
10
|
+
puts(Paint["Created file! : ", :green])
|
11
|
+
system("rake db:create_migration NAME=create_#{pluralized_class_name}")
|
12
|
+
file_path = Dir["db/migrate/*create_#{pluralized_class_name}.rb"].first
|
13
|
+
File.open(file_path, "w") do |f|
|
14
|
+
f.write(<<~TEXT)
|
15
|
+
class Create#{pluralized_class_name.camelize} < ActiveRecord::Migration[6.1]
|
16
|
+
def change
|
17
|
+
create_table :#{pluralized_class_name} do |t|
|
18
|
+
|
19
|
+
t.boolean :is_deleted, null: false, default: false
|
20
|
+
t.timestamps
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
TEXT
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/souls/cli/db/index.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require_relative "./create_migration"
|
1
2
|
require_relative "./create_migration_rbs"
|
2
3
|
require_relative "./model"
|
3
4
|
require_relative "./rspec_model"
|
@@ -17,8 +18,6 @@ module Souls
|
|
17
18
|
db_system("rake db:migrate RACK_ENV=test")
|
18
19
|
end
|
19
20
|
true
|
20
|
-
rescue Thor::Error => e
|
21
|
-
raise(Thor::Error, e)
|
22
21
|
end
|
23
22
|
|
24
23
|
desc "create", "Create Database"
|
@@ -30,8 +29,6 @@ module Souls
|
|
30
29
|
else
|
31
30
|
db_system("rake db:create")
|
32
31
|
end
|
33
|
-
rescue Thor::Error => e
|
34
|
-
raise(Thor::Error, e)
|
35
32
|
end
|
36
33
|
|
37
34
|
desc "seed", "Insert Seed Data"
|
@@ -44,8 +41,6 @@ module Souls
|
|
44
41
|
db_system("rake db:seed")
|
45
42
|
db_system("rake db:seed RACK_ENV=test")
|
46
43
|
end
|
47
|
-
rescue Thor::Error => e
|
48
|
-
raise(Thor::Error, e)
|
49
44
|
end
|
50
45
|
|
51
46
|
desc "migrate_reset", "Reset Database"
|
@@ -57,75 +52,36 @@ module Souls
|
|
57
52
|
else
|
58
53
|
db_system("rake db:migrate:reset")
|
59
54
|
end
|
60
|
-
rescue Thor::Error => e
|
61
|
-
raise(Thor::Error, e)
|
62
|
-
end
|
63
|
-
|
64
|
-
desc "create_migration [CLASS_NAME]", "Create ActiveRecord Migration File"
|
65
|
-
def create_migration(class_name)
|
66
|
-
pluralized_class_name = class_name.underscore.pluralize
|
67
|
-
singularized_class_name = class_name.underscore.singularize
|
68
|
-
Souls::DB.new.invoke(:model, [singularized_class_name], {})
|
69
|
-
Souls::DB.new.invoke(:rspec_model, [singularized_class_name], {})
|
70
|
-
Souls::DB.new.invoke(:model_rbs, [singularized_class_name], {})
|
71
|
-
puts(Paint["Created file! : ", :green])
|
72
|
-
system("rake db:create_migration NAME=create_#{pluralized_class_name}")
|
73
|
-
file_path = Dir["db/migrate/*create_#{pluralized_class_name}.rb"].first
|
74
|
-
File.open(file_path, "w") do |f|
|
75
|
-
f.write(<<~TEXT)
|
76
|
-
class Create#{pluralized_class_name.camelize} < ActiveRecord::Migration[6.1]
|
77
|
-
def change
|
78
|
-
create_table :#{pluralized_class_name} do |t|
|
79
|
-
|
80
|
-
t.boolean :is_deleted, null: false, default: false
|
81
|
-
t.timestamps
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
TEXT
|
86
|
-
end
|
87
|
-
rescue Thor::Error => e
|
88
|
-
raise(Thor::Error, e)
|
89
55
|
end
|
90
56
|
|
91
57
|
desc "add_column [CLASS_NAME]", "Create ActiveRecord Migration File"
|
92
58
|
def add_column(class_name)
|
93
59
|
pluralized_class_name = class_name.underscore.pluralize
|
94
60
|
system("rake db:create_migration NAME=add_column_to_#{pluralized_class_name}")
|
95
|
-
rescue Thor::Error => e
|
96
|
-
raise(Thor::Error, e)
|
97
61
|
end
|
98
62
|
|
99
63
|
desc "rename_column [CLASS_NAME]", "Create ActiveRecord Migration File"
|
100
64
|
def rename_column(class_name)
|
101
65
|
pluralized_class_name = class_name.underscore.pluralize
|
102
66
|
system("rake db:create_migration NAME=rename_column_to_#{pluralized_class_name}")
|
103
|
-
rescue Thor::Error => e
|
104
|
-
raise(Thor::Error, e)
|
105
67
|
end
|
106
68
|
|
107
69
|
desc "change_column [CLASS_NAME]", "Create ActiveRecord Migration File"
|
108
70
|
def change_column(class_name)
|
109
71
|
pluralized_class_name = class_name.underscore.pluralize
|
110
72
|
system("rake db:create_migration NAME=change_column_to_#{pluralized_class_name}")
|
111
|
-
rescue Thor::Error => e
|
112
|
-
raise(Thor::Error, e)
|
113
73
|
end
|
114
74
|
|
115
75
|
desc "remove_column [CLASS_NAME]", "Create ActiveRecord Migration File"
|
116
76
|
def remove_column(class_name)
|
117
77
|
pluralized_class_name = class_name.underscore.pluralize
|
118
78
|
system("rake db:create_migration NAME=remove_column_to_#{pluralized_class_name}")
|
119
|
-
rescue Thor::Error => e
|
120
|
-
raise(Thor::Error, e)
|
121
79
|
end
|
122
80
|
|
123
81
|
desc "drop_table [CLASS_NAME]", "Create ActiveRecord Migration File"
|
124
82
|
def drop_table(class_name)
|
125
83
|
pluralized_class_name = class_name.underscore.pluralize
|
126
84
|
system("rake db:create_migration NAME=drop_table_to_#{pluralized_class_name}")
|
127
|
-
rescue Thor::Error => e
|
128
|
-
raise(Thor::Error, e)
|
129
85
|
end
|
130
86
|
|
131
87
|
private
|
@@ -9,7 +9,9 @@ module Souls
|
|
9
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
|
+
sig_type_path = "./sig/#{worker_name}/app/graphql/types"
|
13
|
+
FileUtils.mkdir_p(sig_type_path) unless Dir.exist?(sig_type_path)
|
14
|
+
type_file_path = "#{sig_type_path}/#{singularized_class_name}_type.rbs"
|
13
15
|
File.open(file_path, "w") do |f|
|
14
16
|
f.write(<<~TEXT)
|
15
17
|
module Queries
|
@@ -2,23 +2,27 @@ module Souls
|
|
2
2
|
class Github < Thor
|
3
3
|
desc "secret_set", "Github Secret Set from .env.production"
|
4
4
|
def secret_set
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
Dir.chdir(Souls.get_mother_path.to_s) do
|
6
|
+
file_path = ".env.production"
|
7
|
+
File.open(file_path, "r") do |file|
|
8
|
+
file.each_line do |line|
|
9
|
+
key_and_value = line.split("=")
|
10
|
+
system("gh secret set #{key_and_value[0]} -b \"#{key_and_value[1].strip}\"")
|
11
|
+
end
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
14
16
|
desc "add_env", "Add New env and Sync Github Secret"
|
15
|
-
method_option :key, aliases: "--key", required: true, desc: "Key Name"
|
16
|
-
method_option :value, aliases: "--value", required: true, desc: "Value Name"
|
17
17
|
method_option :dqm, type: :boolean, aliases: "--dqm", default: false, desc: "Enable Double Quotation Mark"
|
18
18
|
def add_env
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
prompt = TTY::Prompt.new
|
20
|
+
key = prompt.ask("Set Key:")
|
21
|
+
value = prompt.ask("Set Value:")
|
22
|
+
update_env_production(key: key, value: value, dqm: options[:dqm])
|
23
|
+
update_api_env(key: key, value: value, dqm: options[:dqm])
|
24
|
+
update_workers_env(key: key, value: value, dqm: options[:dqm])
|
25
|
+
update_github_actions(key: key)
|
22
26
|
Souls::Github.new.invoke(:secret_set)
|
23
27
|
end
|
24
28
|
|
@@ -52,6 +56,20 @@ module Souls
|
|
52
56
|
end
|
53
57
|
end
|
54
58
|
|
59
|
+
def update_workers_env(key:, value:, dqm: false)
|
60
|
+
Dir.chdir(Souls.get_mother_path.to_s) do
|
61
|
+
workers = Dir["apps/*"]
|
62
|
+
workers.delete("apps/api")
|
63
|
+
workers.each do |worker_path|
|
64
|
+
file_path = "#{worker_path}/.env"
|
65
|
+
File.open(file_path, "a") do |line|
|
66
|
+
dqm ? line.write("\n#{key.upcase}=\"#{value}\"") : line.write("\n#{key.upcase}=#{value}")
|
67
|
+
end
|
68
|
+
puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
55
73
|
def update_github_actions(key:)
|
56
74
|
Dir.chdir(Souls.get_mother_path.to_s) do
|
57
75
|
file_paths = Dir[".github/workflows/*.yml"]
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.30
|
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.30
|
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.7.
|
4
|
+
version: 1.7.30
|
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-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- lib/souls/cli/cli_exception.rb
|
131
131
|
- lib/souls/cli/console/index.rb
|
132
132
|
- lib/souls/cli/create/index.rb
|
133
|
+
- lib/souls/cli/db/create_migration.rb
|
133
134
|
- lib/souls/cli/db/create_migration_rbs.rb
|
134
135
|
- lib/souls/cli/db/index.rb
|
135
136
|
- lib/souls/cli/db/model.rb
|