souls 0.23.5 → 0.23.9

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.
@@ -2,68 +2,77 @@ module Souls
2
2
  module Generate
3
3
  class << self
4
4
  ## Generate Type
5
- def create_type_head class_name: "souls"
5
+ def create_type_head(class_name: "souls")
6
6
  file_path = "./app/graphql/types/#{class_name}_type.rb"
7
- File.open(file_path, "w") do |f|
8
- f.write <<~EOS
9
- module Types
10
- class #{class_name.camelize}Type < BaseObject
11
- implements GraphQL::Types::Relay::Node
7
+ File.open(file_path, "w") do |f|
8
+ f.write(<<~TEXT)
9
+ module Types
10
+ class #{class_name.camelize}Type < BaseObject
11
+ implements GraphQL::Types::Relay::Node
12
12
 
13
- EOS
14
- end
13
+ TEXT
14
+ end
15
15
  end
16
16
 
17
- def create_type_params class_name: "souls"
17
+ def create_type_params(class_name: "souls")
18
18
  file_path = "./app/graphql/types/#{class_name}_type.rb"
19
19
  path = "./db/schema.rb"
20
20
  @on = false
21
21
  File.open(file_path, "a") do |new_line|
22
22
  File.open(path, "r") do |f|
23
- f.each_line.with_index do |line, i|
23
+ f.each_line.with_index do |line, _i|
24
24
  if @on
25
- new_line.write "\n" && break if line.include?("end") || line.include?("t.index")
25
+ new_line.write("\n" && break) if line.include?("end") || line.include?("t.index")
26
26
  field = "[String]" if line.include?("array: true")
27
27
  type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
28
- field ||= type_check type
28
+ field ||= type_check(type)
29
29
  case name
30
30
  when /$*_id\z/
31
- new_line.write " field :#{name.gsub("_id", "")}, Types::#{name.gsub("_id", "").singularize.camelize}Type, null: false\n"
31
+ new_line.write(
32
+ " field :#{name.gsub(
33
+ '_id',
34
+ ''
35
+ )}, Types::#{name.gsub(
36
+ '_id',
37
+ ''
38
+ ).singularize.camelize}Type, null: false\n"
39
+ )
32
40
  else
33
- new_line.write " field :#{name}, #{field}, null: true\n"
41
+ new_line.write(" field :#{name}, #{field}, null: true\n")
34
42
  end
35
43
  end
36
44
  if table_check(line: line, class_name: class_name)
37
45
  @on = true
38
- new_line.write " global_id_field :id\n"
46
+ new_line.write(" global_id_field :id\n")
39
47
  end
40
48
  end
41
49
  end
42
50
  end
43
51
  end
44
52
 
45
- def create_type_end class_name: "souls"
53
+ def create_type_end(class_name: "souls")
46
54
  file_path = "./app/graphql/types/#{class_name}_type.rb"
47
55
  File.open(file_path, "a") do |f|
48
- f.write <<~EOS
56
+ f.write(<<~TEXT)
49
57
  end
50
58
  end
51
- EOS
59
+ TEXT
52
60
  end
53
61
  file_path
54
62
  end
55
63
 
56
- def type class_name: "souls"
64
+ def type(class_name: "souls")
57
65
  singularized_class_name = class_name.singularize
58
66
  file_path = "./app/graphql/types/#{singularized_class_name}_type.rb"
59
- return "Type already exist! #{file_path}" if File.exist? file_path
60
- create_type_head class_name: singularized_class_name
61
- create_type_params class_name: singularized_class_name
62
- create_type_end class_name: singularized_class_name
63
- puts Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }]
67
+ return "Type already exist! #{file_path}" if File.exist?(file_path)
68
+
69
+ create_type_head(class_name: singularized_class_name)
70
+ create_type_params(class_name: singularized_class_name)
71
+ create_type_end(class_name: singularized_class_name)
72
+ puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
64
73
  file_path
65
74
  rescue StandardError => e
66
- raise StandardError, e
75
+ raise(StandardError, e)
67
76
  end
68
77
  end
69
78
  end
data/lib/souls/init.rb CHANGED
@@ -1,58 +1,59 @@
1
1
  module Souls
2
2
  module Init
3
- class << self
4
- def get_version repository_name: "souls_api"
5
- data = JSON.parse `curl \
6
- -H "Accept: application/vnd.github.v3+json" \
7
- -s https://api.github.com/repos/elsoul/#{repository_name}/releases`
8
- data[0]["tag_name"]
9
- end
10
-
11
- def initial_config_init app_name: "souls", strain: "api"
12
- FileUtils.touch "./#{app_name}/config/souls.rb"
13
- file_path = "./#{app_name}/config/souls.rb"
14
- File.open(file_path, "w") do |f|
15
- f.write <<~EOS
16
- Souls.configure do |config|
17
- config.app = "#{app_name}"
18
- config.strain = "#{strain}"
19
- end
20
- EOS
21
- end
22
- rescue StandardError => error
23
- puts error
24
- end
3
+ def self.get_version(repository_name: "souls_api")
4
+ data = JSON.parse(
5
+ `curl \
6
+ -H "Accept: application/vnd.github.v3+json" \
7
+ -s https://api.github.com/repos/elsoul/#{repository_name}/releases`
8
+ )
9
+ data[0]["tag_name"]
10
+ end
25
11
 
26
- def download_souls app_name: "souls", repository_name: "souls_api "
27
- version = get_version repository_name: repository_name
28
- system "curl -OL https://github.com/elsoul/#{repository_name}/archive/#{version}.tar.gz"
29
- system "tar -zxvf ./#{version}.tar.gz"
30
- system "mkdir #{app_name}"
31
- folder = version.delete "v"
32
- `cp -r #{repository_name}-#{folder}/. #{app_name}/`
33
- `rm -rf #{version}.tar.gz && rm -rf #{repository_name}-#{folder}`
34
- line = Paint["====================================", :yellow]
35
- puts "\n"
36
- puts line
37
- txt = <<~TEXT
38
- _____ ____ __ ____#{' '}
39
- / ___// __ \\/ / / / / _____
40
- \\__ \\/ / / / / / / / / ___/
41
- ___/ / /_/ / /_/ / /___(__ )#{' '}
42
- /____/\\____/\\____/_____/____/#{' '}
12
+ def self.initial_config_init(app_name: "souls", strain: "api")
13
+ FileUtils.touch("./#{app_name}/config/souls.rb")
14
+ file_path = "./#{app_name}/config/souls.rb"
15
+ File.open(file_path, "w") do |f|
16
+ f.write(<<~TEXT)
17
+ Souls.configure do |config|
18
+ config.app = "#{app_name}"
19
+ config.strain = "#{strain}"
20
+ end
43
21
  TEXT
44
- message = Paint[txt, :blue]
45
- puts message
46
- puts line
47
- welcome = Paint["Welcome to SOULs!", :white]
48
- puts welcome
49
- souls_ver = Paint["SOULs Version: #{Souls::VERSION}", :white]
50
- puts souls_ver
51
- puts line
52
- cd = Paint["Easy to Run\n$ cd #{app_name}\n$ bundle\n$ souls s\nGo To : http://localhost:3000\n\nDoc: https://souls.elsoul.nl", :white]
53
- puts cd
54
- puts line
55
22
  end
23
+ rescue StandardError => e
24
+ puts(e)
25
+ end
26
+
27
+ def self.download_souls(app_name: "souls", repository_name: "souls_api ")
28
+ version = get_version(repository_name: repository_name)
29
+ system("curl -OL https://github.com/elsoul/#{repository_name}/archive/#{version}.tar.gz")
30
+ system("tar -zxvf ./#{version}.tar.gz")
31
+ system("mkdir #{app_name}")
32
+ folder = version.delete("v")
33
+ `cp -r #{repository_name}-#{folder}/. #{app_name}/`
34
+ `rm -rf #{version}.tar.gz && rm -rf #{repository_name}-#{folder}`
35
+ line = Paint["====================================", :yellow]
36
+ puts("\n")
37
+ puts(line)
38
+ txt = <<~TEXT
39
+ _____ ____ __ ____#{' '}
40
+ / ___// __ \\/ / / / / _____
41
+ \\__ \\/ / / / / / / / / ___/
42
+ ___/ / /_/ / /_/ / /___(__ )#{' '}
43
+ /____/\\____/\\____/_____/____/#{' '}
44
+ TEXT
45
+ message = Paint[txt, :blue]
46
+ puts(message)
47
+ puts(line)
48
+ welcome = Paint["Welcome to SOULs!", :white]
49
+ puts(welcome)
50
+ souls_ver = Paint["SOULs Version: #{Souls::VERSION}", :white]
51
+ puts(souls_ver)
52
+ puts(line)
53
+ cd = Paint["Easy to Run\n$ cd #{app_name}\n$ bundle\n$ souls s\nGo To : http://localhost:3000\n\nDoc: https://souls.elsoul.nl",
54
+ :white]
55
+ puts(cd)
56
+ puts(line)
56
57
  end
57
58
  end
58
59
  end
data/lib/souls/version.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.23.5"
2
+ VERSION = "0.23.9".freeze
3
+ public_constant :VERSION
3
4
  end
data/souls.gemspec CHANGED
@@ -6,8 +6,12 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["POPPIN-FUMI", "KishiTheMechanic", "James Neve"]
7
7
  spec.email = ["f.kawasaki@elsoul.nl", "s.kishi@elsoul.nl", "jamesoneve@gmail.com"]
8
8
 
9
- spec.summary = "SOULs is a Serverless Application Framework. SOULs has four strains, API, Worker, Console, Media, and can be used in combination according to the purpose. SOULs Backend GraphQL Ruby & Frontend Relay are Scalable and Easy to deploy to Google Cloud and Amazon Web Services"
10
- spec.description = "SOULs is a Serverless Application Framework. SOULs has four strains, API, Worker, Console, Media, and can be used in combination according to the purpose. SOULs Backend GraphQL Ruby & Frontend Relay are Scalable and Easy to deploy to Google Cloud and Amazon Web Services"
9
+ spec.summary = "SOULs is a Serverless Application Framework.
10
+ SOULs has four strains, API, Worker, Console, Media, and can be used in combination according to the purpose.
11
+ SOULs Backend GraphQL Ruby & Frontend Relay are Scalable and Easy to deploy to Google Cloud and Amazon Web Services"
12
+ spec.description = "SOULs is a Serverless Application Framework.
13
+ SOULs has four strains, API, Worker, Console, Media, and can be used in combination according to the purpose.
14
+ SOULs Backend GraphQL Ruby & Frontend Relay are Scalable and Easy to deploy to Google Cloud and Amazon Web Services"
11
15
  spec.homepage = "https://souls.elsoul.nl"
12
16
  spec.license = "Apache-2.0"
13
17
  spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
@@ -18,12 +22,13 @@ Gem::Specification.new do |spec|
18
22
 
19
23
  # Specify which files should be added to the gem when it is released.
20
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
- end
25
+ spec.files =
26
+ Dir.chdir(File.expand_path(__dir__)) do
27
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ end
24
29
  spec.bindir = "exe"
25
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
31
  spec.require_paths = ["lib"]
27
- spec.add_runtime_dependency "paint", "2.2.1"
28
- spec.add_runtime_dependency "whirly", "0.3.0"
32
+ spec.add_runtime_dependency("paint", "2.2.1")
33
+ spec.add_runtime_dependency("whirly", "0.3.0")
29
34
  end
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: 0.23.5
4
+ version: 0.23.9
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-07-14 00:00:00.000000000 Z
13
+ date: 2021-07-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: paint
@@ -40,10 +40,10 @@ dependencies:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
42
  version: 0.3.0
43
- description: SOULs is a Serverless Application Framework. SOULs has four strains,
44
- API, Worker, Console, Media, and can be used in combination according to the purpose.
45
- SOULs Backend GraphQL Ruby & Frontend Relay are Scalable and Easy to deploy to Google
46
- Cloud and Amazon Web Services
43
+ description: |-
44
+ SOULs is a Serverless Application Framework.
45
+ SOULs has four strains, API, Worker, Console, Media, and can be used in combination according to the purpose.
46
+ SOULs Backend GraphQL Ruby & Frontend Relay are Scalable and Easy to deploy to Google Cloud and Amazon Web Services
47
47
  email:
48
48
  - f.kawasaki@elsoul.nl
49
49
  - s.kishi@elsoul.nl
@@ -75,6 +75,7 @@ files:
75
75
  - lib/souls/gcloud.rb
76
76
  - lib/souls/gcloud/compute.rb
77
77
  - lib/souls/gcloud/iam.rb
78
+ - lib/souls/gcloud/pubsub.rb
78
79
  - lib/souls/generate.rb
79
80
  - lib/souls/generate/application.rb
80
81
  - lib/souls/generate/connection.rb