souls 0.29.5 → 0.29.6

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: 44391155b6c710dd11e6074752dddd6d495f07abceb9df857b53663a9747fcba
4
- data.tar.gz: bcb6cd5b60ffb949afdb56f2ded4036373bfde9e4d2cce9e408d77fbaa3485c0
3
+ metadata.gz: 3de74c19c656eca1c5cd6f49357be3527150d091d49fb6586f682383f19df91c
4
+ data.tar.gz: cef99823964ef73e5c72e192e2c437cd761cdba4d3e1907cbc9c69f924a92482
5
5
  SHA512:
6
- metadata.gz: 6fc03249c993388b8f199ad94d8db48859e7306e5128cbc5cf540882f0852cee3f8a0e71242b7619936a00d264f1d2bc8aba7fe5b8901b3e6f532f28d9c1db8a
7
- data.tar.gz: 3411cd55b57ccb9d3fe676159d4060291f3c06578973c8d27e5746de4b95fea4f9102cc7cccd86bc5373f1e92c34e56e94aa5ff65ac93dbc2844f28b2ac0525e
6
+ metadata.gz: '093729ea37591c9c0aabe63490f5edfa70a2e36230915f7fc59efe40f430b30a40512c2317e56c017cf4eabc919ae9b5453c6dfaf6a415ea03919da3078af89d'
7
+ data.tar.gz: 192c737658ca8ee527b2428da0df1a83c3989907ca2b8f8e2312b6e4b95da6f0f327df1e8504e0c6e61303f98641954b8458c4d2536d8467966411b9b18054ea
data/exe/souls CHANGED
@@ -20,6 +20,8 @@ begin
20
20
  Souls::Api::Generate.public_send(method_name, class_name: class_name)
21
21
  Whirly.status = "Done!"
22
22
  end
23
+ when "schema:update"
24
+ Souls::Api::Update.update_create_mutation_head
23
25
  else
24
26
  puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
25
27
  end
@@ -160,5 +162,6 @@ begin
160
162
  puts(Paint["Welcome to SOULs!", :green])
161
163
  end
162
164
  rescue StandardError => e
165
+ puts(e.backtrace)
163
166
  puts(Paint[e, :red])
164
167
  end
data/lib/souls.rb CHANGED
@@ -343,6 +343,37 @@ module Souls
343
343
  result.compact
344
344
  end
345
345
 
346
+ def get_add_migration_type(class_name: "user")
347
+ pluralized_class_name = class_name.pluralize
348
+ file_paths = Dir["db/migrate/*_add_column_to_#{pluralized_class_name}.rb"]
349
+ new_columns =
350
+ file_paths.map do |file_path|
351
+ get_col_name_and_type(class_name: class_name, file_path: file_path)
352
+ end
353
+ new_columns.flatten
354
+ end
355
+
356
+ def get_col_name_and_type(class_name: "user", file_path: "db/migrate/20210816094410_add_column_to_users.rb")
357
+ pluralized_class_name = class_name.pluralize
358
+ response = []
359
+ File.open(file_path) do |line|
360
+ line.each_line do |file_line|
361
+ next unless file_line.include?("add_column")
362
+
363
+ array = file_line.include?("array: true")
364
+ types = file_line.split(",").map(&:strip)
365
+ types.map { |n| n.gsub!(":", "") }
366
+ types[0].gsub!("add_column ", "")
367
+ unless types[0].to_s == pluralized_class_name
368
+ raise(StandardError, "Wrong class_name!Please Check your migration file!")
369
+ end
370
+
371
+ response << { column_name: types[1], type: types[2], array: array }
372
+ end
373
+ end
374
+ response
375
+ end
376
+
346
377
  def configure
347
378
  self.configuration ||= Configuration.new
348
379
  yield(configuration)
data/lib/souls/api.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require_relative "./api/generate"
2
+ require_relative "./api/update"
2
3
  module Souls
3
4
  module Api
4
5
  end
@@ -113,6 +113,7 @@ module Souls
113
113
  policy(class_name: singularized_class_name)
114
114
  rspec_policy(class_name: singularized_class_name)
115
115
  rescue StandardError => e
116
+ puts(e.backtrace)
116
117
  raise(StandardError, e)
117
118
  end
118
119
 
@@ -9,27 +9,27 @@ module Souls
9
9
 
10
10
  def add_column(class_name: "user")
11
11
  pluralized_class_name = class_name.underscore.pluralize
12
- system("rake db:create_migration NAME=add_#{pluralized_class_name}")
12
+ system("rake db:create_migration NAME=add_column_to#{pluralized_class_name}")
13
13
  end
14
14
 
15
15
  def rename_column(class_name: "user")
16
16
  pluralized_class_name = class_name.underscore.pluralize
17
- system("rake db:create_migration NAME=rename_#{pluralized_class_name}")
17
+ system("rake db:create_migration NAME=rename_column_to_#{pluralized_class_name}")
18
18
  end
19
19
 
20
20
  def change_column(class_name: "user")
21
21
  pluralized_class_name = class_name.underscore.pluralize
22
- system("rake db:create_migration NAME=change_#{pluralized_class_name}")
22
+ system("rake db:create_migration NAME=change_column_to#{pluralized_class_name}")
23
23
  end
24
24
 
25
25
  def remove_column(class_name: "user")
26
26
  pluralized_class_name = class_name.underscore.pluralize
27
- system("rake db:create_migration NAME=remove_#{pluralized_class_name}")
27
+ system("rake db:create_migration NAME=remove_column_to#{pluralized_class_name}")
28
28
  end
29
29
 
30
30
  def drop_table(class_name: "user")
31
31
  pluralized_class_name = class_name.underscore.pluralize
32
- system("rake db:create_migration NAME=drop_#{pluralized_class_name}")
32
+ system("rake db:create_migration NAME=drop_table_to#{pluralized_class_name}")
33
33
  end
34
34
  end
35
35
  end
@@ -1,5 +1,5 @@
1
1
  module Souls
2
- module Generate
2
+ module Api::Generate
3
3
  class << self
4
4
  ## Generate Type
5
5
  def create_type_head(class_name: "souls")
@@ -0,0 +1,6 @@
1
+ require_relative "./update/update_mutation"
2
+
3
+ module Souls
4
+ module Api::Update
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ module Souls
2
+ module Api
3
+ module Update
4
+ class << self
5
+ def update_create_mutation_head
6
+ p(Souls.get_add_migration_type)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.29.5".freeze
2
+ VERSION = "0.29.6".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.8.5
1
+ 0.8.6
@@ -1 +1 @@
1
- 0.8.5
1
+ 0.8.6
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.29.5
4
+ version: 0.29.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
@@ -120,6 +120,8 @@ files:
120
120
  - lib/souls/api/generate/rspec_query.rb
121
121
  - lib/souls/api/generate/rspec_resolver.rb
122
122
  - lib/souls/api/generate/type.rb
123
+ - lib/souls/api/update.rb
124
+ - lib/souls/api/update/update_mutation.rb
123
125
  - lib/souls/docker.rb
124
126
  - lib/souls/docker/docker.rb
125
127
  - lib/souls/gcloud.rb