souls 1.8.14 → 1.9.0

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: c25448d046f3ccb7457b5245dac3c047b56627698a2ed9e54e1f452d93d92992
4
- data.tar.gz: c8b352a0cdf9b48cb37909d9926f4c205fbc84099bd7b1c752edfeed21792c77
3
+ metadata.gz: 1d42f8146bd0cb2caf649dfbf6d5c6bdbd9655f7c85c3463230c5359cde080e0
4
+ data.tar.gz: b516bb95ca96d96b0d8124322039430e304fa6f1bf4bd7af1190a731c4656ba0
5
5
  SHA512:
6
- metadata.gz: d3a216a10aff587fdd18d4f9194720646429ee7d1e3fe79c2e3bd27cbdea057c8775105ea2768ff12b5069f81c2885a2f12a0993d0decd5bdff15aa448990adc
7
- data.tar.gz: 9724256554c7f5a748d5d1ccf97cfb697e0fd3814c706d047d155b4a22bb7b45bf2ac1adf5ef94b7fb47db924bdcd84d3fcdc4fc4da390c4438497730d23be40
6
+ metadata.gz: 25e87253cae96e0e246ce1a27a50bb9e6dcdf77705249999fa94c618fc5724cd1c58b992d0085791157f49b9119fc5214960eb488952612e05249ed0f74cb840
7
+ data.tar.gz: 2722cc893a908b2b91165dd09817b7d90a700f635e86c5c44fb3f18d37a140216baa912585c81952aa16a7876823aa0218f560d3f3731db2e2cd5d8800b1f564
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
@@ -195,7 +195,6 @@ end
195
195
  --set-env-vars="SOULS_DB_USER=${{ secrets.SOULS_DB_USER }}" \\
196
196
  --set-env-vars="SOULS_DB_PW=${{ secrets.SOULS_DB_PW }}" \\
197
197
  --set-env-vars="SOULS_DB_HOST=${{ secrets.SOULS_DB_HOST }}" \\
198
- --set-env-vars="GITHUB_REPOSITORY=$GITHUB_REPOSITORY" \\
199
198
  --set-env-vars="SOULS_TZ=${{ secrets.SOULS_TZ }}" \\
200
199
  --set-env-vars="SOULS_SECRET_KEY_BASE=${{ secrets.SOULS_SECRET_KEY_BASE }}" \\
201
200
  --set-env-vars="SOULS_PROJECT_ID=${{ secrets.SOULS_GCP_PROJECT_ID }}"
@@ -225,8 +224,6 @@ end
225
224
  end
226
225
  TEXT
227
226
  end
228
- rescue StandardError => e
229
- puts(e)
230
227
  end
231
228
 
232
229
  def souls_helper_rbs(worker_name: "mailer")
@@ -274,11 +271,12 @@ end
274
271
  version = Souls.get_latest_version_txt(service_name: "worker").join(".")
275
272
  file_name = "worker-v#{version}.tgz"
276
273
  url = "https://storage.googleapis.com/souls-bucket/boilerplates/workers/#{file_name}"
274
+ puts(url)
277
275
  system("curl -OL #{url}")
278
276
  system("tar -zxvf ./#{file_name}")
279
277
  system("mv ./worker apps/#{worker_name}")
280
278
  system("cp ./apps/api/config/database.yml ./apps/#{worker_name}/config/")
281
- FileUtils.rm(file_name)
279
+ FileUtils.rm_f(file_name)
282
280
  end
283
281
 
284
282
  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,6 +23,9 @@ 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"
@@ -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,26 @@
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
+ job_name = k.to_s.underscore
18
+ system("gcloud scheduler jobs delete #{job_name} -q >/dev/null 2>&1")
19
+ system(
20
+ <<~COMMAND)
21
+ gcloud scheduler jobs create pubsub #{job_name} --schedule="#{v}" --topic="#{k}" --attributes="" --message-body="#{k}" --time-zone="#{ENV['SOULS_TZ']}"
22
+ COMMAND
23
+ end
24
+ end
25
+ end
26
+ 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,17 +31,14 @@ 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
- puts(api_request)
43
- puts(workflows)
44
-
45
42
  if workflows.nil? || !workflows.key?("workflow_runs")
46
43
  raise(CLIException, "Failed to parse JSON response from Github")
47
44
  end
@@ -51,8 +48,6 @@ module Souls
51
48
  { wf["name"].to_sym => wf["id"] } if wf["status"] == "in_progress"
52
49
  end
53
50
 
54
- puts(wf_info)
55
-
56
51
  wf_id =
57
52
  case wf_info.size
58
53
  when 0
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.8.14".freeze
2
+ VERSION = "1.9.0".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.8.14
1
+ 1.9.0
@@ -1 +1 @@
1
- 1.8.14
1
+ 1.9.0
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: 1.8.14
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
@@ -10,7 +10,7 @@ authors:
10
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