souls 0.20.8 → 0.21.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db131f2efb215e6a22e7a049e443e88cb5e119255a29bc891bda27a7fa26082c
4
- data.tar.gz: c7c8a631cf7c8142fe49508f5538a1c5b5afd921dd1fae6dc1fc8f89376a0b1a
3
+ metadata.gz: eccfd65a990a55c7b1d365e1590278fbbe378234e3dab7cf86d39739384948a7
4
+ data.tar.gz: c7ca4f6c56ce023a13ed2e047977352c28b794cc80dc2c13d61a34bdea428b0e
5
5
  SHA512:
6
- metadata.gz: ad7733d547731ade5ac5c1d7c3bfe8ae95d4dfd86e306922af4b77c1e82db7acd19308cd50b65c52fa443e18f9a8b21e4f3339d9e4f0267cf09c983bacbe8fcf
7
- data.tar.gz: cf363bab6524c5e87d90ba76696ee95498b285d6a319b05ea910234388fec3c4d743e47ddd0053b1c16e09f1a6bd4484400bd23594c7f5e88ea16b52e0d4beae
6
+ metadata.gz: cb25ec736a6f5f5021ea7c01f7273ee9b2f770d8f0e021147f383aae9eefd4fd84088bfb600d2412bb2f019719b554e3ea4dad3b169ea7de093629594e1d6846
7
+ data.tar.gz: f064806fbeecb0f464e4ac2ca343b25b28d70db7dbc5f5cb26b3ea571ed0a9cbc1e2600d23ef49e8c2168898439aaedd01f90e79638747d0bc53b91fd9cac93b
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.0
1
+ 3.0.1
data/Gemfile CHANGED
@@ -3,9 +3,9 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in souls.gemspec
4
4
  gemspec
5
5
 
6
- gem "activesupport", "6.1.0"
7
- gem "parser", "3.0.0"
6
+ gem "activesupport", "6.1.3.2"
7
+ gem "parser", "3.0.1.1"
8
8
  gem "rake", "13.0.3"
9
- gem "rspec", "3.1.0"
10
- gem "rubocop", "1.12.1"
11
- gem "steep", "0.43.1"
9
+ gem "rspec", "3.10.0"
10
+ gem "rubocop", "1.15.0"
11
+ gem "steep", "0.44.1"
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- souls (0.20.8)
4
+ souls (0.21.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activesupport (6.1.0)
9
+ activesupport (6.1.3.2)
10
10
  concurrent-ruby (~> 1.0, >= 1.0.2)
11
11
  i18n (>= 1.6, < 2)
12
12
  minitest (>= 5.1)
@@ -15,63 +15,64 @@ GEM
15
15
  ast (2.4.2)
16
16
  concurrent-ruby (1.1.8)
17
17
  diff-lcs (1.4.4)
18
- ffi (1.15.0)
18
+ ffi (1.15.1)
19
19
  i18n (1.8.10)
20
20
  concurrent-ruby (~> 1.0)
21
- language_server-protocol (3.16.0.0)
21
+ language_server-protocol (3.16.0.1)
22
22
  listen (3.5.1)
23
23
  rb-fsevent (~> 0.10, >= 0.10.3)
24
24
  rb-inotify (~> 0.9, >= 0.9.10)
25
25
  minitest (5.14.4)
26
26
  parallel (1.20.1)
27
- parser (3.0.0.0)
27
+ parser (3.0.1.1)
28
28
  ast (~> 2.4.1)
29
29
  rainbow (3.0.0)
30
30
  rake (13.0.3)
31
- rb-fsevent (0.10.4)
31
+ rb-fsevent (0.11.0)
32
32
  rb-inotify (0.10.1)
33
33
  ffi (~> 1.0)
34
- rbs (1.1.1)
34
+ rbs (1.2.1)
35
35
  regexp_parser (2.1.1)
36
36
  rexml (3.2.5)
37
- rspec (3.1.0)
38
- rspec-core (~> 3.1.0)
39
- rspec-expectations (~> 3.1.0)
40
- rspec-mocks (~> 3.1.0)
41
- rspec-core (3.1.7)
42
- rspec-support (~> 3.1.0)
43
- rspec-expectations (3.1.2)
37
+ rspec (3.10.0)
38
+ rspec-core (~> 3.10.0)
39
+ rspec-expectations (~> 3.10.0)
40
+ rspec-mocks (~> 3.10.0)
41
+ rspec-core (3.10.1)
42
+ rspec-support (~> 3.10.0)
43
+ rspec-expectations (3.10.1)
44
44
  diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.1.0)
46
- rspec-mocks (3.1.3)
47
- rspec-support (~> 3.1.0)
48
- rspec-support (3.1.2)
49
- rubocop (1.12.1)
45
+ rspec-support (~> 3.10.0)
46
+ rspec-mocks (3.10.2)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-support (3.10.2)
50
+ rubocop (1.15.0)
50
51
  parallel (~> 1.10)
51
52
  parser (>= 3.0.0.0)
52
53
  rainbow (>= 2.2.2, < 4.0)
53
54
  regexp_parser (>= 1.8, < 3.0)
54
55
  rexml
55
- rubocop-ast (>= 1.2.0, < 2.0)
56
+ rubocop-ast (>= 1.5.0, < 2.0)
56
57
  ruby-progressbar (~> 1.7)
57
58
  unicode-display_width (>= 1.4.0, < 3.0)
58
- rubocop-ast (1.4.1)
59
- parser (>= 2.7.1.5)
59
+ rubocop-ast (1.6.0)
60
+ parser (>= 3.0.1.1)
60
61
  ruby-progressbar (1.11.0)
61
- steep (0.43.1)
62
+ steep (0.44.1)
62
63
  activesupport (>= 5.1)
63
64
  language_server-protocol (>= 3.15, < 4.0)
64
65
  listen (~> 3.0)
65
66
  parallel (>= 1.0.0)
66
67
  parser (>= 2.7)
67
68
  rainbow (>= 2.2.2, < 4.0)
68
- rbs (~> 1.1.0)
69
+ rbs (>= 1.2.0)
69
70
  terminal-table (>= 2, < 4)
70
- terminal-table (3.0.0)
71
- unicode-display_width (~> 1.1, >= 1.1.1)
71
+ terminal-table (3.0.1)
72
+ unicode-display_width (>= 1.1.1, < 3)
72
73
  tzinfo (2.0.4)
73
74
  concurrent-ruby (~> 1.0)
74
- unicode-display_width (1.7.0)
75
+ unicode-display_width (2.0.0)
75
76
  zeitwerk (2.4.2)
76
77
 
77
78
  PLATFORMS
@@ -79,13 +80,13 @@ PLATFORMS
79
80
  x86_64-linux
80
81
 
81
82
  DEPENDENCIES
82
- activesupport (= 6.1.0)
83
- parser (= 3.0.0)
83
+ activesupport (= 6.1.3.2)
84
+ parser (= 3.0.1.1)
84
85
  rake (= 13.0.3)
85
- rspec (= 3.1.0)
86
- rubocop (= 1.12.1)
86
+ rspec (= 3.10.0)
87
+ rubocop (= 1.15.0)
87
88
  souls!
88
- steep (= 0.43.1)
89
+ steep (= 0.44.1)
89
90
 
90
91
  BUNDLED WITH
91
- 2.2.14
92
+ 2.2.18
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![SOULs](https://firebasestorage.googleapis.com/v0/b/el-quest.appspot.com/o/mediaLibrary%2F1605615287402_souls-ogp.jpg?alt=media&token=1115aa76-6863-469d-acc8-9815ca7fac37)](https://rubygems.org/gems/souls)
1
+ [![SOULs](https://storage.googleapis.com/souls/souls-ogp-vertical.jpg)](https://rubygems.org/gems/souls)
2
2
 
3
3
  <p align="center">
4
4
  <a aria-label="Ruby logo" href="https://el-soul.com">
data/exe/souls CHANGED
@@ -98,16 +98,21 @@ begin
98
98
  Souls::Generate.migrate_all
99
99
  when "migration"
100
100
  system "rake db:create_migration NAME=create_#{ARGV[2]}"
101
+ when "update"
102
+ Souls::Generate.update_delete class_name: ARGV[2]
103
+ Souls::Generate.single_migrate class_name: ARGV[2]
101
104
  else
102
105
  "SOULs!"
103
106
  end
104
107
  when "d"
105
108
  Souls::Generate.delete_all class_name: ARGV[1]
106
- when "update"
107
- Souls::Generate.add_delete class_name: ARGV[1]
108
- Souls::Generate.single_migrate class_name: ARGV[1]
109
109
  when "db:create"
110
- system "rake db:create && rake db:create RACK_ENV=test"
110
+ case ARGV[1]
111
+ when "RACK_ENV=production"
112
+ system "rake db:create RACK_ENV=production"
113
+ else
114
+ system "rake db:create && rake db:create RACK_ENV=test"
115
+ end
111
116
  when "db:migrate"
112
117
  case ARGV[1]
113
118
  when "RACK_ENV=production"
@@ -1,51 +1,20 @@
1
- Dir["./lib/souls/generate/*.rb"].each { |f| require_relative f.gsub("./lib/souls", ".")}
1
+ # Did not work client side
2
+ # Dir["#{__dir__}/lib/souls/generate/*.rb"].each { |f| require_relative f.gsub("./lib/souls", ".")}
3
+ require_relative "./generate/model"
4
+ require_relative "./generate/mutation"
5
+ require_relative "./generate/policy"
6
+ require_relative "./generate/query"
7
+ require_relative "./generate/resolver"
8
+ require_relative "./generate/rspec_factory"
9
+ require_relative "./generate/rspec_model"
10
+ require_relative "./generate/rspec_mutation"
2
11
  require_relative "./generate/rspec_policy"
12
+ require_relative "./generate/rspec_query"
13
+ require_relative "./generate/rspec_resolver"
14
+ require_relative "./generate/type"
15
+ require_relative "./generate/application"
3
16
 
4
17
  module Souls
5
18
  module Generate
6
- def self.policy class_name: "souls"
7
- dir_name = "./app/policies"
8
- FileUtils.mkdir_p dir_name unless Dir.exist? dir_name
9
- file_path = "#{dir_name}/#{class_name.singularize}_policy.rb"
10
- File.open(file_path, "w") do |f|
11
- f.write <<~EOS
12
- class #{class_name.camelize}Policy < ApplicationPolicy
13
- def show?
14
- admin_permissions?
15
- end
16
-
17
- def index?
18
- admin_permissions?
19
- end
20
-
21
- def create?
22
- admin_permissions?
23
- end
24
-
25
- def update?
26
- admin_permissions?
27
- end
28
-
29
- def delete?
30
- admin_permissions?
31
- end
32
-
33
- private
34
-
35
- def staff_permissions?
36
- @user.master? or @user.admin? or @user.staff?
37
- end
38
-
39
- def admin_permissions?
40
- @user.master? or @user.admin?
41
- end
42
- end
43
- EOS
44
- end
45
- file_path
46
- rescue StandardError => error
47
- puts "method error"
48
- puts error.backtrace
49
- end
50
19
  end
51
20
  end
@@ -106,7 +106,9 @@ module Souls
106
106
  rspec_query: rspec_query(class_name: singularized_class_name),
107
107
  rspec_resolver: rspec_resolver(class_name: singularized_class_name),
108
108
  queries: query(class_name: singularized_class_name),
109
- mutations: mutation(class_name: singularized_class_name)
109
+ mutations: mutation(class_name: singularized_class_name),
110
+ policies: policy(class_name: singularized_class_name),
111
+ rspec_policies: rspec_policy(class_name: singularized_class_name)
110
112
  ]
111
113
  end
112
114
 
@@ -132,6 +134,23 @@ module Souls
132
134
  puts error
133
135
  end
134
136
 
137
+ def update_delete class_name: "souls"
138
+ singularized_class_name = class_name.singularize.underscore
139
+ pluralized_class_name = class_name.pluralize.underscore
140
+ FileUtils.rm_rf "./app/graphql/mutations/#{singularized_class_name}"
141
+ FileUtils.rm "./app/graphql/queries/#{singularized_class_name}.rb"
142
+ FileUtils.rm "./app/graphql/queries/#{pluralized_class_name}.rb"
143
+ FileUtils.rm "./app/graphql/resolvers/#{singularized_class_name}_search.rb"
144
+ FileUtils.rm "./app/graphql/types/#{singularized_class_name}_type.rb"
145
+ FileUtils.rm "./app/graphql/types/#{singularized_class_name}_node_type.rb"
146
+ FileUtils.rm "./spec/mutations/#{singularized_class_name}_spec.rb"
147
+ FileUtils.rm "./spec/queries/#{singularized_class_name}_spec.rb"
148
+ FileUtils.rm "./spec/resolvers/#{singularized_class_name}_search_spec.rb"
149
+ puts "deleted #{class_name.camelize} CRUD!"
150
+ rescue StandardError => error
151
+ puts error
152
+ end
153
+
135
154
  def single_migrate class_name: "user"
136
155
  puts "◆◆◆ Let's Auto Generate CRUD API SET ◆◆◆\n"
137
156
  migrate class_name: class_name
@@ -194,6 +194,8 @@ module Souls
194
194
  end
195
195
 
196
196
  def update_mutation class_name: "souls"
197
+ file_path = "./app/graphql/mutations/#{class_name}/update_#{class_name}.rb"
198
+ return "Mutation already exist! #{file_path}" if File.exist? file_path
197
199
  update_mutation_head class_name: class_name
198
200
  relation_params = update_mutation_params class_name: class_name
199
201
  update_mutation_after_params class_name: class_name, relation_params: relation_params
@@ -203,6 +205,7 @@ module Souls
203
205
  # 3. Mutation - Delete
204
206
  def delete_mutation class_name: "souls"
205
207
  file_path = "./app/graphql/mutations/#{class_name}/delete_#{class_name}.rb"
208
+ return "Mutation already exist! #{file_path}" if File.exist? file_path
206
209
  File.open(file_path, "w") do |f|
207
210
  f.write <<~EOS
208
211
  module Mutations
@@ -230,6 +233,7 @@ module Souls
230
233
  # 4. Mutation - Destroy Delete
231
234
  def destroy_delete_mutation class_name: "souls"
232
235
  file_path = "./app/graphql/mutations/#{class_name}/destroy_delete_#{class_name}.rb"
236
+ return "Mutation already exist! #{file_path}" if File.exist? file_path
233
237
  File.open(file_path, "w") do |f|
234
238
  f.write <<~EOS
235
239
  module Mutations
@@ -258,7 +262,8 @@ module Souls
258
262
 
259
263
  def mutation class_name: "souls"
260
264
  singularized_class_name = class_name.singularize
261
-
265
+ file_path = "./app/graphql/mutations/#{singularized_class_name}/create_#{singularized_class_name}.rb"
266
+ return "Mutation already exist! #{file_path}" if File.exist? file_path
262
267
  create_mutation_head class_name: singularized_class_name
263
268
  relation_params = create_mutation_params class_name: singularized_class_name
264
269
  create_mutation_after_params class_name: singularized_class_name, relation_params: relation_params
@@ -6,23 +6,24 @@ module Souls
6
6
  dir_name = "./app/policies"
7
7
  FileUtils.mkdir_p dir_name unless Dir.exist? dir_name
8
8
  file_path = "#{dir_name}/#{class_name.singularize}_policy.rb"
9
+ return "Policy already exist! #{file_path}" if File.exist? file_path
9
10
  File.open(file_path, "w") do |f|
10
11
  f.write <<~EOS
11
12
  class #{class_name.camelize}Policy < ApplicationPolicy
12
13
  def show?
13
- admin_permissions?
14
+ true
14
15
  end
15
16
 
16
17
  def index?
17
- admin_permissions?
18
+ true
18
19
  end
19
20
 
20
21
  def create?
21
- admin_permissions?
22
+ staff_permissions?
22
23
  end
23
24
 
24
25
  def update?
25
- admin_permissions?
26
+ staff_permissions?
26
27
  end
27
28
 
28
29
  def delete?
@@ -4,6 +4,7 @@ module Souls
4
4
  ## Generate Query / Queries
5
5
  def create_queries class_name: "souls"
6
6
  file_path = "./app/graphql/queries/#{class_name.pluralize}.rb"
7
+ return "Query already exist! #{file_path}" if File.exist? file_path
7
8
  File.open(file_path, "w") do |f|
8
9
  f.write <<~EOS
9
10
  module Queries
@@ -24,6 +25,7 @@ module Souls
24
25
 
25
26
  def create_query class_name: "souls"
26
27
  file_path = "./app/graphql/queries/#{class_name}.rb"
28
+ return "Query already exist! #{file_path}" if File.exist? file_path
27
29
  File.open(file_path, "w") do |f|
28
30
  f.write <<~EOS
29
31
  module Queries
@@ -6,7 +6,6 @@ module Souls
6
6
  FileUtils.mkdir_p "./app/graphql/resolvers" unless Dir.exist? "./app/graphql/resolvers"
7
7
  file_path = "./app/graphql/resolvers/#{class_name.singularize}_search.rb"
8
8
  @relation_params = []
9
- return ["Resolver already exist! #{file_path}"] if File.exist? file_path
10
9
  File.open(file_path, "w") do |f|
11
10
  f.write <<~EOS
12
11
  module Resolvers
@@ -126,11 +125,8 @@ module Souls
126
125
  f.write <<~EOS
127
126
  scope = scope.where("created_at >= ?", value[:start_date]) if value[:start_date]
128
127
  scope = scope.where("created_at <= ?", value[:end_date]) if value[:end_date]
129
- #{' '}
130
128
  branches << scope
131
- #{' '}
132
129
  value[:OR].inject(branches) { |s, v| normalize_filters(v, s) } if value[:OR].present?
133
- #{' '}
134
130
  branches
135
131
  end
136
132
  end
@@ -142,6 +138,8 @@ module Souls
142
138
 
143
139
  def resolver class_name: "souls"
144
140
  singularized_class_name = class_name.singularize.underscore
141
+ file_path = "./app/graphql/resolvers/#{singularized_class_name}_search.rb"
142
+ return "Resolver already exist! #{file_path}" if File.exist? file_path
145
143
  resolver_head class_name: singularized_class_name
146
144
  resolver_params class_name: singularized_class_name
147
145
  resolver_after_params class_name: singularized_class_name
@@ -52,7 +52,7 @@ module Souls
52
52
 
53
53
  def rspec_factory class_name: "souls"
54
54
  file_path = "./spec/factories/#{class_name.pluralize}.rb"
55
- return ["Factory aleady exist! #{file_path}"] if File.exist? file_path
55
+ return "RspecFactory already exist! #{file_path}" if File.exist? file_path
56
56
  singularized_class_name = class_name.singularize
57
57
  rspec_factory_head class_name: singularized_class_name
58
58
  rspec_factory_params class_name: singularized_class_name
@@ -4,7 +4,7 @@ module Souls
4
4
  ## Generate Rspec Model
5
5
  def rspec_model class_name: "souls"
6
6
  file_path = "./spec/models/#{class_name}_spec.rb"
7
- return ["Aleady Exist!"] if File.exist? file_path
7
+ return "RspecModel already exist! #{file_path}" if File.exist? file_path
8
8
  File.open(file_path, "w") do |f|
9
9
  f.write <<~EOS
10
10
  RSpec.describe "#{class_name.camelize} Model テスト", type: :model do
@@ -236,6 +236,8 @@ module Souls
236
236
 
237
237
  def rspec_mutation class_name: "souls"
238
238
  singularized_class_name = class_name.singularize
239
+ file_path = "./spec/mutations/#{singularized_class_name}_spec.rb"
240
+ return "RspecMutation already exist! #{file_path}" if File.exist? file_path
239
241
  rspec_mutation_head class_name: singularized_class_name
240
242
  rspec_mutation_after_head class_name: singularized_class_name
241
243
  rspec_mutation_params class_name: singularized_class_name
@@ -6,6 +6,7 @@ module Souls
6
6
  dir_name = "./spec/policies"
7
7
  FileUtils.mkdir_p dir_name unless Dir.exist? dir_name
8
8
  file_path = "./spec/policies/#{class_name}_policy_spec.rb"
9
+ return "RspecPolicy already exist! #{file_path}" if File.exist? file_path
9
10
  File.open(file_path, "w") do |new_line|
10
11
  new_line.write <<~EOS
11
12
  describe #{class_name.camelize}Policy do
@@ -159,6 +159,8 @@ module Souls
159
159
 
160
160
  def rspec_query class_name: "souls"
161
161
  singularized_class_name = class_name.singularize
162
+ file_path = "./spec/queries/#{singularized_class_name}_spec.rb"
163
+ return "RspecQuery already exist! #{file_path}" if File.exist? file_path
162
164
  rspec_query_head class_name: singularized_class_name
163
165
  rspec_query_after_head class_name: singularized_class_name
164
166
  rspec_query_params class_name: singularized_class_name
@@ -71,6 +71,8 @@ module Souls
71
71
 
72
72
  def type class_name: "souls"
73
73
  singularized_class_name = class_name.singularize
74
+ file_path = "./app/graphql/types/#{singularized_class_name}_node_type.rb"
75
+ return "Type already exist! #{file_path}" if File.exist? file_path
74
76
  create_type_head class_name: singularized_class_name
75
77
  create_type_params class_name: singularized_class_name
76
78
  [
data/lib/souls/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.20.8"
2
+ VERSION = "0.21.3"
3
3
  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.20.8
4
+ version: 0.21.3
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-05-23 00:00:00.000000000 Z
13
+ date: 2021-05-27 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: SOULS is a GraphQL Based Web Application Framework for Microservices
16
16
  on Multi Cloud Platform such as Google Cloud Platform, Amazon Web Services, and
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
- rubygems_version: 3.2.3
87
+ rubygems_version: 3.2.15
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: SOULS is a GraphQL Based Web Application Framework for Microservices on Multi