souls 0.47.1 → 0.49.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 +4 -4
- data/exe/souls +32 -30
- data/lib/souls/api/generate/application.rb +1 -64
- data/lib/souls/api/generate/index.rb +10 -0
- data/lib/souls/api/generate/mutation.rb +4 -4
- data/lib/souls/api/generate/resolver.rb +5 -5
- data/lib/souls/api/generate/rspec_factory.rb +2 -2
- data/lib/souls/api/generate/rspec_mutation.rb +5 -5
- data/lib/souls/api/generate/rspec_query.rb +4 -4
- data/lib/souls/api/generate/rspec_resolver.rb +4 -4
- data/lib/souls/api/generate/type.rb +2 -2
- data/lib/souls/api/update/mutation.rb +2 -2
- data/lib/souls/api/update/resolver.rb +2 -2
- data/lib/souls/api/update/rspec_factory.rb +1 -1
- data/lib/souls/api/update/rspec_mutation.rb +2 -2
- data/lib/souls/api/update/rspec_resolver.rb +1 -1
- data/lib/souls/api/update/type.rb +1 -1
- data/lib/souls/cli/console/index.rb +4 -0
- data/lib/souls/cli/create/index.rb +2 -10
- data/lib/souls/cli/db/index.rb +4 -0
- data/lib/souls/cli/gcloud/pubsub/subscriptions.rb +4 -0
- data/lib/souls/cli/gcloud/pubsub/topics.rb +4 -0
- data/lib/souls/cli/gcloud/sql/index.rb +12 -4
- data/lib/souls/cli/index.rb +4 -0
- data/lib/souls/cli/init/index.rb +155 -0
- data/lib/souls/cli/release/release.rb +91 -3
- data/lib/souls/cli/server/index.rb +4 -0
- data/lib/souls/cli/sync/conf.rb +18 -8
- data/lib/souls/index.rb +0 -1
- data/lib/souls/utils/index.rb +177 -0
- 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.rb +2 -212
- metadata +9 -6
- data/lib/souls/init.rb +0 -153
data/lib/souls/init.rb
DELETED
@@ -1,153 +0,0 @@
|
|
1
|
-
module Souls
|
2
|
-
module Init
|
3
|
-
def self.get_version(repository_name: "souls_api")
|
4
|
-
data = JSON.parse(
|
5
|
-
`curl \
|
6
|
-
-H "Accept: application/vnd.github.v3+json" \
|
7
|
-
-s https://api.github.com/repos/elsoul/#{repository_name}/releases`
|
8
|
-
)
|
9
|
-
data[0]["tag_name"]
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.generate_cd
|
13
|
-
shell = `echo $SHELL`.strip
|
14
|
-
rc =
|
15
|
-
if shell.include?("zsh")
|
16
|
-
"zshrc"
|
17
|
-
else
|
18
|
-
"bash"
|
19
|
-
end
|
20
|
-
system("echo '\nalias api=\'cd apps/api\'' >> ~/.#{rc}")
|
21
|
-
system("echo 'alias mother=\'...\'' >> ~/.#{rc}")
|
22
|
-
system("echo 'alias worker=\'cd apps/worker\'' >> ~/.#{rc}")
|
23
|
-
puts(Paint["run `source ~/.#{rc}` to reflect your .#{rc}", :yellow])
|
24
|
-
puts(Paint["You can move to mother/api/worker just type", :green])
|
25
|
-
puts(Paint["\nmother\n", :white])
|
26
|
-
puts(
|
27
|
-
Paint["to go back to mother dir from api/worker\n\nYou can also go to api/worker from mother dir by typing",
|
28
|
-
:green]
|
29
|
-
)
|
30
|
-
puts(Paint["\napi\n", :white])
|
31
|
-
puts(Paint["or\n", :green])
|
32
|
-
puts(Paint["worker", :white])
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.initial_config_init(app_name: "souls", service_name: "api")
|
36
|
-
config_dir = "./#{app_name}/apps/#{service_name}/config"
|
37
|
-
FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
|
38
|
-
FileUtils.touch("#{config_dir}/souls.rb")
|
39
|
-
file_path = "#{config_dir}/souls.rb"
|
40
|
-
File.open(file_path, "w") do |f|
|
41
|
-
f.write(<<~TEXT)
|
42
|
-
Souls.configure do |config|
|
43
|
-
config.app = "#{app_name}"
|
44
|
-
config.project_id = "#{app_name}-project"
|
45
|
-
config.endpoint = "/endpoint"
|
46
|
-
config.strain = "api"
|
47
|
-
config.fixed_gems = ["excluded_gem"]
|
48
|
-
config.workers = []
|
49
|
-
end
|
50
|
-
TEXT
|
51
|
-
end
|
52
|
-
rescue StandardError => e
|
53
|
-
puts(e)
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.download_github_actions(app_name: "souls-app")
|
57
|
-
file_name = "github.tgz"
|
58
|
-
url = "https://storage.googleapis.com/souls-bucket/github_actions/github.tgz"
|
59
|
-
system("curl -OL #{url}")
|
60
|
-
FileUtils.mkdir_p("#{app_name}/github")
|
61
|
-
system("tar -zxvf ./#{file_name} -C #{app_name}/")
|
62
|
-
FileUtils.rm(file_name)
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.mother_config_init(app_name: "souls-app")
|
66
|
-
config_dir = "./#{app_name}/config"
|
67
|
-
FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
|
68
|
-
FileUtils.touch("#{config_dir}/souls.rb")
|
69
|
-
file_path = "#{config_dir}/souls.rb"
|
70
|
-
File.open(file_path, "w") do |f|
|
71
|
-
f.write(<<~TEXT)
|
72
|
-
Souls.configure do |config|
|
73
|
-
config.app = "#{app_name}"
|
74
|
-
config.project_id = "#{app_name}-project"
|
75
|
-
config.endpoint = "/endpoint"
|
76
|
-
config.strain = "mother"
|
77
|
-
config.fixed_gems = ["excluded_gem"]
|
78
|
-
config.workers = []
|
79
|
-
end
|
80
|
-
TEXT
|
81
|
-
end
|
82
|
-
rescue StandardError => e
|
83
|
-
puts(e)
|
84
|
-
end
|
85
|
-
|
86
|
-
def self.start(args)
|
87
|
-
app_name = args[1]
|
88
|
-
if app_name.nil?
|
89
|
-
puts(Paint["you need to specify your app name", :red])
|
90
|
-
puts(Paint["`souls new souls-app`", :yellow])
|
91
|
-
exit
|
92
|
-
end
|
93
|
-
|
94
|
-
service_name = "api"
|
95
|
-
Souls::Init.download_souls(app_name: app_name, service_name: service_name)
|
96
|
-
Souls::Init.mother_config_init(app_name: app_name)
|
97
|
-
Souls::Init.download_github_actions(app_name: app_name)
|
98
|
-
Souls::Init.initial_config_init(app_name: app_name, service_name: service_name)
|
99
|
-
Souls::Init.souls_api_credit(app_name: app_name, service_name: service_name)
|
100
|
-
end
|
101
|
-
|
102
|
-
def self.download_souls(app_name: "souls", service_name: "api")
|
103
|
-
version = Souls.get_latest_version_txt(service_name: service_name).join(".")
|
104
|
-
file_name = "#{service_name}-v#{version}.tgz"
|
105
|
-
url = "https://storage.googleapis.com/souls-bucket/boilerplates/#{service_name.pluralize}/#{file_name}"
|
106
|
-
system("curl -OL #{url}")
|
107
|
-
system("mkdir -p #{app_name}/apps/#{service_name}")
|
108
|
-
system("tar -zxvf ./#{file_name} -C #{app_name}/apps/")
|
109
|
-
system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/.rubocop.yml")
|
110
|
-
system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Gemfile")
|
111
|
-
system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Procfile.dev")
|
112
|
-
system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Procfile")
|
113
|
-
FileUtils.rm(file_name)
|
114
|
-
end
|
115
|
-
|
116
|
-
def self.souls_api_credit(app_name: "souls", service_name: "api")
|
117
|
-
line = Paint["====================================", :yellow]
|
118
|
-
puts("\n")
|
119
|
-
puts(line)
|
120
|
-
txt2 = <<~TEXT
|
121
|
-
_____ ____ __ ____#{' '}
|
122
|
-
/ ___// __ \\/ / / / / %{red1}
|
123
|
-
\\__ \\/ / / / / / / / %{red2}
|
124
|
-
___/ / /_/ / /_/ / /___%{red3}#{' '}
|
125
|
-
/____/\\____/\\____/_____%{red4}#{' '}
|
126
|
-
TEXT
|
127
|
-
red1 = ["_____", :red]
|
128
|
-
red2 = ["/ ___/", :red]
|
129
|
-
red3 = ["(__ )", :red]
|
130
|
-
red4 = ["/____/", :red]
|
131
|
-
ms = Paint % [txt2, :cyan, { red1: red1, red2: red2, red3: red3, red4: red4 }]
|
132
|
-
puts(ms)
|
133
|
-
puts(line)
|
134
|
-
welcome = Paint["Welcome to SOULs!", :white]
|
135
|
-
puts(welcome)
|
136
|
-
souls_ver = Paint["SOULs Version: #{Souls::VERSION}", :white]
|
137
|
-
puts(souls_ver)
|
138
|
-
puts(line)
|
139
|
-
endroll = <<~TEXT
|
140
|
-
Easy to Run
|
141
|
-
$ cd #{app_name}/apps/#{service_name}
|
142
|
-
$ bundle
|
143
|
-
$ souls s
|
144
|
-
Go To : http://localhost:4000
|
145
|
-
|
146
|
-
Doc: https://souls.elsoul.nl
|
147
|
-
TEXT
|
148
|
-
cd = Paint[endroll, :white]
|
149
|
-
puts(cd)
|
150
|
-
puts(line)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|