firespring_dev_commands 2.1.24.pre.alpha.2 → 2.1.25.pre.alpha.2

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: eb2cf1870dd2e6e30d0dbd360bee8827c3bf8f748051a1692411e1a3d3324e71
4
- data.tar.gz: d71152d34719d590445f2265d955faecfc502cb4864411a54fa4c26d2038b666
3
+ metadata.gz: bc2c3fa631451a5358d81be516bf3b1b8c49012716e456a4dce1a2bc0c10223d
4
+ data.tar.gz: f205d96b0445f362055346ecfdf2b4eaa404dab154167400f92051fa517d902f
5
5
  SHA512:
6
- metadata.gz: 5040fae63fb2071356d149f22128aedd0fc4bed611431e1254d0eeff1f3b59b4d7656a1be78d502c5bd0a329c095cff050878f42722aac15d1d376b005313096
7
- data.tar.gz: ed7695707e6d7fd6dfb7e8962a7001500fd2e62dc8844761ec2cc267e5fedcc023a20d61805fbf650dbd9bdeaed10578d5eb8b43f7a7c04d46c0086430d31b9d
6
+ metadata.gz: e85f8c1441301ed54bf937ea89785e6deeddb2df6dd73b3fa6c5c2a5ea4f68a4c9640dedd9b981e4d819f4bdcd8a88d596bcb5b7183a55c0a41503f99b6c1acb
7
+ data.tar.gz: d7a2f85a3a3778c4fc91669b0fc9e22158c30c022297db8ab051984c595c7e5bb9eb08fa54fca17efd23b5493d89259d755bcdb94e5f8762fe11dd6c28545791
@@ -1,10 +1,13 @@
1
1
  module Dev
2
2
  module Coverage
3
+ # Class which defines the methods which must be implemented to function as a coverage class
3
4
  class Base
5
+ # Raises not implemented
4
6
  def php_options
5
7
  raise 'not implemented'
6
8
  end
7
9
 
10
+ # Raises not implemented
8
11
  def check(*)
9
12
  raise 'not implemented'
10
13
  end
@@ -1,14 +1,18 @@
1
1
  module Dev
2
+ # Module with a variety of coverage methods for different languages
2
3
  module Coverage
4
+ # Class which provides methods to effectvely skip coverage
3
5
  class None < Base
4
6
  def initialize(*)
5
7
  super()
6
8
  end
7
9
 
10
+ # Returns the php options for generating code coverage file
8
11
  def php_options
9
12
  []
10
13
  end
11
14
 
15
+ # Checks the code coverage against the defined threshold
12
16
  def check(*)
13
17
  puts 'Coverage not configured'
14
18
  end
@@ -0,0 +1,59 @@
1
+ module Dev
2
+ class Docker
3
+ # Class for configuring docker desktop
4
+ # This is mostly around configuring the docker URL correctly
5
+ class Desktop
6
+ # A snippet of a docker compose file which forwards a socket to a local port so that we can read it in the docker library
7
+ WIN_TCP_COMPOSE_CONTENT = "
8
+ ---
9
+ version: '3.8'
10
+ services:
11
+ windows_tcp:
12
+ image: alpine/socat
13
+ network_mode: bridge
14
+ ports:
15
+ - 127.0.0.1:23750:2375
16
+ volumes:
17
+ - /var/run/docker.sock:/var/run/docker.sock
18
+ command: tcp-listen:2375,reuseaddr,fork unix-connect:/var/run/docker.sock
19
+ restart: always".freeze
20
+
21
+ # Set up the local ports/sockets correctly based off of the os type
22
+ def configure
23
+ if Dev::Os.new.windows?
24
+ # Start up a small proxy container if running Docker Desktop on windows
25
+ # This is needed because the docker api library cannot connect to the windows socket
26
+ unless Dev::Port.new('127.0.0.1', 23_750).open?
27
+ LOG.info('Starting local proxy port for docker')
28
+
29
+ # Write the compose data to a tmp file
30
+ tmp_compose_file = Tempfile.new('windows_tcp')
31
+ tmp_compose_file.write(WIN_TCP_COMPOSE_CONTENT)
32
+ tmp_compose_file.close
33
+
34
+ # Start up the container
35
+ Dev::Docker::Compose.new(
36
+ compose_files: tmp_compose_file.path,
37
+ options: ['--detach'],
38
+ project_name: 'proxy'
39
+ ).up
40
+
41
+ # Wait 1 second before we continue
42
+ sleep 1
43
+ end
44
+
45
+ # Configure the docker url to use 23750 on windows
46
+ ::Docker.url = 'tcp://127.0.0.1:23750'
47
+
48
+ else
49
+ # If a user based socket has been defined, default to that
50
+ ::Docker.url = if File.exist?("/#{Dir.home}/.docker/run/docker.sock")
51
+ "unix://#{Dir.home}/.docker/run/docker.sock"
52
+ elsif File.exist?("/#{Dir.home}/.docker/desktop/docker.sock")
53
+ "unix://#{Dir.home}/.docker/desktop/docker.sock"
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -5,9 +5,8 @@ module Dev
5
5
  END_OF_LIFE_API_URL = 'https://endoflife.date/api'.freeze
6
6
 
7
7
  # Config object for setting top level git config options
8
- Config = Struct.new(:check_aws_resources, :product_versions, :manual_dates) do
8
+ Config = Struct.new(:product_versions, :manual_dates) do
9
9
  def initialize
10
- self.check_aws_resources = false
11
10
  self.product_versions = []
12
11
  self.manual_dates = {}
13
12
  end
@@ -27,10 +26,9 @@ module Dev
27
26
  alias_method :configure, :config
28
27
  end
29
28
 
30
- attr_accessor :url, :products, :check_aws_resources, :product_versions
29
+ attr_accessor :url, :products, :product_versions
31
30
 
32
- def initialize(check_aws_resources: self.class.config.check_aws_resources, product_versions: self.class.config.product_versions)
33
- @check_aws_resources = check_aws_resources
31
+ def initialize(product_versions: self.class.config.product_versions)
34
32
  @product_versions = Array(product_versions)
35
33
  raise 'product version must be of type Dev::EndOfLife::ProductVersions' unless @product_versions.all?(Dev::EndOfLife::ProductVersion)
36
34
  end
@@ -52,14 +50,7 @@ module Dev
52
50
  # Raises an error if any products are EOL
53
51
  def check
54
52
  puts
55
- checks_to_perform = product_versions.clone
56
- if check_aws_resources
57
- account_id = Dev::Aws::Profile.new.current
58
- account_name = Dev::Aws::Account.new.name_by_account(account_id)
59
- LOG.info " Current AWS Account is #{account_name} (#{account_id})".light_yellow
60
- checks_to_perform.concat(Dev::EndOfLife::Aws.new.default_products)
61
- end
62
- checks_to_perform.sort_by(&:name).each(&:print_status)
53
+ product_versions.sort_by(&:name).each(&:print_status)
63
54
  puts
64
55
  raise 'found EOL versions' if product_versions.any?(&:eol)
65
56
  end
@@ -0,0 +1,35 @@
1
+ module Dev
2
+ # Class containing methods for determining operating system information
3
+ class Os
4
+ attr_accessor :os
5
+
6
+ def initialize
7
+ @os = ::RbConfig::CONFIG['host_os']
8
+ end
9
+
10
+ # Returns true if the host_os contains windowsy text
11
+ def windows?
12
+ os.match?(/(mingw|mswin|windows)/i)
13
+ end
14
+
15
+ # Returns true if the host_os contains darwinsy text
16
+ def darwin?
17
+ os.match?(/(darwin|mac os)/i)
18
+ end
19
+
20
+ # Returns true if the host_os contains macsy text
21
+ def mac?
22
+ darwin?
23
+ end
24
+
25
+ # Returns true if the host_os contains nixy text
26
+ def nix?
27
+ os.match?(/(linux|bsd|aix|solaris)/i)
28
+ end
29
+
30
+ # Returns true if the host_os contains cygwiny text
31
+ def cygwin?
32
+ os.match?(/(cygwin)/i)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,24 @@
1
+ module Dev
2
+ # Class containing methods for actions to be taken on ports
3
+ class Port
4
+ attr_accessor :ip_address, :port
5
+
6
+ def initialize(ip_address, port)
7
+ @ip_address = ip_address
8
+ @port = port
9
+ end
10
+
11
+ # Returns true if the port is open
12
+ # Returns false otherwise
13
+ def open?(timeout = 1)
14
+ Timeout.timeout(timeout) do
15
+ TCPSocket.new(ip_address, port).close
16
+ return true
17
+ end
18
+
19
+ false
20
+ rescue Timeout::Error, Errno::ECONNREFUSED, Errno::EHOSTUNREACH
21
+ false
22
+ end
23
+ end
24
+ end
@@ -94,11 +94,23 @@ module Dev
94
94
  end
95
95
  # rubocop:enable Metrics/MethodLength
96
96
 
97
- # Set the EOL library to also check AWS resources
97
+ # Create the rake task for the eol method
98
98
  def create_eol_task!
99
- return if exclude.include?(:eol)
99
+ # Have to set a local variable to be accessible inside of the instance_eval block
100
+ exclude = @exclude
101
+
102
+ DEV_COMMANDS_TOP_LEVEL.instance_eval do
103
+ return if exclude.include?(:eol)
100
104
 
101
- Dev::EndOfLife.config { |c| c.check_aws_resources = true }
105
+ desc 'Compares the current date to the EOL date for supported resources'
106
+ task eol: %w(init ensure_aws_credentials) do
107
+ account_id = Dev::Aws::Profile.new.current
108
+ account_name = Dev::Aws::Account.new.name_by_account(account_id)
109
+ LOG.info " Current AWS Account is #{account_name} (#{account_id})".light_yellow
110
+
111
+ Dev::EndOfLife.new(product_versions: Dev::EndOfLife::Aws.new.default_products).check
112
+ end
113
+ end
102
114
  end
103
115
  end
104
116
  end
@@ -4,23 +4,6 @@ module Dev
4
4
  module Template
5
5
  # Class contains rake templates for managing your git project
6
6
  class Git < Dev::Template::BaseInterface
7
- # Create the rake task for cloning all defined repos
8
- def create_clone_task!
9
- # Have to set a local variable to be accessible inside of the instance_eval block
10
- exclude = @exclude
11
-
12
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
13
- namespace :git do
14
- return if exclude.include?(:clone)
15
-
16
- desc 'Make sure all repos are cloned'
17
- task :clone do
18
- Dev::Git.new.clone_repos
19
- end
20
- end
21
- end
22
- end
23
-
24
7
  # Create the rake task for the git checkout method
25
8
  def create_checkout_task!
26
9
  # Have to set a local variable to be accessible inside of the instance_eval block
@@ -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.24.pre.alpha.2'.freeze
9
+ VERSION = '2.1.25.pre.alpha.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.1.24.pre.alpha.2
4
+ version: 2.1.25.pre.alpha.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-01-16 00:00:00.000000000 Z
11
+ date: 2024-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -339,6 +339,7 @@ files:
339
339
  - lib/firespring_dev_commands/daterange.rb
340
340
  - lib/firespring_dev_commands/docker.rb
341
341
  - lib/firespring_dev_commands/docker/compose.rb
342
+ - lib/firespring_dev_commands/docker/desktop.rb
342
343
  - lib/firespring_dev_commands/docker/status.rb
343
344
  - lib/firespring_dev_commands/dotenv.rb
344
345
  - lib/firespring_dev_commands/env.rb
@@ -357,9 +358,11 @@ files:
357
358
  - lib/firespring_dev_commands/logger.rb
358
359
  - lib/firespring_dev_commands/node.rb
359
360
  - lib/firespring_dev_commands/node/audit.rb
361
+ - lib/firespring_dev_commands/os.rb
360
362
  - lib/firespring_dev_commands/php.rb
361
363
  - lib/firespring_dev_commands/php/audit.rb
362
364
  - lib/firespring_dev_commands/platform.rb
365
+ - lib/firespring_dev_commands/port.rb
363
366
  - lib/firespring_dev_commands/rake.rb
364
367
  - lib/firespring_dev_commands/ruby.rb
365
368
  - lib/firespring_dev_commands/ruby/audit.rb