souls 1.14.0 → 1.15.0

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: 4e0a0c2f62583042427032c3802a5891673d34133516fff6612a23e57f0ac856
4
- data.tar.gz: cc603ee54459e86da37bc87a3f3ee19c3cf36c6190ee00fb3977aec9ab9a828a
3
+ metadata.gz: b8ac629f9417ec89610e144130620cd5b4d63abf618545a2edd03a0dfa641648
4
+ data.tar.gz: 7d90d21c551a6308f813b6036497b306926f989a2e4ffd78711ebf3b8dc730bb
5
5
  SHA512:
6
- metadata.gz: 23a902c39fcb35b1c9e11c23c44db2af53807e56537b256cb4d12672403d9e9fc3eab0985c6c5b37ffbd6b77de8a0792be1c4ec8fdaeecb00ef15df775716cb2
7
- data.tar.gz: c11dad7563e808fffc9f3532a962746d7f94c3a120d248d712d965c96e19baa8df46b33191aeabda271b6e1d3d0d86758f607875104f1533361c0c79b1dbbe81
6
+ metadata.gz: ee9d8fb97ef92a7776ccb458fd46531cb8596e745e739ce0367346a1b1750447b8b99a4079731205d4ee06f1429706e7640cb295f6866a5a50bdbbca9a9a4137
7
+ data.tar.gz: ae1becef1a18db18b3b16d7c70b06d30aeb999916b90f91b6389e4efb558d56463bc1ed5e8af44cac3d4f1cde42af8852ac038a1479565a4a271be4e02921583
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
@@ -1,11 +1,13 @@
1
1
  require_relative "./template/functions_app"
2
2
  require_relative "./template/functions_gemfile"
3
+ require_relative "./template/functions_env_yaml"
3
4
  module Souls
4
5
  class Create < Thor
5
6
  desc "functions", "Create SOULs functions"
6
7
  def functions
7
8
  create_app_file
8
9
  create_gemfile
10
+ create_env_yaml
9
11
  end
10
12
 
11
13
  private
@@ -31,5 +33,16 @@ module Souls
31
33
  Souls::Painter.create_file(file_path)
32
34
  file_path
33
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
34
47
  end
35
48
  end
@@ -4,7 +4,6 @@ module Template
4
4
  require "functions_framework"
5
5
  require "sinatra/base"
6
6
  require "dotenv/load"
7
- require "souls"
8
7
 
9
8
  class App < Sinatra::Base
10
9
  get "/souls-functions-get/:name" do
@@ -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
@@ -6,7 +6,6 @@ module Template
6
6
  gem "dotenv", "2.7.6"
7
7
  gem "functions_framework", "~> 0.7"
8
8
  gem "sinatra", "2.1.0"
9
- gem "souls", "#{Souls::VERSION}"
10
9
 
11
10
  GEMFILE
12
11
  end
@@ -8,12 +8,26 @@ module Souls
8
8
  system(
9
9
  "
10
10
  gcloud functions deploy souls_functions --project=#{project_id} \
11
- --runtime ruby27 --trigger-http --allow-unauthenticated
11
+ --runtime ruby27 --trigger-http --allow-unauthenticated --env-vars-file .env.yaml
12
12
  "
13
13
  )
14
14
  end
15
15
  end
16
16
 
17
+ desc "describe", "Describe SOULs Functions"
18
+ def describe
19
+ require(Souls.get_mother_path.to_s + "/config/souls")
20
+ project_id = Souls.configuration.project_id
21
+ system("gcloud functions describe souls_functions --project=#{project_id}")
22
+ end
23
+
24
+ desc "url", "Get SOULs Functions URL"
25
+ def url
26
+ require(Souls.get_mother_path.to_s + "/config/souls")
27
+ project_id = Souls.configuration.project_id
28
+ system("gcloud functions describe souls_functions --project=#{project_id}| grep url")
29
+ end
30
+
17
31
  desc "dev", "Check SOULs Functions dev"
18
32
  def dev
19
33
  Dir.chdir(Souls.get_functions_path.to_s) do
@@ -12,22 +12,24 @@ module Souls
12
12
 
13
13
  File.open(file_path, "w") do |f|
14
14
  f.write(<<~TEXT)
15
- class BaseResolver
16
- end
17
- class #{singularized_class_name.camelize}Search < BaseResolver
18
- include SearchObject
19
- def self.scope: () ?{ () -> nil } -> [Hash[Symbol, untyped]]
20
- def self.type: (*untyped) -> String
21
- def self.option: (:filter, type: untyped, with: :apply_filter) -> String
22
- def self.description: (String) -> String
23
- def self.types: (*untyped) -> String
24
- def decode_global_key: (String value) -> Integer
25
- def apply_filter: (untyped scope, untyped value) -> untyped
15
+ module Resolvers
16
+ class BaseResolver
17
+ end
18
+ class #{singularized_class_name.camelize}Search < BaseResolver
19
+ include SearchObject
20
+ def self.scope: () ?{ () -> nil } -> [Hash[Symbol, untyped]]
21
+ def self.type: (*untyped) -> String
22
+ def self.option: (:filter, type: untyped, with: :apply_filter) -> String
23
+ def self.description: (String) -> String
24
+ def self.types: (*untyped) -> String
25
+ def decode_global_key: (String value) -> Integer
26
+ def apply_filter: (untyped scope, untyped value) -> untyped
26
27
 
27
- class #{singularized_class_name.camelize}Filter < Souls::Types::BaseInputObject
28
- String: String
29
- Boolean: Boolean
30
- Integer: Integer
28
+ class #{singularized_class_name.camelize}Filter
29
+ String: String
30
+ Boolean: Boolean
31
+ Integer: Integer
32
+ end
31
33
  end
32
34
  end
33
35
  TEXT
@@ -1,9 +1,10 @@
1
1
  module Souls
2
2
  module Utils
3
3
  def get_mother_path
4
- file_array = Dir.pwd.split("/")
4
+ current_dir = Dir.pwd
5
+ file_array = current_dir.split("/")
5
6
  mother_dir_num = file_array.rindex("apps")
6
- file_array.each_slice(mother_dir_num).to_a[0].join("/")
7
+ mother_dir_num ? file_array.each_slice(mother_dir_num).to_a[0].join("/") : current_dir
7
8
  end
8
9
 
9
10
  def get_functions_path
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.14.0".freeze
2
+ VERSION = "1.15.0".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.14.0
1
+ 1.15.0
@@ -1 +1 @@
1
- 1.14.0
1
+ 1.15.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.14.0
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
@@ -177,6 +177,7 @@ files:
177
177
  - lib/souls/cli/create/functions.rb
178
178
  - lib/souls/cli/create/index.rb
179
179
  - lib/souls/cli/create/template/functions_app.rb
180
+ - lib/souls/cli/create/template/functions_env_yaml.rb
180
181
  - lib/souls/cli/create/template/functions_gemfile.rb
181
182
  - lib/souls/cli/db/create_migration.rb
182
183
  - lib/souls/cli/db/create_migration_rbs.rb