souls 1.13.7 → 1.14.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3fc7f40511ec0965a0719e497483a38260310725555a29d0898a9cebc0ed2e1d
4
- data.tar.gz: 631eb79cda3828b4bdfa87631a5135433c984c2a50a6afc9bbca5b7a23631746
3
+ metadata.gz: 8308615df78c8c6ebe073fdbab2cd67b62cd2b793eb50a34f3849d74f6c22424
4
+ data.tar.gz: 36b68ae49c525c4ad70a20ca7da086298c3563a3ef039e1cfb5749710a988146
5
5
  SHA512:
6
- metadata.gz: 813388aae1bfd538bb2546a3e83c471a1b40ca53ff25ba873ed70bb4775695481055e9da0eed6f5f786051aff32adb4423ee333e9ada7e41a0d0414b8d2cc30a
7
- data.tar.gz: d7aaf5a388ccb022b6c2e4bc076146d23da566bac28b2276c0e1a5d9899464905e6dc9825cf2ee5ee678b73db1b0885698e4caef6dc777e91fb3947dd778c64f
6
+ metadata.gz: 2a4bdc4ab3b391b6a863a3a993301953adacdbe2fa3415b896c4b9ada0f55d12a038a27039bb2cdb928f8401e0f40667fda34c0172f4f1c727e4784100201a78
7
+ data.tar.gz: fa8dddbc20ea584a313074acf14194d0ac4628c01aaf29927def9b14a82d04aa547b9ac77190be3b8450115b6131269cf8bff43504a7c42c9ba319ce7fc2111d
data/exe/souls CHANGED
@@ -3,7 +3,14 @@ require "souls"
3
3
  require "thor"
4
4
  begin
5
5
  souls_command = ARGV[0]
6
- require("./config/souls") unless ["new", "docker", "-v", "help", "", nil].include?(souls_command)
6
+ require(Souls.get_mother_path.to_s + "/config/souls") unless [
7
+ "new",
8
+ "docker",
9
+ "-v",
10
+ "help",
11
+ "",
12
+ nil
13
+ ].include?(souls_command)
7
14
  rescue StandardError
8
15
  raise(StandardError, "No config! Please make `./config/souls.rb` File!")
9
16
  end
@@ -0,0 +1,48 @@
1
+ require_relative "./template/functions_app"
2
+ require_relative "./template/functions_gemfile"
3
+ require_relative "./template/functions_env_yaml"
4
+ module Souls
5
+ class Create < Thor
6
+ desc "functions", "Create SOULs functions"
7
+ def functions
8
+ create_app_file
9
+ create_gemfile
10
+ create_env_yaml
11
+ end
12
+
13
+ private
14
+
15
+ def create_app_file
16
+ file_dir = "./apps/functions"
17
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
18
+ file_path = "#{file_dir}/app.rb"
19
+ raise(StandardError, "Already Exist!") if File.exist?(file_path)
20
+
21
+ File.write(file_path, Template.functions_app)
22
+ Souls::Painter.create_file(file_path)
23
+ file_path
24
+ end
25
+
26
+ def create_gemfile
27
+ file_dir = "./apps/functions"
28
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
29
+ file_path = "#{file_dir}/Gemfile"
30
+ raise(StandardError, "Already Exist!") if File.exist?(file_path)
31
+
32
+ File.write(file_path, Template.functions_gemfile)
33
+ Souls::Painter.create_file(file_path)
34
+ file_path
35
+ end
36
+
37
+ def create_env_yaml
38
+ file_dir = "./apps/functions"
39
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
40
+ file_path = "#{file_dir}/.env.yaml"
41
+ raise(StandardError, "Already Exist!") if File.exist?(file_path)
42
+
43
+ File.write(file_path, Template.functions_env_yaml)
44
+ Souls::Painter.create_file(file_path)
45
+ file_path
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,4 @@
1
+ require_relative "./functions"
1
2
  module Souls
2
3
  class Create < Thor
3
4
  desc "worker", "Create SOULs Worker"
@@ -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
@@ -0,0 +1,8 @@
1
+ module Template
2
+ def self.functions_env_yaml
3
+ <<~ENV
4
+ FOO: bar
5
+ BAZ: boo
6
+ ENV
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ module Template
2
+ def self.functions_gemfile
3
+ <<~GEMFILE
4
+ source "https://rubygems.org"
5
+
6
+ gem "dotenv", "2.7.6"
7
+ gem "functions_framework", "~> 0.7"
8
+ gem "sinatra", "2.1.0"
9
+ gem "souls", "#{Souls::VERSION}"
10
+
11
+ GEMFILE
12
+ end
13
+ end
@@ -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 --env-vars-file .env.yaml
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"
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
@@ -1,11 +1,18 @@
1
1
  module Souls
2
2
  module Utils
3
3
  def get_mother_path
4
- Dir.pwd.split(Souls.configuration.app)[0] + Souls.configuration.app
4
+ current_dir = Dir.pwd
5
+ file_array = current_dir.split("/")
6
+ mother_dir_num = file_array.rindex("apps")
7
+ mother_dir_num ? file_array.each_slice(mother_dir_num).to_a[0].join("/") : current_dir
8
+ end
9
+
10
+ def get_functions_path
11
+ get_mother_path + "/apps/functions"
5
12
  end
6
13
 
7
14
  def get_api_path
8
- Dir.pwd.split(Souls.configuration.app)[0] + Souls.configuration.app + "/apps/api"
15
+ get_mother_path + "/apps/api"
9
16
  end
10
17
 
11
18
  def type_check(type)
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.13.7".freeze
2
+ VERSION = "1.14.2".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.13.7
1
+ 1.14.2
@@ -1 +1 @@
1
- 1.13.7
1
+ 1.14.2
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.13.7
4
+ version: 1.14.2
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-22 00:00:00.000000000 Z
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,11 @@ 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_env_yaml.rb
181
+ - lib/souls/cli/create/template/functions_gemfile.rb
178
182
  - lib/souls/cli/db/create_migration.rb
179
183
  - lib/souls/cli/db/create_migration_rbs.rb
180
184
  - lib/souls/cli/db/index.rb
@@ -208,6 +212,7 @@ files:
208
212
  - lib/souls/cli/delete/type_rbs.rb
209
213
  - lib/souls/cli/docker/index.rb
210
214
  - lib/souls/cli/gcloud/compute/index.rb
215
+ - lib/souls/cli/gcloud/functions/index.rb
211
216
  - lib/souls/cli/gcloud/iam/index.rb
212
217
  - lib/souls/cli/gcloud/index.rb
213
218
  - lib/souls/cli/gcloud/pubsub/index.rb