firespring_dev_commands 2.1.37.pre.alpha.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/firespring_dev_commands/eol/node.rb +37 -0
- data/lib/firespring_dev_commands/eol/php.rb +45 -0
- data/lib/firespring_dev_commands/eol/ruby.rb +37 -0
- data/lib/firespring_dev_commands/eol.rb +10 -0
- data/lib/firespring_dev_commands/git.rb +2 -15
- data/lib/firespring_dev_commands/templates/aws.rb +8 -5
- data/lib/firespring_dev_commands/templates/base_interface.rb +2 -2
- data/lib/firespring_dev_commands/templates/docker/node/application.rb +27 -0
- data/lib/firespring_dev_commands/templates/docker/php/application.rb +27 -0
- data/lib/firespring_dev_commands/templates/docker/ruby/application.rb +27 -0
- data/lib/firespring_dev_commands/templates/eol.rb +7 -1
- data/lib/firespring_dev_commands/templates/git.rb +0 -52
- data/lib/firespring_dev_commands/version.rb +1 -1
- metadata +7 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e21d0927fcb2bd86ade4738cf7cd0f95821200e63b8d58ab9fea8f095e7d85e5
|
4
|
+
data.tar.gz: 0bbeaf7d375ce02212e2c4b08cc27474a372cd41389f5b1012449b7b979af316
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4b0b807ef65b476a93fe875e5b9cfd94532729a824417adac7d621b2ba012312341da1d6fde1bde207ad12d5c26b5d5e7a77d64ca47e05d6fca7032be544b9c
|
7
|
+
data.tar.gz: 3f65efdb513bd1ff812161c49d4bce4967aa7eed9aa61b3f164d530f05bf06fc65222058e6ecda08c3c5848b85b4be7a4ef3eff521775edaadabe96449e686b7
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Dev
|
2
|
+
class EndOfLife
|
3
|
+
class Node
|
4
|
+
attr_reader :node, :lockfile
|
5
|
+
|
6
|
+
def initialize(node = Dev::Node.new)
|
7
|
+
@node = node
|
8
|
+
@lockfile = File.join(node.local_path, "#{node.package_file.reverse.split('.')[-1].reverse}-lock.json")
|
9
|
+
end
|
10
|
+
|
11
|
+
def default_products
|
12
|
+
npm_products
|
13
|
+
end
|
14
|
+
|
15
|
+
def npm_products
|
16
|
+
eol = Dev::EndOfLife.new
|
17
|
+
major_version_only_products = %w(ckeditor vue jquery)
|
18
|
+
|
19
|
+
[].tap do |ary|
|
20
|
+
packages = JSON.parse(File.read(lockfile))&.fetch('packages', [])
|
21
|
+
packages.each do |key, info|
|
22
|
+
name = key.split('node_modules/').last
|
23
|
+
product = name
|
24
|
+
|
25
|
+
# Make sure what we found is supported by the EOL library
|
26
|
+
next unless eol.product?(product)
|
27
|
+
|
28
|
+
version = info['version'].reverse.split('.')[-2..].join('.').reverse.tr('v', '')
|
29
|
+
version = version.split('.').first if major_version_only_products.include?(product)
|
30
|
+
version.chop! if version.end_with?('.00')
|
31
|
+
ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Dev
|
2
|
+
class EndOfLife
|
3
|
+
class Php
|
4
|
+
attr_reader :php, :lockfile
|
5
|
+
|
6
|
+
def initialize(php = Dev::Php.new)
|
7
|
+
@php = php
|
8
|
+
@lockfile = File.join(php.local_path, "#{php.package_file.reverse.split('.')[-1].reverse}.lock")
|
9
|
+
end
|
10
|
+
|
11
|
+
def default_products
|
12
|
+
composer_products
|
13
|
+
end
|
14
|
+
|
15
|
+
def composer_products
|
16
|
+
eol = Dev::EndOfLife.new
|
17
|
+
major_version_only_products = ['laravel']
|
18
|
+
laravel_products = ['laravel/framework']
|
19
|
+
symfony_products = ['symfony/http-client', 'symfony/mailer', 'symfony/mailchimp-mailer']
|
20
|
+
|
21
|
+
[].tap do |ary|
|
22
|
+
packages = JSON.parse(File.read(lockfile))&.fetch('packages', [])
|
23
|
+
packages&.each do |package|
|
24
|
+
name = package['name']
|
25
|
+
product = if laravel_products.include?(name)
|
26
|
+
'laravel'
|
27
|
+
elsif symfony_products.include?(name)
|
28
|
+
'symfony'
|
29
|
+
else
|
30
|
+
name
|
31
|
+
end
|
32
|
+
|
33
|
+
# Make sure what we found is supported by the EOL library
|
34
|
+
next unless eol.product?(product)
|
35
|
+
|
36
|
+
version = package['version'].reverse.split('.')[-2..].join('.').reverse.tr('v', '')
|
37
|
+
version = version.split('.').first if major_version_only_products.include?(product)
|
38
|
+
version.chop! if version.end_with?('.00')
|
39
|
+
ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Dev
|
2
|
+
class EndOfLife
|
3
|
+
class Ruby
|
4
|
+
attr_reader :ruby, :lockfile
|
5
|
+
|
6
|
+
def initialize(ruby = Dev::Ruby.new)
|
7
|
+
@ruby = ruby
|
8
|
+
@lockfile = File.join(ruby.local_path, "#{ruby.package_file.reverse.split('.')[-1].reverse}.lock")
|
9
|
+
end
|
10
|
+
|
11
|
+
def default_products
|
12
|
+
composer_products
|
13
|
+
end
|
14
|
+
|
15
|
+
def composer_products
|
16
|
+
eol = Dev::EndOfLife.new
|
17
|
+
major_version_only_products = []
|
18
|
+
|
19
|
+
[].tap do |ary|
|
20
|
+
packages = Bundler::LockfileParser.new(Bundler.read_file(lockfile)).specs
|
21
|
+
packages.each do |package|
|
22
|
+
name = package.name
|
23
|
+
product = name
|
24
|
+
|
25
|
+
# Make sure what we found is supported by the EOL library
|
26
|
+
next unless eol.product?(product)
|
27
|
+
|
28
|
+
version = package.version.to_s.reverse.split('.')[-2..].join('.').reverse.tr('v', '')
|
29
|
+
version = version.split('.').first if major_version_only_products.include?(product)
|
30
|
+
version.chop! if version.end_with?('.00')
|
31
|
+
ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -46,8 +46,18 @@ module Dev
|
|
46
46
|
@products
|
47
47
|
end
|
48
48
|
|
49
|
+
# Returns true if the given product is supported either in the endoflife api products or a manual product
|
50
|
+
def product?(product)
|
51
|
+
products.include?(product) || self.class.config.manual_dates.any? { |key, _| key.to_s.start_with?("#{product}_") }
|
52
|
+
end
|
53
|
+
|
49
54
|
# Prints all of the product version statuses
|
50
55
|
def status
|
56
|
+
if product_versions.empty?
|
57
|
+
puts ' no tracked products'
|
58
|
+
return
|
59
|
+
end
|
60
|
+
|
51
61
|
product_versions.sort_by(&:name).each(&:print_status)
|
52
62
|
end
|
53
63
|
|
@@ -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
|
@@ -97,7 +96,8 @@ module Dev
|
|
97
96
|
def branch_name(dir: default_project_dir)
|
98
97
|
return unless File.exist?(dir)
|
99
98
|
|
100
|
-
::Git.open(dir)
|
99
|
+
g = ::Git.open(dir)
|
100
|
+
g.current_branch || "HEAD detached at #{g.object('HEAD').sha[0..7]}"
|
101
101
|
end
|
102
102
|
|
103
103
|
# Returns true if the remote branch exists, false otherwise
|
@@ -425,19 +425,6 @@ module Dev
|
|
425
425
|
g.fetch('origin', prune: true)
|
426
426
|
end
|
427
427
|
|
428
|
-
def commit_status(token:, repository:, branch:, status:, organization: 'firespring', options: {})
|
429
|
-
# Set up the GitHub client
|
430
|
-
client = Octokit::Client.new(access_token: token)
|
431
|
-
|
432
|
-
# Fetch the latest commit SHA for the given branch
|
433
|
-
repo = "#{organization}/#{repository}"
|
434
|
-
ref = "heads/#{branch}"
|
435
|
-
sha = client.ref(repo, ref).object.sha
|
436
|
-
|
437
|
-
# Create the commit status
|
438
|
-
client.create_status(repo, sha, status, options)
|
439
|
-
end
|
440
|
-
|
441
428
|
# Builds an ssh repo URL using the org and repo name given
|
442
429
|
def ssh_repo_url(name, org)
|
443
430
|
"git@github.com:#{org}/#{name}.git"
|
@@ -101,7 +101,6 @@ module Dev
|
|
101
101
|
|
102
102
|
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
103
103
|
return if exclude.include?(:eol)
|
104
|
-
return if ENV.fetch('CHECK_AWS', nil).to_s.strip == 'false'
|
105
104
|
|
106
105
|
task eol: [:'eol:aws'] do
|
107
106
|
# This is just a placeholder to execute the dependencies
|
@@ -110,12 +109,16 @@ module Dev
|
|
110
109
|
namespace :eol do
|
111
110
|
desc 'Compares the current date to the EOL date for supported aws resources'
|
112
111
|
task aws: %w(init ensure_aws_credentials) do
|
112
|
+
next if ENV.fetch('CHECK_AWS', nil).to_s.strip == 'false'
|
113
|
+
|
114
|
+
aws_products = Dev::EndOfLife::Aws.new.default_products
|
115
|
+
next if aws_products.empty?
|
116
|
+
|
117
|
+
puts
|
113
118
|
account_id = Dev::Aws::Profile.new.current
|
114
119
|
account_name = Dev::Aws::Account.new.name_by_account(account_id)
|
115
|
-
|
116
|
-
|
117
|
-
Dev::EndOfLife.new(product_versions: Dev::EndOfLife::Aws.new.default_products).status
|
118
|
-
puts
|
120
|
+
puts "AWS product versions (in account #{account_name} / #{account_id})".light_yellow
|
121
|
+
Dev::EndOfLife.new(product_versions: aws_products).status
|
119
122
|
end
|
120
123
|
end
|
121
124
|
end
|
@@ -47,14 +47,14 @@ end
|
|
47
47
|
# Create the base init command
|
48
48
|
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
49
49
|
task :init do
|
50
|
-
|
50
|
+
# Default Base Init method
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
# Create the base init_docker command
|
55
55
|
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
56
56
|
task init_docker: %w(init) do
|
57
|
-
|
57
|
+
# Default Base Init Docker method
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -163,6 +163,33 @@ module Dev
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
end
|
166
|
+
|
167
|
+
# Create the rake task for the node eol method
|
168
|
+
def create_eol_task!
|
169
|
+
# Have to set a local variable to be accessible inside of the instance_eval block
|
170
|
+
exclude = @exclude
|
171
|
+
node = @node
|
172
|
+
|
173
|
+
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
174
|
+
return if exclude.include?(:eol)
|
175
|
+
|
176
|
+
task eol: [:'eol:node'] do
|
177
|
+
# This is just a placeholder to execute the dependencies
|
178
|
+
end
|
179
|
+
|
180
|
+
namespace :eol do
|
181
|
+
desc 'Compares the current date to the EOL date for supported packages in the node package file'
|
182
|
+
task node: %w(init) do
|
183
|
+
eol = Dev::EndOfLife::Node.new(node)
|
184
|
+
node_products = eol.default_products
|
185
|
+
|
186
|
+
puts
|
187
|
+
puts "Node product versions (in #{eol.lockfile})".light_yellow
|
188
|
+
Dev::EndOfLife.new(product_versions: node_products).status
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
166
193
|
end
|
167
194
|
end
|
168
195
|
end
|
@@ -210,6 +210,33 @@ module Dev
|
|
210
210
|
end
|
211
211
|
end
|
212
212
|
end
|
213
|
+
|
214
|
+
# Create the rake task for the php eol method
|
215
|
+
def create_eol_task!
|
216
|
+
# Have to set a local variable to be accessible inside of the instance_eval block
|
217
|
+
exclude = @exclude
|
218
|
+
php = @php
|
219
|
+
|
220
|
+
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
221
|
+
return if exclude.include?(:eol)
|
222
|
+
|
223
|
+
task eol: [:'eol:php'] do
|
224
|
+
# Thie is just a placeholder to execute the dependencies
|
225
|
+
end
|
226
|
+
|
227
|
+
namespace :eol do
|
228
|
+
desc 'Compares the current date to the EOL date for supported packages in the php package file'
|
229
|
+
task php: %w(init) do
|
230
|
+
eol = Dev::EndOfLife::Php.new(php)
|
231
|
+
php_products = eol.default_products
|
232
|
+
|
233
|
+
puts
|
234
|
+
puts "Php product versions (in #{eol.lockfile})".light_yellow
|
235
|
+
Dev::EndOfLife.new(product_versions: php_products).status
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
213
240
|
end
|
214
241
|
end
|
215
242
|
end
|
@@ -163,6 +163,33 @@ module Dev
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
end
|
166
|
+
|
167
|
+
# Create the rake task for the ruby eol method
|
168
|
+
def create_eol_task!
|
169
|
+
# Have to set a local variable to be accessible inside of the instance_eval block
|
170
|
+
exclude = @exclude
|
171
|
+
ruby = @ruby
|
172
|
+
|
173
|
+
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
174
|
+
return if exclude.include?(:eol)
|
175
|
+
|
176
|
+
task eol: [:'eol:ruby'] do
|
177
|
+
# This is just a placeholder to execute the dependencies
|
178
|
+
end
|
179
|
+
|
180
|
+
namespace :eol do
|
181
|
+
desc 'Compares the current date to the EOL date for supported packages in the ruby package file'
|
182
|
+
task ruby: %w(init) do
|
183
|
+
eol = Dev::EndOfLife::Ruby.new(ruby)
|
184
|
+
ruby_products = eol.default_products
|
185
|
+
|
186
|
+
puts
|
187
|
+
puts "Ruby product versions (in #{eol.lockfile})".light_yellow
|
188
|
+
Dev::EndOfLife.new(product_versions: ruby_products).status
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
166
193
|
end
|
167
194
|
end
|
168
195
|
end
|
@@ -15,7 +15,13 @@ module Dev
|
|
15
15
|
desc 'Compares the current date to the EOL date for all configured projects' \
|
16
16
|
"\n\toptionally specify CHECK_AWS=<true/false> to toggle whether AWS resources are checked for EOL (defaults to true)"
|
17
17
|
task eol: %w(init) do
|
18
|
-
Dev::EndOfLife.new.
|
18
|
+
manual_products = Dev::EndOfLife.new.product_versions
|
19
|
+
next if manual_products.empty?
|
20
|
+
|
21
|
+
puts
|
22
|
+
puts 'Manual product versions'
|
23
|
+
Dev::EndOfLife.new(product_versions: manual_products).status
|
24
|
+
puts
|
19
25
|
end
|
20
26
|
end
|
21
27
|
end
|
@@ -159,58 +159,6 @@ module Dev
|
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
162
|
-
|
163
|
-
# rubocop:disable Metrics/MethodLength
|
164
|
-
# Create the rake task for the git commit status task.
|
165
|
-
def create_commit_status_task!
|
166
|
-
# Have to set a local variable to be accessible inside of the instance_eval block
|
167
|
-
exclude = @exclude
|
168
|
-
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
169
|
-
namespace :git do
|
170
|
-
return if exclude.include?(:commit_status)
|
171
|
-
|
172
|
-
desc 'Add status to PR' \
|
173
|
-
"\n\tuse GITHUB_TOKEN=abc123 enables write options for the check (required)" \
|
174
|
-
"\n\tuse REPOSITORY=abc123 to specify the repository (required)" \
|
175
|
-
"\n\tuse BRANCH=abc123 to specify the branch of code (required)" \
|
176
|
-
"\n\tuse CONTEXT=abc123 names the check on the PR (optional)" \
|
177
|
-
"\n\tuse TARGET_URL={url} adds 'detail' hyperlink to check on the PR (optional)"
|
178
|
-
|
179
|
-
# Key Values
|
180
|
-
token = ENV['GITHUB_TOKEN'].to_s.strip
|
181
|
-
repository = ENV['REPOSITORY'].to_s.strip
|
182
|
-
branch = ENV['BRANCH'].to_s.strip
|
183
|
-
|
184
|
-
raise 'GITHUB_TOKEN is required' unless token
|
185
|
-
raise 'Repository name is required' unless repository
|
186
|
-
raise 'Branch name is required' unless branch
|
187
|
-
|
188
|
-
options = {}
|
189
|
-
options[:context] = ENV['CONTEXT'].to_s.strip unless ENV['CONTEXT'].to_s.strip.empty?
|
190
|
-
options[:target_url] = ENV['TARGET_URL'].to_s.strip unless ENV['TARGET_URL'].to_s.strip.empty?
|
191
|
-
|
192
|
-
namespace :commit_status do
|
193
|
-
desc 'Add status success'
|
194
|
-
task :success do
|
195
|
-
Dev::Git.new.commit_status(token:, repository:, branch:, status: 'success', options:)
|
196
|
-
end
|
197
|
-
desc 'Add status pending'
|
198
|
-
task :pending do
|
199
|
-
Dev::Git.new.commit_status(token:, repository:, branch:, status: 'pending', options:)
|
200
|
-
end
|
201
|
-
desc 'Add status error'
|
202
|
-
task :error do
|
203
|
-
Dev::Git.new.commit_status(token:, repository:, branch:, status: 'error', options:)
|
204
|
-
end
|
205
|
-
desc 'Add status failure'
|
206
|
-
task :failure do
|
207
|
-
Dev::Git.new.commit_status(token:, repository:, branch:, status: 'failure', options:)
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
212
|
-
end
|
213
|
-
# rubocop:enable Metrics/MethodLength
|
214
162
|
end
|
215
163
|
end
|
216
164
|
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.
|
4
|
+
version: 2.2.0
|
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-
|
11
|
+
date: 2024-06-05 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
|
@@ -389,7 +361,10 @@ files:
|
|
389
361
|
- lib/firespring_dev_commands/env.rb
|
390
362
|
- lib/firespring_dev_commands/eol.rb
|
391
363
|
- lib/firespring_dev_commands/eol/aws.rb
|
364
|
+
- lib/firespring_dev_commands/eol/node.rb
|
365
|
+
- lib/firespring_dev_commands/eol/php.rb
|
392
366
|
- lib/firespring_dev_commands/eol/product_version.rb
|
367
|
+
- lib/firespring_dev_commands/eol/ruby.rb
|
393
368
|
- lib/firespring_dev_commands/git.rb
|
394
369
|
- lib/firespring_dev_commands/git/info.rb
|
395
370
|
- lib/firespring_dev_commands/jira.rb
|
@@ -457,9 +432,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
457
432
|
version: '3.1'
|
458
433
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
459
434
|
requirements:
|
460
|
-
- - "
|
435
|
+
- - ">="
|
461
436
|
- !ruby/object:Gem::Version
|
462
|
-
version:
|
437
|
+
version: '0'
|
463
438
|
requirements: []
|
464
439
|
rubygems_version: 3.4.10
|
465
440
|
signing_key:
|