souls 0.23.3 → 0.23.7
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 -135
- data/Gemfile.lock +1 -1
- data/README.md +23 -11
- data/Rakefile +2 -2
- data/exe/souls +74 -73
- data/lib/souls.rb +153 -145
- data/lib/souls/gcloud/compute.rb +61 -51
- data/lib/souls/gcloud/iam.rb +22 -24
- 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 +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ef86159c8d1ad6c8801122b80b58937274879225668865f5c21da4654e4a076
|
4
|
+
data.tar.gz: 33f24d59216616940228f0c8409e6d99341a0066c21c43905045a7b456ae0cb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eedc0abbc08ce885f149ef755c4ad8e6ec961921a0e3cf84cb825b04fadf2ad2979a2d6c6d2a47472b43d5fad7b10ff3d36d29e0574f3a0c91a374a20cd7689
|
7
|
+
data.tar.gz: 869475fd3569b722a1c8ef87fe77fe27425c80225ff4e4deab18d550d0ff0c16f860d2054c31dc790dd01298adc4b4214b68d77668be22ca526f1e9447fa2f02
|
data/.rubocop.yml
CHANGED
@@ -1,214 +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/
|
13
|
+
Style/Copyright:
|
14
|
+
Description: "Include a copyright notice in each file before any code."
|
5
15
|
Enabled: false
|
16
|
+
VersionAdded: "0.30"
|
17
|
+
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
18
|
+
AutocorrectNotice: "Copyright 2021 by ELSOUL LABO B.V."
|
6
19
|
|
7
|
-
Style/
|
8
|
-
|
20
|
+
Style/TopLevelMethodDefinition:
|
21
|
+
Exclude:
|
22
|
+
- "db/seeds.rb"
|
23
|
+
- "spec/spec_helper.rb"
|
9
24
|
|
10
|
-
Style/
|
11
|
-
|
25
|
+
Style/IpAddresses:
|
26
|
+
Exclude:
|
27
|
+
- "config.ru"
|
28
|
+
- "Gemfile"
|
12
29
|
|
13
|
-
Style/
|
14
|
-
|
30
|
+
Style/HashSyntax:
|
31
|
+
EnforcedStyle: ruby19
|
32
|
+
Exclude:
|
33
|
+
- "**/*.rake"
|
34
|
+
- "Rakefile"
|
15
35
|
|
16
|
-
Style/
|
17
|
-
|
36
|
+
Style/Semicolon:
|
37
|
+
Exclude:
|
38
|
+
- "spec/**/*"
|
18
39
|
|
19
|
-
Style/
|
20
|
-
|
40
|
+
Style/StringLiterals:
|
41
|
+
EnforcedStyle: double_quotes
|
21
42
|
|
22
|
-
Style/
|
43
|
+
Style/ClassVars:
|
44
|
+
Exclude:
|
45
|
+
- "spec/spec_helper.rb"
|
46
|
+
Style/StringConcatenation:
|
23
47
|
Enabled: false
|
24
48
|
|
25
|
-
Style/
|
49
|
+
Style/Documentation:
|
26
50
|
Enabled: false
|
27
51
|
|
28
52
|
Style/DocumentationMethod:
|
29
53
|
Enabled: false
|
30
54
|
|
31
|
-
Style/
|
32
|
-
PreferredMethods:
|
33
|
-
detect: "detect"
|
34
|
-
find: "detect"
|
35
|
-
inject: "inject"
|
36
|
-
reduce: "inject"
|
37
|
-
|
38
|
-
Style/Documentation:
|
39
|
-
Enabled: false
|
40
|
-
|
41
|
-
Style/DoubleNegation:
|
55
|
+
Style/FrozenStringLiteralComment:
|
42
56
|
Enabled: false
|
57
|
+
Style/Lambda:
|
58
|
+
EnforcedStyle: literal
|
43
59
|
|
44
|
-
|
60
|
+
Style/AsciiComments:
|
45
61
|
Enabled: false
|
46
62
|
|
47
|
-
Layout/DotPosition:
|
48
|
-
EnforcedStyle: trailing
|
49
|
-
|
50
|
-
|
51
|
-
Layout/EmptyLineAfterGuardClause:
|
52
|
-
Enabled: false
|
53
|
-
|
54
|
-
Style/EmptyElse:
|
55
|
-
EnforcedStyle: empty
|
56
|
-
|
57
|
-
Layout/ExtraSpacing:
|
58
|
-
Exclude:
|
59
|
-
- "db/migrate/*.rb"
|
60
|
-
- "*.gemspec"
|
61
|
-
|
62
|
-
Style/FormatString:
|
63
|
-
EnforcedStyle: percent
|
64
|
-
|
65
63
|
Style/MissingElse:
|
66
64
|
Enabled: false
|
67
65
|
|
68
66
|
Style/StringHashKeys:
|
69
67
|
Exclude:
|
70
|
-
- "spec
|
71
|
-
- "*.gemspec"
|
72
|
-
|
73
|
-
Style/GuardClause:
|
74
|
-
MinBodyLength: 5
|
68
|
+
- "spec/**/*.rb"
|
75
69
|
|
76
|
-
Style/
|
77
|
-
EnforcedStyle: ruby19
|
78
|
-
Exclude:
|
79
|
-
- "**/*.rake"
|
80
|
-
- "Rakefile"
|
81
|
-
|
82
|
-
|
83
|
-
Style/IfUnlessModifier:
|
70
|
+
Style/CollectionMethods:
|
84
71
|
Enabled: false
|
85
72
|
|
86
|
-
Style/
|
87
|
-
EnforcedStyle: short
|
88
|
-
|
89
|
-
Style/Lambda:
|
73
|
+
Style/FormatString:
|
90
74
|
Enabled: false
|
91
75
|
|
92
|
-
Style/
|
93
|
-
MinDigits: 7
|
94
|
-
|
95
|
-
Style/PerlBackrefs:
|
96
|
-
AutoCorrect: false
|
97
|
-
|
98
|
-
Style/RedundantSelf:
|
76
|
+
Style/ClassAndModuleChildren:
|
99
77
|
Enabled: false
|
100
78
|
|
101
|
-
Style/
|
79
|
+
Style/FormatStringToken:
|
102
80
|
Enabled: false
|
103
81
|
|
104
|
-
Style/
|
105
|
-
AllowMultipleReturnValues: true
|
106
|
-
|
107
|
-
Style/RedundantArgument:
|
82
|
+
Style/ClassMethodsDefinitions:
|
108
83
|
Enabled: false
|
109
84
|
|
110
|
-
|
85
|
+
Layout/ExtraSpacing:
|
111
86
|
Exclude:
|
112
|
-
- "
|
87
|
+
- "db/migrate/*.rb"
|
113
88
|
|
114
|
-
|
115
|
-
|
89
|
+
Layout/LineLength:
|
90
|
+
Exclude:
|
91
|
+
- "lib/souls/generate/rspec_mutation.rb"
|
92
|
+
- "lib/souls/generate/resolver.rb"
|
116
93
|
|
117
|
-
|
94
|
+
Layout/LineEndStringConcatenationIndentation:
|
118
95
|
Enabled: false
|
119
96
|
|
120
|
-
|
121
|
-
EnforcedStyle: double_quotes
|
122
|
-
|
123
|
-
Style/StringLiteralsInInterpolation:
|
97
|
+
GraphQL/ObjectDescription:
|
124
98
|
Enabled: false
|
125
99
|
|
126
|
-
|
100
|
+
GraphQL/FieldDescription:
|
127
101
|
Enabled: false
|
128
102
|
|
129
|
-
|
103
|
+
GraphQL/ArgumentDescription:
|
130
104
|
Enabled: false
|
131
105
|
|
132
|
-
|
106
|
+
GraphQL/ExtractInputType:
|
133
107
|
Enabled: false
|
134
108
|
|
109
|
+
GraphQL/ExtractType:
|
110
|
+
Enabled: false
|
135
111
|
|
136
|
-
|
112
|
+
GraphQL/ArgumentName:
|
137
113
|
Enabled: false
|
138
114
|
|
139
|
-
|
140
|
-
|
115
|
+
Lint/ConstantResolution:
|
116
|
+
Enabled: false
|
141
117
|
|
142
|
-
|
118
|
+
Lint/NumberConversion:
|
143
119
|
Enabled: false
|
144
120
|
|
145
|
-
|
121
|
+
Lint/MissingSuper:
|
146
122
|
Enabled: false
|
147
123
|
|
148
|
-
|
124
|
+
Metrics/AbcSize:
|
149
125
|
Enabled: false
|
150
|
-
|
151
126
|
|
152
127
|
Metrics/MethodLength:
|
153
128
|
Enabled: false
|
154
129
|
|
155
|
-
Metrics/
|
130
|
+
Metrics/BlockLength:
|
156
131
|
Enabled: false
|
157
132
|
|
158
|
-
|
159
|
-
|
133
|
+
Metrics/CyclomaticComplexity:
|
134
|
+
Enabled: false
|
160
135
|
|
161
|
-
|
136
|
+
Metrics/PerceivedComplexity:
|
162
137
|
Enabled: false
|
163
138
|
|
164
139
|
Metrics/ModuleLength:
|
165
140
|
Enabled: false
|
166
141
|
|
167
|
-
|
142
|
+
Metrics/BlockNesting:
|
168
143
|
Enabled: false
|
169
144
|
|
170
|
-
|
145
|
+
Naming/AccessorMethodName:
|
171
146
|
Enabled: false
|
172
147
|
|
173
|
-
Naming/
|
148
|
+
Naming/PredicateName:
|
174
149
|
Enabled: false
|
175
150
|
|
176
151
|
Bundler/GemComment:
|
177
|
-
Enabled: false
|
178
|
-
|
179
|
-
Style/SafeNavigation:
|
180
|
-
Enabled: false
|
181
|
-
|
182
|
-
Lint/NumberConversion:
|
183
|
-
Enabled: false
|
184
|
-
Style/ConstantVisibility:
|
185
|
-
Enabled: false
|
186
|
-
Style/MutableConstant:
|
187
|
-
Enabled: false
|
188
|
-
Style/Copyright:
|
189
|
-
Enabled: false
|
190
|
-
Style/MultilineTernaryOperator:
|
191
|
-
Enabled: false
|
192
|
-
Layout/MultilineAssignmentLayout:
|
193
|
-
Enabled: false
|
194
|
-
Style/Send:
|
195
|
-
Enabled: false
|
196
|
-
Style/RedundantFileExtensionInRequire:
|
197
|
-
Enabled: false
|
198
|
-
Style/ClassMethodsDefinitions:
|
199
|
-
Enabled: false
|
200
|
-
Style/GlobalStdStream:
|
201
|
-
Enabled: false
|
202
|
-
Layout/IndentationConsistency:
|
203
|
-
Enabled: false
|
204
|
-
Layout/IndentationWidth:
|
205
|
-
Enabled: false
|
206
|
-
Style/DateTime:
|
207
|
-
Enabled: false
|
208
|
-
Layout/HeredocIndentation:
|
209
|
-
Exclude:
|
210
|
-
- "lib/souls/init.rb"
|
211
|
-
Style/RaiseArgs:
|
212
|
-
Enabled: false
|
213
|
-
Metrics/BlockNesting:
|
214
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/exe/souls
CHANGED
@@ -1,81 +1,82 @@
|
|
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} %{magenda_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
|
+
magenda_text: ["\n6. SOULs Doc Web", :magenda]
|
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
|
-
Souls::Gcloud.
|
72
|
+
Souls::Gcloud.public_send(send_method)
|
72
73
|
Whirly.status = "Done!"
|
73
74
|
end
|
74
75
|
when "-v", "--version"
|
75
|
-
puts
|
76
|
+
puts(Paint[Souls::VERSION, :white])
|
76
77
|
when "gem:update", "gemfile:update"
|
77
78
|
status = Paint["Checking for updates...", :yellow]
|
78
|
-
Whirly.start
|
79
|
+
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
79
80
|
Whirly.status = status
|
80
81
|
Souls.update_gemfile
|
81
82
|
Whirly.status = "Done!"
|
@@ -84,17 +85,17 @@ begin
|
|
84
85
|
graphql_class = ARGV[1]
|
85
86
|
case graphql_class
|
86
87
|
when "mutation"
|
87
|
-
Souls::Init.add_mutation
|
88
|
+
Souls::Init.add_mutation(class_name: "user", file_name: "hoi")
|
88
89
|
when "type"
|
89
|
-
Souls::Init.add_type
|
90
|
+
Souls::Init.add_type(class_name: "user", file_name: "hoi")
|
90
91
|
when "connection"
|
91
|
-
Souls::Init.add_connection
|
92
|
+
Souls::Init.add_connection(class_name: "user", file_name: "hoi")
|
92
93
|
when "edge"
|
93
|
-
Souls::Init.add_edge
|
94
|
+
Souls::Init.add_edge(class_name: "user", file_name: "hoi")
|
94
95
|
when "rspec_mutation"
|
95
|
-
Souls::Init.add_rspec_mutation
|
96
|
+
Souls::Init.add_rspec_mutation(class_name: "user", file_name: "hoi")
|
96
97
|
else
|
97
|
-
puts
|
98
|
+
puts(Paint["Wrong Argument!", :red])
|
98
99
|
end
|
99
100
|
when "g", "generate"
|
100
101
|
graphql_class = ARGV[1]
|
@@ -103,84 +104,84 @@ begin
|
|
103
104
|
when "test_dir"
|
104
105
|
Souls::Generate.test_dir
|
105
106
|
when "model"
|
106
|
-
Souls::Generate.model
|
107
|
+
Souls::Generate.model(class_name: class_name)
|
107
108
|
when "mutation"
|
108
|
-
Souls::Generate.mutation
|
109
|
+
Souls::Generate.mutation(class_name: class_name)
|
109
110
|
when "query"
|
110
|
-
Souls::Generate.query
|
111
|
+
Souls::Generate.query(class_name: class_name)
|
111
112
|
when "type"
|
112
|
-
Souls::Generate.type
|
113
|
+
Souls::Generate.type(class_name: class_name)
|
113
114
|
when "edge"
|
114
|
-
Souls::Generate.edge
|
115
|
+
Souls::Generate.edge(class_name: class_name)
|
115
116
|
when "connection"
|
116
|
-
Souls::Generate.connection
|
117
|
+
Souls::Generate.connection(class_name: class_name)
|
117
118
|
when "resolver"
|
118
|
-
Souls::Generate.resolver
|
119
|
+
Souls::Generate.resolver(class_name: class_name)
|
119
120
|
when "policy"
|
120
|
-
Souls::Generate.policy
|
121
|
+
Souls::Generate.policy(class_name: class_name)
|
121
122
|
when "rspec_factory"
|
122
|
-
Souls::Generate.rspec_factory
|
123
|
+
Souls::Generate.rspec_factory(class_name: class_name)
|
123
124
|
when "rspec_model"
|
124
|
-
Souls::Generate.rspec_model
|
125
|
+
Souls::Generate.rspec_model(class_name: class_name)
|
125
126
|
when "rspec_mutation"
|
126
|
-
Souls::Generate.rspec_mutation
|
127
|
+
Souls::Generate.rspec_mutation(class_name: class_name)
|
127
128
|
when "rspec_query"
|
128
|
-
Souls::Generate.rspec_query
|
129
|
+
Souls::Generate.rspec_query(class_name: class_name)
|
129
130
|
when "rspec_resolver"
|
130
|
-
Souls::Generate.rspec_resolver
|
131
|
+
Souls::Generate.rspec_resolver(class_name: class_name)
|
131
132
|
when "rspec_policy"
|
132
|
-
Souls::Generate.rspec_policy
|
133
|
+
Souls::Generate.rspec_policy(class_name: class_name)
|
133
134
|
when "node_type"
|
134
|
-
Souls::Generate.node_type
|
135
|
+
Souls::Generate.node_type(class_name: class_name)
|
135
136
|
when "job"
|
136
|
-
Souls::Generate.job
|
137
|
+
Souls::Generate.job(class_name: class_name)
|
137
138
|
when "migrate"
|
138
|
-
Souls::Generate.single_migrate
|
139
|
+
Souls::Generate.single_migrate(class_name: class_name)
|
139
140
|
when "migrate_all"
|
140
141
|
Souls::Generate.migrate_all
|
141
142
|
when "migration"
|
142
143
|
pluralized_class_name = class_name.underscore.pluralize
|
143
|
-
system
|
144
|
+
system("rake db:create_migration NAME=create_#{pluralized_class_name}")
|
144
145
|
when "update"
|
145
|
-
Souls::Generate.update_delete
|
146
|
-
Souls::Generate.single_migrate
|
146
|
+
Souls::Generate.update_delete(class_name: class_name)
|
147
|
+
Souls::Generate.single_migrate(class_name: class_name)
|
147
148
|
else
|
148
149
|
"SOULs!"
|
149
150
|
end
|
150
151
|
when "d"
|
151
152
|
class_name = ARGV[1]
|
152
|
-
Souls::Generate.delete_all
|
153
|
+
Souls::Generate.delete_all(class_name: class_name)
|
153
154
|
when "db:create"
|
154
155
|
rack_env = ARGV[1]
|
155
156
|
case rack_env
|
156
157
|
when "RACK_ENV=production"
|
157
|
-
system
|
158
|
+
system("rake db:create RACK_ENV=production")
|
158
159
|
else
|
159
|
-
system
|
160
|
+
system("rake db:create && rake db:create RACK_ENV=test")
|
160
161
|
end
|
161
162
|
when "db:migrate"
|
162
163
|
rack_env = ARGV[1]
|
163
164
|
case rack_env
|
164
165
|
when "RACK_ENV=production"
|
165
|
-
system
|
166
|
+
system("rake db:migrate RACK_ENV=production")
|
166
167
|
else
|
167
|
-
system
|
168
|
+
system("rake db:migrate && rake db:migrate RACK_ENV=test")
|
168
169
|
end
|
169
170
|
when "db:seed"
|
170
171
|
rack_env = ARGV[1]
|
171
172
|
case rack_env
|
172
173
|
when "RACK_ENV=production"
|
173
|
-
system
|
174
|
+
system("rake db:seed RACK_ENV=production")
|
174
175
|
else
|
175
|
-
system
|
176
|
+
system("rake db:seed")
|
176
177
|
end
|
177
178
|
when "db:migrate:reset"
|
178
179
|
rack_env = ARGV[1]
|
179
180
|
case rack_env
|
180
181
|
when "RACK_ENV=production"
|
181
|
-
system
|
182
|
+
system("rake db:migrate:reset RACK_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1")
|
182
183
|
else
|
183
|
-
system
|
184
|
+
system("rake db:migrate:reset && rake db:migrate:reset RACK_ENV=test")
|
184
185
|
end
|
185
186
|
when "db:update"
|
186
187
|
strain = Souls.configuration.strain
|
@@ -190,22 +191,22 @@ begin
|
|
190
191
|
when "worker"
|
191
192
|
other_app = Souls.configuration.api_name
|
192
193
|
else
|
193
|
-
raise
|
194
|
+
raise(StandardError, "Unknown app name!")
|
194
195
|
end
|
195
|
-
system
|
196
|
-
system
|
196
|
+
system("rm -rf ../#{other_app}/db/*")
|
197
|
+
system("cp -r ./db/* ../#{other_app}/db/*")
|
197
198
|
when "t", "test"
|
198
|
-
system
|
199
|
-
system
|
199
|
+
system("rubocop -a")
|
200
|
+
system("bundle exec rspec")
|
200
201
|
when "run"
|
201
|
-
system
|
202
|
-
system
|
202
|
+
system("docker build . -t souls -f Dockerfile.dev")
|
203
|
+
system("docker run --rm --env-file .env -p 3000:3000 souls:latest")
|
203
204
|
when "deploy"
|
204
205
|
project_id = Souls.configuration.project_id
|
205
|
-
system
|
206
|
+
system("gcloud builds submit --config=cloudbuild.yml --project #{project_id}")
|
206
207
|
else
|
207
|
-
puts
|
208
|
+
puts(Paint["Welcome to SOULs!", :green])
|
208
209
|
end
|
209
|
-
rescue StandardError =>
|
210
|
-
puts
|
210
|
+
rescue StandardError => e
|
211
|
+
puts(Paint[e, :red])
|
211
212
|
end
|