souls 1.13.5 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/souls/cli/create/functions.rb +35 -0
- data/lib/souls/cli/create/index.rb +1 -0
- data/lib/souls/cli/create/template/functions_app.rb +25 -0
- data/lib/souls/cli/create/template/functions_gemfile.rb +13 -0
- data/lib/souls/cli/db/index.rb +2 -2
- data/lib/souls/cli/gcloud/functions/index.rb +24 -0
- data/lib/souls/cli/gcloud/index.rb +4 -0
- data/lib/souls/cli/generate/manager_rbs.rb +2 -2
- data/lib/souls/cli/generate/rspec_manager.rb +3 -1
- data/lib/souls/cli.rb +3 -0
- data/lib/souls/utils/index.rb +8 -2
- 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 +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e0a0c2f62583042427032c3802a5891673d34133516fff6612a23e57f0ac856
|
4
|
+
data.tar.gz: cc603ee54459e86da37bc87a3f3ee19c3cf36c6190ee00fb3977aec9ab9a828a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23a902c39fcb35b1c9e11c23c44db2af53807e56537b256cb4d12672403d9e9fc3eab0985c6c5b37ffbd6b77de8a0792be1c4ec8fdaeecb00ef15df775716cb2
|
7
|
+
data.tar.gz: c11dad7563e808fffc9f3532a962746d7f94c3a120d248d712d965c96e19baa8df46b33191aeabda271b6e1d3d0d86758f607875104f1533361c0c79b1dbbe81
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative "./template/functions_app"
|
2
|
+
require_relative "./template/functions_gemfile"
|
3
|
+
module Souls
|
4
|
+
class Create < Thor
|
5
|
+
desc "functions", "Create SOULs functions"
|
6
|
+
def functions
|
7
|
+
create_app_file
|
8
|
+
create_gemfile
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def create_app_file
|
14
|
+
file_dir = "./apps/functions"
|
15
|
+
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
16
|
+
file_path = "#{file_dir}/app.rb"
|
17
|
+
raise(StandardError, "Already Exist!") if File.exist?(file_path)
|
18
|
+
|
19
|
+
File.write(file_path, Template.functions_app)
|
20
|
+
Souls::Painter.create_file(file_path)
|
21
|
+
file_path
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_gemfile
|
25
|
+
file_dir = "./apps/functions"
|
26
|
+
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
27
|
+
file_path = "#{file_dir}/Gemfile"
|
28
|
+
raise(StandardError, "Already Exist!") if File.exist?(file_path)
|
29
|
+
|
30
|
+
File.write(file_path, Template.functions_gemfile)
|
31
|
+
Souls::Painter.create_file(file_path)
|
32
|
+
file_path
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Template
|
2
|
+
def self.functions_app
|
3
|
+
<<~APP
|
4
|
+
require "functions_framework"
|
5
|
+
require "sinatra/base"
|
6
|
+
require "dotenv/load"
|
7
|
+
require "souls"
|
8
|
+
|
9
|
+
class App < Sinatra::Base
|
10
|
+
get "/souls-functions-get/:name" do
|
11
|
+
"SOULs Functions Job Done! - \#{params['name']}"
|
12
|
+
end
|
13
|
+
|
14
|
+
post "/souls-functions-post" do
|
15
|
+
params = JSON.parse(request.body.read)
|
16
|
+
"SOULs Functions Job Done! - \#{params['name']}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
FunctionsFramework.http("souls_functions") do |request|
|
21
|
+
App.call(request.env)
|
22
|
+
end
|
23
|
+
APP
|
24
|
+
end
|
25
|
+
end
|
data/lib/souls/cli/db/index.rb
CHANGED
@@ -61,11 +61,11 @@ module Souls
|
|
61
61
|
case options[:env]
|
62
62
|
when "production"
|
63
63
|
db_system("rake db:migrate:reset RACK_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1")
|
64
|
-
db_system("rake db
|
64
|
+
db_system("rake db:seed RACK_ENV=production")
|
65
65
|
else
|
66
66
|
db_system("rake db:migrate:reset")
|
67
67
|
db_system("rake db:migrate RACK_ENV=test")
|
68
|
-
db_system("rake db
|
68
|
+
db_system("rake db:seed")
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Souls
|
2
|
+
class Functions < Thor
|
3
|
+
desc "deploy", "Deploy Cloud Functions"
|
4
|
+
def deploy
|
5
|
+
require(Souls.get_mother_path.to_s + "/config/souls")
|
6
|
+
project_id = Souls.configuration.project_id
|
7
|
+
Dir.chdir(Souls.get_functions_path.to_s) do
|
8
|
+
system(
|
9
|
+
"
|
10
|
+
gcloud functions deploy souls_functions --project=#{project_id} \
|
11
|
+
--runtime ruby27 --trigger-http --allow-unauthenticated
|
12
|
+
"
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "dev", "Check SOULs Functions dev"
|
18
|
+
def dev
|
19
|
+
Dir.chdir(Souls.get_functions_path.to_s) do
|
20
|
+
system("bundle exec functions-framework-ruby --target souls_functions")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -4,6 +4,7 @@ require_relative "./run/index"
|
|
4
4
|
require_relative "./sql/index"
|
5
5
|
require_relative "./compute/index"
|
6
6
|
require_relative "./scheduler/index"
|
7
|
+
require_relative "./functions/index"
|
7
8
|
require_relative "../cli_exception"
|
8
9
|
|
9
10
|
module Souls
|
@@ -26,6 +27,9 @@ module Souls
|
|
26
27
|
desc "scheduler [COMMAND]", "souls gcloud schedluer Commands"
|
27
28
|
subcommand "scheduler", CloudScheduler
|
28
29
|
|
30
|
+
desc "functions [COMMAND]", "souls gcloud functions Commands"
|
31
|
+
subcommand "functions", Functions
|
32
|
+
|
29
33
|
map run: "cloud_run"
|
30
34
|
|
31
35
|
desc "auth_login", "gcloud config set and gcloud auth login"
|
@@ -13,8 +13,8 @@ module Souls
|
|
13
13
|
f.write(<<~TEXT)
|
14
14
|
module Mutations
|
15
15
|
module Managers
|
16
|
-
module #{singularized_class_name.camelize}Manager
|
17
|
-
class #{options[:mutation].singularize.camelize}
|
16
|
+
module #{singularized_class_name.camelize}Manager
|
17
|
+
class #{options[:mutation].singularize.camelize} < BaseMutation
|
18
18
|
def self.description: (String)-> untyped
|
19
19
|
def self.argument: (untyped, untyped, untyped)-> untyped
|
20
20
|
def self.field: (untyped, untyped, untyped)-> untyped
|
data/lib/souls/cli.rb
CHANGED
@@ -31,6 +31,9 @@ module Souls
|
|
31
31
|
desc "upgrade [COMMAND]", "SOULs Upgrade Commands"
|
32
32
|
subcommand "upgrade", Upgrade
|
33
33
|
|
34
|
+
desc "functions [COMMAND]", "SOULs functions Commands"
|
35
|
+
subcommand "functions", Functions
|
36
|
+
|
34
37
|
# rubocop:disable Style/StringHashKeys
|
35
38
|
map "c" => :console
|
36
39
|
map "s" => :server
|
data/lib/souls/utils/index.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
module Souls
|
2
2
|
module Utils
|
3
3
|
def get_mother_path
|
4
|
-
Dir.pwd.split(
|
4
|
+
file_array = Dir.pwd.split("/")
|
5
|
+
mother_dir_num = file_array.rindex("apps")
|
6
|
+
file_array.each_slice(mother_dir_num).to_a[0].join("/")
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_functions_path
|
10
|
+
get_mother_path + "/apps/functions"
|
5
11
|
end
|
6
12
|
|
7
13
|
def get_api_path
|
8
|
-
|
14
|
+
get_mother_path + "/apps/api"
|
9
15
|
end
|
10
16
|
|
11
17
|
def type_check(type)
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.14.0
|
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.14.0
|
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.
|
4
|
+
version: 1.14.0
|
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-12-
|
13
|
+
date: 2021-12-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -174,7 +174,10 @@ files:
|
|
174
174
|
- lib/souls/cli.rb
|
175
175
|
- lib/souls/cli/cli_exception.rb
|
176
176
|
- lib/souls/cli/console/index.rb
|
177
|
+
- lib/souls/cli/create/functions.rb
|
177
178
|
- lib/souls/cli/create/index.rb
|
179
|
+
- lib/souls/cli/create/template/functions_app.rb
|
180
|
+
- lib/souls/cli/create/template/functions_gemfile.rb
|
178
181
|
- lib/souls/cli/db/create_migration.rb
|
179
182
|
- lib/souls/cli/db/create_migration_rbs.rb
|
180
183
|
- lib/souls/cli/db/index.rb
|
@@ -208,6 +211,7 @@ files:
|
|
208
211
|
- lib/souls/cli/delete/type_rbs.rb
|
209
212
|
- lib/souls/cli/docker/index.rb
|
210
213
|
- lib/souls/cli/gcloud/compute/index.rb
|
214
|
+
- lib/souls/cli/gcloud/functions/index.rb
|
211
215
|
- lib/souls/cli/gcloud/iam/index.rb
|
212
216
|
- lib/souls/cli/gcloud/index.rb
|
213
217
|
- lib/souls/cli/gcloud/pubsub/index.rb
|