souls 1.8.15 → 1.9.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32745af9b5a52413990e7877b58dc195c0a6477027456e0e1054f67460e0e228
4
- data.tar.gz: e09028d257f4837aa3e2161ed5dde29b44fa56f3d3d4392731410c1fbcbeb96c
3
+ metadata.gz: 173b8d7d59f4e6634111fe869ad67e98579dd9ca72327bad969add57cb3ec20b
4
+ data.tar.gz: f7e5bf717c6371154582210ecb5d774452d02839769568a5c69b0ac6b50f553f
5
5
  SHA512:
6
- metadata.gz: d4e27c8d6a3da3c2e90176ee859964213ac34d23da244bf24429b7d842558e609cb86b65506b1ed3590c9c6c6cd3e313f24eb5e8ee9e2eaea87fbcef99a2bf53
7
- data.tar.gz: 3a7f47c761f6a5627375a723e95a00de9461f6023600dd0228a17041d6f92fecdf3b779ec2a2ad4d0119fbf1dfdf16df586ab0638ecbc2d0c6ab63675ecae746
6
+ metadata.gz: 886353f53d7257add09aa0afc4a536e34c1b1ecb1bf006abc0d87de19ed157263faac56bb2019f3ce03648bbb16493ba46f5ce7b2934c1f742118841d4916b93
7
+ data.tar.gz: f69694a0587d76bbb848130a920d392890708d5928909a9c89e396cb0207d768b90a8d4830c44a30869a4f2ea38f71a7a85555199c60f23c641a182bbdf2d6cd
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,74 +1,133 @@
1
+
1
2
  # Contributor Covenant Code of Conduct
2
3
 
3
4
  ## Our Pledge
4
5
 
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, caste, color, religion, or sexual
11
+ identity and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
11
15
 
12
16
  ## Our Standards
13
17
 
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
16
20
 
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the overall
27
+ community
22
28
 
23
- Examples of unacceptable behavior by participants include:
29
+ Examples of unacceptable behavior include:
24
30
 
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
31
+ * The use of sexualized language or imagery, and sexual attention or advances of
32
+ any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
28
34
  * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
35
+ * Publishing others' private information, such as a physical or email address,
36
+ without their explicit permission
31
37
  * Other conduct which could reasonably be considered inappropriate in a
32
38
  professional setting
33
39
 
34
- ## Our Responsibilities
40
+ ## Enforcement Responsibilities
35
41
 
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
39
46
 
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
45
51
 
46
52
  ## Scope
47
53
 
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
54
59
 
55
60
  ## Enforcement
56
61
 
57
62
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at fumitake.kawasaki@el-soul.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
+ reported to the community leaders responsible for enforcement at
64
+ [INSERT CONTACT METHOD].
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
63
85
 
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
86
+ **Community Impact**: A violation through a single incident or series of
87
+ actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or permanent
94
+ ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within the
114
+ community.
67
115
 
68
116
  ## Attribution
69
117
 
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.1, available at
120
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
+ [https://www.contributor-covenant.org/translations][translations].
72
128
 
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
@@ -170,6 +170,9 @@ end
170
170
  service_account_key: ${{ secrets.SOULS_GCP_SA_KEY }}
171
171
  export_default_credentials: true
172
172
 
173
+ - name: Sync Tasks
174
+ run: cd apps/#{worker_name} && souls gcloud scheduler sync_schedules
175
+
173
176
  - name: Configure Docker
174
177
  run: gcloud auth configure-docker --quiet
175
178
 
@@ -195,7 +198,6 @@ end
195
198
  --set-env-vars="SOULS_DB_USER=${{ secrets.SOULS_DB_USER }}" \\
196
199
  --set-env-vars="SOULS_DB_PW=${{ secrets.SOULS_DB_PW }}" \\
197
200
  --set-env-vars="SOULS_DB_HOST=${{ secrets.SOULS_DB_HOST }}" \\
198
- --set-env-vars="GITHUB_REPOSITORY=$GITHUB_REPOSITORY" \\
199
201
  --set-env-vars="SOULS_TZ=${{ secrets.SOULS_TZ }}" \\
200
202
  --set-env-vars="SOULS_SECRET_KEY_BASE=${{ secrets.SOULS_SECRET_KEY_BASE }}" \\
201
203
  --set-env-vars="SOULS_PROJECT_ID=${{ secrets.SOULS_GCP_PROJECT_ID }}"
@@ -225,8 +227,6 @@ end
225
227
  end
226
228
  TEXT
227
229
  end
228
- rescue StandardError => e
229
- puts(e)
230
230
  end
231
231
 
232
232
  def souls_helper_rbs(worker_name: "mailer")
@@ -274,11 +274,12 @@ end
274
274
  version = Souls.get_latest_version_txt(service_name: "worker").join(".")
275
275
  file_name = "worker-v#{version}.tgz"
276
276
  url = "https://storage.googleapis.com/souls-bucket/boilerplates/workers/#{file_name}"
277
+ puts(url)
277
278
  system("curl -OL #{url}")
278
279
  system("tar -zxvf ./#{file_name}")
279
280
  system("mv ./worker apps/#{worker_name}")
280
281
  system("cp ./apps/api/config/database.yml ./apps/#{worker_name}/config/")
281
- FileUtils.rm(file_name)
282
+ FileUtils.rm_f(file_name)
282
283
  end
283
284
 
284
285
  def souls_worker_credit(worker_name: "mailer")
@@ -5,7 +5,7 @@ module Souls
5
5
  def rspec_manager(class_name)
6
6
  singularized_class_name = class_name.underscore.singularize
7
7
  file_path = "./spec/mutations/managers/#{singularized_class_name}/#{options[:mutation]}_spec.rb"
8
- FileUtils.rm(file_path)
8
+ FileUtils.rm_f(file_path)
9
9
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
10
10
  file_path
11
11
  end
@@ -4,7 +4,7 @@ module Souls
4
4
  def rspec_mutation(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./spec/mutations/base/#{singularized_class_name}_spec.rb"
7
- FileUtils.rm(file_path)
7
+ FileUtils.rm_f(file_path)
8
8
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
9
  file_path
10
10
  rescue StandardError => e
@@ -4,7 +4,7 @@ module Souls
4
4
  def rspec_query(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./spec/queries/#{singularized_class_name}_spec.rb"
7
- FileUtils.rm(file_path)
7
+ FileUtils.rm_f(file_path)
8
8
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
9
  file_path
10
10
  end
@@ -4,7 +4,7 @@ module Souls
4
4
  def rspec_resolver(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./spec/resolvers/#{singularized_class_name}_search_spec.rb"
7
- FileUtils.rm(file_path)
7
+ FileUtils.rm_f(file_path)
8
8
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
9
  file_path
10
10
  end
@@ -4,7 +4,7 @@ module Souls
4
4
  def type(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./app/graphql/types/#{singularized_class_name}_type.rb"
7
- FileUtils.rm(file_path)
7
+ FileUtils.rm_f(file_path)
8
8
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
9
  file_path
10
10
  end
@@ -6,9 +6,8 @@ module Souls
6
6
  file_path = ""
7
7
  Dir.chdir(Souls.get_mother_path.to_s) do
8
8
  file_dir = "./sig/api/app/graphql/types"
9
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
10
9
  file_path = "#{file_dir}/#{singularized_class_name}_type.rbs"
11
- FileUtils.rm(file_path)
10
+ FileUtils.rm_f(file_path)
12
11
  end
13
12
  puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
14
13
  file_path
@@ -3,6 +3,7 @@ require_relative "./pubsub/index"
3
3
  require_relative "./run/index"
4
4
  require_relative "./sql/index"
5
5
  require_relative "./compute/index"
6
+ require_relative "./scheduler/index"
6
7
  require_relative "../cli_exception"
7
8
 
8
9
  module Souls
@@ -22,13 +23,16 @@ module Souls
22
23
  desc "run [COMMAND]", "souls gcloud run Commands"
23
24
  subcommand "cloud_run", CloudRun
24
25
 
26
+ desc "scheduler [COMMAND]", "souls gcloud schedluer Commands"
27
+ subcommand "scheduler", CloudScheduler
28
+
25
29
  map run: "cloud_run"
26
30
 
27
31
  desc "auth_login", "gcloud config set and gcloud auth login"
28
32
  def auth_login
29
33
  project_id = Souls.configuration.project_id
30
34
  system("gcloud projects describe #{project_id}", out: File::NULL) or raise(Souls::GcloudException)
31
- system("gcloud config set project #{project_id}")
35
+ system("gcloud config set project #{project_id} >/dev/null 2>&1")
32
36
  system("gcloud auth login")
33
37
  end
34
38
 
@@ -36,7 +40,7 @@ module Souls
36
40
  def config_set
37
41
  project_id = Souls.configuration.project_id
38
42
  system("gcloud projects describe #{project_id}", out: File::NULL) or raise(Souls::GcloudException)
39
- system("gcloud config set project #{project_id}")
43
+ system("gcloud config set project #{project_id} >/dev/null 2>&1")
40
44
  end
41
45
 
42
46
  desc "enable_permissions", "Enable Google Cloud APIs for SOULs Framework"
@@ -50,6 +54,7 @@ module Souls
50
54
  system("gcloud services enable containerregistry.googleapis.com")
51
55
  system("gcloud services enable run.googleapis.com")
52
56
  system("gcloud services enable vpcaccess.googleapis.com")
57
+ system("gcloud services enable cloudscheduler.googleapis.com")
53
58
  end
54
59
  end
55
60
  end
@@ -1,15 +1,5 @@
1
1
  module Souls
2
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
- --schedule '0,10,20,30,40,50 * * * *' --uri #{url} --http-method GET"
10
- )
11
- end
12
-
13
3
  desc "list", "Show Google Cloud Run List"
14
4
  def list
15
5
  system("gcloud run services list --platform managed")
@@ -0,0 +1,27 @@
1
+ module Souls
2
+ class CloudScheduler < 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
+ --schedule '0,10,20,30,40,50 * * * *' --uri #{options[:url]} --http-method GET"
10
+ )
11
+ end
12
+
13
+ desc "sync_schedules", "Collect schedules from queries and sync with GCloud"
14
+ def sync_schedules
15
+ require("./app")
16
+ Queries::BaseQuery.all_schedules.each do |k, v|
17
+ worker_name = FileUtils.pwd.split("/").last
18
+ job_name = "#{worker_name}_#{k.to_s.underscore}"
19
+ system("gcloud scheduler jobs delete #{job_name} -q >/dev/null 2>&1")
20
+ system(
21
+ <<~COMMAND)
22
+ gcloud scheduler jobs create pubsub #{job_name} --schedule="#{v}" --topic="#{k}" --attributes="" --message-body="#{k}" --time-zone="#{ENV['SOULS_TZ']}"
23
+ COMMAND
24
+ end
25
+ end
26
+ end
27
+ end
@@ -30,7 +30,6 @@ module Souls
30
30
  SOULS_DB_USER=postgres
31
31
  SOULS_GCP_PROJECT_ID=#{project_id}
32
32
  SOULS_SECRET_KEY_BASE='#{SecureRandom.base64(64)}'
33
- GITHUB_REPOSITORY='elsoul/souls'
34
33
  TZ="#{region_to_timezone(region: region)}"
35
34
  TEXT
36
35
  end
@@ -47,7 +46,6 @@ module Souls
47
46
  SOULS_GCP_REGION=#{region}
48
47
  SOULS_GCLOUDSQL_INSTANCE="#{project_id}:#{region}:#{instance_name}"
49
48
  SOULS_SECRET_KEY_BASE='#{SecureRandom.base64(64)}'
50
- GITHUB_REPOSITORY='elsoul/souls'
51
49
  TZ="#{region_to_timezone(region: region)}"
52
50
  TEXT
53
51
  end
@@ -31,12 +31,12 @@ module Souls
31
31
  desc "watch", "Watch GitHub Actions Workflow"
32
32
  def watch
33
33
  remote_url = `git remote get-url origin`
34
- split_url = %r{\A(git@github.com:)(.+/.+)(\.git)}.match(remote_url)
35
- if split_url.nil? || split_url.size != 4
34
+ split_url = %r{\A(https://|git@)(github.com)(:|/)([^.]+/[^.]+)(\.git)?\z}.match(remote_url)
35
+ if split_url.nil? || split_url.size != 6
36
36
  raise(CLIException, "Cannot access Github, please check your credentials")
37
37
  end
38
38
 
39
- api_request = "gh api -X GET 'repos/#{split_url[2]}/actions/runs'"
39
+ api_request = "gh api -X GET 'repos/#{split_url[4]}/actions/runs'"
40
40
  workflows = JSON.parse(`#{api_request}`)
41
41
 
42
42
  if workflows.nil? || !workflows.key?("workflow_runs")
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.8.15".freeze
2
+ VERSION = "1.9.1".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.8.15
1
+ 1.9.1
@@ -1 +1 @@
1
- 1.8.15
1
+ 1.9.1
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.15
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
8
8
  - KishiTheMechanic
9
9
  - James Neve
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-11-22 00:00:00.000000000 Z
13
+ date: 2021-11-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -168,6 +168,7 @@ files:
168
168
  - lib/souls/cli/gcloud/pubsub/subscriptions.rb
169
169
  - lib/souls/cli/gcloud/pubsub/topics.rb
170
170
  - lib/souls/cli/gcloud/run/index.rb
171
+ - lib/souls/cli/gcloud/scheduler/index.rb
171
172
  - lib/souls/cli/gcloud/sql/index.rb
172
173
  - lib/souls/cli/generate/application.rb
173
174
  - lib/souls/cli/generate/connection.rb
@@ -226,7 +227,7 @@ licenses:
226
227
  - Apache-2.0
227
228
  metadata:
228
229
  rubygems_mfa_required: 'true'
229
- post_install_message:
230
+ post_install_message:
230
231
  rdoc_options: []
231
232
  require_paths:
232
233
  - lib
@@ -242,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
243
  version: '0'
243
244
  requirements: []
244
245
  rubygems_version: 3.2.22
245
- signing_key:
246
+ signing_key:
246
247
  specification_version: 4
247
248
  summary: Build Serverless Apps faster like Rails. Powered by Ruby GraphQL, RBS/Steep,
248
249
  Active Record, RSpec, RuboCop, and Google Cloud.