souls 0.16.6 → 0.17.1
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 +0 -2
- data/Gemfile.lock +1 -1
- data/exe/souls +22 -2
- data/lib/souls/generate.rb +37 -20
- 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: 355c7cee19de658ccd9388304dcd579be138cfbf08bf8bf85286e89fb7eed494
|
4
|
+
data.tar.gz: 865cf06eeab74c947f817b520d88762835ba3d6f5f9c28a15cf8e5a1fd2e601e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8675b29f4901bc934e3ac67b2ce3d6baacd1df2ded71164a99cda4be3eb7c16d7452e066dcdafc784124481de74deb194629b3b565ee5d35a881411fc788441a
|
7
|
+
data.tar.gz: ea38542d2c8be19a503829cc4eee72b3576f8b20e89d82fcc66ff921992dbe05fcd19bcbb3db262c173994ce44bd2642082bbe78a6db3e1abe59d34a6f3ed5d8
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/exe/souls
CHANGED
@@ -35,7 +35,7 @@ begin
|
|
35
35
|
else
|
36
36
|
case ARGV[1]
|
37
37
|
when "RACK_ENV=production"
|
38
|
-
system "bundle exec irb
|
38
|
+
system "RACK_ENV=production bundle exec irb"
|
39
39
|
else
|
40
40
|
system "bundle exec irb"
|
41
41
|
end
|
@@ -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"
|
@@ -99,7 +114,12 @@ begin
|
|
99
114
|
system "rake db:migrate && rake db:migrate RACK_ENV=test"
|
100
115
|
end
|
101
116
|
when "db:seed"
|
102
|
-
|
117
|
+
case ARGV[1]
|
118
|
+
when "RACK_ENV=production"
|
119
|
+
system "rake db:seed RACK_ENV=production"
|
120
|
+
else
|
121
|
+
system "rake db:seed"
|
122
|
+
end
|
103
123
|
when "db:migrate:reset"
|
104
124
|
case ARGV[1]
|
105
125
|
when "RACK_ENV=production"
|
data/lib/souls/generate.rb
CHANGED
@@ -77,7 +77,6 @@ module Souls
|
|
77
77
|
file_path = "./app/graphql/resolvers/#{class_name.singularize}_search.rb"
|
78
78
|
File.open(file_path, "a") do |f|
|
79
79
|
f.write <<-EOS
|
80
|
-
argument :is_deleted, Boolean, required: false
|
81
80
|
argument :start_date, String, required: false
|
82
81
|
argument :end_date, String, required: false
|
83
82
|
end
|
@@ -91,19 +90,6 @@ module Souls
|
|
91
90
|
scope.merge branches
|
92
91
|
end
|
93
92
|
|
94
|
-
def apply_first(scope, value)
|
95
|
-
scope.limit(value)
|
96
|
-
end
|
97
|
-
|
98
|
-
def apply_skip(scope, value)
|
99
|
-
scope.offset(value)
|
100
|
-
end
|
101
|
-
|
102
|
-
def decode_global_key id
|
103
|
-
_, data_id = SoulsApiSchema.from_global_id id
|
104
|
-
data_id
|
105
|
-
end
|
106
|
-
|
107
93
|
def normalize_filters(value, branches = [])
|
108
94
|
scope = ::#{class_name.camelize}.all
|
109
95
|
EOS
|
@@ -123,7 +109,7 @@ module Souls
|
|
123
109
|
if line.include?("end") || line.include?("t.index")
|
124
110
|
break
|
125
111
|
end
|
126
|
-
|
112
|
+
type, name = get_type_and_name(line)
|
127
113
|
if line.include?("array: true")
|
128
114
|
new_line.write " scope = scope.where(\"#{name} @> ARRAY[?]::text[]\", value[:#{name}]) if value[:#{name}]\n"
|
129
115
|
next
|
@@ -137,7 +123,12 @@ module Souls
|
|
137
123
|
when "created_at", "updated_at"
|
138
124
|
next
|
139
125
|
else
|
140
|
-
|
126
|
+
case type
|
127
|
+
when "boolean"
|
128
|
+
new_line.write " scope = scope.where(#{name}: value[:#{name}]) unless value[:#{name}].nil?\n"
|
129
|
+
else
|
130
|
+
new_line.write " scope = scope.where(#{name}: value[:#{name}]) if value[:#{name}]\n"
|
131
|
+
end
|
141
132
|
end
|
142
133
|
end
|
143
134
|
@on = true if table_check(line: line, class_name: class_name)
|
@@ -150,7 +141,6 @@ module Souls
|
|
150
141
|
file_path = "./app/graphql/resolvers/#{class_name.singularize}_search.rb"
|
151
142
|
File.open(file_path, "a") do |f|
|
152
143
|
f.write <<-EOS
|
153
|
-
scope = scope.where(is_deleted: value[:is_deleted]) if value[:is_deleted]
|
154
144
|
scope = scope.where("created_at >= ?", value[:start_date]) if value[:start_date]
|
155
145
|
scope = scope.where("created_at <= ?", value[:end_date]) if value[:end_date]
|
156
146
|
|
@@ -182,9 +172,6 @@ end
|
|
182
172
|
File.open(file_path, "w") do |f|
|
183
173
|
f.write <<~EOS
|
184
174
|
class #{class_name.camelize}
|
185
|
-
include Sidekiq::Status::Worker
|
186
|
-
include Sidekiq::Worker
|
187
|
-
sidekiq_options queue: "default"
|
188
175
|
|
189
176
|
def perform **args
|
190
177
|
# write task code here
|
@@ -398,6 +385,36 @@ end
|
|
398
385
|
rescue StandardError => error
|
399
386
|
puts error
|
400
387
|
end
|
388
|
+
|
389
|
+
def add_mutation class_name: "souls", file_name: "hoi"
|
390
|
+
singularized_class_name = class_name.singularize.underscore
|
391
|
+
file_path = "./app/graphql/mutations/#{singularized_class_name}/#{file_name}.rb"
|
392
|
+
file_path
|
393
|
+
end
|
394
|
+
|
395
|
+
def add_type class_name: "souls", file_name: "hoi"
|
396
|
+
singularized_class_name = class_name.singularize.underscore
|
397
|
+
file_path = "./app/graphql/types/#{file_name}.rb"
|
398
|
+
file_path
|
399
|
+
end
|
400
|
+
|
401
|
+
def add_edge class_name: "souls", file_name: "hoi"
|
402
|
+
singularized_class_name = class_name.singularize.underscore
|
403
|
+
file_path = "./app/graphql/types/#{file_name}.rb"
|
404
|
+
file_path
|
405
|
+
end
|
406
|
+
|
407
|
+
def add_connection class_name: "souls", file_name: "hoi"
|
408
|
+
singularized_class_name = class_name.singularize.underscore
|
409
|
+
file_path = "./app/graphql/types/#{file_name}.rb"
|
410
|
+
file_path
|
411
|
+
end
|
412
|
+
|
413
|
+
def add_rspec_mutation class_name: "souls", file_name: "hoi"
|
414
|
+
singularized_class_name = class_name.singularize.underscore
|
415
|
+
file_path = "./app/graphql/types/#{file_name}.rb"
|
416
|
+
file_path
|
417
|
+
end
|
401
418
|
end
|
402
419
|
end
|
403
420
|
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.
|
4
|
+
version: 0.17.1
|
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-16 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.
|