souls 0.36.1 → 0.37.0
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/create/index.rb +26 -0
- data/lib/souls/cli/sync/model.rb +11 -76
- data/lib/souls/index.rb +1 -0
- data/lib/souls/utils/index.rb +11 -0
- 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
- data/lib/souls.rb +1 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f843f3295ec17169c7824a495e36bd0575a598622dd0f103e1f7aed2bf9336b
|
4
|
+
data.tar.gz: ce6c1e59f43dc68b4ec422a882afe5fe3181e45de743470c3c836caf137edf43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2508e23509136d0ca103d9b818d51c36f570d7d0c5795121fe30eace9be3d514f9e8f3f72e90dc20b180d060b71260ea747f5c4284a31d3af1556fa945701d71
|
7
|
+
data.tar.gz: 38abb11be46fb55b3fea8a1bee97bfbf81fb8abd08b767bc706066e282dc3f992fb44f26bbc91677eca18ebe0142beb2cb35d52b565bbbc6011a1399e2eac172
|
@@ -2,6 +2,9 @@ module Souls
|
|
2
2
|
module Create
|
3
3
|
class << self
|
4
4
|
def worker(worker_name: "mailer")
|
5
|
+
file_dir = "apps/#{worker_name}"
|
6
|
+
raise(StandardError, "Same Worker Already Exist!") if Dir.exist?(file_dir)
|
7
|
+
|
5
8
|
workers = Souls.configuration.workers
|
6
9
|
port = 3000 + workers.size
|
7
10
|
download_worker(worker_name: worker_name)
|
@@ -10,6 +13,7 @@ module Souls
|
|
10
13
|
workflow(worker_name: worker_name)
|
11
14
|
procfile(worker_name: worker_name, port: port)
|
12
15
|
mother_procfile(worker_name: worker_name)
|
16
|
+
souls_config_init(worker_name: worker_name)
|
13
17
|
end
|
14
18
|
|
15
19
|
def procfile(worker_name: "mailer", port: 3000)
|
@@ -173,6 +177,28 @@ end
|
|
173
177
|
raise(StandardError, e)
|
174
178
|
end
|
175
179
|
|
180
|
+
def souls_config_init(worker_name: "mailer")
|
181
|
+
app_name = Souls.configuration.app
|
182
|
+
project_id = Souls.configuration.project_id
|
183
|
+
config_dir = "apps/#{worker_name}/config"
|
184
|
+
FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
|
185
|
+
FileUtils.touch("#{config_dir}/souls.rb")
|
186
|
+
file_path = "#{config_dir}/souls.rb"
|
187
|
+
File.open(file_path, "w") do |f|
|
188
|
+
f.write(<<~TEXT)
|
189
|
+
Souls.configure do |config|
|
190
|
+
config.app = "#{app_name}"
|
191
|
+
config.project_id = "#{project_id}"
|
192
|
+
config.strain = "worker"
|
193
|
+
config.fixed_gems = ["excluded_gem"]
|
194
|
+
config.workers = []
|
195
|
+
end
|
196
|
+
TEXT
|
197
|
+
end
|
198
|
+
rescue StandardError => e
|
199
|
+
puts(e)
|
200
|
+
end
|
201
|
+
|
176
202
|
def download_worker(worker_name: "mailer")
|
177
203
|
raise(StandardError, "Can't use `worker` for worker. Change Name.") if worker_name == "worker"
|
178
204
|
|
data/lib/souls/cli/sync/model.rb
CHANGED
@@ -2,88 +2,23 @@ module Souls
|
|
2
2
|
module Sync
|
3
3
|
class << self
|
4
4
|
def model
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
raise(StandardError, "You are at wrong directory!Go to API or Worker Directory!")
|
9
|
-
end
|
10
|
-
|
11
|
-
cp_dir = get_models_path(service_name: current_dir_name)
|
12
|
-
cp_dir.each do |path|
|
13
|
-
cp_and_dl_files(api_dir: path[:api], worker_dir: path[:worker])
|
5
|
+
cp_dir = %w[db app/models spec/factories]
|
6
|
+
cp_dir.each do |dir|
|
7
|
+
cp_and_dl_files(dir: dir)
|
14
8
|
end
|
15
9
|
end
|
16
10
|
|
17
11
|
private
|
18
12
|
|
19
|
-
def
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
last_update = s.mtime.to_s
|
28
|
-
last_status_change = s.ctime.to_s
|
29
|
-
last_access = s.atime.to_s
|
30
|
-
{
|
31
|
-
last_update: last_update,
|
32
|
-
last_status_change: last_status_change,
|
33
|
-
last_access: last_access
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
def cp_and_dl_files(api_dir: "", worker_dir: "")
|
38
|
-
if Dir["#{worker_dir}/*.rb"].blank?
|
39
|
-
|
40
|
-
api_latest_date = 1
|
41
|
-
worker_latest_date = 0
|
42
|
-
else
|
43
|
-
api_file_data = file_diff(Dir["#{api_dir}/*.rb"])
|
44
|
-
worker_file_data = file_diff(Dir["#{worker_dir}/*.rb"])
|
45
|
-
# rubocop:disable Style/DateTime
|
46
|
-
api_latest_date = DateTime.parse(api_file_data.max)
|
47
|
-
worker_latest_date = DateTime.parse(worker_file_data.max)
|
48
|
-
# rubocop:enable Style/DateTime
|
49
|
-
end
|
50
|
-
|
51
|
-
if api_latest_date < worker_latest_date
|
52
|
-
FileUtils.rm_rf(api_dir) if Dir.exist?(api_dir)
|
53
|
-
FileUtils.mkdir(api_dir) unless Dir.exist?(api_dir)
|
54
|
-
system("cp -r #{worker_dir}/* #{api_dir}")
|
55
|
-
else
|
56
|
-
FileUtils.rm_rf(worker_dir) if Dir.exist?(worker_dir)
|
57
|
-
FileUtils.mkdir(worker_dir) unless Dir.exist?(worker_dir)
|
58
|
-
system("cp -r #{api_dir}/* #{worker_dir}")
|
59
|
-
end
|
60
|
-
rescue StandardError => e
|
61
|
-
puts(Paint[e, :red])
|
62
|
-
end
|
63
|
-
|
64
|
-
def get_models_path(service_name: "api")
|
65
|
-
case service_name
|
66
|
-
when "api"
|
67
|
-
api_path = "."
|
68
|
-
worker_path = "../worker"
|
69
|
-
when "worker"
|
70
|
-
api_path = "../api"
|
71
|
-
worker_path = "."
|
13
|
+
def cp_and_dl_files(dir: "db")
|
14
|
+
worker_paths = Souls.configuration.workers.map { |n| n[:name] }
|
15
|
+
worker_paths.each do |path|
|
16
|
+
cp_path = "./apps/api/#{dir}"
|
17
|
+
old_path = "./apps/#{path}/#{dir}"
|
18
|
+
FileUtils.rm_rf(old_path) if Dir.exist?(old_path)
|
19
|
+
FileUtils.mkdir(old_path) unless Dir.exist?(old_path)
|
20
|
+
system("cp -r #{cp_path}/* #{old_path}", chdir: Souls.get_mother_path)
|
72
21
|
end
|
73
|
-
[
|
74
|
-
{
|
75
|
-
api: "#{api_path}/db",
|
76
|
-
worker: "#{worker_path}/db"
|
77
|
-
},
|
78
|
-
{
|
79
|
-
api: "#{api_path}/app/models",
|
80
|
-
worker: "#{worker_path}/app/models"
|
81
|
-
},
|
82
|
-
{
|
83
|
-
api: "#{api_path}/spec/factories",
|
84
|
-
worker: "#{worker_path}/spec/factories"
|
85
|
-
}
|
86
|
-
]
|
87
22
|
end
|
88
23
|
end
|
89
24
|
end
|
data/lib/souls/index.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
module Souls
|
2
|
+
module Utils
|
3
|
+
def get_mother_path
|
4
|
+
FileUtils.pwd.split(Souls.configuration.app)[0] + Souls.configuration.app
|
5
|
+
end
|
6
|
+
|
7
|
+
def get_api_path
|
8
|
+
FileUtils.pwd.split(Souls.configuration.app)[0] + Souls.configuration.app + "/apps/api"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.16.0
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.16.0
|
data/lib/souls.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: souls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.37.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- POPPIN-FUMI
|
8
8
|
- KishiTheMechanic
|
9
9
|
- James Neve
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-09-
|
13
|
+
date: 2021-09-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- lib/souls/cli/upgrade/index.rb
|
145
145
|
- lib/souls/index.rb
|
146
146
|
- lib/souls/init.rb
|
147
|
+
- lib/souls/utils/index.rb
|
147
148
|
- lib/souls/version.rb
|
148
149
|
- lib/souls/versions/.souls_api_version
|
149
150
|
- lib/souls/versions/.souls_worker_version
|
@@ -158,7 +159,7 @@ metadata:
|
|
158
159
|
homepage_uri: https://souls.elsoul.nl
|
159
160
|
source_code_uri: https://github.com/elsoul/souls
|
160
161
|
changelog_uri: https://github.com/elsoul/souls
|
161
|
-
post_install_message:
|
162
|
+
post_install_message:
|
162
163
|
rdoc_options: []
|
163
164
|
require_paths:
|
164
165
|
- lib
|
@@ -174,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
175
|
version: '0'
|
175
176
|
requirements: []
|
176
177
|
rubygems_version: 3.2.22
|
177
|
-
signing_key:
|
178
|
+
signing_key:
|
178
179
|
specification_version: 4
|
179
180
|
summary: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
|
180
181
|
クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
|