souls 0.25.19 → 0.25.20

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: b95e788773391bebd59bf7faf921e9d647bb39f564430b45e239e79c2b0ccfed
4
- data.tar.gz: 22d8445babf829feb19c61209033f5e9b32196f827468f0ad2f9c40aa75305d9
3
+ metadata.gz: 66e0b6654b29ea6a361da6bece2be252de22550bb07c844ad7790fcd548a2ff5
4
+ data.tar.gz: e29b9acf01284142e562e8889743fd696fcf56600aed6c116c7bdb9aa4f3e7d2
5
5
  SHA512:
6
- metadata.gz: 19d6e7e610f56fe92c41c12f2b2175fd92877d2d398a2f246e3a26c18f8cb4d53abb462e4644bf21527c92e9b89e26f16e88e66e68cb682a65c11eecc49b2bc8
7
- data.tar.gz: eca89781a54e42932c3835f56b9c70c3ea1cc3f282b9c4c32c0effeb8ce354e313ce1cafb64ceb90e9191f78c9e92ffe18a5ce6bc9b9503cee257d87bf06bc0b
6
+ metadata.gz: cfd541e08f629d71834914a18ee30c87bf1b25464897e4f6d8b82130d5fcedfbcab9b9ac972f693ee8f0c355b168b097289e82d3bd16bfd79606e529a6532b71
7
+ data.tar.gz: abd69b5e9843eb059268d584830ba7892a583566791f4f77537473df3c5c156cf1c5c345ed625e9f639f1c6c24978f0094be6eb03b301ec7c855c24fd2d2142c
data/exe/souls CHANGED
@@ -9,25 +9,8 @@ begin
9
9
  souls_command = ARGV[0]
10
10
  case souls_command
11
11
  when "new"
12
- STRAINS = %w[api worker console admin media doc].freeze
13
- app_name = ARGV[1]
14
- if app_name.nil?
15
- puts(Paint["you need to specify your app name", :red])
16
- puts(Paint["`souls new app_name`", :yellow])
17
- exit
18
- end
19
-
20
- prompt = TTY::Prompt.new
21
- choices = ["1. SOULs GraphQL API", "2. SOULs Pub/Sub Worker", "3. SOULs Frontend Web"]
22
- choice_num = prompt.select(Paint["Select Strain: ", :cyan], choices)[0].to_i
23
- case choice_num
24
- when 1, 2
25
- service_name = (STRAINS[choice_num.to_i - 1]).to_s
26
- Souls::Init.download_souls(app_name: app_name, service_name: service_name)
27
- Souls::Init.initial_config_init(app_name: app_name, service_name: service_name)
28
- else
29
- puts(Paint["Coming Soon...", :blue])
30
- end
12
+ args = ARGV
13
+ Souls::Init.return_method(args)
31
14
  when "s", "server"
32
15
  strain = Souls.configuration.strain
33
16
  case strain
@@ -53,6 +53,8 @@ module Souls
53
53
  when "update"
54
54
  Souls::Generate.update_delete(class_name: class_name)
55
55
  Souls::Generate.migrate(class_name: class_name)
56
+ when "worker"
57
+ Souls::Init.download_worker
56
58
  else
57
59
  "SOULs!"
58
60
  end
data/lib/souls/init.rb CHANGED
@@ -10,13 +10,15 @@ module Souls
10
10
  end
11
11
 
12
12
  def self.initial_config_init(app_name: "souls", service_name: "api")
13
- FileUtils.touch("./#{app_name}/#{service_name}/config/souls.rb")
14
- file_path = "./#{app_name}/#{service_name}/config/souls.rb"
13
+ config_dir = "./#{app_name}/apps/#{service_name}/config"
14
+ FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
15
+ FileUtils.touch("#{config_dir}/souls.rb")
16
+ file_path = "#{config_dir}/souls.rb"
15
17
  File.open(file_path, "w") do |f|
16
18
  f.write(<<~TEXT)
17
19
  Souls.configure do |config|
18
20
  config.app = "#{app_name}"
19
- config.project_id = "souls-api"
21
+ config.project_id = "souls-app"
20
22
  config.strain = "#{service_name}"
21
23
  config.worker_endpoint = "https://worker.com"
22
24
  config.fixed_gems = ["excluded_gem"]
@@ -27,13 +29,59 @@ module Souls
27
29
  puts(e)
28
30
  end
29
31
 
32
+ def self.mother_config_init(app_name: "souls-app")
33
+ config_dir = "./#{app_name}/config"
34
+ FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
35
+ FileUtils.touch("#{config_dir}/souls.rb")
36
+ file_path = "#{config_dir}/souls.rb"
37
+ File.open(file_path, "w") do |f|
38
+ f.write(<<~TEXT)
39
+ Souls.configure do |config|
40
+ config.app = "#{app_name}"
41
+ config.project_id = "souls-app"
42
+ config.strain = "mother"
43
+ config.api = true
44
+ config.worker = false
45
+ config.frontend = false
46
+ config.worker_endpoint = ""
47
+ config.fixed_gems = ["excluded_gem"]
48
+ end
49
+ TEXT
50
+ end
51
+ rescue StandardError => e
52
+ puts(e)
53
+ end
54
+
55
+ def self.return_method(args)
56
+ strains = %w[api worker console admin media doc].freeze
57
+ app_name = args[1]
58
+ if app_name.nil?
59
+ puts(Paint["you need to specify your app name", :red])
60
+ puts(Paint["`souls new souls-app`", :yellow])
61
+ exit
62
+ end
63
+
64
+ prompt = TTY::Prompt.new
65
+ choices = ["1. SOULs GraphQL API", "2. SOULs Pub/Sub Worker", "3. SOULs Frontend Web"]
66
+ choice_num = prompt.select(Paint["Select Strain: ", :cyan], choices)[0].to_i
67
+ case choice_num
68
+ when 1, 2
69
+ service_name = (strains[choice_num.to_i - 1]).to_s
70
+ Souls::Init.download_souls(app_name: app_name, service_name: service_name)
71
+ Souls::Init.mother_config_init(app_name: app_name)
72
+ Souls::Init.initial_config_init(app_name: app_name, service_name: service_name)
73
+ else
74
+ puts(Paint["Coming Soon...", :blue])
75
+ end
76
+ end
77
+
30
78
  def self.download_souls(app_name: "souls", service_name: "api")
31
79
  version = Souls.get_latest_version_txt(service_name: service_name).join(".")
32
80
  file_name = "#{service_name}-v#{version}.tgz"
33
81
  url = "https://storage.googleapis.com/souls-bucket/boilerplates/#{service_name.pluralize}/#{file_name}"
34
82
  system("curl -OL #{url}")
35
- system("mkdir -p #{app_name}/#{service_name}")
36
- system("tar -zxvf ./#{file_name} -C #{app_name}/")
83
+ system("mkdir -p #{app_name}/apps/#{service_name}")
84
+ system("tar -zxvf ./#{file_name} -C #{app_name}/apps/")
37
85
  FileUtils.rm(file_name)
38
86
  line = Paint["====================================", :yellow]
39
87
  puts("\n")
@@ -59,8 +107,53 @@ module Souls
59
107
  puts(line)
60
108
  endroll = <<~TEXT
61
109
  Easy to Run
62
- $ cd #{app_name}/#{service_name}
110
+ $ cd #{app_name}/app/#{service_name}
111
+ $ bundle
112
+ $ souls s
113
+ Go To : http://localhost:4000
114
+
115
+ Doc: https://souls.elsoul.nl
116
+ TEXT
117
+ cd = Paint[endroll, :white]
118
+ puts(cd)
119
+ puts(line)
120
+ end
121
+
122
+ def self.download_worker
123
+ version = Souls.get_latest_version_txt(service_name: "worker").join(".")
124
+ file_name = "worker-v#{version}.tgz"
125
+ url = "https://storage.googleapis.com/souls-bucket/boilerplates/workers/#{file_name}"
126
+ system("curl -OL #{url}")
127
+ system("mkdir -p ./apps/worker")
128
+ system("tar -zxvf ./#{file_name} -C ./apps/worker")
129
+ FileUtils.rm(file_name)
130
+ line = Paint["====================================", :yellow]
131
+ puts("\n")
132
+ puts(line)
133
+ txt2 = <<~TEXT
134
+ _____ ____ __ ____#{' '}
135
+ / ___// __ \\/ / / / / %{red1}
136
+ \\__ \\/ / / / / / / / %{red2}
137
+ ___/ / /_/ / /_/ / /___%{red3}#{' '}
138
+ /____/\\____/\\____/_____%{red4}#{' '}
139
+ TEXT
140
+ red1 = ["_____", :red]
141
+ red2 = ["/ ___/", :red]
142
+ red3 = ["(__ )", :red]
143
+ red4 = ["/____/", :red]
144
+ ms = Paint % [txt2, :cyan, { red1: red1, red2: red2, red3: red3, red4: red4 }]
145
+ puts(ms)
146
+ puts(line)
147
+ welcome = Paint["SOULs Worker Activated!", :white]
148
+ puts(welcome)
149
+ souls_ver = Paint["SOULs Version: #{Souls::VERSION}", :white]
150
+ puts(souls_ver)
151
+ puts(line)
152
+ endroll = <<~TEXT
153
+ Easy to Run
154
+ $ cd ./apps/worker
63
155
  $ bundle
156
+ $ souls model:update
64
157
  $ souls s
65
158
  Go To : http://localhost:3000
66
159
 
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.25.19".freeze
2
+ VERSION = "0.25.20".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.4.22
1
+ 0.4.23
@@ -1 +1 @@
1
- 0.4.22
1
+ 0.4.23
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.25.19
4
+ version: 0.25.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
@@ -10,8 +10,36 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-08-02 00:00:00.000000000 Z
13
+ date: 2021-08-03 00:00:00.000000000 Z
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
21
+ version: 6.1.4
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - '='
27
+ - !ruby/object:Gem::Version
28
+ version: 6.1.4
29
+ - !ruby/object:Gem::Dependency
30
+ name: dotenv
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - '='
34
+ - !ruby/object:Gem::Version
35
+ version: 2.7.6
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '='
41
+ - !ruby/object:Gem::Version
42
+ version: 2.7.6
15
43
  - !ruby/object:Gem::Dependency
16
44
  name: paint
17
45
  requirement: !ruby/object:Gem::Requirement