souls 0.51.2 → 0.52.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -1
  3. data/exe/souls +4 -202
  4. data/lib/souls/api/generate/application.rb +97 -94
  5. data/lib/souls/api/generate/connection.rb +5 -4
  6. data/lib/souls/api/generate/edge.rb +5 -4
  7. data/lib/souls/api/generate/index.rb +0 -1
  8. data/lib/souls/api/generate/manager.rb +9 -7
  9. data/lib/souls/api/generate/model.rb +16 -18
  10. data/lib/souls/api/generate/mutation.rb +217 -218
  11. data/lib/souls/api/generate/policy.rb +5 -5
  12. data/lib/souls/api/generate/query.rb +51 -51
  13. data/lib/souls/api/generate/resolver.rb +115 -115
  14. data/lib/souls/api/generate/rspec_factory.rb +53 -53
  15. data/lib/souls/api/generate/rspec_model.rb +5 -5
  16. data/lib/souls/api/generate/rspec_mutation.rb +178 -178
  17. data/lib/souls/api/generate/rspec_policy.rb +5 -5
  18. data/lib/souls/api/generate/rspec_query.rb +111 -111
  19. data/lib/souls/api/generate/rspec_resolver.rb +163 -163
  20. data/lib/souls/api/generate/type.rb +66 -66
  21. data/lib/souls/api/index.rb +7 -4
  22. data/lib/souls/api/update/index.rb +15 -0
  23. data/lib/souls/api/update/mutation.rb +68 -64
  24. data/lib/souls/api/update/resolver.rb +59 -60
  25. data/lib/souls/api/update/rspec_factory.rb +40 -39
  26. data/lib/souls/api/update/rspec_mutation.rb +84 -83
  27. data/lib/souls/api/update/rspec_resolver.rb +70 -69
  28. data/lib/souls/api/update/type.rb +39 -38
  29. data/lib/souls/cli/console/index.rb +13 -1
  30. data/lib/souls/cli/create/index.rb +97 -93
  31. data/lib/souls/cli/db/index.rb +122 -1
  32. data/lib/souls/cli/docker/index.rb +30 -38
  33. data/lib/souls/cli/gcloud/compute/index.rb +100 -98
  34. data/lib/souls/cli/gcloud/iam/index.rb +84 -69
  35. data/lib/souls/cli/gcloud/index.rb +36 -35
  36. data/lib/souls/cli/gcloud/pubsub/subscriptions.rb +40 -27
  37. data/lib/souls/cli/gcloud/pubsub/topics.rb +16 -10
  38. data/lib/souls/cli/gcloud/run/index.rb +23 -17
  39. data/lib/souls/cli/gcloud/sql/index.rb +66 -47
  40. data/lib/souls/cli/index.rb +3 -20
  41. data/lib/souls/cli/init/index.rb +140 -140
  42. data/lib/souls/cli/release/release.rb +106 -105
  43. data/lib/souls/cli/server/index.rb +12 -1
  44. data/lib/souls/cli/sync/conf.rb +39 -38
  45. data/lib/souls/cli/sync/model.rb +19 -20
  46. data/lib/souls/cli/sync/pubsub.rb +69 -70
  47. data/lib/souls/cli/upgrade/gemfile.rb +108 -0
  48. data/lib/souls/cli/upgrade/index.rb +1 -1
  49. data/lib/souls/cli.rb +57 -0
  50. data/lib/souls/index.rb +1 -5
  51. data/lib/souls/version.rb +1 -1
  52. data/lib/souls/versions/.souls_api_version +1 -1
  53. data/lib/souls/versions/.souls_worker_version +1 -1
  54. data/lib/souls/worker/generate/index.rb +1 -1
  55. data/lib/souls/worker/generate/job.rb +45 -0
  56. data/lib/souls/worker/generate/mailer.rb +38 -43
  57. data/lib/souls/worker/index.rb +3 -1
  58. data/lib/souls.rb +2 -0
  59. metadata +19 -5
  60. data/lib/souls/api/generate/migration.rb +0 -51
  61. data/lib/souls/cli/upgrade/gem_update.rb +0 -107
  62. data/lib/souls/worker/generate/mutation.rb +0 -44
@@ -1,37 +1,50 @@
1
1
  module Souls
2
- module Gcloud
3
- module Pubsub
4
- class << self
5
- def create_subscription(
6
- topic_name: "send-user-mail",
7
- project_id: "",
8
- service_account: "",
9
- endpoint: "https:://test.com"
10
- )
11
- project_id = Souls.configuration.project_id if project_id.blank?
12
- service_account = "#{Souls.configuration.app}@#{project_id}.iam.gserviceaccount.com" if service_account.blank?
13
- system(
14
- "gcloud pubsub subscriptions create #{topic_name}-sub \
15
- --topic #{topic_name} \
2
+ class Pubsub < Thor
3
+ desc "create_subscription", "Create Google Cloud PubSub Subscription"
4
+ method_option :topic_name,
5
+ default: "send-user-mailer",
6
+ aliases: "--topic_name",
7
+ desc: "Google Cloud Pubsub Topic Name"
8
+ method_option :endpoint,
9
+ default: "https:://test.com",
10
+ aliases: "--endpoint",
11
+ desc: "Google Cloud Pubsub Push Subscription Endpoint"
12
+ def create_subscription
13
+ project_id = Souls.configuration.project_id
14
+ service_account = "#{Souls.configuration.app}@#{project_id}.iam.gserviceaccount.com"
15
+ system(
16
+ "gcloud pubsub subscriptions create #{options[:topic_name]}-sub \
17
+ --topic #{options[:topic_name]} \
16
18
  --topic-project #{project_id} \
17
19
  --push-auth-service-account #{service_account} \
18
- --push-endpoint #{endpoint} \
20
+ --push-endpoint #{options[:endpoint]} \
19
21
  --expiration-period never
20
22
  "
21
- )
22
- end
23
+ )
24
+ rescue Thor::Error => e
25
+ raise(Thor::Error, e)
26
+ end
23
27
 
24
- def subscription_list
25
- system("gcloud pubsub subscriptions list")
26
- end
28
+ desc "subscription_list", "Show Google Cloud Pubsub Subscription List"
29
+ def subscription_list
30
+ system("gcloud pubsub subscriptions list")
31
+ rescue Thor::Error => e
32
+ raise(Thor::Error, e)
33
+ end
27
34
 
28
- def update_subscription(
29
- topic_name: "send-user-mail",
30
- endpoint: "https:://test.com"
31
- )
32
- system("gcloud pubsub subscriptions update #{topic_name}-sub --push-endpoint #{endpoint} ")
33
- end
34
- end
35
+ desc "update_subscription", "Update Google Cloud Pubsub Subscription Endpoint"
36
+ method_option :topic_name,
37
+ default: "send-user-mailer",
38
+ aliases: "--topic_name",
39
+ desc: "Google Cloud Pubsub Topic Name"
40
+ method_option :endpoint,
41
+ default: "https:://test.com",
42
+ aliases: "--endpoint",
43
+ desc: "Google Cloud Pubsub Push Subscription Endpoint"
44
+ def update_subscription
45
+ system("gcloud pubsub subscriptions update #{options[:topic_name]}-sub --push-endpoint #{options[:endpoint]} ")
46
+ rescue Thor::Error => e
47
+ raise(Thor::Error, e)
35
48
  end
36
49
  end
37
50
  end
@@ -1,15 +1,21 @@
1
1
  module Souls
2
- module Gcloud
3
- module Pubsub
4
- class << self
5
- def create_topic(topic_name: "send-user-mail")
6
- system("gcloud pubsub topics create #{topic_name}")
7
- end
2
+ class Pubsub < Thor
3
+ desc "create_topic", "Create Google Cloud Pubsub Topic"
4
+ method_option :topic_name,
5
+ default: "send-user-mailer",
6
+ aliases: "--topic_name",
7
+ desc: "Google Cloud Pubsub Topic Name"
8
+ def create_topic
9
+ system("gcloud pubsub topics create #{options[:topic_name]}")
10
+ rescue Thor::Error => e
11
+ raise(Thor::Error, e)
12
+ end
8
13
 
9
- def topic_list
10
- system("gcloud pubsub topics list")
11
- end
12
- end
14
+ desc "topic_list", "Show Google Cloud Topic List"
15
+ def topic_list
16
+ system("gcloud pubsub topics list")
17
+ rescue Thor::Error => e
18
+ raise(Thor::Error, e)
13
19
  end
14
20
  end
15
21
  end
@@ -1,24 +1,30 @@
1
1
  module Souls
2
- module Gcloud
3
- module Run
4
- class << self
5
- def awake(app_name: "", url: "")
6
- app_name = Souls.configuration.app if app_name.blank?
7
- system(
8
- "gcloud scheduler jobs create http #{app_name}-awake
2
+ class CloudRun < Thor
3
+ desc "awake", "Set Ping Every 15min by Google Cloud Scheduler"
4
+ method_option :url, default: "https://souls.souls.nl", aliases: "--url", desc: "Set URL"
5
+ def awake
6
+ app_name = Souls.configuration.app
7
+ system(
8
+ "gcloud scheduler jobs create http #{app_name}-awake
9
9
  --schedule '0,10,20,30,40,50 * * * *' --uri #{url} --http-method GET"
10
- )
11
- end
10
+ )
11
+ rescue Thor::Error => e
12
+ raise(Thor::Error, e)
13
+ end
12
14
 
13
- def list(project_id: "")
14
- project_id = Souls.configuration.project_id if project_id.blank?
15
- system("gcloud run services list --project #{project_id} --platform managed")
16
- end
15
+ desc "list", "Show Google Cloud Run List"
16
+ def list(project_id: "")
17
+ project_id = Souls.configuration.project_id if project_id.blank?
18
+ system("gcloud run services list --project #{project_id} --platform managed")
19
+ rescue Thor::Error => e
20
+ raise(Thor::Error, e)
21
+ end
17
22
 
18
- def get_endpoint(worker_name: "")
19
- `gcloud run services list | grep #{worker_name} | awk '{print $4}'`
20
- end
21
- end
23
+ desc "get_endpoint", "Show Worker's Endpoint"
24
+ def get_endpoint(worker_name: "")
25
+ `gcloud run services list | grep #{worker_name} | awk '{print $4}'`
26
+ rescue Thor::Error => e
27
+ raise(Thor::Error, e)
22
28
  end
23
29
  end
24
30
  end
@@ -1,39 +1,52 @@
1
1
  module Souls
2
- module Gcloud
3
- module Sql
4
- class << self
5
- def create_instance(root_pass: "PassWord")
6
- instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
7
- region = Souls.configuration.region
8
- zone = "#{region}-b"
9
- system(
10
- "gcloud sql instances create #{instance_name} \
2
+ class Sql < Thor
3
+ desc "create_instance", "Create Google Cloud SQL - PostgreSQL13"
4
+ method_option :region, default: "", aliases: "--region", desc: "Google Cloud Platform Region"
5
+ method_option :root_password, default: "", aliases: "--root-password", desc: "Set Cloud SQL Root Password"
6
+ def create_instance
7
+ instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
8
+ region = Souls.configuration.region if options[:region].blank?
9
+ zone = "#{region}-b"
10
+ system(
11
+ "gcloud sql instances create #{instance_name} \
11
12
  --database-version=POSTGRES_13 --cpu=2 --memory=7680MB --zone=#{zone} \
12
- --root-password='#{root_pass}' --database-flags cloudsql.iam_authentication=on"
13
- )
14
- end
13
+ --root-password='#{options[:root_password]}' --database-flags cloudsql.iam_authentication=on"
14
+ )
15
+ rescue Thor::Error => e
16
+ raise(Thor::Error, e)
17
+ end
15
18
 
16
- def list
17
- system("gcloud sql instances list")
18
- end
19
+ desc "list", "Show Cloud SQL Instances List"
20
+ def list
21
+ system("gcloud sql instances list")
22
+ rescue Thor::Error => e
23
+ raise(Thor::Error, e)
24
+ end
19
25
 
20
- def setup_private_ip
21
- create_ip_range
22
- create_vpc_connector
23
- assign_network
24
- end
26
+ desc "setup_private_ip", "Enable Private IP"
27
+ def setup_private_ip
28
+ create_ip_range
29
+ create_vpc_connector
30
+ assign_network
31
+ rescue Thor::Error => e
32
+ raise(Thor::Error, e)
33
+ end
25
34
 
26
- def assign_network
27
- app_name = Souls.configuration.app
28
- instance_name = "#{Souls.configuration.app}-db"
29
- project_id = Souls.configuration.project_id
30
- system("gcloud beta sql instances patch #{instance_name} --project=#{project_id} --network=#{app_name}")
31
- end
35
+ desc "assign_network", "Assign Network"
36
+ def assign_network
37
+ app_name = Souls.configuration.app
38
+ instance_name = "#{Souls.configuration.app}-db"
39
+ project_id = Souls.configuration.project_id
40
+ system("gcloud beta sql instances patch #{instance_name} --project=#{project_id} --network=#{app_name}")
41
+ rescue Thor::Error => e
42
+ raise(Thor::Error, e)
43
+ end
32
44
 
33
- def create_ip_range
34
- app_name = Souls.configuration.app
35
- system(
36
- "
45
+ desc "create_ip_range", "Create VPC Adress Range"
46
+ def create_ip_range
47
+ app_name = Souls.configuration.app
48
+ system(
49
+ "
37
50
  gcloud compute addresses create #{app_name}-ip-range \
38
51
  --global \
39
52
  --purpose=VPC_PEERING \
@@ -41,37 +54,43 @@ module Souls
41
54
  --description='peering range for SOULs' \
42
55
  --network=#{app_name} \
43
56
  --project=#{app_name}"
44
- )
45
- end
57
+ )
58
+ rescue Thor::Error => e
59
+ raise(Thor::Error, e)
60
+ end
46
61
 
47
- def create_vpc_connector
48
- app_name = Souls.configuration.app
49
- system(
50
- "
62
+ desc "create_vpc_connector", "Create VPC-PEERING Connect"
63
+ def create_vpc_connector
64
+ app_name = Souls.configuration.app
65
+ system(
66
+ "
51
67
  gcloud services vpc-peerings connect \
52
68
  --service=servicenetworking.googleapis.com \
53
69
  --ranges=#{app_name}-ip-range \
54
70
  --network=#{app_name} \
55
71
  --project=#{app_name}
56
72
  "
57
- )
58
- end
73
+ )
74
+ rescue Thor::Error => e
75
+ raise(Thor::Error, e)
76
+ end
59
77
 
60
- def assign_ip(instance_name: "", ip: "")
61
- ip = `curl inet-ip.info` if ip.blank?
62
- project_id = Souls.configuration.project_id
63
- instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
64
- system(
65
- "
78
+ desc "assgin_ip", "Add Current Grobal IP to White List"
79
+ def assign_ip(instance_name: "", ip: "")
80
+ ip = `curl inet-ip.info` if ip.blank?
81
+ project_id = Souls.configuration.project_id
82
+ instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
83
+ system(
84
+ "
66
85
  gcloud beta sql instances patch #{instance_name} \
67
86
  --project=#{project_id} \
68
87
  --assign-ip \
69
88
  --authorized-networks=#{ip} \
70
89
  --quiet
71
90
  "
72
- )
73
- end
74
- end
91
+ )
92
+ rescue Thor::Error => e
93
+ raise(Thor::Error, e)
75
94
  end
76
95
  end
77
96
  end
@@ -1,30 +1,13 @@
1
+ require_relative "./console/index"
1
2
  require_relative "./create/index"
3
+ require_relative "./db/index"
2
4
  require_relative "./docker/index"
3
5
  require_relative "./gcloud/index"
4
6
  require_relative "./init/index"
5
7
  require_relative "./release/index"
6
8
  require_relative "./sync/index"
7
9
  require_relative "./upgrade/index"
10
+ require_relative "./server/index"
8
11
 
9
12
  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
27
-
28
- module Upgrade
29
- end
30
13
  end
@@ -1,157 +1,157 @@
1
1
  module Souls
2
- module Init
3
- class << self
4
- def get_version(repository_name: "souls_api")
5
- data = JSON.parse(
6
- `curl \
7
- -H "Accept: application/vnd.github.v3+json" \
8
- -s https://api.github.com/repos/elsoul/#{repository_name}/releases`
9
- )
10
- data[0]["tag_name"]
2
+ class CLI < Thor
3
+ desc "new [APP_NAME]", "Create SOULs APP"
4
+ def new(app_name)
5
+ if app_name.nil?
6
+ puts(Paint["you need to specify your app name", :red])
7
+ puts(Paint["`souls new souls-app`", :yellow])
8
+ exit
11
9
  end
12
10
 
13
- def generate_cd
14
- shell = `echo $SHELL`.strip
15
- rc =
16
- if shell.include?("zsh")
17
- "zshrc"
18
- else
19
- "bash"
20
- end
21
- system("echo '\nalias api=\'cd apps/api\'' >> ~/.#{rc}")
22
- system("echo 'alias mother=\'...\'' >> ~/.#{rc}")
23
- system("echo 'alias worker=\'cd apps/worker\'' >> ~/.#{rc}")
24
- puts(Paint["run `source ~/.#{rc}` to reflect your .#{rc}", :yellow])
25
- puts(Paint["You can move to mother/api/worker just type", :green])
26
- puts(Paint["\nmother\n", :white])
27
- puts(
28
- Paint["to go back to mother dir from api/worker\n\nYou can also go to api/worker from mother dir by typing",
29
- :green]
30
- )
31
- puts(Paint["\napi\n", :white])
32
- puts(Paint["or\n", :green])
33
- puts(Paint["worker", :white])
34
- end
11
+ service_name = "api"
12
+ download_souls(app_name: app_name, service_name: service_name)
13
+ mother_config_init(app_name: app_name)
14
+ download_github_actions(app_name: app_name)
15
+ initial_config_init(app_name: app_name, service_name: service_name)
16
+ souls_api_credit(app_name: app_name, service_name: service_name)
17
+ end
35
18
 
36
- def initial_config_init(app_name: "souls", service_name: "api")
37
- config_dir = "./#{app_name}/apps/#{service_name}/config"
38
- FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
39
- FileUtils.touch("#{config_dir}/souls.rb")
40
- file_path = "#{config_dir}/souls.rb"
41
- File.open(file_path, "w") do |f|
42
- f.write(<<~TEXT)
43
- Souls.configure do |config|
44
- config.app = "#{app_name}"
45
- config.project_id = "#{app_name}"
46
- config.region = "asia-northeast1"
47
- config.endpoint = "/endpoint"
48
- config.strain = "api"
49
- config.fixed_gems = ["spring"]
50
- config.workers = []
51
- end
52
- TEXT
53
- end
54
- rescue StandardError => e
55
- puts(e)
56
- end
19
+ private
57
20
 
58
- def download_github_actions(app_name: "souls-app")
59
- file_name = "github.tgz"
60
- url = "https://storage.googleapis.com/souls-bucket/github_actions/github.tgz"
61
- system("curl -OL #{url}")
62
- FileUtils.mkdir_p("#{app_name}/github")
63
- system("tar -zxvf ./#{file_name} -C #{app_name}/")
64
- FileUtils.rm(file_name)
65
- end
21
+ def get_version(repository_name: "souls_api")
22
+ data = JSON.parse(
23
+ `curl \
24
+ -H "Accept: application/vnd.github.v3+json" \
25
+ -s https://api.github.com/repos/elsoul/#{repository_name}/releases`
26
+ )
27
+ data[0]["tag_name"]
28
+ end
66
29
 
67
- def mother_config_init(app_name: "souls-app")
68
- config_dir = "./#{app_name}/config"
69
- FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
70
- FileUtils.touch("#{config_dir}/souls.rb")
71
- file_path = "#{config_dir}/souls.rb"
72
- File.open(file_path, "w") do |f|
73
- f.write(<<~TEXT)
74
- Souls.configure do |config|
75
- config.app = "#{app_name}"
76
- config.project_id = "#{app_name}"
77
- config.region = "asia-northeast1"
78
- config.endpoint = "/endpoint"
79
- config.strain = "mother"
80
- config.fixed_gems = ["spring"]
81
- config.workers = []
82
- end
83
- TEXT
30
+ def generate_cd
31
+ shell = `echo $SHELL`.strip
32
+ rc =
33
+ if shell.include?("zsh")
34
+ "zshrc"
35
+ else
36
+ "bash"
84
37
  end
85
- rescue StandardError => e
86
- puts(e)
38
+ system("echo '\nalias api=\'cd apps/api\'' >> ~/.#{rc}")
39
+ system("echo 'alias mother=\'...\'' >> ~/.#{rc}")
40
+ system("echo 'alias worker=\'cd apps/worker\'' >> ~/.#{rc}")
41
+ puts(Paint["run `source ~/.#{rc}` to reflect your .#{rc}", :yellow])
42
+ puts(Paint["You can move to mother/api/worker just type", :green])
43
+ puts(Paint["\nmother\n", :white])
44
+ puts(
45
+ Paint["to go back to mother dir from api/worker\n\nYou can also go to api/worker from mother dir by typing",
46
+ :green]
47
+ )
48
+ puts(Paint["\napi\n", :white])
49
+ puts(Paint["or\n", :green])
50
+ puts(Paint["worker", :white])
51
+ end
52
+
53
+ def initial_config_init(app_name: "souls", service_name: "api")
54
+ config_dir = "./#{app_name}/apps/#{service_name}/config"
55
+ FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
56
+ FileUtils.touch("#{config_dir}/souls.rb")
57
+ file_path = "#{config_dir}/souls.rb"
58
+ File.open(file_path, "w") do |f|
59
+ f.write(<<~TEXT)
60
+ Souls.configure do |config|
61
+ config.app = "#{app_name}"
62
+ config.project_id = "#{app_name}"
63
+ config.region = "asia-northeast1"
64
+ config.endpoint = "/endpoint"
65
+ config.strain = "api"
66
+ config.fixed_gems = ["spring"]
67
+ config.workers = []
68
+ end
69
+ TEXT
87
70
  end
71
+ rescue StandardError => e
72
+ puts(e)
73
+ end
88
74
 
89
- def start(args)
90
- app_name = args[1]
91
- if app_name.nil?
92
- puts(Paint["you need to specify your app name", :red])
93
- puts(Paint["`souls new souls-app`", :yellow])
94
- exit
95
- end
75
+ def download_github_actions(app_name: "souls-app")
76
+ file_name = "github.tgz"
77
+ url = "https://storage.googleapis.com/souls-bucket/github_actions/github.tgz"
78
+ system("curl -OL #{url}")
79
+ FileUtils.mkdir_p("#{app_name}/github")
80
+ system("tar -zxvf ./#{file_name} -C #{app_name}/")
81
+ FileUtils.rm(file_name)
82
+ end
96
83
 
97
- service_name = "api"
98
- Souls::Init.download_souls(app_name: app_name, service_name: service_name)
99
- Souls::Init.mother_config_init(app_name: app_name)
100
- Souls::Init.download_github_actions(app_name: app_name)
101
- Souls::Init.initial_config_init(app_name: app_name, service_name: service_name)
102
- Souls::Init.souls_api_credit(app_name: app_name, service_name: service_name)
84
+ def mother_config_init(app_name: "souls-app")
85
+ config_dir = "./#{app_name}/config"
86
+ FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
87
+ FileUtils.touch("#{config_dir}/souls.rb")
88
+ file_path = "#{config_dir}/souls.rb"
89
+ File.open(file_path, "w") do |f|
90
+ f.write(<<~TEXT)
91
+ Souls.configure do |config|
92
+ config.app = "#{app_name}"
93
+ config.project_id = "#{app_name}"
94
+ config.region = "asia-northeast1"
95
+ config.endpoint = "/endpoint"
96
+ config.strain = "mother"
97
+ config.fixed_gems = ["spring"]
98
+ config.workers = []
99
+ end
100
+ TEXT
103
101
  end
102
+ rescue StandardError => e
103
+ puts(e)
104
+ end
104
105
 
105
- def download_souls(app_name: "souls", service_name: "api")
106
- version = Souls.get_latest_version_txt(service_name: service_name).join(".")
107
- file_name = "#{service_name}-v#{version}.tgz"
108
- url = "https://storage.googleapis.com/souls-bucket/boilerplates/#{service_name.pluralize}/#{file_name}"
109
- system("curl -OL #{url}")
110
- system("mkdir -p #{app_name}/apps/#{service_name}")
111
- system("tar -zxvf ./#{file_name} -C #{app_name}/apps/")
112
- system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/.rubocop.yml")
113
- system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Gemfile")
114
- system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Procfile.dev")
115
- system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Procfile")
116
- FileUtils.rm(file_name)
117
- end
106
+ def download_souls(app_name: "souls", service_name: "api")
107
+ version = Souls.get_latest_version_txt(service_name: service_name).join(".")
108
+ file_name = "#{service_name}-v#{version}.tgz"
109
+ url = "https://storage.googleapis.com/souls-bucket/boilerplates/#{service_name.pluralize}/#{file_name}"
110
+ system("curl -OL #{url}")
111
+ system("mkdir -p #{app_name}/apps/#{service_name}")
112
+ system("tar -zxvf ./#{file_name} -C #{app_name}/apps/")
113
+ system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/.rubocop.yml")
114
+ system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Gemfile")
115
+ system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Procfile.dev")
116
+ system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Procfile")
117
+ FileUtils.rm(file_name)
118
+ end
118
119
 
119
- def souls_api_credit(app_name: "souls", service_name: "api")
120
- line = Paint["====================================", :yellow]
121
- puts("\n")
122
- puts(line)
123
- txt2 = <<~TEXT
124
- _____ ____ __ ____#{' '}
125
- / ___// __ \\/ / / / / %{red1}
126
- \\__ \\/ / / / / / / / %{red2}
127
- ___/ / /_/ / /_/ / /___%{red3}#{' '}
128
- /____/\\____/\\____/_____%{red4}#{' '}
129
- TEXT
130
- red1 = ["_____", :red]
131
- red2 = ["/ ___/", :red]
132
- red3 = ["(__ )", :red]
133
- red4 = ["/____/", :red]
134
- ms = Paint % [txt2, :cyan, { red1: red1, red2: red2, red3: red3, red4: red4 }]
135
- puts(ms)
136
- puts(line)
137
- welcome = Paint["Welcome to SOULs!", :white]
138
- puts(welcome)
139
- souls_ver = Paint["SOULs Version: #{Souls::VERSION}", :white]
140
- puts(souls_ver)
141
- puts(line)
142
- endroll = <<~TEXT
143
- Easy to Run
144
- $ cd #{app_name}/apps/#{service_name}
145
- $ bundle
146
- $ souls s
147
- Go To : http://localhost:4000
120
+ def souls_api_credit(app_name: "souls", service_name: "api")
121
+ line = Paint["====================================", :yellow]
122
+ puts("\n")
123
+ puts(line)
124
+ txt2 = <<~TEXT
125
+ _____ ____ __ ____#{' '}
126
+ / ___// __ \\/ / / / / %{red1}
127
+ \\__ \\/ / / / / / / / %{red2}
128
+ ___/ / /_/ / /_/ / /___%{red3}#{' '}
129
+ /____/\\____/\\____/_____%{red4}#{' '}
130
+ TEXT
131
+ red1 = ["_____", :red]
132
+ red2 = ["/ ___/", :red]
133
+ red3 = ["(__ )", :red]
134
+ red4 = ["/____/", :red]
135
+ ms = Paint % [txt2, :cyan, { red1: red1, red2: red2, red3: red3, red4: red4 }]
136
+ puts(ms)
137
+ puts(line)
138
+ welcome = Paint["Welcome to SOULs!", :white]
139
+ puts(welcome)
140
+ souls_ver = Paint["SOULs Version: #{Souls::VERSION}", :white]
141
+ puts(souls_ver)
142
+ puts(line)
143
+ endroll = <<~TEXT
144
+ Easy to Run
145
+ $ cd #{app_name}/apps/#{service_name}
146
+ $ bundle
147
+ $ souls s
148
+ Go To : http://localhost:4000
148
149
 
149
- Doc: https://souls.elsoul.nl
150
- TEXT
151
- cd = Paint[endroll, :white]
152
- puts(cd)
153
- puts(line)
154
- end
150
+ Doc: https://souls.elsoul.nl
151
+ TEXT
152
+ cd = Paint[endroll, :white]
153
+ puts(cd)
154
+ puts(line)
155
155
  end
156
156
  end
157
157
  end