souls 0.29.6 → 0.29.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3de74c19c656eca1c5cd6f49357be3527150d091d49fb6586f682383f19df91c
4
- data.tar.gz: cef99823964ef73e5c72e192e2c437cd761cdba4d3e1907cbc9c69f924a92482
3
+ metadata.gz: cc98a9c24cdabf1ec57a40a86568022f359ea9f06dca660e43026be99f15cd35
4
+ data.tar.gz: 1a98e52c5c2c99db4f862eb3df16cbb203103582cb6eff0bbfb82ba3c124fb07
5
5
  SHA512:
6
- metadata.gz: '093729ea37591c9c0aabe63490f5edfa70a2e36230915f7fc59efe40f430b30a40512c2317e56c017cf4eabc919ae9b5453c6dfaf6a415ea03919da3078af89d'
7
- data.tar.gz: 192c737658ca8ee527b2428da0df1a83c3989907ca2b8f8e2312b6e4b95da6f0f327df1e8504e0c6e61303f98641954b8458c4d2536d8467966411b9b18054ea
6
+ metadata.gz: a69a2c609172b3d5a0d3c0bbe9578a1b67aa9a0613c217b1f6d3cfcc2b62b34ff21d455cb933728383eecff5fe61ae3a30ea7ddba7d833cc54c44dde8026818e
7
+ data.tar.gz: 46b1abe8dd28421a07480afadf78ee88b21a58593d61869b3cc5deaca895f006a34ca9c4efd9a8de4c1dc70c59b14241f17b78396be8106e78e6ef58a5a92b9d
data/lib/souls.rb CHANGED
@@ -332,20 +332,29 @@ module Souls
332
332
  }
333
333
  end
334
334
 
335
- def detect_change
336
- git_status = `git status`
337
- result =
338
- %w[api worker].map do |service_name|
339
- next unless git_status.include?("apps/#{service_name}/")
340
-
341
- service_name
335
+ def get_columns_num(class_name: "user")
336
+ file_path = "./db/schema.rb"
337
+ class_check_flag = false
338
+ cols = []
339
+ File.open(file_path, "r") do |f|
340
+ f.each_line.with_index do |line, _i|
341
+ class_check_flag = true if line.include?("create_table") && line.include?(class_name)
342
+ if class_check_flag == true && !line.include?("create_table")
343
+ return cols if line.include?("t.index") || line.strip == "end"
344
+
345
+ types = Souls::Api::Generate.get_type_and_name(line)
346
+ array = line.include?("array: true")
347
+ cols << { column_name: types[1], type: types[0], array: array }
348
+ end
342
349
  end
343
- result.compact
350
+ end
351
+ cols
344
352
  end
345
353
 
346
354
  def get_add_migration_type(class_name: "user")
347
355
  pluralized_class_name = class_name.pluralize
348
356
  file_paths = Dir["db/migrate/*_add_column_to_#{pluralized_class_name}.rb"]
357
+ p(file_paths)
349
358
  new_columns =
350
359
  file_paths.map do |file_path|
351
360
  get_col_name_and_type(class_name: class_name, file_path: file_path)
@@ -9,7 +9,7 @@ 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_column_to#{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")
@@ -19,17 +19,17 @@ module Souls
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_column_to#{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_column_to#{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_table_to#{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
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.29.6".freeze
2
+ VERSION = "0.29.7".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.8.6
1
+ 0.8.7
@@ -1 +1 @@
1
- 0.8.6
1
+ 0.8.7
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.6
4
+ version: 0.29.7
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-08-16 00:00:00.000000000 Z
13
+ date: 2021-08-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport