souls 0.48.0 → 0.50.0

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: 581824196708bbb86562b72b1afb79b7149d3b3d98068906383d67f6469873ec
4
- data.tar.gz: 82194e0ae014bd374ca0f4ed2903351dd11dc132556f2a4b75a650891573f8e0
3
+ metadata.gz: f09e978fcff3505869e0f90ec0361236dc9ab49060a02877ee2be566920873d2
4
+ data.tar.gz: d752f6115d32fed0193905455e0cac1ffb799d3e2845a8e7f71807955de399ec
5
5
  SHA512:
6
- metadata.gz: b6aacc5383ccc63578b2687bf2fda4f3db8ff7a6a3982de9014da924fc4aa338dd37535f1e02ba03fb65f0311aeb1ea494554b37d268ae0b00527e8f2bbac146
7
- data.tar.gz: 41825b30bb8bde62cb1fe0d5fa3ba558e8c571bc80843af4d7cd1542e94620b97ddd0c44773892bda682575b1087c961e7bb789cfa10ecef2655794b20c8e2a9
6
+ metadata.gz: 48020ee00fc64db00d1f98c08aa087fe2dd41bb1bbfdf0b5c68d418bd3ce90726c43016bd6c5215fdb338c01ab4e5fba046d147aeb64878728b1f565899750b4
7
+ data.tar.gz: 91398508a99065252a54dabc29141bea6432ba0448936796ba2eda2c10eb64d8340b2763ebcab1c61e5ca10851628997a97f4953e499d109c6fa489da40255b3
data/exe/souls CHANGED
@@ -10,37 +10,39 @@ begin
10
10
  case souls_command
11
11
  when "api"
12
12
  api_command = ARGV[1]
13
- case api_command
14
- when "generate", "g"
15
- method_name = ARGV[2]
16
- class_name = ARGV[3]
17
- args = { class_name: class_name }
18
- args[:mutation] = ARGV[4] if ARGV.size > 4
19
- status = Paint["Running SOULs Generate Commands...", :yellow]
20
- Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
21
- Whirly.status = status
22
- Souls::Api::Generate.public_send(method_name, **args)
23
- Whirly.status = "Done!"
24
- end
25
- when "update"
26
- class_name = ARGV[2]
27
- status = Paint["Running SOULs Update Commands...", :yellow]
28
- Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
29
- Whirly.status = status
30
- Souls::Api::Update.create_mutation(class_name: class_name)
31
- Souls::Api::Update.update_mutation(class_name: class_name)
32
- Souls::Api::Update.resolver(class_name: class_name)
33
- Souls::Api::Update.type(class_name: class_name)
34
- Souls::Api::Update.rspec_factory(class_name: class_name)
35
- Souls::Api::Update.rspec_mutation(class_name: class_name)
36
- Souls::Api::Update.rspec_resolver(class_name: class_name)
37
- Whirly.status = "Done!"
13
+ Dir.chdir(Souls.get_api_path.to_s) do
14
+ case api_command
15
+ when "generate", "g"
16
+ method_name = ARGV[2]
17
+ class_name = ARGV[3]
18
+ args = { class_name: class_name }
19
+ args[:mutation] = ARGV[4] if ARGV.size > 4
20
+ status = Paint["Running SOULs Generate Commands...", :yellow]
21
+ Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
22
+ Whirly.status = status
23
+ Souls::Api::Generate.public_send(method_name, **args)
24
+ Whirly.status = "Done!"
25
+ end
26
+ when "update"
27
+ class_name = ARGV[2]
28
+ status = Paint["Running SOULs Update Commands...", :yellow]
29
+ Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
30
+ Whirly.status = status
31
+ Souls::Api::Update.create_mutation(class_name: class_name)
32
+ Souls::Api::Update.update_mutation(class_name: class_name)
33
+ Souls::Api::Update.resolver(class_name: class_name)
34
+ Souls::Api::Update.type(class_name: class_name)
35
+ Souls::Api::Update.rspec_factory(class_name: class_name)
36
+ Souls::Api::Update.rspec_mutation(class_name: class_name)
37
+ Souls::Api::Update.rspec_resolver(class_name: class_name)
38
+ Whirly.status = "Done!"
39
+ end
40
+ when "d", "delete"
41
+ class_name = ARGV[2]
42
+ Souls::Api::Generate.delete_all(class_name: class_name)
43
+ else
44
+ puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
38
45
  end
39
- when "d", "delete"
40
- class_name = ARGV[2]
41
- Souls::Api::Generate.delete_all(class_name: class_name)
42
- else
43
- puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
44
46
  end
45
47
  when "worker"
46
48
  api_command = ARGV[1]
@@ -27,21 +27,6 @@ module Souls
27
27
  ]
28
28
  end
29
29
 
30
- def get_type_and_name(line)
31
- line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
32
- end
33
-
34
- def get_tables
35
- path = "./db/schema.rb"
36
- tables = []
37
- File.open(path, "r") do |f|
38
- f.each_line.with_index do |line, _i|
39
- tables << line.split("\"")[1] if line.include?("create_table")
40
- end
41
- end
42
- tables
43
- end
44
-
45
30
  def test_dir
46
31
  FileUtils.mkdir_p("./app/graphql/mutations")
47
32
  FileUtils.mkdir_p("./app/graphql/queries")
@@ -62,54 +47,6 @@ module Souls
62
47
  puts("test dir created!")
63
48
  end
64
49
 
65
- def type_check(type)
66
- {
67
- bigint: "Integer",
68
- string: "String",
69
- float: "Float",
70
- text: "String",
71
- datetime: "String",
72
- date: "String",
73
- boolean: "Boolean",
74
- integer: "Integer"
75
- }[type.to_sym]
76
- end
77
-
78
- def get_type(type)
79
- {
80
- bigint: "Integer",
81
- string: "String",
82
- float: "Float",
83
- text: "String",
84
- datetime: "GraphQL::Types::ISO8601DateTime",
85
- date: "GraphQL::Types::ISO8601DateTime",
86
- boolean: "Boolean",
87
- integer: "Integer"
88
- }[type.to_sym]
89
- end
90
-
91
- def get_test_type(type)
92
- {
93
- bigint: "rand(1..10)",
94
- float: 4.2,
95
- string: '"MyString"',
96
- text: '"MyString"',
97
- datetime: "Time.now",
98
- date: "Time.now.strftime('%F')",
99
- boolean: false,
100
- integer: "rand(1..10)"
101
- }[type.to_sym]
102
- end
103
-
104
- def table_check(line: "", class_name: "")
105
- if line.include?("create_table") && (line.split[1].gsub("\"", "").gsub(",", "") == class_name.pluralize.to_s)
106
-
107
- return true
108
- end
109
-
110
- false
111
- end
112
-
113
50
  def scaffold(class_name: "user")
114
51
  singularized_class_name = class_name.singularize
115
52
  model(class_name: singularized_class_name)
@@ -133,7 +70,7 @@ module Souls
133
70
 
134
71
  def scaffold_all
135
72
  puts(Paint["Let's Go SOULs AUTO CRUD Assist!\n", :cyan])
136
- Souls::Api::Generate.get_tables.each do |table|
73
+ Souls.get_tables.each do |table|
137
74
  Souls::Api::Generate.scaffold(class_name: table.singularize)
138
75
  puts(Paint["Generated #{table.camelize} CRUD Files\n", :yellow])
139
76
  end
@@ -48,7 +48,7 @@ module Souls
48
48
  end
49
49
  field = "[String]" if line.include?("array: true")
50
50
  type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
51
- field ||= type_check(type)
51
+ field ||= Souls.type_check(type)
52
52
  case name
53
53
  when "user_id"
54
54
  @user_exist = true
@@ -61,7 +61,7 @@ module Souls
61
61
  new_line.write(" argument :#{name}, #{field}, required: false\n")
62
62
  end
63
63
  end
64
- @on = true if table_check(line: line, class_name: class_name)
64
+ @on = true if Souls.table_check(line: line, class_name: class_name)
65
65
  end
66
66
  end
67
67
  end
@@ -144,7 +144,7 @@ module Souls
144
144
  end
145
145
  field = "[String]" if line.include?("array: true")
146
146
  type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
147
- field ||= type_check(type)
147
+ field ||= Souls.type_check(type)
148
148
  case name
149
149
  when "user_id"
150
150
  @user_exist = true
@@ -157,7 +157,7 @@ module Souls
157
157
  new_line.write(" argument :#{name}, #{field}, required: false\n")
158
158
  end
159
159
  end
160
- @on = true if table_check(line: line, class_name: class_name)
160
+ @on = true if Souls.table_check(line: line, class_name: class_name)
161
161
  end
162
162
  end
163
163
  end
@@ -34,8 +34,8 @@ module Souls
34
34
  break if line.include?("t.index") || line.strip == "end"
35
35
 
36
36
  field = "[String]" if line.include?("array: true")
37
- type, name = get_type_and_name(line)
38
- field ||= type_check(type)
37
+ type, name = Souls.get_type_and_name(line)
38
+ field ||= Souls.type_check(type)
39
39
  case name
40
40
  when "user_id"
41
41
  @user_exist = true
@@ -48,7 +48,7 @@ module Souls
48
48
  new_line.write(" argument :#{name}, #{field}, required: false\n")
49
49
  end
50
50
  end
51
- @on = true if table_check(line: line, class_name: class_name)
51
+ @on = true if Souls.table_check(line: line, class_name: class_name)
52
52
  end
53
53
  end
54
54
  end
@@ -89,7 +89,7 @@ module Souls
89
89
  if @on
90
90
  break if line.include?("t.index") || line.strip == "end"
91
91
 
92
- type, name = get_type_and_name(line)
92
+ type, name = Souls.get_type_and_name(line)
93
93
  if line.include?("array: true")
94
94
  new_line.write(
95
95
  " scope = scope.where(\"#{name} @> ARRAY[?]::text[]\", value[:#{name}]) if value[:#{name}]\n"
@@ -115,7 +115,7 @@ module Souls
115
115
  end
116
116
  end
117
117
  end
118
- @on = true if table_check(line: line, class_name: class_name)
118
+ @on = true if Souls.table_check(line: line, class_name: class_name)
119
119
  end
120
120
  end
121
121
  end
@@ -24,7 +24,7 @@ module Souls
24
24
  new_line.write("\n" && break) if line.include?("t.index") || line.strip == "end"
25
25
  field = '["tag1", "tag2", "tag3"]' if line.include?("array: true")
26
26
  type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
27
- field ||= get_test_type(type)
27
+ field ||= Souls.get_test_type(type)
28
28
  if type == "bigint" && name.include?("_id")
29
29
  id_name = name.gsub("_id", "")
30
30
  new_line.write(" association :#{id_name}, factory: :#{id_name}\n")
@@ -32,7 +32,7 @@ module Souls
32
32
  new_line.write(" #{name} { #{field} }\n")
33
33
  end
34
34
  end
35
- @on = true if table_check(line: line, class_name: class_name)
35
+ @on = true if Souls.table_check(line: line, class_name: class_name)
36
36
  end
37
37
  end
38
38
  end
@@ -58,7 +58,7 @@ module Souls
58
58
  new_line.write(" let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n")
59
59
  end
60
60
  end
61
- @on = true if table_check(line: line, class_name: class_name)
61
+ @on = true if Souls.table_check(line: line, class_name: class_name)
62
62
  end
63
63
  end
64
64
  end
@@ -113,7 +113,7 @@ module Souls
113
113
  end
114
114
  end
115
115
  end
116
- @on = true if table_check(line: line, class_name: class_name)
116
+ @on = true if Souls.table_check(line: line, class_name: class_name)
117
117
  end
118
118
  end
119
119
  end
@@ -193,7 +193,7 @@ module Souls
193
193
  end
194
194
  end
195
195
  end
196
- @on = true if table_check(line: line, class_name: class_name)
196
+ @on = true if Souls.table_check(line: line, class_name: class_name)
197
197
  end
198
198
  end
199
199
  end
@@ -217,7 +217,7 @@ module Souls
217
217
  break
218
218
  end
219
219
  type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
220
- field ||= type_check(type)
220
+ field ||= Souls.type_check(type)
221
221
  array_true = line.include?("array: true")
222
222
  case name
223
223
  when "user_id", "created_at", "updated_at", /$*_id\z/
@@ -245,7 +245,7 @@ module Souls
245
245
  end
246
246
  end
247
247
  end
248
- @on = true if table_check(line: line, class_name: class_name)
248
+ @on = true if Souls.table_check(line: line, class_name: class_name)
249
249
  end
250
250
  end
251
251
  end
@@ -56,7 +56,7 @@ module Souls
56
56
  new_line.write(" let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n")
57
57
  end
58
58
  end
59
- @on = true if table_check(line: line, class_name: class_name)
59
+ @on = true if Souls.table_check(line: line, class_name: class_name)
60
60
  end
61
61
  end
62
62
  end
@@ -101,7 +101,7 @@ module Souls
101
101
  new_line.write(" #{name.camelize(:lower)}\n")
102
102
  end
103
103
  end
104
- @on = true if table_check(line: line, class_name: class_name)
104
+ @on = true if Souls.table_check(line: line, class_name: class_name)
105
105
  end
106
106
  end
107
107
  end
@@ -125,7 +125,7 @@ module Souls
125
125
  break
126
126
  end
127
127
  type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
128
- field ||= type_check(type)
128
+ field ||= Souls.type_check(type)
129
129
  array_true = line.include?("array: true")
130
130
  case name
131
131
  when "user_id", "created_at", "updated_at", /$*_id\z/
@@ -145,7 +145,7 @@ module Souls
145
145
  end
146
146
  end
147
147
  end
148
- @on = true if table_check(line: line, class_name: class_name)
148
+ @on = true if Souls.table_check(line: line, class_name: class_name)
149
149
  end
150
150
  end
151
151
  end
@@ -64,7 +64,7 @@ module Souls
64
64
  new_line.write(" let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n")
65
65
  end
66
66
  end
67
- @on = true if table_check(line: line, class_name: class_name)
67
+ @on = true if Souls.table_check(line: line, class_name: class_name)
68
68
  end
69
69
  end
70
70
  end
@@ -120,7 +120,7 @@ module Souls
120
120
  new_line.write(" #{name.camelize(:lower)}\n")
121
121
  end
122
122
  end
123
- @on = true if table_check(line: line, class_name: class_name)
123
+ @on = true if Souls.table_check(line: line, class_name: class_name)
124
124
  end
125
125
  end
126
126
  end
@@ -144,7 +144,7 @@ module Souls
144
144
  break
145
145
  end
146
146
  type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
147
- field ||= type_check(type)
147
+ field ||= Souls.type_check(type)
148
148
  array_true = line.include?("array: true")
149
149
  case name
150
150
  when "user_id", "created_at", "updated_at", /$*_id\z/
@@ -172,7 +172,7 @@ module Souls
172
172
  end
173
173
  end
174
174
  end
175
- @on = true if table_check(line: line, class_name: class_name)
175
+ @on = true if Souls.table_check(line: line, class_name: class_name)
176
176
  end
177
177
  end
178
178
  end
@@ -27,7 +27,7 @@ module Souls
27
27
  new_line.write("\n" && break) if line.include?("t.index") || line.strip == "end"
28
28
  field = "[String]" if line.include?("array: true")
29
29
  type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
30
- field ||= type_check(type)
30
+ field ||= Souls.type_check(type)
31
31
  case name
32
32
  when /$*_id\z/
33
33
  new_line.write(
@@ -43,7 +43,7 @@ module Souls
43
43
  new_line.write(" field :#{name}, #{field}, null: true\n")
44
44
  end
45
45
  end
46
- if table_check(line: line, class_name: class_name)
46
+ if Souls.table_check(line: line, class_name: class_name)
47
47
  @on = true
48
48
  new_line.write(" global_id_field :id\n")
49
49
  end
@@ -16,7 +16,7 @@ module Souls
16
16
  next unless line.include?("argument") && !argument
17
17
 
18
18
  new_cols.each do |col|
19
- type = Souls::Api::Generate.type_check(col[:type])
19
+ type = Souls.type_check(col[:type])
20
20
  type = "[#{type}]" if col[:array]
21
21
  args = check_mutation_argument(class_name: class_name)
22
22
  next if args.include?(col[:column_name])
@@ -47,7 +47,7 @@ module Souls
47
47
  next unless line.include?("argument") && !argument
48
48
 
49
49
  new_cols.each do |col|
50
- type = Souls::Api::Generate.type_check(col[:type])
50
+ type = Souls.type_check(col[:type])
51
51
  type = "[#{type}]" if col[:array]
52
52
  args = check_mutation_argument(class_name: class_name, action: "update")
53
53
  next if args.include?(col[:column_name])
@@ -18,7 +18,7 @@ module Souls
18
18
  new_line.write(line)
19
19
  if line.include?("argument") && !argument
20
20
  new_cols.each do |col|
21
- type = Souls::Api::Generate.type_check(col[:type])
21
+ type = Souls.type_check(col[:type])
22
22
  type = "[#{type}]" if col[:array]
23
23
  add_line = " argument :#{col[:column_name]}, #{type}, required: false\n"
24
24
  new_line.write(add_line) unless args.include?(col[:column_name])
@@ -26,7 +26,7 @@ module Souls
26
26
  argument = true
27
27
  elsif line.include?("scope = ::") && !scope
28
28
  new_cols.each do |col|
29
- type = Souls::Api::Generate.type_check(col[:type])
29
+ type = Souls.type_check(col[:type])
30
30
  type = "[#{type}]" if col[:array]
31
31
 
32
32
  if type.include?("[")
@@ -19,7 +19,7 @@ module Souls
19
19
  new_cols.each do |col|
20
20
  next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
21
21
 
22
- type = Souls::Api::Generate.get_test_type(col[:type])
22
+ type = Souls.get_test_type(col[:type])
23
23
  type = "[#{type}]" if col[:array]
24
24
  args = check_factory_argument(class_name: class_name)
25
25
 
@@ -22,7 +22,7 @@ module Souls
22
22
 
23
23
  if line.include?('#{') && !argument
24
24
  new_cols.each do |col|
25
- type = Souls::Api::Generate.type_check(col[:type])
25
+ type = Souls.type_check(col[:type])
26
26
  next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
27
27
 
28
28
  type_line =
@@ -46,7 +46,7 @@ module Souls
46
46
  elsif test_res && line.include?("=> be_")
47
47
  test_args = check_rspec_mutation_argument(class_name: class_name, action: "test_args")
48
48
  new_cols.each do |col|
49
- type = Souls::Api::Generate.type_check(col[:type])
49
+ type = Souls.type_check(col[:type])
50
50
  text =
51
51
  case type
52
52
  when "Integer", "Float"
@@ -30,7 +30,7 @@ module Souls
30
30
  elsif test_res && line.include?("=> be_")
31
31
  test_args = check_rspec_resolver_argument(class_name: class_name, action: "test_args")
32
32
  new_cols.each do |col|
33
- type = Souls::Api::Generate.type_check(col[:type])
33
+ type = Souls.type_check(col[:type])
34
34
  text =
35
35
  case type
36
36
  when "Integer", "Float"
@@ -16,7 +16,7 @@ module Souls
16
16
  next unless line.include?("field") && !argument
17
17
 
18
18
  new_cols.each do |col|
19
- type = Souls::Api::Generate.get_type(col[:type])
19
+ type = Souls.get_type(col[:type])
20
20
  type = "[#{type}]" if col[:array]
21
21
  args = check_type_argument(class_name: class_name)
22
22
  unless args.include?(col[:column_name])
@@ -204,20 +204,12 @@ end
204
204
  end
205
205
 
206
206
  def download_worker(worker_name: "mailer")
207
- raise(StandardError, "Can't use `worker` for worker. Change Name.") if worker_name == "worker"
208
-
209
- current_dir_name = FileUtils.pwd.to_s.match(%r{/([^/]+)/?$})[1]
210
- wrong_dir = %w[apps api worker]
211
- if wrong_dir.include?(current_dir_name)
212
- raise(StandardError, "You are at wrong directory!Go to Mother Directory!")
213
- end
214
-
215
207
  version = Souls.get_latest_version_txt(service_name: "worker").join(".")
216
208
  file_name = "worker-v#{version}.tgz"
217
209
  url = "https://storage.googleapis.com/souls-bucket/boilerplates/workers/#{file_name}"
218
210
  system("curl -OL #{url}")
219
- system("tar -zxvf ./#{file_name} -C ./apps/")
220
- system("mv apps/worker apps/#{worker_name}")
211
+ system("tar -zxvf ./#{file_name}")
212
+ system("mv ./worker apps/#{worker_name}")
221
213
  system("cp ./apps/api/config/database.yml ./apps/#{worker_name}/config/")
222
214
  FileUtils.rm(file_name)
223
215
  end
@@ -15,12 +15,16 @@ module Souls
15
15
  system("gcloud sql instances list")
16
16
  end
17
17
 
18
- def setup_private_ip(instance_name: "")
19
- app_name = Souls.configuration.app
20
- instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
21
- project_id = Souls.configuration.project_id
18
+ def setup_private_ip
22
19
  create_ip_range
23
20
  create_vpc_connector
21
+ assign_network
22
+ end
23
+
24
+ def assign_network
25
+ app_name = Souls.configuration.app
26
+ instance_name = "#{Souls.configuration.app}-db"
27
+ project_id = Souls.configuration.project_id
24
28
  system("gcloud beta sql instances patch #{instance_name} --project=#{project_id} --network=#{app_name}")
25
29
  end
26
30
 
@@ -1,15 +1,30 @@
1
- require "active_support/core_ext/string/inflections"
1
+ require_relative "./create/index"
2
+ require_relative "./docker/index"
3
+ require_relative "./gcloud/index"
4
+ require_relative "./init/index"
5
+ require_relative "./release/index"
6
+ require_relative "./sync/index"
7
+ require_relative "./upgrade/index"
2
8
 
3
- require_paths = []
4
- modules =
5
- Dir["lib/souls/cli/*"].map do |n|
6
- next if n.include?("index.rb")
9
+ module Souls
10
+ module Create
11
+ end
12
+
13
+ module Docker
14
+ end
15
+
16
+ module Gcloud
17
+ end
18
+
19
+ module Init
20
+ end
21
+
22
+ module Release
23
+ end
24
+
25
+ module Sync
26
+ end
7
27
 
8
- require_paths << n.split("/").last
9
- n.split("/").last.camelize
28
+ module Upgrade
10
29
  end
11
- modules.compact!
12
- require_paths.each_with_index do |path, i|
13
- require_relative "./#{path}/index"
14
- Object.const_get("Souls::#{modules[i]}")
15
30
  end
@@ -24,16 +24,26 @@ module Souls
24
24
  next unless worker_switch
25
25
 
26
26
  new_line.write(" config.workers = [\n")
27
- workers.each do |worker|
27
+ workers.each_with_index do |worker, i|
28
28
  base_url = Souls::Gcloud::Run.get_endpoint(worker_name: worker[:name])
29
29
  endpoint = Souls.configuration.endpoint
30
- new_line.write(<<-TEXT)
31
- {
32
- name: "#{worker[:name]}",
33
- endpoint: "#{base_url.strip}#{endpoint}",
34
- port: #{worker[:port]}
35
- },
36
- TEXT
30
+ if (i + 1) == workers.size
31
+ new_line.write(<<-TEXT)
32
+ {
33
+ name: "#{worker[:name]}",
34
+ endpoint: "#{base_url.strip}#{endpoint}",
35
+ port: #{worker[:port]}
36
+ }
37
+ TEXT
38
+ else
39
+ new_line.write(<<-TEXT)
40
+ {
41
+ name: "#{worker[:name]}",
42
+ endpoint: "#{base_url.strip}#{endpoint}",
43
+ port: #{worker[:port]}
44
+ },
45
+ TEXT
46
+ end
37
47
  end
38
48
  break
39
49
  end
@@ -59,7 +59,8 @@ module Souls
59
59
  pubsub = Google::Cloud::Pubsub.new
60
60
 
61
61
  topic = pubsub.topic(topic_id)
62
- topic.subscribe(subscription_id, endpoint: endpoint)
62
+ sub = topic.subscribe(subscription_id, endpoint: endpoint, deadline: 20)
63
+ sub.expires_in = nil
63
64
  puts("Push subscription #{subscription_id} created.")
64
65
  end
65
66
 
@@ -8,6 +8,69 @@ module Souls
8
8
  FileUtils.pwd.split(Souls.configuration.app)[0] + Souls.configuration.app + "/apps/api"
9
9
  end
10
10
 
11
+ def type_check(type)
12
+ {
13
+ bigint: "Integer",
14
+ string: "String",
15
+ float: "Float",
16
+ text: "String",
17
+ datetime: "String",
18
+ date: "String",
19
+ boolean: "Boolean",
20
+ integer: "Integer"
21
+ }[type.to_sym]
22
+ end
23
+
24
+ def get_type_and_name(line)
25
+ line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
26
+ end
27
+
28
+ def get_type(type)
29
+ {
30
+ bigint: "Integer",
31
+ string: "String",
32
+ float: "Float",
33
+ text: "String",
34
+ datetime: "GraphQL::Types::ISO8601DateTime",
35
+ date: "GraphQL::Types::ISO8601DateTime",
36
+ boolean: "Boolean",
37
+ integer: "Integer"
38
+ }[type.to_sym]
39
+ end
40
+
41
+ def get_test_type(type)
42
+ {
43
+ bigint: "rand(1..10)",
44
+ float: 4.2,
45
+ string: '"MyString"',
46
+ text: '"MyString"',
47
+ datetime: "Time.now",
48
+ date: "Time.now.strftime('%F')",
49
+ boolean: false,
50
+ integer: "rand(1..10)"
51
+ }[type.to_sym]
52
+ end
53
+
54
+ def get_tables
55
+ path = "./db/schema.rb"
56
+ tables = []
57
+ File.open(path, "r") do |f|
58
+ f.each_line.with_index do |line, _i|
59
+ tables << line.split("\"")[1] if line.include?("create_table")
60
+ end
61
+ end
62
+ tables
63
+ end
64
+
65
+ def table_check(line: "", class_name: "")
66
+ if line.include?("create_table") && (line.split[1].gsub("\"", "").gsub(",", "") == class_name.pluralize.to_s)
67
+
68
+ return true
69
+ end
70
+
71
+ false
72
+ end
73
+
11
74
  def version_detector(current_ver: [0, 0, 1], update_kind: "patch")
12
75
  case update_kind
13
76
  when "patch"
@@ -45,7 +108,7 @@ module Souls
45
108
  if class_check_flag == true && !line.include?("create_table")
46
109
  return cols if line.include?("t.index") || line.strip == "end"
47
110
 
48
- types = Souls::Api::Generate.get_type_and_name(line)
111
+ types = Souls.get_type_and_name(line)
49
112
  array = line.include?("array: true")
50
113
  cols << { column_name: types[1], type: types[0], array: array }
51
114
  end
@@ -69,7 +132,7 @@ module Souls
69
132
  next unless class_check_flag == true && !line.include?("create_table")
70
133
  return response if line.include?("t.timestamps") || line.strip == "end"
71
134
 
72
- types = Souls::Api::Generate.get_type_and_name(line)
135
+ types = Souls.get_type_and_name(line)
73
136
  types.map { |n| n.gsub!(":", "") }
74
137
  array = line.include?("array: true")
75
138
  response << { column_name: types[1], type: types[0], array: array }
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.48.0".freeze
2
+ VERSION = "0.50.0".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.27.0
1
+ 0.29.0
@@ -1 +1 @@
1
- 0.27.0
1
+ 0.29.0
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.48.0
4
+ version: 0.50.0
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-09-09 00:00:00.000000000 Z
13
+ date: 2021-09-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport