souls 0.29.1 β 0.29.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 +4 -4
- data/exe/souls +18 -3
- data/lib/souls.rb +1 -0
- data/lib/souls/api/generate.rb +1 -0
- data/lib/souls/api/generate/manager.rb +26 -0
- data/lib/souls/api/generate/migration.rb +31 -4
- data/lib/souls/gcloud/iam.rb +2 -2
- data/lib/souls/init.rb +1 -3
- data/lib/souls/release.rb +1 -1
- data/lib/souls/release/{methods.rb β release.rb} +1 -1
- data/lib/souls/version.rb +1 -1
- data/lib/souls/versions/.souls_api_version +1 -1
- data/lib/souls/versions/.souls_worker_version +1 -1
- data/lib/souls/worker.rb +6 -1
- data/lib/souls/worker/generate.rb +7 -0
- data/lib/souls/worker/generate/application.rb +150 -0
- data/lib/souls/worker/generate/mailer.rb +62 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44391155b6c710dd11e6074752dddd6d495f07abceb9df857b53663a9747fcba
|
4
|
+
data.tar.gz: bcb6cd5b60ffb949afdb56f2ded4036373bfde9e4d2cce9e408d77fbaa3485c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fc03249c993388b8f199ad94d8db48859e7306e5128cbc5cf540882f0852cee3f8a0e71242b7619936a00d264f1d2bc8aba7fe5b8901b3e6f532f28d9c1db8a
|
7
|
+
data.tar.gz: 3411cd55b57ccb9d3fe676159d4060291f3c06578973c8d27e5746de4b95fea4f9102cc7cccd86bc5373f1e92c34e56e94aa5ff65ac93dbc2844f28b2ac0525e
|
data/exe/souls
CHANGED
@@ -24,10 +24,25 @@ begin
|
|
24
24
|
puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
|
25
25
|
end
|
26
26
|
when "worker"
|
27
|
-
|
27
|
+
api_command = ARGV[1]
|
28
|
+
case api_command
|
29
|
+
when "generate", "g"
|
30
|
+
method_name = ARGV[2]
|
31
|
+
class_name = ARGV[3]
|
32
|
+
args = { class_name: class_name }
|
33
|
+
args[:option] = ARGV[4] if ARGV.size > 4
|
34
|
+
status = Paint["Running SOULs Generate Commands...", :yellow]
|
35
|
+
Whirly.start(spinner: "clock", interval: 420, stop: "π") do
|
36
|
+
Whirly.status = status
|
37
|
+
Souls::Worker::Generate.public_send(method_name, **args)
|
38
|
+
Whirly.status = "Done!"
|
39
|
+
end
|
40
|
+
else
|
41
|
+
puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
|
42
|
+
end
|
28
43
|
when "new"
|
29
44
|
args = ARGV
|
30
|
-
Souls::Init.
|
45
|
+
Souls::Init.start(args)
|
31
46
|
when "s", "server"
|
32
47
|
system("foreman start -f Procfile.dev")
|
33
48
|
when "c", "console"
|
@@ -65,7 +80,7 @@ begin
|
|
65
80
|
Whirly.status = "Done!"
|
66
81
|
end
|
67
82
|
when "release"
|
68
|
-
Souls::Release.
|
83
|
+
Souls::Release.gem_release
|
69
84
|
when "model:update"
|
70
85
|
status = Paint["Syncing Models...", :yellow]
|
71
86
|
Whirly.start(spinner: "clock", interval: 420, stop: "π") do
|
data/lib/souls.rb
CHANGED
@@ -2,6 +2,7 @@ require_relative "souls/version"
|
|
2
2
|
require "active_support/core_ext/string/inflections"
|
3
3
|
require_relative "souls/init"
|
4
4
|
require_relative "souls/api"
|
5
|
+
require_relative "souls/worker"
|
5
6
|
require_relative "souls/gcloud"
|
6
7
|
require_relative "souls/release"
|
7
8
|
require_relative "souls/docker"
|
data/lib/souls/api/generate.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Souls
|
2
|
+
module Api::Generate
|
3
|
+
def self.manager(class_name: "souls")
|
4
|
+
singularized_class_name = class_name.underscore.singularize
|
5
|
+
file_dir = "./app/graphql/mutations/managers/#{singularized_class_name}_manager"
|
6
|
+
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
7
|
+
file_path = "#{file_dir}/#{singularized_class_name}.rb"
|
8
|
+
File.open(file_path, "w") do |f|
|
9
|
+
f.write(<<~TEXT)
|
10
|
+
class Types::#{singularized_class_name.camelize}Edge < module Mutations
|
11
|
+
module Mailers
|
12
|
+
class #{singularized_class_name.camelize}Mailer < BaseMutation
|
13
|
+
description "Mail γιδΏ‘γγΎγγ"
|
14
|
+
field :response, String, null: false
|
15
|
+
|
16
|
+
node_type(Types::#{singularized_class_name.camelize}Type)
|
17
|
+
end
|
18
|
+
TEXT
|
19
|
+
end
|
20
|
+
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
21
|
+
file_path
|
22
|
+
rescue StandardError => e
|
23
|
+
raise(StandardError, e)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,9 +1,36 @@
|
|
1
1
|
module Souls
|
2
2
|
module Api
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
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_#{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_#{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_#{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_#{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_#{pluralized_class_name}")
|
33
|
+
end
|
7
34
|
end
|
8
35
|
end
|
9
36
|
end
|
data/lib/souls/gcloud/iam.rb
CHANGED
@@ -63,8 +63,8 @@ module Souls
|
|
63
63
|
roles = [
|
64
64
|
"roles/cloudsql.instanceUser",
|
65
65
|
"roles/containerregistry.ServiceAgent",
|
66
|
-
"roles/pubsub.
|
67
|
-
"roles/firestore.
|
66
|
+
"roles/pubsub.serviceAdmin",
|
67
|
+
"roles/firestore.serviceAdmin",
|
68
68
|
"roles/iam.serviceAccountUser",
|
69
69
|
"roles/storage.objectAdmin",
|
70
70
|
"roles/run.admin"
|
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.
|
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
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.5
|
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.5
|
data/lib/souls/worker.rb
CHANGED
@@ -0,0 +1,150 @@
|
|
1
|
+
module Souls
|
2
|
+
module Worker
|
3
|
+
module Generate
|
4
|
+
## Common Methods
|
5
|
+
def self.generated_paths(class_name: "user")
|
6
|
+
singularized_class_name = class_name.singularize.underscore
|
7
|
+
pluralized_class_name = class_name.pluralize.underscore
|
8
|
+
[
|
9
|
+
"./app/models/#{singularized_class_name}.rb",
|
10
|
+
"./app/policies/#{singularized_class_name}_policy.rb",
|
11
|
+
"./app/graphql/mutations/create_#{singularized_class_name}.rb",
|
12
|
+
"./app/graphql/mutations/delete_#{singularized_class_name}.rb",
|
13
|
+
"./app/graphql/mutations/destroy_delete_#{singularized_class_name}.rb",
|
14
|
+
"./app/graphql/mutations/update_#{singularized_class_name}.rb",
|
15
|
+
"./app/graphql/queries/#{singularized_class_name}.rb",
|
16
|
+
"./app/graphql/queries/#{pluralized_class_name}.rb",
|
17
|
+
"./app/graphql/resolvers/#{singularized_class_name}_search.rb",
|
18
|
+
"./app/graphql/types/#{singularized_class_name}_type.rb",
|
19
|
+
"./app/graphql/types/edges/#{singularized_class_name}_edge.rb",
|
20
|
+
"./app/graphql/types/connections/#{singularized_class_name}_connection.rb",
|
21
|
+
"./spec/factories/#{pluralized_class_name}.rb",
|
22
|
+
"./spec/mutations/#{singularized_class_name}_spec.rb",
|
23
|
+
"./spec/models/#{singularized_class_name}_spec.rb",
|
24
|
+
"./spec/queries/#{singularized_class_name}_spec.rb",
|
25
|
+
"./spec/policies/#{singularized_class_name}_policy_spec.rb",
|
26
|
+
"./spec/resolvers/#{singularized_class_name}_search_spec.rb"
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.get_type_and_name(line)
|
31
|
+
line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.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
|
+
def self.type_check(type)
|
46
|
+
{
|
47
|
+
bigint: "Integer",
|
48
|
+
string: "String",
|
49
|
+
float: "Float",
|
50
|
+
text: "String",
|
51
|
+
datetime: "String",
|
52
|
+
date: "String",
|
53
|
+
boolean: "Boolean",
|
54
|
+
integer: "Integer"
|
55
|
+
}[type.to_sym]
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.get_test_type(type)
|
59
|
+
{
|
60
|
+
bigint: 1,
|
61
|
+
float: 4.2,
|
62
|
+
string: '"MyString"',
|
63
|
+
text: '"MyString"',
|
64
|
+
datetime: "Time.now",
|
65
|
+
date: "Time.now",
|
66
|
+
boolean: false,
|
67
|
+
integer: 1
|
68
|
+
}[type.to_sym]
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.table_check(line: "", class_name: "")
|
72
|
+
if line.include?("create_table") && (line.split[1].gsub("\"", "").gsub(",", "") == class_name.pluralize.to_s)
|
73
|
+
|
74
|
+
return true
|
75
|
+
end
|
76
|
+
|
77
|
+
false
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.migrate(class_name: "souls")
|
81
|
+
singularized_class_name = class_name.singularize
|
82
|
+
model(class_name: singularized_class_name)
|
83
|
+
type(class_name: singularized_class_name)
|
84
|
+
edge(class_name: singularized_class_name)
|
85
|
+
connection(class_name: singularized_class_name)
|
86
|
+
resolver(class_name: singularized_class_name)
|
87
|
+
rspec_factory(class_name: singularized_class_name)
|
88
|
+
rspec_model(class_name: singularized_class_name)
|
89
|
+
rspec_mutation(class_name: singularized_class_name)
|
90
|
+
rspec_query(class_name: singularized_class_name)
|
91
|
+
rspec_resolver(class_name: singularized_class_name)
|
92
|
+
query(class_name: singularized_class_name)
|
93
|
+
mutation(class_name: singularized_class_name)
|
94
|
+
policy(class_name: singularized_class_name)
|
95
|
+
rspec_policy(class_name: singularized_class_name)
|
96
|
+
rescue StandardError => e
|
97
|
+
raise(StandardError, e)
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.migrate_all
|
101
|
+
puts(Paint["Let's Go SOULs AUTO CRUD Assist!\n", :cyan])
|
102
|
+
Souls::Api::Generate.get_tables.each do |table|
|
103
|
+
Souls::Api::Generate.migrate(class_name: table.singularize)
|
104
|
+
puts(Paint["Generated #{table.camelize} CRUD Files\n", :yellow])
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.delete_all(class_name: "souls")
|
109
|
+
singularized_class_name = class_name.singularize.underscore
|
110
|
+
pluralized_class_name = class_name.pluralize.underscore
|
111
|
+
FileUtils.rm("./app/models/#{singularized_class_name}.rb")
|
112
|
+
FileUtils.rm("./app/policies/#{singularized_class_name}_policy.rb")
|
113
|
+
FileUtils.rm_rf("./app/graphql/mutations/base/#{singularized_class_name}")
|
114
|
+
FileUtils.rm("./app/graphql/queries/#{singularized_class_name}.rb")
|
115
|
+
FileUtils.rm("./app/graphql/queries/#{pluralized_class_name}.rb")
|
116
|
+
FileUtils.rm("./app/graphql/resolvers/#{singularized_class_name}_search.rb")
|
117
|
+
FileUtils.rm("./app/graphql/types/#{singularized_class_name}_type.rb")
|
118
|
+
FileUtils.rm("./app/graphql/types/edges/#{singularized_class_name}_edge.rb")
|
119
|
+
FileUtils.rm("./app/graphql/types/connections/#{singularized_class_name}_connection.rb")
|
120
|
+
FileUtils.rm("./spec/factories/#{pluralized_class_name}.rb")
|
121
|
+
FileUtils.rm("./spec/mutations/base/#{singularized_class_name}_spec.rb")
|
122
|
+
FileUtils.rm("./spec/models/#{singularized_class_name}_spec.rb")
|
123
|
+
FileUtils.rm("./spec/queries/#{singularized_class_name}_spec.rb")
|
124
|
+
FileUtils.rm("./spec/policies/#{singularized_class_name}_policy_spec.rb")
|
125
|
+
FileUtils.rm("./spec/resolvers/#{singularized_class_name}_search_spec.rb")
|
126
|
+
puts(Paint["deleted #{class_name.camelize} CRUD!", :yellow])
|
127
|
+
rescue StandardError => e
|
128
|
+
raise(StandardError, e)
|
129
|
+
end
|
130
|
+
|
131
|
+
def self.update_delete(class_name: "souls")
|
132
|
+
singularized_class_name = class_name.singularize.underscore
|
133
|
+
pluralized_class_name = class_name.pluralize.underscore
|
134
|
+
FileUtils.rm_rf("./app/graphql/mutations/#{singularized_class_name}")
|
135
|
+
FileUtils.rm("./app/graphql/queries/#{singularized_class_name}.rb")
|
136
|
+
FileUtils.rm("./app/graphql/queries/#{pluralized_class_name}.rb")
|
137
|
+
FileUtils.rm("./app/graphql/resolvers/#{singularized_class_name}_search.rb")
|
138
|
+
FileUtils.rm("./app/graphql/types/#{singularized_class_name}_type.rb")
|
139
|
+
FileUtils.rm("./app/graphql/types/edges/#{singularized_class_name}_edge.rb")
|
140
|
+
FileUtils.rm("./app/graphql/types/connections/#{singularized_class_name}_connection.rb")
|
141
|
+
FileUtils.rm("./spec/mutations/#{singularized_class_name}_spec.rb")
|
142
|
+
FileUtils.rm("./spec/queries/#{singularized_class_name}_spec.rb")
|
143
|
+
FileUtils.rm("./spec/resolvers/#{singularized_class_name}_search_spec.rb")
|
144
|
+
puts("deleted #{class_name.camelize} CRUD!")
|
145
|
+
rescue StandardError => e
|
146
|
+
raise(StandardError, e)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Souls
|
2
|
+
module Worker
|
3
|
+
module Generate
|
4
|
+
class << self
|
5
|
+
def mailer(class_name: "mailer", option: "")
|
6
|
+
puts(option)
|
7
|
+
if option.to_sym == :sendgrid
|
8
|
+
sendgrid_mailer(class_name: class_name)
|
9
|
+
else
|
10
|
+
mailgun_mailer(class_name: class_name)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def mailgun_mailer(class_name: "mailer")
|
17
|
+
file_dir = "./app/graphql/mutations/mailers/"
|
18
|
+
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
19
|
+
file_path = "#{file_dir}#{class_name.singularize}_mailer.rb"
|
20
|
+
raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
|
21
|
+
|
22
|
+
File.open(file_path, "w") do |f|
|
23
|
+
f.write(<<~TEXT)
|
24
|
+
module Mutations
|
25
|
+
module Mailers
|
26
|
+
class #{class_name.camelize}Mailer < BaseMutation
|
27
|
+
description "Mail γιδΏ‘γγΎγγ"
|
28
|
+
field :response, String, null: false
|
29
|
+
|
30
|
+
def resolve
|
31
|
+
# First, instantiate the Mailgun Client with your API key
|
32
|
+
mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
|
33
|
+
|
34
|
+
# Define your message parameters
|
35
|
+
message_params = {
|
36
|
+
from: "postmaster@YOUR-DOMAIN",
|
37
|
+
to: "sending@to.mail.com",
|
38
|
+
subject: "SOULs Mailer test!",
|
39
|
+
text: "It is really easy to send a message!"
|
40
|
+
}
|
41
|
+
|
42
|
+
# Send your message through the client
|
43
|
+
mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
|
44
|
+
{ response: "Job done!" }
|
45
|
+
rescue StandardError => e
|
46
|
+
GraphQL::ExecutionError.new(e.to_s)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
TEXT
|
51
|
+
end
|
52
|
+
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
53
|
+
file_path
|
54
|
+
end
|
55
|
+
|
56
|
+
def sendgrid_mailer(class_name: "mailer")
|
57
|
+
p("Coming Soon..")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
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.
|
4
|
+
version: 0.29.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-08-
|
13
|
+
date: 2021-08-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/souls/api/generate/application.rb
|
107
107
|
- lib/souls/api/generate/connection.rb
|
108
108
|
- lib/souls/api/generate/edge.rb
|
109
|
+
- lib/souls/api/generate/manager.rb
|
109
110
|
- lib/souls/api/generate/migration.rb
|
110
111
|
- lib/souls/api/generate/model.rb
|
111
112
|
- lib/souls/api/generate/mutation.rb
|
@@ -129,11 +130,14 @@ files:
|
|
129
130
|
- lib/souls/gcloud/run.rb
|
130
131
|
- lib/souls/init.rb
|
131
132
|
- lib/souls/release.rb
|
132
|
-
- lib/souls/release/
|
133
|
+
- lib/souls/release/release.rb
|
133
134
|
- lib/souls/version.rb
|
134
135
|
- lib/souls/versions/.souls_api_version
|
135
136
|
- lib/souls/versions/.souls_worker_version
|
136
137
|
- lib/souls/worker.rb
|
138
|
+
- lib/souls/worker/generate.rb
|
139
|
+
- lib/souls/worker/generate/application.rb
|
140
|
+
- lib/souls/worker/generate/mailer.rb
|
137
141
|
homepage: https://souls.elsoul.nl
|
138
142
|
licenses:
|
139
143
|
- Apache-2.0
|