souls 0.16.7 → 0.17.2

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: 8f0df698e69275cc28c4f58e2b83bab33ad7ee2d3f34cc928bda1d7b42198ca5
4
- data.tar.gz: fa40ef64c0ade791ef760a3d912f0d97fb7fb6ff39db09c07022af44f821cea6
3
+ metadata.gz: 36a0dab64172ffc88d5d0b08b585c7ee00a4c592ad0333e514965d325298f6cd
4
+ data.tar.gz: b43bc48a6aa7f62b5399db04164b33312a03f7ec718247bfa516bf5b15800169
5
5
  SHA512:
6
- metadata.gz: c27e742bca22479ce7967648984220104d8ede75172e73e3ff541e8a4649a3fed658630e94f7e3bc02b9480a39ba16545c3026c22fc2ce11b25c75a49c90d7e1
7
- data.tar.gz: a1cd25dc4863a3639cf466f186ad01e832a910b5f974444c6c52c66c54f6b89c235843535560d0f5ae610b457364a06aeecb34171d0520bfa4e5ca4090d8d078
6
+ metadata.gz: beabb98cd7dd49f9e429ea3b8687a404d1a2eb6e1b3b1c15f6a981e54940d5b2cbf6184587ad8a54493f1d0e5bd6523307e11d017942501cfdc296e9d81b4c7a
7
+ data.tar.gz: fab2fe6850ca6326e6427ab8e5102c17b9dcfc91b67224a496763fae9f7537fcf1b5f5ad5ba35a7e70997ee335f79898eea882d4bf58798f744820fbaad84d9f
data/.rubocop.yml CHANGED
@@ -79,8 +79,6 @@ Style/HashSyntax:
79
79
  - "**/*.rake"
80
80
  - "Rakefile"
81
81
 
82
- Layout/HeredocIndentation:
83
- Enabled: false
84
82
 
85
83
  Style/IfUnlessModifier:
86
84
  Enabled: false
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 RACK_ENV=production"
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"
@@ -88,7 +103,10 @@ begin
88
103
  "SOULs!"
89
104
  end
90
105
  when "d"
91
- Souls::Init.delete_all class_name: ARGV[1]
106
+ Souls::Init.add_delete class_name: ARGV[1]
107
+ when "update"
108
+ Souls::Init.add_delete class_name: ARGV[1]
109
+ Souls::Init.single_migrate class_name: ARGV[1]
92
110
  when "db:create"
93
111
  system "rake db:create && rake db:create RACK_ENV=test"
94
112
  when "db:migrate"
@@ -99,7 +117,12 @@ begin
99
117
  system "rake db:migrate && rake db:migrate RACK_ENV=test"
100
118
  end
101
119
  when "db:seed"
102
- system "rake db:seed"
120
+ case ARGV[1]
121
+ when "RACK_ENV=production"
122
+ system "rake db:seed RACK_ENV=production"
123
+ else
124
+ system "rake db:seed"
125
+ end
103
126
  when "db:migrate:reset"
104
127
  case ARGV[1]
105
128
  when "RACK_ENV=production"
@@ -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
@@ -110,7 +109,7 @@ module Souls
110
109
  if line.include?("end") || line.include?("t.index")
111
110
  break
112
111
  end
113
- _, name = get_type_and_name(line)
112
+ type, name = get_type_and_name(line)
114
113
  if line.include?("array: true")
115
114
  new_line.write " scope = scope.where(\"#{name} @> ARRAY[?]::text[]\", value[:#{name}]) if value[:#{name}]\n"
116
115
  next
@@ -124,7 +123,12 @@ module Souls
124
123
  when "created_at", "updated_at"
125
124
  next
126
125
  else
127
- new_line.write " scope = scope.where(#{name}: value[:#{name}]) if value[:#{name}]\n"
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
128
132
  end
129
133
  end
130
134
  @on = true if table_check(line: line, class_name: class_name)
@@ -137,7 +141,6 @@ module Souls
137
141
  file_path = "./app/graphql/resolvers/#{class_name.singularize}_search.rb"
138
142
  File.open(file_path, "a") do |f|
139
143
  f.write <<-EOS
140
- scope = scope.where(is_deleted: value[:is_deleted]) if value[:is_deleted]
141
144
  scope = scope.where("created_at >= ?", value[:start_date]) if value[:start_date]
142
145
  scope = scope.where("created_at <= ?", value[:end_date]) if value[:end_date]
143
146
 
@@ -169,9 +172,6 @@ end
169
172
  File.open(file_path, "w") do |f|
170
173
  f.write <<~EOS
171
174
  class #{class_name.camelize}
172
- include Sidekiq::Status::Worker
173
- include Sidekiq::Worker
174
- sidekiq_options queue: "default"
175
175
 
176
176
  def perform **args
177
177
  # write task code here
@@ -366,6 +366,25 @@ end
366
366
  rspec_resolver_end class_name: singularized_class_name
367
367
  end
368
368
 
369
+ def add_delete class_name: "souls"
370
+ singularized_class_name = class_name.singularize.underscore
371
+ pluralized_class_name = class_name.pluralize.underscore
372
+ FileUtils.rm_rf "./app/graphql/mutations/#{singularized_class_name}"
373
+ FileUtils.rm "./app/graphql/queries/#{singularized_class_name}.rb"
374
+ FileUtils.rm "./app/graphql/queries/#{pluralized_class_name}.rb"
375
+ FileUtils.rm "./app/graphql/resolvers/#{singularized_class_name}_search.rb"
376
+ FileUtils.rm "./app/graphql/types/#{singularized_class_name}_type.rb"
377
+ FileUtils.rm "./app/graphql/types/#{singularized_class_name}_node_type.rb"
378
+ FileUtils.rm "./spec/factories/#{pluralized_class_name}.rb"
379
+ FileUtils.rm "./spec/mutations/#{singularized_class_name}_spec.rb"
380
+ FileUtils.rm "./spec/models/#{singularized_class_name}_spec.rb"
381
+ FileUtils.rm "./spec/queries/#{singularized_class_name}_spec.rb"
382
+ FileUtils.rm "./spec/resolvers/#{singularized_class_name}_search_spec.rb"
383
+ puts "deleted #{class_name.camelize} CRUD!"
384
+ rescue StandardError => error
385
+ puts error
386
+ end
387
+
369
388
  def delete_all class_name: "souls"
370
389
  singularized_class_name = class_name.singularize.underscore
371
390
  pluralized_class_name = class_name.pluralize.underscore
@@ -385,6 +404,36 @@ end
385
404
  rescue StandardError => error
386
405
  puts error
387
406
  end
407
+
408
+ def add_mutation class_name: "souls", file_name: "hoi"
409
+ singularized_class_name = class_name.singularize.underscore
410
+ file_path = "./app/graphql/mutations/#{singularized_class_name}/#{file_name}.rb"
411
+ file_path
412
+ end
413
+
414
+ def add_type class_name: "souls", file_name: "hoi"
415
+ singularized_class_name = class_name.singularize.underscore
416
+ file_path = "./app/graphql/types/#{file_name}.rb"
417
+ file_path
418
+ end
419
+
420
+ def add_edge class_name: "souls", file_name: "hoi"
421
+ singularized_class_name = class_name.singularize.underscore
422
+ file_path = "./app/graphql/types/#{file_name}.rb"
423
+ file_path
424
+ end
425
+
426
+ def add_connection class_name: "souls", file_name: "hoi"
427
+ singularized_class_name = class_name.singularize.underscore
428
+ file_path = "./app/graphql/types/#{file_name}.rb"
429
+ file_path
430
+ end
431
+
432
+ def add_rspec_mutation class_name: "souls", file_name: "hoi"
433
+ singularized_class_name = class_name.singularize.underscore
434
+ file_path = "./app/graphql/types/#{file_name}.rb"
435
+ file_path
436
+ end
388
437
  end
389
438
  end
390
439
  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
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.16.7"
2
+ VERSION = "0.17.2"
3
3
  end
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.7
4
+ version: 0.17.2
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-02 00:00:00.000000000 Z
13
+ date: 2021-03-29 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.