souls 1.7.28 → 1.7.32
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 +4 -4
- 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/github/index.rb +32 -13
- 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 +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb5a2331815decfceac613eba1aaf62b1da94bc93029bc2a7ea3633d3d49515f
|
4
|
+
data.tar.gz: 85893b36c5e653d01202e8ea230a872eb2843b287b5e290c4ea75d66bfbbfb1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf6f4b88c770fa08d62b58dcf4720980d7570f4267b7c61881eb841304480fc31fab5b7284f1aaa0ed25eb62b23e017146af113a356a0f69fe45a1ff55fed637
|
7
|
+
data.tar.gz: 061e956b41e9a78d872b2d0b13aacd00d2bb9a9408be8bee68d3c647a7d6ed5a6517c52ce1cc0a0aca66f5d3da749786f44a488f67b44f96bb77075c7dbc7d28
|
@@ -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
|
@@ -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,13 +56,28 @@ 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"]
|
58
76
|
file_paths.each do |file_path|
|
59
|
-
File.
|
60
|
-
|
61
|
-
|
77
|
+
worker_workflow = File.readlines(file_path)
|
78
|
+
worker_workflow[worker_workflow.size - 1] = worker_workflow.last.chomp
|
79
|
+
worker_workflow << " \\ \n --set-env-vars=\"#{key.upcase}=${{ secrets.#{key.upcase} }}\""
|
80
|
+
File.open(file_path, "w") { |f| f.write(worker_workflow.join) }
|
62
81
|
puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
63
82
|
end
|
64
83
|
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.32
|
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.32
|
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.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- POPPIN-FUMI
|
@@ -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
|