firespring_dev_commands 2.1.24.pre.alpha.2 → 2.1.25.pre.alpha.1
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 +4 -4
- data/lib/firespring_dev_commands/coverage/base.rb +3 -0
- data/lib/firespring_dev_commands/coverage/none.rb +4 -0
- data/lib/firespring_dev_commands/docker/desktop.rb +63 -0
- data/lib/firespring_dev_commands/eol.rb +4 -13
- data/lib/firespring_dev_commands/os.rb +35 -0
- data/lib/firespring_dev_commands/port.rb +24 -0
- data/lib/firespring_dev_commands/templates/aws.rb +15 -3
- data/lib/firespring_dev_commands/templates/git.rb +0 -17
- data/lib/firespring_dev_commands/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 235d5f072b69f3bb254426a735dff14aab125c350ac839607680079c81dfaec7
|
4
|
+
data.tar.gz: cbc047347a657b8e00c129cc4b9059f66366b64f088d3b7dd117e5cf8b40fdf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 285074c0b9aaa50b96bb64e1fb4dadde6156569245c98aa8033ac947d6378e0f71f6dcc35f690cd2cb3d8d0c139bb10a27df5451e9a8956e2cf058f1a64d3bc7
|
7
|
+
data.tar.gz: add7ae0e81533290ab062a0ee35226b9f22231d5ac2dd7c7a9a977538885c799287cca5962227925cecd8c8c23b79c7e73936f783f84523c49efdba4f42dd3a1
|
@@ -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,63 @@
|
|
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
|
+
socat:
|
12
|
+
image: alpine/socat
|
13
|
+
container_name: windows_tcp
|
14
|
+
network_mode: bridge
|
15
|
+
ports:
|
16
|
+
- 127.0.0.1:23750:2375
|
17
|
+
volumes:
|
18
|
+
- /var/run/docker.sock:/var/run/docker.sock
|
19
|
+
command: tcp-listen:2375,reuseaddr,fork unix-connect:/var/run/docker.sock
|
20
|
+
restart: always".freeze
|
21
|
+
|
22
|
+
# Set up the local ports/sockets correctly based off of the os type
|
23
|
+
def configure
|
24
|
+
if Dev::Os.new.windows?
|
25
|
+
# Start up a small proxy container if running Docker Desktop on windows
|
26
|
+
# This is needed because the docker api library cannot connect to the windows socket
|
27
|
+
unless Dev::Port.new('127.0.0.1', 23_750).open?
|
28
|
+
LOG.info('Starting local proxy port for docker')
|
29
|
+
|
30
|
+
# Make sure any stopped version of the container are cleaned up
|
31
|
+
Dev::Docker.new.prune_containers
|
32
|
+
|
33
|
+
# Write the compose data to a tmp file
|
34
|
+
tmp_compose_file = Tempfile.new('windows_tcp')
|
35
|
+
tmp_compose_file.write(WIN_TCP_COMPOSE_CONTENT)
|
36
|
+
tmp_compose_file.close
|
37
|
+
|
38
|
+
# Start up the container
|
39
|
+
Dev::Docker::Compose.new(
|
40
|
+
compose_files: tmp_compose_file.path,
|
41
|
+
options: ['--detach'],
|
42
|
+
project_name: SecureRandom.hex
|
43
|
+
).up
|
44
|
+
|
45
|
+
# Wait 1 second before we continue
|
46
|
+
sleep 1
|
47
|
+
end
|
48
|
+
|
49
|
+
# Configure the docker url to use 23750 on windows
|
50
|
+
::Docker.url = 'tcp://127.0.0.1:23750'
|
51
|
+
|
52
|
+
else
|
53
|
+
# If a user based socket has been defined, default to that
|
54
|
+
::Docker.url = if File.exist?("/#{Dir.home}/.docker/run/docker.sock")
|
55
|
+
"unix://#{Dir.home}/.docker/run/docker.sock"
|
56
|
+
elsif File.exist?("/#{Dir.home}/.docker/desktop/docker.sock")
|
57
|
+
"unix://#{Dir.home}/.docker/desktop/docker.sock"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
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(:
|
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, :
|
29
|
+
attr_accessor :url, :products, :product_versions
|
31
30
|
|
32
|
-
def initialize(
|
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
|
-
|
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
|
-
#
|
97
|
+
# Create the rake task for the eol method
|
98
98
|
def create_eol_task!
|
99
|
-
|
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
|
-
|
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
|
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.
|
4
|
+
version: 2.1.25.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-01-
|
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
|