souls 1.13.8 → 1.14.3

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: 72b7296bab23e98fd9b93903438de51f974d3c6b5e259ac33507482709a2d42f
4
- data.tar.gz: 3bc159dcedd469188c6dae391e33e66457967f028459ee409d98bacb29213ac9
3
+ metadata.gz: 307c03a9709bb93fa10b1c01c3aeef9195998851d3911cd82e9caf15bdf681e6
4
+ data.tar.gz: 73e46b801ed06da8633ba90f26a4614adbc0bcc1421b23eab9fae4b2f46fe978
5
5
  SHA512:
6
- metadata.gz: cdf23e5b33d20ddb69e9f8c53df6500477114f098a76d7815378f0a4c5ed7c9f8154a6fdface501449eb3af8d9d2af1510250af20717ab912cb89feb0839cfc8
7
- data.tar.gz: 3a501236dc84b6b7156603a9e4b65a0c7afdc13048c4b1d42b8f27dcfe266198bc801e9ec1cbe58ced9f90b2842bb1d0b233879b4b7e9a30b9aa5361f47203b2
6
+ metadata.gz: 0cb923fdc7f81864b921b1c6d02ff39512ed972826281c64e8e93da4232f8c9071b48e6266f0642baec145f66d6bbc377e1c91f6573f6623f5c160d202fb57d9
7
+ data.tar.gz: 727b4134dc221130f6af878677b0d6ec666748ec319aa03970b2e5093f62c33d549b1f46ca78ed2d83be918b97619a3f385ffb736fe30fafe4ee132921d552bf
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
@@ -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
@@ -2,18 +2,32 @@ module Souls
2
2
  class Functions < Thor
3
3
  desc "deploy", "Deploy Cloud Functions"
4
4
  def deploy
5
+ require(Souls.get_mother_path.to_s + "/config/souls")
5
6
  project_id = Souls.configuration.project_id
6
- Souls::Gcloud.new.config_set
7
7
  Dir.chdir(Souls.get_functions_path.to_s) do
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
@@ -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.8".freeze
2
+ VERSION = "1.14.3".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.13.8
1
+ 1.14.3
@@ -1 +1 @@
1
- 1.13.8
1
+ 1.14.3
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.8
4
+ version: 1.14.3
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