souls 0.29.3 → 0.29.7

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: 676dd947f68cd5f0fc4d8971a560308151010d39fcb71bd07d2f7c5bb5d9410f
4
- data.tar.gz: c1216a0b9cbf4a35722728164caa4cdf4a11b7ea4749a5de290cea66cb0ecb65
3
+ metadata.gz: cc98a9c24cdabf1ec57a40a86568022f359ea9f06dca660e43026be99f15cd35
4
+ data.tar.gz: 1a98e52c5c2c99db4f862eb3df16cbb203103582cb6eff0bbfb82ba3c124fb07
5
5
  SHA512:
6
- metadata.gz: 271aaf367d445863910ed8973cfb7cbcb8fcad5fa05d64ce985b67d2042dcf333c4aa2c600a7de0ce299fdc660bc37c5036444e8512c19fdfd8e61ced4a1903e
7
- data.tar.gz: c47be0a5c8489bc71155bb46b15ded04aa5ef761298edd1c72ed6b401dbd0c7336df2939debdf37f61d7c91c016e505fae5ffc611f210912f952c3e681c95273
6
+ metadata.gz: a69a2c609172b3d5a0d3c0bbe9578a1b67aa9a0613c217b1f6d3cfcc2b62b34ff21d455cb933728383eecff5fe61ae3a30ea7ddba7d833cc54c44dde8026818e
7
+ data.tar.gz: 46b1abe8dd28421a07480afadf78ee88b21a58593d61869b3cc5deaca895f006a34ca9c4efd9a8de4c1dc70c59b14241f17b78396be8106e78e6ef58a5a92b9d
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
@@ -29,10 +31,12 @@ begin
29
31
  when "generate", "g"
30
32
  method_name = ARGV[2]
31
33
  class_name = ARGV[3]
34
+ args = { class_name: class_name }
35
+ args[:option] = ARGV[4] if ARGV.size > 4
32
36
  status = Paint["Running SOULs Generate Commands...", :yellow]
33
37
  Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
34
38
  Whirly.status = status
35
- Souls::Worker::Generate.public_send(method_name, class_name: class_name)
39
+ Souls::Worker::Generate.public_send(method_name, **args)
36
40
  Whirly.status = "Done!"
37
41
  end
38
42
  else
@@ -40,7 +44,7 @@ begin
40
44
  end
41
45
  when "new"
42
46
  args = ARGV
43
- Souls::Init.return_method(args)
47
+ Souls::Init.start(args)
44
48
  when "s", "server"
45
49
  system("foreman start -f Procfile.dev")
46
50
  when "c", "console"
@@ -78,7 +82,7 @@ begin
78
82
  Whirly.status = "Done!"
79
83
  end
80
84
  when "release"
81
- Souls::Release.return_method
85
+ Souls::Release.gem_release
82
86
  when "model:update"
83
87
  status = Paint["Syncing Models...", :yellow]
84
88
  Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
@@ -158,5 +162,6 @@ begin
158
162
  puts(Paint["Welcome to SOULs!", :green])
159
163
  end
160
164
  rescue StandardError => e
165
+ puts(e.backtrace)
161
166
  puts(Paint[e, :red])
162
167
  end
data/lib/souls.rb CHANGED
@@ -332,15 +332,55 @@ 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}/")
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"
340
344
 
341
- service_name
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
352
+ end
353
+
354
+ def get_add_migration_type(class_name: "user")
355
+ pluralized_class_name = class_name.pluralize
356
+ file_paths = Dir["db/migrate/*_add_column_to_#{pluralized_class_name}.rb"]
357
+ p(file_paths)
358
+ new_columns =
359
+ file_paths.map do |file_path|
360
+ get_col_name_and_type(class_name: class_name, file_path: file_path)
361
+ end
362
+ new_columns.flatten
363
+ end
364
+
365
+ def get_col_name_and_type(class_name: "user", file_path: "db/migrate/20210816094410_add_column_to_users.rb")
366
+ pluralized_class_name = class_name.pluralize
367
+ response = []
368
+ File.open(file_path) do |line|
369
+ line.each_line do |file_line|
370
+ next unless file_line.include?("add_column")
371
+
372
+ array = file_line.include?("array: true")
373
+ types = file_line.split(",").map(&:strip)
374
+ types.map { |n| n.gsub!(":", "") }
375
+ types[0].gsub!("add_column ", "")
376
+ unless types[0].to_s == pluralized_class_name
377
+ raise(StandardError, "Wrong class_name!Please Check your migration file!")
378
+ end
379
+
380
+ response << { column_name: types[1], type: types[2], array: array }
381
+ end
382
+ end
383
+ response
344
384
  end
345
385
 
346
386
  def configure
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
 
@@ -1,9 +1,36 @@
1
1
  module Souls
2
2
  module Api
3
- module Migration
4
- def self.create_migration(class_name: "user")
5
- pluralized_class_name = class_name.underscore.pluralize
6
- system("rake db:create_migration NAME=create_#{pluralized_class_name}")
3
+ module Generate
4
+ class << self
5
+ def create_migration(class_name: "user")
6
+ pluralized_class_name = class_name.underscore.pluralize
7
+ system("rake db:create_migration NAME=create_#{pluralized_class_name}")
8
+ end
9
+
10
+ def add_column(class_name: "user")
11
+ pluralized_class_name = class_name.underscore.pluralize
12
+ system("rake db:create_migration NAME=add_column_to_#{pluralized_class_name}")
13
+ end
14
+
15
+ def rename_column(class_name: "user")
16
+ pluralized_class_name = class_name.underscore.pluralize
17
+ system("rake db:create_migration NAME=rename_column_to_#{pluralized_class_name}")
18
+ end
19
+
20
+ def change_column(class_name: "user")
21
+ pluralized_class_name = class_name.underscore.pluralize
22
+ system("rake db:create_migration NAME=change_column_to_#{pluralized_class_name}")
23
+ end
24
+
25
+ def remove_column(class_name: "user")
26
+ pluralized_class_name = class_name.underscore.pluralize
27
+ system("rake db:create_migration NAME=remove_column_to_#{pluralized_class_name}")
28
+ end
29
+
30
+ def drop_table(class_name: "user")
31
+ pluralized_class_name = class_name.underscore.pluralize
32
+ system("rake db:create_migration NAME=drop_table_to_#{pluralized_class_name}")
33
+ end
7
34
  end
8
35
  end
9
36
  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/init.rb CHANGED
@@ -21,7 +21,6 @@ module Souls
21
21
  config.project_id = "souls-app"
22
22
  config.strain = "#{app_name}"
23
23
  config.github_repo = "elsoul/souls"
24
- config.worker_endpoint = "https://worker.test.com"
25
24
  config.fixed_gems = ["excluded_gem"]
26
25
  end
27
26
  TEXT
@@ -51,7 +50,6 @@ module Souls
51
50
  config.project_id = "#{app_name}"
52
51
  config.strain = "mother"
53
52
  config.github_repo = "elsoul/souls"
54
- config.worker_endpoint = "https://worker.test.com"
55
53
  config.fixed_gems = ["excluded_gem"]
56
54
  end
57
55
  TEXT
@@ -60,7 +58,7 @@ module Souls
60
58
  puts(e)
61
59
  end
62
60
 
63
- def self.return_method(args)
61
+ def self.start(args)
64
62
  app_name = args[1]
65
63
  if app_name.nil?
66
64
  puts(Paint["you need to specify your app name", :red])
data/lib/souls/release.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative "./release/methods"
1
+ require_relative "./release/release"
2
2
 
3
3
  module Souls
4
4
  module Release
@@ -1,7 +1,7 @@
1
1
  module Souls
2
2
  module Release
3
3
  class << self
4
- def return_method
4
+ def gem_release
5
5
  system("gem install souls")
6
6
  sleep(3)
7
7
  current_souls_ver = Souls::VERSION.strip.split(".").map(&:to_i)
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.29.3".freeze
2
+ VERSION = "0.29.7".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.8.3
1
+ 0.8.7
@@ -1 +1 @@
1
- 0.8.3
1
+ 0.8.7
@@ -2,8 +2,9 @@ module Souls
2
2
  module Worker
3
3
  module Generate
4
4
  class << self
5
- def mailer(class_name: "mailer", option: :mailgun)
6
- if option == :sendgrid
5
+ def mailer(class_name: "mailer", option: "")
6
+ puts(option)
7
+ if option.to_sym == :sendgrid
7
8
  sendgrid_mailer(class_name: class_name)
8
9
  else
9
10
  mailgun_mailer(class_name: class_name)
@@ -52,7 +53,9 @@ module Souls
52
53
  file_path
53
54
  end
54
55
 
55
- def sendgrid_mailer; end
56
+ def sendgrid_mailer(class_name: "mailer")
57
+ p("Coming Soon..")
58
+ end
56
59
  end
57
60
  end
58
61
  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.29.3
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-13 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
@@ -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
@@ -130,7 +132,7 @@ files:
130
132
  - lib/souls/gcloud/run.rb
131
133
  - lib/souls/init.rb
132
134
  - lib/souls/release.rb
133
- - lib/souls/release/methods.rb
135
+ - lib/souls/release/release.rb
134
136
  - lib/souls/version.rb
135
137
  - lib/souls/versions/.souls_api_version
136
138
  - lib/souls/versions/.souls_worker_version