souls 0.23.5 → 0.23.9
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/.rubocop.yml +73 -138
- data/Gemfile.lock +1 -1
- data/README.md +23 -11
- data/Rakefile +2 -2
- data/config/souls.rb +1 -1
- data/exe/souls +89 -73
- data/lib/souls.rb +157 -144
- data/lib/souls/gcloud.rb +1 -0
- data/lib/souls/gcloud/compute.rb +44 -32
- data/lib/souls/gcloud/iam.rb +9 -9
- data/lib/souls/gcloud/pubsub.rb +21 -0
- data/lib/souls/generate/application.rb +160 -160
- data/lib/souls/generate/connection.rb +13 -15
- data/lib/souls/generate/edge.rb +13 -15
- data/lib/souls/generate/model.rb +16 -17
- data/lib/souls/generate/mutation.rb +225 -221
- data/lib/souls/generate/policy.rb +44 -45
- data/lib/souls/generate/query.rb +49 -49
- data/lib/souls/generate/resolver.rb +121 -124
- data/lib/souls/generate/rspec_factory.rb +49 -52
- data/lib/souls/generate/rspec_model.rb +17 -18
- data/lib/souls/generate/rspec_mutation.rb +193 -199
- data/lib/souls/generate/rspec_policy.rb +38 -39
- data/lib/souls/generate/rspec_query.rb +133 -140
- data/lib/souls/generate/rspec_resolver.rb +147 -154
- data/lib/souls/generate/type.rb +34 -25
- data/lib/souls/init.rb +51 -50
- data/lib/souls/version.rb +2 -1
- data/souls.gemspec +12 -7
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ac8f535bffb1cffc5cc10019b62891735f888982c000bd50e8412a887983bf5
|
4
|
+
data.tar.gz: a5458cc6c2b9f94452a2362f4b62f4e33f98ce5d4e68de038586f9dc0f5ce218
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27c3d5389d371076afe009ea9839dd23ff97701bf3ef5b901a7d5c80eb01bdb2b76f01cec1ffd771cab42acec5cbe64b2baa74846a68dc982a78c46cef3e752c
|
7
|
+
data.tar.gz: e70e36f757202fcc306401e95414de79c671797aeccd27646b2f1b7fdf85552b6f8fcfb7fed0e51d9ecfc55fc1a67bbabe1240e4757349e0e68d36292d425e17
|
data/.rubocop.yml
CHANGED
@@ -1,217 +1,152 @@
|
|
1
|
+
require: rubocop-graphql
|
1
2
|
AllCops:
|
3
|
+
SuggestExtensions: false
|
2
4
|
EnabledByDefault: true
|
5
|
+
Exclude:
|
6
|
+
- "app/**/*.rb"
|
7
|
+
- "db/migrate/*.rb"
|
8
|
+
- "db/schema.rb"
|
9
|
+
- "spec/spec_helper.rb"
|
10
|
+
- "spec/**/*.rb"
|
11
|
+
- "lib/souls/generate/type.rb"
|
3
12
|
|
4
|
-
Style/
|
5
|
-
|
6
|
-
|
7
|
-
Style/ClassAndModuleChildren:
|
13
|
+
Style/Copyright:
|
14
|
+
Description: "Include a copyright notice in each file before any code."
|
8
15
|
Enabled: false
|
16
|
+
VersionAdded: "0.30"
|
17
|
+
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
18
|
+
AutocorrectNotice: "Copyright 2021 by ELSOUL LABO B.V."
|
9
19
|
|
10
|
-
Style/
|
11
|
-
|
20
|
+
Style/TopLevelMethodDefinition:
|
21
|
+
Exclude:
|
22
|
+
- "db/seeds.rb"
|
23
|
+
- "spec/spec_helper.rb"
|
12
24
|
|
13
|
-
Style/
|
14
|
-
|
25
|
+
Style/IpAddresses:
|
26
|
+
Exclude:
|
27
|
+
- "config.ru"
|
28
|
+
- "Gemfile"
|
15
29
|
|
16
|
-
Style/
|
17
|
-
|
30
|
+
Style/HashSyntax:
|
31
|
+
EnforcedStyle: ruby19
|
32
|
+
Exclude:
|
33
|
+
- "**/*.rake"
|
34
|
+
- "Rakefile"
|
18
35
|
|
19
|
-
Style/
|
20
|
-
|
36
|
+
Style/Semicolon:
|
37
|
+
Exclude:
|
38
|
+
- "spec/**/*"
|
21
39
|
|
22
|
-
Style/
|
23
|
-
|
40
|
+
Style/StringLiterals:
|
41
|
+
EnforcedStyle: double_quotes
|
24
42
|
|
25
|
-
Style/
|
43
|
+
Style/ClassVars:
|
44
|
+
Exclude:
|
45
|
+
- "spec/spec_helper.rb"
|
46
|
+
Style/StringConcatenation:
|
26
47
|
Enabled: false
|
27
48
|
|
28
|
-
Style/
|
49
|
+
Style/Documentation:
|
29
50
|
Enabled: false
|
30
51
|
|
31
52
|
Style/DocumentationMethod:
|
32
53
|
Enabled: false
|
33
54
|
|
34
|
-
Style/
|
35
|
-
PreferredMethods:
|
36
|
-
detect: "detect"
|
37
|
-
find: "detect"
|
38
|
-
inject: "inject"
|
39
|
-
reduce: "inject"
|
40
|
-
|
41
|
-
Style/Documentation:
|
42
|
-
Enabled: false
|
43
|
-
|
44
|
-
Style/DoubleNegation:
|
55
|
+
Style/FrozenStringLiteralComment:
|
45
56
|
Enabled: false
|
57
|
+
Style/Lambda:
|
58
|
+
EnforcedStyle: literal
|
46
59
|
|
47
|
-
|
60
|
+
Style/AsciiComments:
|
48
61
|
Enabled: false
|
49
62
|
|
50
|
-
Layout/DotPosition:
|
51
|
-
EnforcedStyle: trailing
|
52
|
-
|
53
|
-
|
54
|
-
Layout/EmptyLineAfterGuardClause:
|
55
|
-
Enabled: false
|
56
|
-
|
57
|
-
Style/EmptyElse:
|
58
|
-
EnforcedStyle: empty
|
59
|
-
|
60
|
-
Layout/ExtraSpacing:
|
61
|
-
Exclude:
|
62
|
-
- "db/migrate/*.rb"
|
63
|
-
- "*.gemspec"
|
64
|
-
|
65
|
-
Style/FormatString:
|
66
|
-
EnforcedStyle: percent
|
67
|
-
|
68
63
|
Style/MissingElse:
|
69
64
|
Enabled: false
|
70
65
|
|
71
66
|
Style/StringHashKeys:
|
72
67
|
Exclude:
|
73
|
-
- "spec
|
74
|
-
- "*.gemspec"
|
75
|
-
|
76
|
-
Style/GuardClause:
|
77
|
-
MinBodyLength: 5
|
78
|
-
|
79
|
-
Style/HashSyntax:
|
80
|
-
EnforcedStyle: ruby19
|
81
|
-
Exclude:
|
82
|
-
- "**/*.rake"
|
83
|
-
- "Rakefile"
|
84
|
-
|
68
|
+
- "spec/**/*.rb"
|
85
69
|
|
86
|
-
Style/
|
70
|
+
Style/CollectionMethods:
|
87
71
|
Enabled: false
|
88
72
|
|
89
|
-
Style/
|
90
|
-
EnforcedStyle: short
|
91
|
-
|
92
|
-
Style/Lambda:
|
73
|
+
Style/FormatString:
|
93
74
|
Enabled: false
|
94
75
|
|
95
|
-
Style/
|
96
|
-
MinDigits: 7
|
97
|
-
|
98
|
-
Style/PerlBackrefs:
|
99
|
-
AutoCorrect: false
|
100
|
-
|
101
|
-
Style/RedundantSelf:
|
76
|
+
Style/ClassAndModuleChildren:
|
102
77
|
Enabled: false
|
103
78
|
|
104
|
-
Style/
|
79
|
+
Style/FormatStringToken:
|
105
80
|
Enabled: false
|
106
81
|
|
107
|
-
Style/
|
108
|
-
AllowMultipleReturnValues: true
|
109
|
-
|
110
|
-
Style/RedundantArgument:
|
82
|
+
Style/ClassMethodsDefinitions:
|
111
83
|
Enabled: false
|
112
84
|
|
113
|
-
|
85
|
+
Layout/ExtraSpacing:
|
114
86
|
Exclude:
|
115
|
-
- "
|
87
|
+
- "db/migrate/*.rb"
|
116
88
|
|
117
|
-
|
118
|
-
|
89
|
+
Layout/LineLength:
|
90
|
+
Exclude:
|
91
|
+
- "lib/souls/generate/rspec_mutation.rb"
|
92
|
+
- "lib/souls/generate/resolver.rb"
|
119
93
|
|
120
|
-
|
94
|
+
Layout/LineEndStringConcatenationIndentation:
|
121
95
|
Enabled: false
|
122
96
|
|
123
|
-
|
124
|
-
EnforcedStyle: double_quotes
|
125
|
-
|
126
|
-
Style/StringLiteralsInInterpolation:
|
97
|
+
GraphQL/ObjectDescription:
|
127
98
|
Enabled: false
|
128
99
|
|
129
|
-
|
100
|
+
GraphQL/FieldDescription:
|
130
101
|
Enabled: false
|
131
102
|
|
132
|
-
|
103
|
+
GraphQL/ArgumentDescription:
|
133
104
|
Enabled: false
|
134
105
|
|
135
|
-
|
106
|
+
GraphQL/ExtractInputType:
|
136
107
|
Enabled: false
|
137
108
|
|
109
|
+
GraphQL/ExtractType:
|
110
|
+
Enabled: false
|
138
111
|
|
139
|
-
|
112
|
+
GraphQL/ArgumentName:
|
140
113
|
Enabled: false
|
141
114
|
|
142
|
-
|
143
|
-
|
115
|
+
Lint/ConstantResolution:
|
116
|
+
Enabled: false
|
144
117
|
|
145
|
-
|
118
|
+
Lint/NumberConversion:
|
146
119
|
Enabled: false
|
147
120
|
|
148
|
-
|
121
|
+
Lint/MissingSuper:
|
149
122
|
Enabled: false
|
150
123
|
|
151
|
-
|
124
|
+
Metrics/AbcSize:
|
152
125
|
Enabled: false
|
153
|
-
|
154
126
|
|
155
127
|
Metrics/MethodLength:
|
156
128
|
Enabled: false
|
157
129
|
|
158
|
-
Metrics/
|
130
|
+
Metrics/BlockLength:
|
159
131
|
Enabled: false
|
160
132
|
|
161
|
-
|
162
|
-
|
133
|
+
Metrics/CyclomaticComplexity:
|
134
|
+
Enabled: false
|
163
135
|
|
164
|
-
|
136
|
+
Metrics/PerceivedComplexity:
|
165
137
|
Enabled: false
|
166
138
|
|
167
139
|
Metrics/ModuleLength:
|
168
140
|
Enabled: false
|
169
141
|
|
170
|
-
|
142
|
+
Metrics/BlockNesting:
|
171
143
|
Enabled: false
|
172
144
|
|
173
|
-
|
145
|
+
Naming/AccessorMethodName:
|
174
146
|
Enabled: false
|
175
147
|
|
176
|
-
Naming/
|
148
|
+
Naming/PredicateName:
|
177
149
|
Enabled: false
|
178
150
|
|
179
151
|
Bundler/GemComment:
|
180
|
-
Enabled: false
|
181
|
-
|
182
|
-
Style/SafeNavigation:
|
183
|
-
Enabled: false
|
184
|
-
|
185
|
-
Lint/NumberConversion:
|
186
|
-
Enabled: false
|
187
|
-
Style/ConstantVisibility:
|
188
|
-
Enabled: false
|
189
|
-
Style/MutableConstant:
|
190
|
-
Enabled: false
|
191
|
-
Style/Copyright:
|
192
|
-
Enabled: false
|
193
|
-
Style/MultilineTernaryOperator:
|
194
|
-
Enabled: false
|
195
|
-
Layout/MultilineAssignmentLayout:
|
196
|
-
Enabled: false
|
197
|
-
Style/Send:
|
198
|
-
Enabled: false
|
199
|
-
Style/RedundantFileExtensionInRequire:
|
200
|
-
Enabled: false
|
201
|
-
Style/ClassMethodsDefinitions:
|
202
|
-
Enabled: false
|
203
|
-
Style/GlobalStdStream:
|
204
|
-
Enabled: false
|
205
|
-
Layout/IndentationConsistency:
|
206
|
-
Enabled: false
|
207
|
-
Layout/IndentationWidth:
|
208
|
-
Enabled: false
|
209
|
-
Style/DateTime:
|
210
|
-
Enabled: false
|
211
|
-
Layout/HeredocIndentation:
|
212
|
-
Exclude:
|
213
|
-
- "lib/souls/init.rb"
|
214
|
-
Style/RaiseArgs:
|
215
|
-
Enabled: false
|
216
|
-
Metrics/BlockNesting:
|
217
152
|
Enabled: false
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -21,29 +21,38 @@
|
|
21
21
|
|
22
22
|
Welcome to SOULs Framework!
|
23
23
|
|
24
|
-
SOULs is a Serverless Application Framework.
|
25
|
-
|
24
|
+
SOULs is a Serverless Application Framework.
|
25
|
+
SOULs has six strains, API, Worker, Console, Admin, Media, Doc, and can be used in combination according to the purpose. SOULs Backend GraphQL Ruby & Frontend Relay are Scalable and Easy to deploy to Google Cloud.
|
26
|
+
You can focus on your business logic. No more infra problems.
|
26
27
|
|
27
|
-
SOULs creates
|
28
|
+
SOULs creates 6 types of framework.
|
28
29
|
|
29
30
|
1. API - GraphQL (Ruby) - Simple API - Cloud Run
|
30
31
|
2. Worker - Google Pub/Sub Worker API (Ruby) - Cloud Run
|
31
|
-
3.
|
32
|
+
3. Console Web Client - User Console and CMS (TypeScript)
|
32
33
|
4. Admin Web Client - Admin Console and CMS (TypeScript)
|
34
|
+
5. Media Web Client - Media web client with SSG (TypeScript)
|
35
|
+
6. Doc Web Client - Doc web client with SSG (TypeScript)
|
33
36
|
|
34
37
|
## Dependency
|
35
38
|
|
36
39
|
- [Google SDK](https://cloud.google.com/sdk/docs)
|
37
40
|
- [Docker](https://www.docker.com/)
|
38
41
|
- [Firebase CLI](https://firebase.google.com/docs/cli)
|
42
|
+
- [Ruby](https://www.ruby-lang.org)
|
39
43
|
|
40
44
|
## Cloud Infrastructure
|
41
45
|
|
42
|
-
- [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine)
|
43
|
-
- [Google Traffic Director](https://cloud.google.com/traffic-director)
|
44
46
|
- [Google Cloud Run](https://cloud.google.com/run)
|
47
|
+
- [Google Cloud SQL](https://cloud.google.com/sql)
|
48
|
+
- [Google Cloud Pub/Sub](https://cloud.google.com/pubsub)
|
49
|
+
- [Google Cloud Storage](https://cloud.google.com/run)
|
50
|
+
- [Google Cloud IAM](https://cloud.google.com/iam)
|
51
|
+
- [Google Cloud DNS](https://cloud.google.com/dns)
|
52
|
+
- [Google Cloud Container Registry](https://cloud.google.com/container-registry)
|
45
53
|
- [Google Firebase](https://firebase.google.com/)
|
46
54
|
- [Google Cloud Scheduler](https://cloud.google.com/scheduler)
|
55
|
+
- [Github Actions](https://github.com/features/actions)
|
47
56
|
|
48
57
|
## Installation
|
49
58
|
|
@@ -67,10 +76,13 @@ And Create Your APP
|
|
67
76
|
|
68
77
|
### Choose SOULs Type:
|
69
78
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
79
|
+
Select Strain:
|
80
|
+
1. SOULs GraphQL API
|
81
|
+
2. SOULs Worker
|
82
|
+
3. SOULs Console Web
|
83
|
+
4. SOULs Admin Web
|
84
|
+
5. SOULs Media Web
|
85
|
+
6. SOULs Doc Web
|
74
86
|
|
75
87
|
|
76
88
|
## SOULs Document
|
@@ -81,7 +93,7 @@ And Create Your APP
|
|
81
93
|
|
82
94
|
## Development
|
83
95
|
|
84
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `
|
96
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `souls t` to run the tests. You can also run `souls c` for an interactive prompt that will allow you to experiment.
|
85
97
|
|
86
98
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org/gems/souls).
|
87
99
|
|
data/Rakefile
CHANGED
@@ -10,14 +10,14 @@ namespace :task do
|
|
10
10
|
task :g do
|
11
11
|
file_path = "./lib/souls/generate/"
|
12
12
|
Souls::SOULS_METHODS.each do |f|
|
13
|
-
FileUtils.touch
|
13
|
+
FileUtils.touch("#{file_path}#{f}.rb")
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
task :a do
|
18
18
|
file_path = "./spec/generate/"
|
19
19
|
Souls::SOULS_METHODS.each do |f|
|
20
|
-
FileUtils.touch
|
20
|
+
FileUtils.touch("#{file_path}#{f}_spec.rb")
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/config/souls.rb
CHANGED
data/exe/souls
CHANGED
@@ -1,81 +1,97 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require "souls"
|
3
3
|
begin
|
4
|
-
require
|
5
|
-
rescue
|
6
|
-
puts
|
4
|
+
require("./config/souls") unless ARGV[0] == "new" || ARGV[0] == "i" || ARGV[0] == "-v" || ARGV[0] == "deploy"
|
5
|
+
rescue StandardError
|
6
|
+
puts("Make sure you are at SOULs APP directory!")
|
7
7
|
end
|
8
8
|
begin
|
9
9
|
souls_command = ARGV[0]
|
10
10
|
case souls_command
|
11
11
|
when "new"
|
12
|
-
STRAINS = [
|
12
|
+
STRAINS = %w[api worker console admin media doc].freeze
|
13
13
|
app_name = ARGV[1]
|
14
14
|
if app_name.nil?
|
15
|
-
puts
|
16
|
-
puts
|
15
|
+
puts(Paint["you need to specify your app name", :red])
|
16
|
+
puts(Paint["`souls new app_name`", :yellow])
|
17
17
|
exit
|
18
18
|
end
|
19
19
|
first_message = Paint % [
|
20
|
-
"Select Strain: %{red_text} %{yellow_text} %{green_text} %{blue_text} %{cyan_text}",
|
20
|
+
"Select Strain: %{red_text} %{yellow_text} %{green_text} %{blue_text} %{cyan_text} %{magenta_text}",
|
21
21
|
:white,
|
22
22
|
{
|
23
23
|
red_text: ["\n1. SOULs GraphQL API", :red],
|
24
|
-
yellow_text: ["\n2. SOULs Worker", :yellow],
|
24
|
+
yellow_text: ["\n2. SOULs Pub/Sub Worker", :yellow],
|
25
25
|
green_text: ["\n3. SOULs Console Web", :green],
|
26
26
|
blue_text: ["\n4. SOULs Admin Web", :blue],
|
27
|
-
cyan_text: ["\n5. SOULs Media Web", :cyan]
|
27
|
+
cyan_text: ["\n5. SOULs Media Web", :cyan],
|
28
|
+
magenta_text: ["\n6. SOULs Doc Web", :magenta]
|
28
29
|
}
|
29
30
|
]
|
30
|
-
puts
|
31
|
-
strain =
|
31
|
+
puts(first_message)
|
32
|
+
strain = $stdin.gets.chomp.to_i
|
32
33
|
case strain
|
33
34
|
when 1, 2
|
34
|
-
Souls::Init.download_souls
|
35
|
-
Souls::Init.initial_config_init
|
35
|
+
Souls::Init.download_souls(app_name: app_name, repository_name: "souls_#{STRAINS[strain.to_i - 1]}")
|
36
|
+
Souls::Init.initial_config_init(app_name: app_name, strain: STRAINS[strain.to_i - 1])
|
36
37
|
else
|
37
|
-
puts
|
38
|
+
puts(Paint["Coming Soon...", :blue])
|
38
39
|
end
|
39
40
|
when "s", "server"
|
40
41
|
strain = Souls.configuration.strain
|
41
42
|
case strain
|
42
|
-
when "media", "admin", "console"
|
43
|
-
system
|
43
|
+
when "media", "admin", "console", "doc"
|
44
|
+
system("yarn dev")
|
44
45
|
when "worker"
|
45
|
-
system
|
46
|
+
system("bundle exec puma -p 3000 -e development")
|
46
47
|
else
|
47
|
-
system
|
48
|
+
system("foreman start -f Procfile.dev")
|
48
49
|
end
|
49
50
|
when "c", "console"
|
50
51
|
strain = Souls.configuration.strain
|
51
52
|
case strain
|
52
|
-
when "media", "admin"
|
53
|
-
system
|
53
|
+
when "media", "admin", "console", "doc"
|
54
|
+
system("yarn dev")
|
54
55
|
else
|
55
56
|
rack_env = ARGV[1]
|
56
57
|
case rack_env
|
57
58
|
when "RACK_ENV=production"
|
58
|
-
system
|
59
|
+
system("RACK_ENV=production bundle exec irb")
|
59
60
|
else
|
60
|
-
system
|
61
|
+
system("bundle exec irb")
|
61
62
|
end
|
62
63
|
end
|
63
64
|
when "i", "infra"
|
64
65
|
send_method = ARGV[1]
|
65
|
-
Souls.
|
66
|
+
Souls.public_send(send_method)
|
66
67
|
when "gcloud"
|
67
68
|
status = Paint["Running Gcloud Commands...", :yellow]
|
68
|
-
Whirly.start
|
69
|
+
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
69
70
|
Whirly.status = status
|
70
71
|
send_method = ARGV[1]
|
71
|
-
|
72
|
+
|
73
|
+
case send_method
|
74
|
+
when "create_pubsub_topic"
|
75
|
+
topic_name = ARGV[2]
|
76
|
+
args = { topic_name: topic_name }
|
77
|
+
Souls::Gcloud.public_send(send_method, args)
|
78
|
+
when "create_pubsub_subscription"
|
79
|
+
project_id = Souls.configuration.project_id
|
80
|
+
topic_name = ARGV[2]
|
81
|
+
service_account = "#{Souls.configuration.app}@#{project_id}iam.gserviceaccount.com"
|
82
|
+
endpoint = Souls.configuration.endpoint
|
83
|
+
args = { project_id: project_id, topic_name: topic_name, service_account: service_account, endpoint: endpoint }
|
84
|
+
Souls::Gcloud.public_send(send_method, args)
|
85
|
+
else
|
86
|
+
Souls::Gcloud.public_send(send_method)
|
87
|
+
end
|
72
88
|
Whirly.status = "Done!"
|
73
89
|
end
|
74
90
|
when "-v", "--version"
|
75
|
-
puts
|
91
|
+
puts(Paint[Souls::VERSION, :white])
|
76
92
|
when "gem:update", "gemfile:update"
|
77
93
|
status = Paint["Checking for updates...", :yellow]
|
78
|
-
Whirly.start
|
94
|
+
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
79
95
|
Whirly.status = status
|
80
96
|
Souls.update_gemfile
|
81
97
|
Whirly.status = "Done!"
|
@@ -84,17 +100,17 @@ begin
|
|
84
100
|
graphql_class = ARGV[1]
|
85
101
|
case graphql_class
|
86
102
|
when "mutation"
|
87
|
-
Souls::Init.add_mutation
|
103
|
+
Souls::Init.add_mutation(class_name: "user", file_name: "hoi")
|
88
104
|
when "type"
|
89
|
-
Souls::Init.add_type
|
105
|
+
Souls::Init.add_type(class_name: "user", file_name: "hoi")
|
90
106
|
when "connection"
|
91
|
-
Souls::Init.add_connection
|
107
|
+
Souls::Init.add_connection(class_name: "user", file_name: "hoi")
|
92
108
|
when "edge"
|
93
|
-
Souls::Init.add_edge
|
109
|
+
Souls::Init.add_edge(class_name: "user", file_name: "hoi")
|
94
110
|
when "rspec_mutation"
|
95
|
-
Souls::Init.add_rspec_mutation
|
111
|
+
Souls::Init.add_rspec_mutation(class_name: "user", file_name: "hoi")
|
96
112
|
else
|
97
|
-
puts
|
113
|
+
puts(Paint["Wrong Argument!", :red])
|
98
114
|
end
|
99
115
|
when "g", "generate"
|
100
116
|
graphql_class = ARGV[1]
|
@@ -103,84 +119,84 @@ begin
|
|
103
119
|
when "test_dir"
|
104
120
|
Souls::Generate.test_dir
|
105
121
|
when "model"
|
106
|
-
Souls::Generate.model
|
122
|
+
Souls::Generate.model(class_name: class_name)
|
107
123
|
when "mutation"
|
108
|
-
Souls::Generate.mutation
|
124
|
+
Souls::Generate.mutation(class_name: class_name)
|
109
125
|
when "query"
|
110
|
-
Souls::Generate.query
|
126
|
+
Souls::Generate.query(class_name: class_name)
|
111
127
|
when "type"
|
112
|
-
Souls::Generate.type
|
128
|
+
Souls::Generate.type(class_name: class_name)
|
113
129
|
when "edge"
|
114
|
-
Souls::Generate.edge
|
130
|
+
Souls::Generate.edge(class_name: class_name)
|
115
131
|
when "connection"
|
116
|
-
Souls::Generate.connection
|
132
|
+
Souls::Generate.connection(class_name: class_name)
|
117
133
|
when "resolver"
|
118
|
-
Souls::Generate.resolver
|
134
|
+
Souls::Generate.resolver(class_name: class_name)
|
119
135
|
when "policy"
|
120
|
-
Souls::Generate.policy
|
136
|
+
Souls::Generate.policy(class_name: class_name)
|
121
137
|
when "rspec_factory"
|
122
|
-
Souls::Generate.rspec_factory
|
138
|
+
Souls::Generate.rspec_factory(class_name: class_name)
|
123
139
|
when "rspec_model"
|
124
|
-
Souls::Generate.rspec_model
|
140
|
+
Souls::Generate.rspec_model(class_name: class_name)
|
125
141
|
when "rspec_mutation"
|
126
|
-
Souls::Generate.rspec_mutation
|
142
|
+
Souls::Generate.rspec_mutation(class_name: class_name)
|
127
143
|
when "rspec_query"
|
128
|
-
Souls::Generate.rspec_query
|
144
|
+
Souls::Generate.rspec_query(class_name: class_name)
|
129
145
|
when "rspec_resolver"
|
130
|
-
Souls::Generate.rspec_resolver
|
146
|
+
Souls::Generate.rspec_resolver(class_name: class_name)
|
131
147
|
when "rspec_policy"
|
132
|
-
Souls::Generate.rspec_policy
|
148
|
+
Souls::Generate.rspec_policy(class_name: class_name)
|
133
149
|
when "node_type"
|
134
|
-
Souls::Generate.node_type
|
150
|
+
Souls::Generate.node_type(class_name: class_name)
|
135
151
|
when "job"
|
136
|
-
Souls::Generate.job
|
152
|
+
Souls::Generate.job(class_name: class_name)
|
137
153
|
when "migrate"
|
138
|
-
Souls::Generate.single_migrate
|
154
|
+
Souls::Generate.single_migrate(class_name: class_name)
|
139
155
|
when "migrate_all"
|
140
156
|
Souls::Generate.migrate_all
|
141
157
|
when "migration"
|
142
158
|
pluralized_class_name = class_name.underscore.pluralize
|
143
|
-
system
|
159
|
+
system("rake db:create_migration NAME=create_#{pluralized_class_name}")
|
144
160
|
when "update"
|
145
|
-
Souls::Generate.update_delete
|
146
|
-
Souls::Generate.single_migrate
|
161
|
+
Souls::Generate.update_delete(class_name: class_name)
|
162
|
+
Souls::Generate.single_migrate(class_name: class_name)
|
147
163
|
else
|
148
164
|
"SOULs!"
|
149
165
|
end
|
150
166
|
when "d"
|
151
167
|
class_name = ARGV[1]
|
152
|
-
Souls::Generate.delete_all
|
168
|
+
Souls::Generate.delete_all(class_name: class_name)
|
153
169
|
when "db:create"
|
154
170
|
rack_env = ARGV[1]
|
155
171
|
case rack_env
|
156
172
|
when "RACK_ENV=production"
|
157
|
-
system
|
173
|
+
system("rake db:create RACK_ENV=production")
|
158
174
|
else
|
159
|
-
system
|
175
|
+
system("rake db:create && rake db:create RACK_ENV=test")
|
160
176
|
end
|
161
177
|
when "db:migrate"
|
162
178
|
rack_env = ARGV[1]
|
163
179
|
case rack_env
|
164
180
|
when "RACK_ENV=production"
|
165
|
-
system
|
181
|
+
system("rake db:migrate RACK_ENV=production")
|
166
182
|
else
|
167
|
-
system
|
183
|
+
system("rake db:migrate && rake db:migrate RACK_ENV=test")
|
168
184
|
end
|
169
185
|
when "db:seed"
|
170
186
|
rack_env = ARGV[1]
|
171
187
|
case rack_env
|
172
188
|
when "RACK_ENV=production"
|
173
|
-
system
|
189
|
+
system("rake db:seed RACK_ENV=production")
|
174
190
|
else
|
175
|
-
system
|
191
|
+
system("rake db:seed")
|
176
192
|
end
|
177
193
|
when "db:migrate:reset"
|
178
194
|
rack_env = ARGV[1]
|
179
195
|
case rack_env
|
180
196
|
when "RACK_ENV=production"
|
181
|
-
system
|
197
|
+
system("rake db:migrate:reset RACK_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1")
|
182
198
|
else
|
183
|
-
system
|
199
|
+
system("rake db:migrate:reset && rake db:migrate:reset RACK_ENV=test")
|
184
200
|
end
|
185
201
|
when "db:update"
|
186
202
|
strain = Souls.configuration.strain
|
@@ -190,22 +206,22 @@ begin
|
|
190
206
|
when "worker"
|
191
207
|
other_app = Souls.configuration.api_name
|
192
208
|
else
|
193
|
-
raise
|
209
|
+
raise(StandardError, "Unknown app name!")
|
194
210
|
end
|
195
|
-
system
|
196
|
-
system
|
211
|
+
system("rm -rf ../#{other_app}/db/*")
|
212
|
+
system("cp -r ./db/* ../#{other_app}/db/*")
|
197
213
|
when "t", "test"
|
198
|
-
system
|
199
|
-
system
|
214
|
+
system("rubocop -a")
|
215
|
+
system("bundle exec rspec")
|
200
216
|
when "run"
|
201
|
-
system
|
202
|
-
system
|
217
|
+
system("docker build . -t souls -f Dockerfile.dev")
|
218
|
+
system("docker run --rm --env-file .env -p 3000:3000 souls:latest")
|
203
219
|
when "deploy"
|
204
220
|
project_id = Souls.configuration.project_id
|
205
|
-
system
|
221
|
+
system("gcloud builds submit --config=cloudbuild.yml --project #{project_id}")
|
206
222
|
else
|
207
|
-
puts
|
223
|
+
puts(Paint["Welcome to SOULs!", :green])
|
208
224
|
end
|
209
|
-
rescue StandardError =>
|
210
|
-
puts
|
225
|
+
rescue StandardError => e
|
226
|
+
puts(Paint[e, :red])
|
211
227
|
end
|