firespring_dev_commands 2.2.1.pre.alpha.4 → 2.2.2

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: e88b6624e61a9b925a68bcba5d681a07934dfb893df3a2b3015ab589bdb08d9e
4
- data.tar.gz: 65ead36c027f263b188eabf9532d7a4d56024013aceef93502c14997d973d409
3
+ metadata.gz: b60fb9f23da32fe3006bd63627788753dc822b14d16782e253ecdfe3e516ae12
4
+ data.tar.gz: 94e3b4fc79749292e56e9db5de9f170def61c64e154daa11ef66e8bdbc4049cf
5
5
  SHA512:
6
- metadata.gz: 0fda12454259b1364ef6561b63a03f8bec741ab92d04d2ecf34d6ef1eef21ea7a4bbf058368d8277b07734ba307f89c1d28893c37ab243f891500daa7a0d3846
7
- data.tar.gz: c820bf2ecc04f71928accebeb6a1561d676cd06fbef5b5e3a889fee15218bc049b378ff9d749cfed21a8775457cd555901979a1a2439812fa1eb3df0ae2546ba
6
+ metadata.gz: 5a53e1b2ffd61b54eabf8ad81559054dec6fd40f9023ebf22ec27aea56cc9c3cd884cc329d0055b133da54792e77bce23ea44119fceb67e87493e8e80d5e25af
7
+ data.tar.gz: 10237fa32a8c41d9a9b9c7196d7ded272d5ec4c36ad2cb2d789956acb33ed66a70388d4368b4ac2ed2fc5024aca91381d682cb1ef9f73b226ee5a1c88a44e0bd
@@ -1,5 +1,6 @@
1
1
  module Dev
2
2
  class EndOfLife
3
+ # Class which checks for eol packges referenced by the node package manager
3
4
  class Node
4
5
  attr_reader :node, :lockfile
5
6
 
@@ -8,10 +9,14 @@ module Dev
8
9
  @lockfile = File.join(node.local_path, "#{node.package_file.reverse.split('.')[-1].reverse}-lock.json")
9
10
  end
10
11
 
12
+ # Default to NPM products
11
13
  def default_products
12
14
  npm_products
13
15
  end
14
16
 
17
+ # 1.) Parse the npm lock file
18
+ # 2.) Do some package name and version manipulation
19
+ # 3.) Return the product if it looks like something that the EOL library tracks
15
20
  def npm_products
16
21
  eol = Dev::EndOfLife.new
17
22
  major_version_only_products = %w(ckeditor vue jquery)
@@ -1,5 +1,6 @@
1
1
  module Dev
2
2
  class EndOfLife
3
+ # Class which checks for eol packges referenced by the php package manager
3
4
  class Php
4
5
  attr_reader :php, :lockfile
5
6
 
@@ -8,10 +9,14 @@ module Dev
8
9
  @lockfile = File.join(php.local_path, "#{php.package_file.reverse.split('.')[-1].reverse}.lock")
9
10
  end
10
11
 
12
+ # Default to Composer products
11
13
  def default_products
12
14
  composer_products
13
15
  end
14
16
 
17
+ # 1.) Parse the composer lock file
18
+ # 2.) Do some package name and version manipulation
19
+ # 3.) Return the product if it looks like something that the EOL library tracks
15
20
  def composer_products
16
21
  eol = Dev::EndOfLife.new
17
22
  major_version_only_products = ['laravel']
@@ -1,5 +1,6 @@
1
1
  module Dev
2
2
  class EndOfLife
3
+ # Class which checks for eol packges referenced by the ruby package manager
3
4
  class Ruby
4
5
  attr_reader :ruby, :lockfile
5
6
 
@@ -8,11 +9,15 @@ module Dev
8
9
  @lockfile = File.join(ruby.local_path, "#{ruby.package_file.reverse.split('.')[-1].reverse}.lock")
9
10
  end
10
11
 
12
+ # Default to Rubygems products
11
13
  def default_products
12
- composer_products
14
+ rubygems_products
13
15
  end
14
16
 
15
- def composer_products
17
+ # 1.) Parse the rubygems lock file
18
+ # 2.) Do some package name and version manipulation
19
+ # 3.) Return the product if it looks like something that the EOL library tracks
20
+ def rubygems_products
16
21
  eol = Dev::EndOfLife.new
17
22
  major_version_only_products = []
18
23
 
@@ -1,6 +1,5 @@
1
1
  require 'fileutils'
2
2
  require 'git'
3
- require 'octokit'
4
3
 
5
4
  module Dev
6
5
  # Class for performing git functions
@@ -409,10 +408,7 @@ module Dev
409
408
  # Clones the repo_name into the dir
410
409
  # Optionally specify a repo_org
411
410
  # Optionally specify a branch to check out (defaults to the repository default branch)
412
- def clone_repo(dir:, repo_name:, repo_org: nil, branch: nil, depth: nil)
413
- # TODO: Split out the default of 'firespring' into a configuration variable
414
- repo_org = 'firespring' if repo_org.to_s.strip.empty?
415
-
411
+ def clone_repo(dir:, repo_name:, repo_org: 'firespring', branch: nil, depth: nil)
416
412
  if Dir.exist?("#{dir}/.git")
417
413
  puts "#{dir} already cloned".light_green
418
414
  return
@@ -429,19 +425,6 @@ module Dev
429
425
  g.fetch('origin', prune: true)
430
426
  end
431
427
 
432
- def commit_status(token:, repo_name:, commit_id:, status:, repo_org: nil, options: {})
433
- # TODO: Split out the default of 'firespring' into a configuration variable
434
- repo_org = 'firespring' if repo_org.to_s.strip.empty?
435
- repo = "#{repo_org}/#{repo_name}"
436
-
437
- # Set up the GitHub client
438
- client = Octokit::Client.new(access_token: token)
439
-
440
- # Create the commit status
441
- puts "Tagging commit #{commit_id} in #{repo} as #{status} for #{options[:context]}"
442
- client.create_status(repo, commit_id, status, options)
443
- end
444
-
445
428
  # Builds an ssh repo URL using the org and repo name given
446
429
  def ssh_repo_url(name, org)
447
430
  "git@github.com:#{org}/#{name}.git"
@@ -16,6 +16,10 @@ module Dev
16
16
  def to_report
17
17
  Dev::Audit::Report.new(
18
18
  data['advisories'].map do |_, v|
19
+ # If there are multiple advisories for the same package, v changes from an array into a hash
20
+ v = v.values if v.is_a?(Hash)
21
+
22
+ # Iterate over the advisories and turn them into report items
19
23
  v.map do |it|
20
24
  Dev::Audit::Report::Item.new(
21
25
  id: it['advisoryId'],
@@ -18,6 +18,22 @@ module Dev
18
18
  end
19
19
  end
20
20
 
21
+ # Create the rake task which shows the current AWS account information
22
+ def create_show_account_info_task!
23
+ # Have to set a local variable to be accessible inside of the instance_eval block
24
+ exclude = @exclude
25
+
26
+ DEV_COMMANDS_TOP_LEVEL.instance_eval do
27
+ return if exclude.include?(:show_account_info)
28
+
29
+ task show_account_info: %w(init ensure_aws_credentials) do
30
+ account_id = Dev::Aws::Credentials.new.logged_in_account
31
+ account_name = Dev::Aws::Account.new.name_by_account(account_id)
32
+ LOG.info "\n Current AWS Account is #{account_name} (#{account_id})\n".light_yellow
33
+ end
34
+ end
35
+ end
36
+
21
37
  # Create the rake task for the aws profile method
22
38
  def create_profile_task!
23
39
  # Have to set a local variable to be accessible inside of the instance_eval block
@@ -20,15 +20,17 @@ module Dev
20
20
  # Have to set a local variable to be accessible inside of the instance_eval block
21
21
  exclude = @exclude
22
22
  cloudformations = @cloudformations
23
- return if exclude.include?(:status)
23
+ return if exclude.include?(:create)
24
24
 
25
25
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
26
26
  namespace :ci do
27
27
  desc 'Create the ci cloudformation stack in aws'
28
- task create: %w(init ensure_aws_credentials) do
29
- LOG.info
28
+ task create: %w(init ensure_aws_credentials show_account_info) do
30
29
  next if cloudformations.empty?
31
30
 
31
+ names = cloudformations.map(&:name).join(', ')
32
+ Dev::Common.new.exit_unless_confirmed(" This will create the #{names} pipelines. Continue?")
33
+
32
34
  # Start create on all stacks without waiting so they are created in parallel
33
35
  cloudformations.each do |cloudformation|
34
36
  next if cloudformation.exist?
@@ -53,15 +55,17 @@ module Dev
53
55
  # Have to set a local variable to be accessible inside of the instance_eval block
54
56
  exclude = @exclude
55
57
  cloudformations = @cloudformations
56
- return if exclude.include?(:status)
58
+ return if exclude.include?(:update)
57
59
 
58
60
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
59
61
  namespace :ci do
60
62
  desc 'Update the ci cloudformation stack in aws'
61
- task update: %w(init ensure_aws_credentials) do
62
- LOG.info
63
+ task update: %w(init ensure_aws_credentials show_account_info) do
63
64
  next if cloudformations.empty?
64
65
 
66
+ names = cloudformations.map(&:name).join(', ')
67
+ Dev::Common.new.exit_unless_confirmed(" This will update the #{names} pipelines. Continue?")
68
+
65
69
  # Start update on all stacks without waiting so they are updated in parallel
66
70
  cloudformations.each do |cloudformation|
67
71
  next unless cloudformation.exist?
@@ -86,15 +90,17 @@ module Dev
86
90
  # Have to set a local variable to be accessible inside of the instance_eval block
87
91
  exclude = @exclude
88
92
  cloudformations = @cloudformations
89
- return if exclude.include?(:status)
93
+ return if exclude.include?(:delete)
90
94
 
91
95
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
92
96
  namespace :ci do
93
97
  desc 'Delete the ci cloudformation stack in aws'
94
- task delete: %w(init ensure_aws_credentials) do
95
- LOG.info
98
+ task delete: %w(init ensure_aws_credentials show_account_info) do
96
99
  next if cloudformations.empty?
97
100
 
101
+ names = cloudformations.map(&:name).join(', ')
102
+ Dev::Common.new.exit_unless_confirmed(" This will delete the #{names} pipelines. Continue?")
103
+
98
104
  # Start delete on all stacks without waiting so they are deleted in parallel
99
105
  cloudformations.each do |cloudformation|
100
106
  next unless cloudformation.exist?
@@ -124,8 +130,7 @@ module Dev
124
130
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
125
131
  namespace :ci do
126
132
  desc 'Show the current status of the pipelines associated with your branch'
127
- task status: %w(init ensure_aws_credentials) do
128
- LOG.info
133
+ task status: %w(init ensure_aws_credentials show_account_info) do
129
134
  next if cloudformations.empty?
130
135
 
131
136
  pattern = /#{cloudformations.map(&:name).join('|')}/
@@ -159,154 +159,6 @@ module Dev
159
159
  end
160
160
  end
161
161
  end
162
-
163
- # Create the rake task for the git commit status pending task.
164
- def create_commit_status_pending_task!
165
- # Have to set a local variable to be accessible inside of the instance_eval block
166
- exclude = @exclude
167
-
168
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
169
- namespace :git do
170
- return if exclude.include?(:commit_status)
171
-
172
- namespace :commit_status do
173
- desc 'Add pending status to commit' \
174
- "\n\tuse GITHUB_TOKEN=abc123 enables write options for the check (required)" \
175
- "\n\tuse REPOSITORY=abc123 to specify the repository (required)" \
176
- "\n\tuse COMMIT_ID=abc123 to specify the commit id of code (required)" \
177
- "\n\tuse CONTEXT=abc123 names the check on the PR (optional)" \
178
- "\n\tuse TARGET_URL={url} adds 'detail' hyperlink to check on the PR (optional)"
179
- task :pending do
180
- status = 'pending'
181
- token = ENV['GITHUB_TOKEN'].to_s.strip
182
- repo_org, repo_name = ENV['REPOSITORY'].to_s.strip.split('/')
183
- commit_id = ENV['COMMIT_ID'].to_s.strip
184
-
185
- raise 'GITHUB_TOKEN is required' unless token
186
- raise 'REPOSITORY is required' unless repo_name
187
- raise 'COMMIT_ID is required' unless commit_id
188
-
189
- options = {}
190
- options[:context] = ENV['CONTEXT'].to_s.strip unless ENV['CONTEXT'].to_s.strip.empty?
191
- options[:target_url] = ENV['TARGET_URL'].to_s.strip unless ENV['TARGET_URL'].to_s.strip.empty?
192
-
193
- Dev::Git.new.commit_status(token:, repo_name:, commit_id:, status:, repo_org:, options:)
194
- end
195
- end
196
- end
197
- end
198
- end
199
-
200
- # Create the rake task for the git commit status success task.
201
- def create_commit_status_success_task!
202
- # Have to set a local variable to be accessible inside of the instance_eval block
203
- exclude = @exclude
204
-
205
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
206
- namespace :git do
207
- return if exclude.include?(:commit_status)
208
-
209
- namespace :commit_status do
210
- desc 'Add success status to commit' \
211
- "\n\tuse GITHUB_TOKEN=abc123 enables write options for the check (required)" \
212
- "\n\tuse REPOSITORY=abc123 to specify the repository (required)" \
213
- "\n\tuse COMMIT_ID=abc123 to specify the commit id of code (required)" \
214
- "\n\tuse CONTEXT=abc123 names the check on the PR (optional)" \
215
- "\n\tuse TARGET_URL={url} adds 'detail' hyperlink to check on the PR (optional)"
216
- task :success do
217
- status = 'success'
218
- token = ENV['GITHUB_TOKEN'].to_s.strip
219
- repo_org, repo_name = ENV['REPOSITORY'].to_s.strip.split('/')
220
- commit_id = ENV['COMMIT_ID'].to_s.strip
221
-
222
- raise 'GITHUB_TOKEN is required' unless token
223
- raise 'REPOSITORY is required' unless repo_name
224
- raise 'COMMIT_ID is required' unless commit_id
225
-
226
- options = {}
227
- options[:context] = ENV['CONTEXT'].to_s.strip unless ENV['CONTEXT'].to_s.strip.empty?
228
- options[:target_url] = ENV['TARGET_URL'].to_s.strip unless ENV['TARGET_URL'].to_s.strip.empty?
229
-
230
- Dev::Git.new.commit_status(token:, repo_name:, commit_id:, status:, repo_org:, options:)
231
- end
232
- end
233
- end
234
- end
235
- end
236
-
237
- # Create the rake task for the git commit status error task.
238
- def create_commit_status_error_task!
239
- # Have to set a local variable to be accessible inside of the instance_eval block
240
- exclude = @exclude
241
-
242
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
243
- namespace :git do
244
- return if exclude.include?(:commit_status)
245
-
246
- namespace :commit_status do
247
- desc 'Add error status to commit' \
248
- "\n\tuse GITHUB_TOKEN=abc123 enables write options for the check (required)" \
249
- "\n\tuse REPOSITORY=abc123 to specify the repository (required)" \
250
- "\n\tuse COMMIT_ID=abc123 to specify the commit id of code (required)" \
251
- "\n\tuse CONTEXT=abc123 names the check on the PR (optional)" \
252
- "\n\tuse TARGET_URL={url} adds 'detail' hyperlink to check on the PR (optional)"
253
- task :error do
254
- status = 'error'
255
- token = ENV['GITHUB_TOKEN'].to_s.strip
256
- repo_org, repo_name = ENV['REPOSITORY'].to_s.strip.split('/')
257
- commit_id = ENV['COMMIT_ID'].to_s.strip
258
-
259
- raise 'GITHUB_TOKEN is required' unless token
260
- raise 'REPOSITORY is required' unless repo_name
261
- raise 'COMMIT_ID is required' unless commit_id
262
-
263
- options = {}
264
- options[:context] = ENV['CONTEXT'].to_s.strip unless ENV['CONTEXT'].to_s.strip.empty?
265
- options[:target_url] = ENV['TARGET_URL'].to_s.strip unless ENV['TARGET_URL'].to_s.strip.empty?
266
-
267
- Dev::Git.new.commit_status(token:, repo_name:, commit_id:, status:, repo_org:, options:)
268
- end
269
- end
270
- end
271
- end
272
- end
273
-
274
- # Create the rake task for the git commit status failure task.
275
- def create_commit_status_failure_task!
276
- # Have to set a local variable to be accessible inside of the instance_eval block
277
- exclude = @exclude
278
-
279
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
280
- namespace :git do
281
- return if exclude.include?(:commit_status)
282
-
283
- namespace :commit_status do
284
- desc 'Add failure status to commit' \
285
- "\n\tuse GITHUB_TOKEN=abc123 enables write options for the check (required)" \
286
- "\n\tuse REPOSITORY=abc123 to specify the repository (required)" \
287
- "\n\tuse COMMIT_ID=abc123 to specify the commit id of code (required)" \
288
- "\n\tuse CONTEXT=abc123 names the check on the PR (optional)" \
289
- "\n\tuse TARGET_URL={url} adds 'detail' hyperlink to check on the PR (optional)"
290
- task :failure do
291
- status = 'failure'
292
- token = ENV['GITHUB_TOKEN'].to_s.strip
293
- repo_org, repo_name = ENV['REPOSITORY'].to_s.strip.split('/')
294
- commit_id = ENV['COMMIT_ID'].to_s.strip
295
-
296
- raise 'GITHUB_TOKEN is required' unless token
297
- raise 'REPOSITORY is required' unless repo_name
298
- raise 'COMMIT_ID is required' unless commit_id
299
-
300
- options = {}
301
- options[:context] = ENV['CONTEXT'].to_s.strip unless ENV['CONTEXT'].to_s.strip.empty?
302
- options[:target_url] = ENV['TARGET_URL'].to_s.strip unless ENV['TARGET_URL'].to_s.strip.empty?
303
-
304
- Dev::Git.new.commit_status(token:, repo_name:, commit_id:, status:, repo_org:, options:)
305
- end
306
- end
307
- end
308
- end
309
- end
310
162
  end
311
163
  end
312
164
  end
@@ -6,6 +6,6 @@ module Dev
6
6
  # Use 'v.v.v.pre.alpha.v' for pre-release vesions
7
7
  # Use 'v.v.v.beta.v for beta versions
8
8
  # Use semantic versioning for any releases (https://semver.org/)
9
- VERSION = '2.2.1.pre.alpha.4'.freeze
9
+ VERSION = '2.2.2'.freeze
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firespring_dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1.pre.alpha.4
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-25 00:00:00.000000000 Z
11
+ date: 2024-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -220,20 +220,6 @@ dependencies:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
222
  version: 2.8.1
223
- - !ruby/object:Gem::Dependency
224
- name: faraday-retry
225
- requirement: !ruby/object:Gem::Requirement
226
- requirements:
227
- - - "~>"
228
- - !ruby/object:Gem::Version
229
- version: '2.0'
230
- type: :runtime
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- requirements:
234
- - - "~>"
235
- - !ruby/object:Gem::Version
236
- version: '2.0'
237
223
  - !ruby/object:Gem::Dependency
238
224
  name: git
239
225
  requirement: !ruby/object:Gem::Requirement
@@ -276,20 +262,6 @@ dependencies:
276
262
  - - "~>"
277
263
  - !ruby/object:Gem::Version
278
264
  version: 2.3.0
279
- - !ruby/object:Gem::Dependency
280
- name: octokit
281
- requirement: !ruby/object:Gem::Requirement
282
- requirements:
283
- - - "~>"
284
- - !ruby/object:Gem::Version
285
- version: '8.1'
286
- type: :runtime
287
- prerelease: false
288
- version_requirements: !ruby/object:Gem::Requirement
289
- requirements:
290
- - - "~>"
291
- - !ruby/object:Gem::Version
292
- version: '8.1'
293
265
  - !ruby/object:Gem::Dependency
294
266
  name: ox
295
267
  requirement: !ruby/object:Gem::Requirement
@@ -460,9 +432,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
460
432
  version: '3.1'
461
433
  required_rubygems_version: !ruby/object:Gem::Requirement
462
434
  requirements:
463
- - - ">"
435
+ - - ">="
464
436
  - !ruby/object:Gem::Version
465
- version: 1.3.1
437
+ version: '0'
466
438
  requirements: []
467
439
  rubygems_version: 3.4.10
468
440
  signing_key: