firespring_dev_commands 3.0.1 → 3.1.0

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: '086747ff191a4480922b80069fed263ae8adac5e240e9e0650101dcb30b5fefb'
4
- data.tar.gz: 011a78ff9104945be999b33511f7171969548c8a3d897ddf33b56f03fcacfe5f
3
+ metadata.gz: b8a0cf1089d3d18c9125820042028a2c2acd1324aec9cc1f7e0a6726a643d2ed
4
+ data.tar.gz: 374e07c279f5a49e364f6de708349214441174ab92fa2d52ac90e117ccf46ab8
5
5
  SHA512:
6
- metadata.gz: e34be26a5e9e64dc71b8c3f893cbeb23fd5a5d21aa84f6e115a1ec4e5899daf43be883da7dc2ee08280ba112a9a715f84dfc1c56a7c91040adf9a718ad79be18
7
- data.tar.gz: 25c771fedf875de69f1a0151da8973923906be0db3fc8ab83b4c5b95656dbf9ed0da4b5000684e07a0be04b9494b2b29f8cfb7204975464667b4e38e1379386f
6
+ metadata.gz: a90a05a3beef66c4cbc4a931f3f09c836b5e489e4c0e979d786f8d17a122e8fe12bb1eaed0b0387c0127e6a6ea7f03500ef85828efd921a7ca59707bbafdb2b5
7
+ data.tar.gz: 4b7b731d9ba25e3ebf8d14ac7da991e2b111ff9cd9e69cc09c9595b20d35699d80230dadea34cd7923bbdaeaccaae2b76d56b15c4062a98883fb6e60a13f2aab
@@ -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
 
@@ -99,7 +99,6 @@ module Dev
99
99
 
100
100
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
101
101
  return if exclude.include?(:eol)
102
- return if ENV.fetch('CHECK_AWS', nil).to_s.strip == 'false'
103
102
 
104
103
  task eol: [:'eol:aws'] do
105
104
  # This is just a placeholder to execute the dependencies
@@ -108,12 +107,16 @@ module Dev
108
107
  namespace :eol do
109
108
  desc 'Compares the current date to the EOL date for supported aws resources'
110
109
  task aws: %w(init ensure_aws_credentials) do
110
+ next if ENV.fetch('CHECK_AWS', nil).to_s.strip == 'false'
111
+
112
+ aws_products = Dev::EndOfLife::Aws.new.default_products
113
+ next if aws_products.empty?
114
+
115
+ puts
111
116
  account_id = Dev::Aws::Profile.new.current
112
117
  account_name = Dev::Aws::Account.new.name_by_account(account_id)
113
- LOG.info " Current AWS Account is #{account_name} (#{account_id})".light_yellow
114
- puts
115
- Dev::EndOfLife.new(product_versions: Dev::EndOfLife::Aws.new.default_products).status
116
- puts
118
+ puts "AWS product versions (in account #{account_name} / #{account_id})".light_yellow
119
+ Dev::EndOfLife.new(product_versions: aws_products).status
117
120
  end
118
121
  end
119
122
  end
@@ -214,6 +214,33 @@ module Dev
214
214
  end
215
215
  end
216
216
  end
217
+
218
+ # Create the rake task for the node eol method
219
+ def create_eol_task!
220
+ # Have to set a local variable to be accessible inside of the instance_eval block
221
+ exclude = @exclude
222
+ node = @node
223
+
224
+ DEV_COMMANDS_TOP_LEVEL.instance_eval do
225
+ return if exclude.include?(:eol)
226
+
227
+ task eol: [:'eol:node'] do
228
+ # This is just a placeholder to execute the dependencies
229
+ end
230
+
231
+ namespace :eol do
232
+ desc 'Compares the current date to the EOL date for supported packages in the node package file'
233
+ task node: %w(init) do
234
+ eol = Dev::EndOfLife::Node.new(node)
235
+ node_products = eol.default_products
236
+
237
+ puts
238
+ puts "Node product versions (in #{eol.lockfile})".light_yellow
239
+ Dev::EndOfLife.new(product_versions: node_products).status
240
+ end
241
+ end
242
+ end
243
+ end
217
244
  end
218
245
  end
219
246
  end
@@ -260,6 +260,33 @@ module Dev
260
260
  end
261
261
  end
262
262
  end
263
+
264
+ # Create the rake task for the php eol method
265
+ def create_eol_task!
266
+ # Have to set a local variable to be accessible inside of the instance_eval block
267
+ exclude = @exclude
268
+ php = @php
269
+
270
+ DEV_COMMANDS_TOP_LEVEL.instance_eval do
271
+ return if exclude.include?(:eol)
272
+
273
+ task eol: [:'eol:php'] do
274
+ # Thie is just a placeholder to execute the dependencies
275
+ end
276
+
277
+ namespace :eol do
278
+ desc 'Compares the current date to the EOL date for supported packages in the php package file'
279
+ task php: %w(init) do
280
+ eol = Dev::EndOfLife::Php.new(php)
281
+ php_products = eol.default_products
282
+
283
+ puts
284
+ puts "Php product versions (in #{eol.lockfile})".light_yellow
285
+ Dev::EndOfLife.new(product_versions: php_products).status
286
+ end
287
+ end
288
+ end
289
+ end
263
290
  end
264
291
  end
265
292
  end
@@ -215,6 +215,33 @@ module Dev
215
215
  end
216
216
  end
217
217
  end
218
+
219
+ # Create the rake task for the ruby eol method
220
+ def create_eol_task!
221
+ # Have to set a local variable to be accessible inside of the instance_eval block
222
+ exclude = @exclude
223
+ ruby = @ruby
224
+
225
+ DEV_COMMANDS_TOP_LEVEL.instance_eval do
226
+ return if exclude.include?(:eol)
227
+
228
+ task eol: [:'eol:ruby'] do
229
+ # This is just a placeholder to execute the dependencies
230
+ end
231
+
232
+ namespace :eol do
233
+ desc 'Compares the current date to the EOL date for supported packages in the ruby package file'
234
+ task ruby: %w(init) do
235
+ eol = Dev::EndOfLife::Ruby.new(ruby)
236
+ ruby_products = eol.default_products
237
+
238
+ puts
239
+ puts "Ruby product versions (in #{eol.lockfile})".light_yellow
240
+ Dev::EndOfLife.new(product_versions: ruby_products).status
241
+ end
242
+ end
243
+ end
244
+ end
218
245
  end
219
246
  end
220
247
  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.status
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
@@ -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 = '3.0.1'.freeze
9
+ VERSION = '3.1.0'.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: 3.0.1
4
+ version: 3.1.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-05-14 00:00:00.000000000 Z
11
+ date: 2024-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -362,7 +362,10 @@ files:
362
362
  - lib/firespring_dev_commands/env.rb
363
363
  - lib/firespring_dev_commands/eol.rb
364
364
  - lib/firespring_dev_commands/eol/aws.rb
365
+ - lib/firespring_dev_commands/eol/node.rb
366
+ - lib/firespring_dev_commands/eol/php.rb
365
367
  - lib/firespring_dev_commands/eol/product_version.rb
368
+ - lib/firespring_dev_commands/eol/ruby.rb
366
369
  - lib/firespring_dev_commands/git.rb
367
370
  - lib/firespring_dev_commands/git/info.rb
368
371
  - lib/firespring_dev_commands/jira.rb