souls 0.16.7 → 0.16.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -2
- data/exe/souls +15 -0
- data/lib/souls/generate.rb +38 -6
- data/lib/souls/init.rb +0 -4
- data/lib/souls/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09d37b12a50b54d68e40410a8c69b930cc091553515f735df7575fa6daa88abb'
|
4
|
+
data.tar.gz: 770c7f445b61f046d1a2a166004dd4c4e42272aab1192636a4596db0753cb316
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d15a89dae81309eeaacee343f636ab4fef4cf04ddc7a287a5ba9fd76e094a9a89c48ad6c42feee91a2f3c70ff09979eecfbf4d63ec882d01d970bc9340047410
|
7
|
+
data.tar.gz: 56c5ec546f7e536bbf72b87bba895b292a1b79daebceb2b4037a97729cc8f9c4a91736449872943c1cde940eb829b5087423f18399e649c0272ec9979bf24106
|
data/.rubocop.yml
CHANGED
data/exe/souls
CHANGED
@@ -48,6 +48,21 @@ begin
|
|
48
48
|
Souls::Init.config_init
|
49
49
|
when "-v", "--version"
|
50
50
|
puts Souls::VERSION
|
51
|
+
when "add"
|
52
|
+
case ARGV[1]
|
53
|
+
when "mutation"
|
54
|
+
Souls::Init.add_mutation class_name: "user", file_name: "hoi"
|
55
|
+
when "type"
|
56
|
+
Souls::Init.add_type class_name: "user", file_name: "hoi"
|
57
|
+
when "connection"
|
58
|
+
Souls::Init.add_connection class_name: "user", file_name: "hoi"
|
59
|
+
when "edge"
|
60
|
+
Souls::Init.add_edge class_name: "user", file_name: "hoi"
|
61
|
+
when "rspec_mutation"
|
62
|
+
Souls::Init.add_rspec_mutation class_name: "user", file_name: "hoi"
|
63
|
+
else
|
64
|
+
puts "HOI!"
|
65
|
+
end
|
51
66
|
when "g", "generate"
|
52
67
|
case ARGV[1]
|
53
68
|
when "test_dir"
|
data/lib/souls/generate.rb
CHANGED
@@ -110,7 +110,7 @@ module Souls
|
|
110
110
|
if line.include?("end") || line.include?("t.index")
|
111
111
|
break
|
112
112
|
end
|
113
|
-
|
113
|
+
type, name = get_type_and_name(line)
|
114
114
|
if line.include?("array: true")
|
115
115
|
new_line.write " scope = scope.where(\"#{name} @> ARRAY[?]::text[]\", value[:#{name}]) if value[:#{name}]\n"
|
116
116
|
next
|
@@ -124,7 +124,12 @@ module Souls
|
|
124
124
|
when "created_at", "updated_at"
|
125
125
|
next
|
126
126
|
else
|
127
|
-
|
127
|
+
case type
|
128
|
+
when "boolean"
|
129
|
+
new_line.write " scope = scope.where(#{name}: value[:#{name}]) unless value[:#{name}].nil?\n"
|
130
|
+
else
|
131
|
+
new_line.write " scope = scope.where(#{name}: value[:#{name}]) if value[:#{name}]\n"
|
132
|
+
end
|
128
133
|
end
|
129
134
|
end
|
130
135
|
@on = true if table_check(line: line, class_name: class_name)
|
@@ -137,7 +142,7 @@ module Souls
|
|
137
142
|
file_path = "./app/graphql/resolvers/#{class_name.singularize}_search.rb"
|
138
143
|
File.open(file_path, "a") do |f|
|
139
144
|
f.write <<-EOS
|
140
|
-
scope = scope.where(is_deleted: value[:is_deleted])
|
145
|
+
scope = scope.where(is_deleted: value[:is_deleted]) unless value[:is_deleted].nil?
|
141
146
|
scope = scope.where("created_at >= ?", value[:start_date]) if value[:start_date]
|
142
147
|
scope = scope.where("created_at <= ?", value[:end_date]) if value[:end_date]
|
143
148
|
|
@@ -169,9 +174,6 @@ end
|
|
169
174
|
File.open(file_path, "w") do |f|
|
170
175
|
f.write <<~EOS
|
171
176
|
class #{class_name.camelize}
|
172
|
-
include Sidekiq::Status::Worker
|
173
|
-
include Sidekiq::Worker
|
174
|
-
sidekiq_options queue: "default"
|
175
177
|
|
176
178
|
def perform **args
|
177
179
|
# write task code here
|
@@ -385,6 +387,36 @@ end
|
|
385
387
|
rescue StandardError => error
|
386
388
|
puts error
|
387
389
|
end
|
390
|
+
|
391
|
+
def add_mutation class_name: "souls", file_name: "hoi"
|
392
|
+
singularized_class_name = class_name.singularize.underscore
|
393
|
+
file_path = "./app/graphql/mutations/#{singularized_class_name}/#{file_name}.rb"
|
394
|
+
file_path
|
395
|
+
end
|
396
|
+
|
397
|
+
def add_type class_name: "souls", file_name: "hoi"
|
398
|
+
singularized_class_name = class_name.singularize.underscore
|
399
|
+
file_path = "./app/graphql/types/#{file_name}.rb"
|
400
|
+
file_path
|
401
|
+
end
|
402
|
+
|
403
|
+
def add_edge class_name: "souls", file_name: "hoi"
|
404
|
+
singularized_class_name = class_name.singularize.underscore
|
405
|
+
file_path = "./app/graphql/types/#{file_name}.rb"
|
406
|
+
file_path
|
407
|
+
end
|
408
|
+
|
409
|
+
def add_connection class_name: "souls", file_name: "hoi"
|
410
|
+
singularized_class_name = class_name.singularize.underscore
|
411
|
+
file_path = "./app/graphql/types/#{file_name}.rb"
|
412
|
+
file_path
|
413
|
+
end
|
414
|
+
|
415
|
+
def add_rspec_mutation class_name: "souls", file_name: "hoi"
|
416
|
+
singularized_class_name = class_name.singularize.underscore
|
417
|
+
file_path = "./app/graphql/types/#{file_name}.rb"
|
418
|
+
file_path
|
419
|
+
end
|
388
420
|
end
|
389
421
|
end
|
390
422
|
end
|
data/lib/souls/init.rb
CHANGED
@@ -780,10 +780,6 @@ module Souls
|
|
780
780
|
EOS
|
781
781
|
else
|
782
782
|
new_line.write <<-EOS
|
783
|
-
|
784
|
-
def get_global_key class_name, id
|
785
|
-
Base64.encode64(\"\#{class_name}:\#{id}\")
|
786
|
-
end
|
787
783
|
let(:#{class_name}) { FactoryBot.attributes_for(:#{class_name}, #{@relation_params.join(", ")}) }
|
788
784
|
|
789
785
|
let(:mutation) do
|
data/lib/souls/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: souls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- POPPIN-FUMI
|
8
8
|
- KishiTheMechanic
|
9
9
|
- James Neve
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-03-
|
13
|
+
date: 2021-03-12 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: SOULS is a Web Application Framework for Microservices on Multi Cloud
|
16
16
|
Platform such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud.
|
@@ -55,7 +55,7 @@ metadata:
|
|
55
55
|
homepage_uri: https://github.com/elsoul/souls
|
56
56
|
source_code_uri: https://github.com/elsoul/souls
|
57
57
|
changelog_uri: https://github.com/elsoul/souls
|
58
|
-
post_install_message:
|
58
|
+
post_install_message:
|
59
59
|
rdoc_options: []
|
60
60
|
require_paths:
|
61
61
|
- lib
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
version: '0'
|
72
72
|
requirements: []
|
73
73
|
rubygems_version: 3.2.3
|
74
|
-
signing_key:
|
74
|
+
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: SOULS is a GraphQL Based Web Application Framework for Microservices on Multi
|
77
77
|
Cloud Platform such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud.
|