souls 0.9.9 → 0.10.5

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: 5426be38dac47ec1aed9a6dfad5cca1e57996bb84288d143c0e89e15490a48c4
4
- data.tar.gz: 03c05301799061cd7e1929ddf117116ee3d8bba7c15aaa7db83bae62461669ae
3
+ metadata.gz: 2b156e6723bbffc13d1cc2902a86ac4cbcd5ba627ba4ad3b14dc3a1d5385d5dc
4
+ data.tar.gz: 8d6378c58d3c8af8f157da88cdc47ba625aed8dac14703fa6ba14413fe2bd4f7
5
5
  SHA512:
6
- metadata.gz: 539da594c3c5c147da4d5d549beda06fff35056197a3098fdb9361b70a7515a329b089f53a3ead10934cfbcba7f2be03933a2d88c972b5220263620f42b5c9ec
7
- data.tar.gz: 7f016159015af63519cf9023db6e73614e66267be9d282c6bbf2233ff34a29685a9980a6093a67f6c5a9bdca028fad3c140e2949bd777e9c5eea19a004458c25
6
+ metadata.gz: 6d2ffbf97336cba78bd194d7bcfc3cf7a5e796fa225a83e960b00ccd11efe041e5e5694c71980886823ba4ccb7f3cf61fa027d5ac3efad03341ab83e627f794d
7
+ data.tar.gz: eb88107ec6ffdae5a6e771cf6d431ae8eea6177bb6fafc2316d408a31ca076169948dd13bc428f921ec921d1fdf89025e98b1f85a044239c2387295ce2b8a341
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- souls (0.9.6)
4
+ souls (0.10.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/exe/souls CHANGED
@@ -76,8 +76,8 @@ begin
76
76
  else
77
77
  end
78
78
  when "t", "test"
79
- puts `rubocop`
80
- puts `bundle exec rspec`
79
+ `rubocop`
80
+ `bundle exec rspec`
81
81
  when "deploy"
82
82
  project_id = Souls.configuration.project_id
83
83
  `gcloud builds submit --config=cloudbuild.yml --project #{project_id}`
@@ -3,7 +3,7 @@ module Souls
3
3
  module Init
4
4
  class << self
5
5
  def create_souls strain: 1, app_name: "souls"
6
- config_needed = (1..2)
6
+ config_needed = (1..3)
7
7
  project = {}
8
8
  project[:strain] = STRAINS[strain.to_i - 1]
9
9
  begin
@@ -49,7 +49,6 @@ module Souls
49
49
  end
50
50
 
51
51
  def initial_config_init app_name: "souls", project: {}
52
- puts "Generating souls conf..."
53
52
  `touch "#{app_name}/config/initializers/souls.rb"`
54
53
  file_path = "#{app_name}/config/initializers/souls.rb"
55
54
  File.open(file_path, "w") do |f|
@@ -244,7 +243,7 @@ module Souls
244
243
  end
245
244
 
246
245
  def model class_name: "souls"
247
- file_path = "./app/models/#{class_name}.rb"
246
+ file_path = "./app/models/#{class_name.singularize}.rb"
248
247
  File.open(file_path, "w") do |f|
249
248
  f.write <<~EOS
250
249
  class #{class_name.camelize} < ActiveRecord::Base
@@ -332,7 +331,7 @@ module Souls
332
331
  new_line.write <<~EOS
333
332
 
334
333
  def resolve **args
335
- #{class_name} = #{class_name.camelize}.new args
334
+ #{class_name} = ::#{class_name.camelize}.new args
336
335
  if #{class_name}.save
337
336
  { #{class_name}: #{class_name} }
338
337
  else
@@ -393,9 +392,9 @@ module Souls
393
392
  new_line.write <<~EOS
394
393
 
395
394
  def resolve **args
396
- #{class_name} = #{class_name.camelize}.find args[:id]
395
+ #{class_name} = ::#{class_name.camelize}.find args[:id]
397
396
  #{class_name}.update args
398
- { #{class_name}: #{class_name.camelize}.find(args[:id]) }
397
+ { #{class_name}: ::#{class_name.camelize}.find(args[:id]) }
399
398
  rescue StandardError => error
400
399
  GraphQL::ExecutionError.new error
401
400
  end
@@ -424,7 +423,7 @@ module Souls
424
423
  argument :id, Integer, required: true
425
424
 
426
425
  def resolve id:
427
- #{class_name} = #{class_name.camelize}.find id
426
+ #{class_name} = ::#{class_name.camelize}.find id
428
427
  #{class_name}.destroy
429
428
  { #{class_name}: #{class_name} }
430
429
  rescue StandardError => error
@@ -438,20 +437,20 @@ module Souls
438
437
  file_path
439
438
  end
440
439
 
441
- def create_confirm
442
- puts "Directory already exists, Overwrite?? (Y/N)"
440
+ def create_confirm dir_path: ""
441
+ puts "Directory already exists, Overwrite?? (Y/N)\n#{dir_path}"
443
442
  input = STDIN.gets.chomp
444
443
  return true if input == "Y"
445
- raise StandardError.new "Directory Already Exist!"
444
+ raise StandardError.new "Directory Already Exist!\n#{dir_path}"
446
445
  end
447
446
 
448
447
  def mutation class_name: "souls"
449
448
  singularized_class_name = class_name.singularize
450
449
  if Dir.exist? "./app/graphql/mutations/#{singularized_class_name}"
451
- # create_confirm
452
- FileUtils.rm_r("./app/graphql/mutations/#{singularized_class_name}")
450
+ create_confirm dir_path: "./app/graphql/mutations/#{singularized_class_name}"
451
+ else
452
+ Dir.mkdir "./app/graphql/mutations/#{singularized_class_name}"
453
453
  end
454
- Dir.mkdir "./app/graphql/mutations/#{singularized_class_name}"
455
454
  create_mutation_head class_name: singularized_class_name
456
455
  create_mutation_params class_name: singularized_class_name
457
456
  [
@@ -665,7 +664,6 @@ module Souls
665
664
  end
666
665
 
667
666
  def migrate class_name: "souls"
668
- # `rake db:migrate`
669
667
  singularized_class_name = class_name.singularize
670
668
  model_paths = model class_name: singularized_class_name
671
669
  type_paths = type class_name: singularized_class_name
@@ -681,21 +679,22 @@ module Souls
681
679
  query: query_path,
682
680
  mutation: mutation_path,
683
681
  add_query_type: [
684
- "field :#{singularized_class_name}, resolver: Queries::#{singularized_class_name.camelize}",
685
- "field :#{singularized_class_name.pluralize}, Types::#{singularized_class_name.camelize}Type.connection_type, null: true"
682
+ " field :#{singularized_class_name}, resolver: Queries::#{singularized_class_name.camelize}",
683
+ " field :#{singularized_class_name.pluralize}, Types::#{singularized_class_name.camelize}Type.connection_type, null: true"
686
684
  ],
687
685
  add_mutation_type: [
688
- "field :create_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Create#{singularized_class_name.camelize}",
689
- "field :update_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Update#{singularized_class_name.camelize}",
690
- "field :delete_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Delete#{singularized_class_name.camelize}"
686
+ " field :create_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Create#{singularized_class_name.camelize}",
687
+ " field :update_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Update#{singularized_class_name.camelize}",
688
+ " field :delete_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Delete#{singularized_class_name.camelize}"
691
689
  ]
692
690
  ]
693
691
  end
694
692
 
695
693
  def migrate_all
696
694
  puts "◆◆◆ Let's Auto Generate CRUD API ◆◆◆\n"
695
+ `rake db:migrate`
697
696
  paths = get_tables.map do |class_name|
698
- migrate class_name: class_name
697
+ migrate class_name: class_name.singularize
699
698
  end
700
699
  puts "\n============== Model ======================\n\n"
701
700
  paths.each do |class_name|
@@ -745,6 +744,12 @@ module Souls
745
744
  path[:add_query_type].each { |line| puts line }
746
745
  end
747
746
  end
747
+ puts "\n ## Connection Type\n\n"
748
+ get_tables.each do |class_name|
749
+ puts " def #{class_name.pluralize}"
750
+ puts " #{class_name.singularize.camelize}.all.order(id: :desc)"
751
+ puts " end\n\n"
752
+ end
748
753
  puts "\n#############################################################\n"
749
754
  puts "# #\n"
750
755
  puts "# Add These Lines at ./app/graphql/types/mutation_type.rb #\n"
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.9.9"
2
+ VERSION = "0.10.5"
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.9.9
4
+ version: 0.10.5
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-01-22 00:00:00.000000000 Z
13
+ date: 2021-01-23 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.
@@ -47,7 +47,6 @@ files:
47
47
  - lib/souls/version.rb
48
48
  - rbs/init.rbs
49
49
  - souls.gemspec
50
- - v0.0.8.tar.gz
51
50
  homepage: https://github.com/elsoul/souls
52
51
  licenses:
53
52
  - Apache-2.0
@@ -70,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
69
  - !ruby/object:Gem::Version
71
70
  version: '0'
72
71
  requirements: []
73
- rubygems_version: 3.2.3
72
+ rubygems_version: 3.2.4
74
73
  signing_key:
75
74
  specification_version: 4
76
75
  summary: SOULS is a Web Application Framework for Microservices on Multi Cloud Platform
Binary file