firespring_dev_commands 2.1.35 → 2.1.36.pre.alpha.1

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: 5d97f25c0c50e859219b3290437df7e53f0d8fc2a3a15ee1049887fabd874912
4
- data.tar.gz: b41c42a086341da86c2004863ab197ab5b6889db02205f781b544b6a2ad3c259
3
+ metadata.gz: e5611330994ac3ca41d2cd24858378750e56a345e2e4cbe9c54de75abb589832
4
+ data.tar.gz: 127ef766837e8ca4d72660344f169d45ef1e3cc366434aeacdd9e0ee6a415793
5
5
  SHA512:
6
- metadata.gz: a6d1420dedc541e1d511d3b2292f8699490f748357837903f0036aa1b839dc7a5f1cb0b084c04abbe7eb857d0476671b13c8c5c8cbd3a8fed07c433d03caef7f
7
- data.tar.gz: 37626fe912ece1e7a22af13e25ab68c4915bba3093d87b393b35ef6b0c07347110146b306200d31aef5dc8397b5ecd12aad99d29c10f26b18bb06acb8bacf164
6
+ metadata.gz: 15bb926abd35f96841b4578812b80cc343a5b234b9d524f2207d02cd0b04c7bc9b3fdcaa22494be1e7270feba5d5b943429c762f3ce50e41dd96e2cf46c76feb
7
+ data.tar.gz: 155587ff0f508dd440b4b7db1ac527db0f86dcb384d6e189b3cd85a2405747de5966b9aca3e44319d66a4134ed2207cfe6707afe2cd3ecf1d8e82235ea5e0f0c
@@ -0,0 +1,38 @@
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.open(lockfile))&.fetch('packages', [])
21
+ packages.each do |key, info|
22
+ name = key.split('node_modules/').last
23
+ info['version']
24
+ product = name
25
+
26
+ # Make sure what we found is supported by the EOL library
27
+ next unless eol.product?(product)
28
+
29
+ version = info['version'].reverse.split('.')[-2..].join('.').reverse.tr('v', '')
30
+ version = version.split('.').first if major_version_only_products.include?(product)
31
+ version.chop! if version.end_with?('.00')
32
+ ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ 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.open(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,6 +46,11 @@ 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
51
56
  product_versions.sort_by(&:name).each(&:print_status)
@@ -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,11 +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
- LOG.info " Current AWS Account is #{account_name} (#{account_id})".light_yellow
116
- puts
117
- Dev::EndOfLife.new(product_versions: Dev::EndOfLife::Aws.new.default_products).status
120
+ puts "AWS product versions (in account #{account_name} / #{account_id})".light_yellow
121
+ Dev::EndOfLife.new(product_versions: aws_products).status
118
122
  puts
119
123
  end
120
124
  end
@@ -163,6 +163,35 @@ 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
+ next if node_products.empty?
186
+
187
+ puts
188
+ puts "Node product versions (in #{eol.lockfile})".light_yellow
189
+ Dev::EndOfLife.new(product_versions: node_products).status
190
+ puts
191
+ end
192
+ end
193
+ end
194
+ end
166
195
  end
167
196
  end
168
197
  end
@@ -210,6 +210,35 @@ 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
+ next if php_products.empty?
233
+
234
+ puts
235
+ puts "Php product versions (in #{eol.lockfile})".light_yellow
236
+ Dev::EndOfLife.new(product_versions: php_products).status
237
+ puts
238
+ end
239
+ end
240
+ end
241
+ end
213
242
  end
214
243
  end
215
244
  end
@@ -163,6 +163,35 @@ 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
+ next if ruby_products.empty?
186
+
187
+ puts
188
+ puts "Ruby product versions (in #{eol.lockfile})".light_yellow
189
+ Dev::EndOfLife.new(product_versions: ruby_products).status
190
+ puts
191
+ end
192
+ end
193
+ end
194
+ end
166
195
  end
167
196
  end
168
197
  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 = '2.1.35'.freeze
9
+ VERSION = '2.1.36.pre.alpha.1'.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.1.35
4
+ version: 2.1.36.pre.alpha.1
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-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -361,7 +361,10 @@ files:
361
361
  - lib/firespring_dev_commands/env.rb
362
362
  - lib/firespring_dev_commands/eol.rb
363
363
  - lib/firespring_dev_commands/eol/aws.rb
364
+ - lib/firespring_dev_commands/eol/node.rb
365
+ - lib/firespring_dev_commands/eol/php.rb
364
366
  - lib/firespring_dev_commands/eol/product_version.rb
367
+ - lib/firespring_dev_commands/eol/ruby.rb
365
368
  - lib/firespring_dev_commands/git.rb
366
369
  - lib/firespring_dev_commands/git/info.rb
367
370
  - lib/firespring_dev_commands/jira.rb
@@ -429,9 +432,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
429
432
  version: '3.1'
430
433
  required_rubygems_version: !ruby/object:Gem::Requirement
431
434
  requirements:
432
- - - ">="
435
+ - - ">"
433
436
  - !ruby/object:Gem::Version
434
- version: '0'
437
+ version: 1.3.1
435
438
  requirements: []
436
439
  rubygems_version: 3.4.10
437
440
  signing_key: