souls 0.23.4 → 0.23.8
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 +4 -4
- data/.rubocop.yml +73 -135
- data/Gemfile.lock +1 -1
- data/README.md +23 -11
- data/Rakefile +2 -2
- data/exe/souls +74 -73
- data/lib/souls.rb +153 -141
- data/lib/souls/gcloud/compute.rb +61 -51
- data/lib/souls/gcloud/iam.rb +22 -24
- data/lib/souls/generate/application.rb +160 -160
- data/lib/souls/generate/connection.rb +13 -15
- data/lib/souls/generate/edge.rb +13 -15
- data/lib/souls/generate/model.rb +16 -17
- data/lib/souls/generate/mutation.rb +225 -221
- data/lib/souls/generate/policy.rb +44 -45
- data/lib/souls/generate/query.rb +49 -49
- data/lib/souls/generate/resolver.rb +121 -124
- data/lib/souls/generate/rspec_factory.rb +49 -52
- data/lib/souls/generate/rspec_model.rb +17 -18
- data/lib/souls/generate/rspec_mutation.rb +193 -199
- data/lib/souls/generate/rspec_policy.rb +38 -39
- data/lib/souls/generate/rspec_query.rb +133 -140
- data/lib/souls/generate/rspec_resolver.rb +147 -154
- data/lib/souls/generate/type.rb +34 -25
- data/lib/souls/init.rb +51 -50
- data/lib/souls/version.rb +2 -1
- data/souls.gemspec +12 -7
- metadata +6 -6
data/lib/souls/generate/type.rb
CHANGED
@@ -2,68 +2,77 @@ module Souls
|
|
2
2
|
module Generate
|
3
3
|
class << self
|
4
4
|
## Generate Type
|
5
|
-
def create_type_head
|
5
|
+
def create_type_head(class_name: "souls")
|
6
6
|
file_path = "./app/graphql/types/#{class_name}_type.rb"
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
14
|
-
|
13
|
+
TEXT
|
14
|
+
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def create_type_params
|
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,
|
23
|
+
f.each_line.with_index do |line, _i|
|
24
24
|
if @on
|
25
|
-
new_line.write
|
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
|
28
|
+
field ||= type_check(type)
|
29
29
|
case name
|
30
30
|
when /$*_id\z/
|
31
|
-
new_line.write
|
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
|
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
|
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
|
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
|
56
|
+
f.write(<<~TEXT)
|
49
57
|
end
|
50
58
|
end
|
51
|
-
|
59
|
+
TEXT
|
52
60
|
end
|
53
61
|
file_path
|
54
62
|
end
|
55
63
|
|
56
|
-
def type
|
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?
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
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
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
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.
|
10
|
-
|
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 =
|
22
|
-
|
23
|
-
|
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
|
28
|
-
spec.add_runtime_dependency
|
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.
|
4
|
+
version: 0.23.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-07-
|
13
|
+
date: 2021-07-18 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:
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|