souls 1.13.4 → 1.13.8

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: 3ba8bc79c88dcbafa85d3dffd3f30a529c2ba5c8670abcd48ad5efb52d2d7352
4
- data.tar.gz: 59bf01296c88174c88f638ade4855cbe5a2da2c74f36f4f1f4ec1370c6d5835f
3
+ metadata.gz: 72b7296bab23e98fd9b93903438de51f974d3c6b5e259ac33507482709a2d42f
4
+ data.tar.gz: 3bc159dcedd469188c6dae391e33e66457967f028459ee409d98bacb29213ac9
5
5
  SHA512:
6
- metadata.gz: 28a38e6407d7d297bdc1c9a97cb65933fb726617ecaf37045d5e3f323ecee56bb17b4224b5c9ae026967a3515a533d9497da6b412e5b79add0ea2666f9f99b0a
7
- data.tar.gz: 6743ee5010f6bb0df88347be32491e74c0166c625adc523918b7829745bb5fd70eb23e76b17079b35e77002d1457dc90fe8e644d0c32a75d26ccfb4c70af1830
6
+ metadata.gz: cdf23e5b33d20ddb69e9f8c53df6500477114f098a76d7815378f0a4c5ed7c9f8154a6fdface501449eb3af8d9d2af1510250af20717ab912cb89feb0839cfc8
7
+ data.tar.gz: 3a501236dc84b6b7156603a9e4b65a0c7afdc13048c4b1d42b8f27dcfe266198bc801e9ec1cbe58ced9f90b2842bb1d0b233879b4b7e9a30b9aa5361f47203b2
@@ -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,24 @@
1
+ module Template
2
+ def self.functions_app
3
+ <<~APP
4
+ require "functions_framework"
5
+ require "sinatra/base"
6
+ require "dotenv/load"
7
+
8
+ class App < Sinatra::Base
9
+ get "/souls-functions-get/:name" do
10
+ "SOULs Functions Job Done! - \#{params['name']}"
11
+ end
12
+
13
+ post "/souls-functions-post" do
14
+ params = JSON.parse(request.body.read)
15
+ "SOULs Functions Job Done! - \#{params['name']}"
16
+ end
17
+ end
18
+
19
+ FunctionsFramework.http("souls_functions") do |request|
20
+ App.call(request.env)
21
+ end
22
+ APP
23
+ end
24
+ end
@@ -0,0 +1,12 @@
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
+
10
+ GEMFILE
11
+ end
12
+ end
@@ -55,6 +55,20 @@ module Souls
55
55
  end
56
56
  end
57
57
 
58
+ desc "reset", "Reset Database and Seed"
59
+ method_option :env, aliases: "--e", default: "development", desc: "Difine APP Enviroment - development | production"
60
+ def reset
61
+ case options[:env]
62
+ when "production"
63
+ db_system("rake db:migrate:reset RACK_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1")
64
+ db_system("rake db:seed RACK_ENV=production")
65
+ else
66
+ db_system("rake db:migrate:reset")
67
+ db_system("rake db:migrate RACK_ENV=test")
68
+ db_system("rake db:seed")
69
+ end
70
+ end
71
+
58
72
  desc "add_column [CLASS_NAME]", "Create ActiveRecord Migration File"
59
73
  def add_column(class_name)
60
74
  pluralized_class_name = class_name.underscore.pluralize
@@ -88,7 +102,7 @@ module Souls
88
102
  private
89
103
 
90
104
  def db_system(cmd)
91
- system(cmd) or raise(Souls::PSQLException)
105
+ system(cmd) or Souls::Painter.error("DB is not running. Please run `souls docker psql`")
92
106
  end
93
107
  end
94
108
  end
@@ -0,0 +1,24 @@
1
+ module Souls
2
+ class Functions < Thor
3
+ desc "deploy", "Deploy Cloud Functions"
4
+ def deploy
5
+ project_id = Souls.configuration.project_id
6
+ Souls::Gcloud.new.config_set
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"
@@ -36,6 +36,7 @@ module Souls
36
36
 
37
37
  def resolve(args)
38
38
  # Define Here
39
+ puts(args)
39
40
  { response: "success!" }
40
41
  end
41
42
  end
@@ -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
@@ -6,34 +6,10 @@ module Souls
6
6
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
7
7
  singularized_class_name = class_name.singularize
8
8
  create_individual_query(class_name: singularized_class_name)
9
- create_index_query(class_name: singularized_class_name)
10
9
  end
11
10
 
12
11
  private
13
12
 
14
- def create_index_query(class_name: "user")
15
- file_path = "./app/graphql/queries/#{class_name.pluralize}.rb"
16
- return "Query already exist! #{file_path}" if File.exist?(file_path)
17
-
18
- File.open(file_path, "w") do |f|
19
- f.write(<<~TEXT)
20
- module Queries
21
- class #{class_name.camelize.pluralize} < Queries::BaseQuery
22
- type [Types::#{class_name.camelize}Type], null: false
23
-
24
- def resolve
25
- ::#{class_name.camelize}.all
26
- end
27
- end
28
- end
29
- TEXT
30
- end
31
- Souls::Painter.create_file(file_path.to_s)
32
- file_path
33
- rescue StandardError => e
34
- raise(StandardError, e)
35
- end
36
-
37
13
  def create_individual_query(class_name: "user")
38
14
  file_path = "./app/graphql/queries/#{class_name}.rb"
39
15
  return "Query already exist! #{file_path}" if File.exist?(file_path)
@@ -3,7 +3,6 @@ module Souls
3
3
  desc "query_rbs [CLASS_NAME]", "Generate GraphQL Query RBS"
4
4
  def query_rbs(class_name)
5
5
  single_query_rbs(class_name)
6
- queries_rbs(class_name)
7
6
  end
8
7
 
9
8
  private
@@ -35,29 +34,5 @@ module Souls
35
34
  end
36
35
  file_path
37
36
  end
38
-
39
- def queries_rbs(class_name)
40
- file_path = ""
41
- Dir.chdir(Souls.get_mother_path.to_s) do
42
- file_dir = "./sig/api/app/graphql/queries/"
43
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
44
- pluralized_class_name = class_name.underscore.pluralize
45
- file_path = "#{file_dir}#{pluralized_class_name}.rbs"
46
- File.open(file_path, "w") do |f|
47
- f.write(<<~TEXT)
48
- module Queries
49
- class BaseQuery
50
- end
51
- class #{pluralized_class_name.camelize} < Queries::BaseQuery
52
- def resolve: () -> ( Hash[Symbol, ( String | Integer | bool )] | ::GraphQL::ExecutionError)
53
- def self.type: (*untyped) -> String
54
- end
55
- end
56
- TEXT
57
- end
58
- Souls::Painter.create_file(file_path.to_s)
59
- end
60
- file_path
61
- end
62
37
  end
63
38
  end
@@ -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
  }
@@ -34,7 +36,7 @@ module Souls
34
36
  rescue StandardError
35
37
  raise(StandardError, result)
36
38
  end
37
- expect(a1).to(include("response" => be_a(String)))
39
+ expect(a1).to(eq("success!"))
38
40
  end
39
41
  end
40
42
  end
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/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.13.4".freeze
2
+ VERSION = "1.13.8".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.13.4
1
+ 1.13.8
@@ -1 +1 @@
1
- 1.13.4
1
+ 1.13.8
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.4
4
+ version: 1.13.8
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-14 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
@@ -138,10 +138,9 @@ dependencies:
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
140
  version: 1.1.0
141
- description: "Ruby Serverless Framework 'SOULs'. The SOULs project was launched with
142
- the goal of reducing software development, operation and maintenance costs. Build
143
- Serverless Apps faster like Rails.\n Powered by Ruby GraphQL, RBS/Steep, Active
144
- Record, RSpec, RuboCop, and Google Cloud. "
141
+ description: |-
142
+ Ruby Serverless Framework 'SOULs' | Ruby サーバーレスフレームワーク SOULs.
143
+ Powered by Ruby GraphQL, RBS/Steep, Active Record, RSpec, RuboCop, and Google Cloud.
145
144
  email:
146
145
  - f.kawasaki@elsoul.nl
147
146
  - s.kishi@elsoul.nl
@@ -175,7 +174,10 @@ files:
175
174
  - lib/souls/cli.rb
176
175
  - lib/souls/cli/cli_exception.rb
177
176
  - lib/souls/cli/console/index.rb
177
+ - lib/souls/cli/create/functions.rb
178
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
179
181
  - lib/souls/cli/db/create_migration.rb
180
182
  - lib/souls/cli/db/create_migration_rbs.rb
181
183
  - lib/souls/cli/db/index.rb
@@ -209,6 +211,7 @@ files:
209
211
  - lib/souls/cli/delete/type_rbs.rb
210
212
  - lib/souls/cli/docker/index.rb
211
213
  - lib/souls/cli/gcloud/compute/index.rb
214
+ - lib/souls/cli/gcloud/functions/index.rb
212
215
  - lib/souls/cli/gcloud/iam/index.rb
213
216
  - lib/souls/cli/gcloud/index.rb
214
217
  - lib/souls/cli/gcloud/pubsub/index.rb
@@ -292,8 +295,6 @@ requirements: []
292
295
  rubygems_version: 3.2.32
293
296
  signing_key:
294
297
  specification_version: 4
295
- summary: Ruby Serverless Framework 'SOULs'. The SOULs project was launched with the
296
- goal of reducing software development, operation and maintenance costs. Build Serverless
297
- Apps faster like Rails. Powered by Ruby GraphQL, RBS/Steep, Active Record, RSpec,
298
- RuboCop, and Google Cloud.
298
+ summary: Ruby Serverless Framework 'SOULs' | Ruby サーバーレスフレームワーク SOULs. Powered by
299
+ Ruby GraphQL, RBS/Steep, Active Record, RSpec, RuboCop, and Google Cloud.
299
300
  test_files: []