souls 1.13.6 → 1.14.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a118ef08a3774a66d30e0dc99084579a1806d60abd43503f131f57705e6fe08
4
- data.tar.gz: cc2bcff6cd1aa810da5adf7576484e00cf1d7439539a6500da95575182a31ce3
3
+ metadata.gz: 86e9a0ba6f61532e0ceb30f68cbf47445b84e53c034366f287cb514be8c50bcb
4
+ data.tar.gz: 01a9ad3ff6c9d73633041cd4f4befc197adf1bfefb55208cfb6793a27010ef9a
5
5
  SHA512:
6
- metadata.gz: 0f3c4227abd7e591219a0547b53af58091c9287c8ea9accb58e7a621d19c0f6b9c5b8e8029d564567cd163e478619fa65227551ddc853e5ae69dd4e05e3cdc79
7
- data.tar.gz: 4d26b93f0548b80c245adc9ee531299d65b26748da5389927d0724a1043cb4c9d6d5903ab687dbfd79a89b8c8d364f4a09cd85f8bd5698c40eb4b770afbae0d9
6
+ metadata.gz: 5474dc7a392e012288a6db34b0f1a960a0c2452649a1b9146f8515aea9352fa4c67d30fb447fc388bbcb83260d665c2301edf23a608d214643ec970f37af5d12
7
+ data.tar.gz: 49804c5f3b4b2ce9cf35290e948c8b3663c13a9f0b0b0791d5af1ae73b9966bf6d4675a015521327993bb2770acb35361b3815d74bdff929db7c9f8e20ba6cf7
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,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
@@ -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,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
@@ -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 seed RACK_ENV=production")
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 seed")
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 < BaseMutation
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
@@ -16,7 +16,9 @@ module Souls
16
16
 
17
17
  let(:mutation) do
18
18
  %(mutation {
19
- #{options[:mutation].singularize.camelize(:lower)}(input: {}) {
19
+ #{options[:mutation].singularize.camelize(:lower)}(input: {
20
+ argument: "argument test!"
21
+ }) {
20
22
  response
21
23
  }
22
24
  }
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,17 @@
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
+ file_array = Dir.pwd.split("/")
5
+ mother_dir_num = file_array.rindex("apps")
6
+ mother_dir_num ? file_array.slice(mother_dir_num).join("/") : file_array.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
- Dir.pwd.split(Souls.configuration.app)[0] + Souls.configuration.app + "/apps/api"
14
+ get_mother_path + "/apps/api"
9
15
  end
10
16
 
11
17
  def type_check(type)
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.13.6".freeze
2
+ VERSION = "1.14.1".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.13.6
1
+ 1.14.1
@@ -1 +1 @@
1
- 1.13.6
1
+ 1.14.1
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.6
4
+ version: 1.14.1
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-21 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,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