firespring_dev_commands 2.3.4 → 2.5.0.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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/firespring_dev_commands/audit/report.rb +2 -9
  4. data/lib/firespring_dev_commands/aws/account.rb +1 -1
  5. data/lib/firespring_dev_commands/aws/cloudformation.rb +3 -10
  6. data/lib/firespring_dev_commands/aws/login.rb +11 -37
  7. data/lib/firespring_dev_commands/common.rb +2 -22
  8. data/lib/firespring_dev_commands/docker/compose.rb +1 -2
  9. data/lib/firespring_dev_commands/docker/status.rb +0 -20
  10. data/lib/firespring_dev_commands/docker.rb +16 -86
  11. data/lib/firespring_dev_commands/eol/aws.rb +2 -10
  12. data/lib/firespring_dev_commands/eol.rb +2 -22
  13. data/lib/firespring_dev_commands/git.rb +29 -44
  14. data/lib/firespring_dev_commands/jira/issue.rb +1 -3
  15. data/lib/firespring_dev_commands/node.rb +1 -1
  16. data/lib/firespring_dev_commands/php/audit.rb +0 -4
  17. data/lib/firespring_dev_commands/php.rb +12 -28
  18. data/lib/firespring_dev_commands/platform.rb +31 -38
  19. data/lib/firespring_dev_commands/ruby.rb +3 -6
  20. data/lib/firespring_dev_commands/target_process/query.rb +4 -30
  21. data/lib/firespring_dev_commands/target_process/release.rb +1 -1
  22. data/lib/firespring_dev_commands/target_process/team_assignment.rb +1 -1
  23. data/lib/firespring_dev_commands/target_process/user.rb +1 -13
  24. data/lib/firespring_dev_commands/target_process/user_story.rb +1 -1
  25. data/lib/firespring_dev_commands/target_process/user_story_history.rb +1 -1
  26. data/lib/firespring_dev_commands/target_process.rb +7 -24
  27. data/lib/firespring_dev_commands/templates/aws.rb +6 -33
  28. data/lib/firespring_dev_commands/templates/base_interface.rb +2 -2
  29. data/lib/firespring_dev_commands/templates/ci.rb +11 -16
  30. data/lib/firespring_dev_commands/templates/docker/application.rb +2 -2
  31. data/lib/firespring_dev_commands/templates/docker/node/application.rb +5 -55
  32. data/lib/firespring_dev_commands/templates/docker/php/application.rb +16 -58
  33. data/lib/firespring_dev_commands/templates/docker/ruby/application.rb +5 -54
  34. data/lib/firespring_dev_commands/templates/eol.rb +2 -9
  35. data/lib/firespring_dev_commands/templates/git.rb +4 -171
  36. data/lib/firespring_dev_commands/version.rb +1 -1
  37. data/lib/firespring_dev_commands.rb +1 -1
  38. metadata +37 -113
  39. data/lib/firespring_dev_commands/aws/route53.rb +0 -139
  40. data/lib/firespring_dev_commands/bloom_growth/rock.rb +0 -34
  41. data/lib/firespring_dev_commands/bloom_growth/seat.rb +0 -16
  42. data/lib/firespring_dev_commands/bloom_growth/user.rb +0 -43
  43. data/lib/firespring_dev_commands/bloom_growth.rb +0 -132
  44. data/lib/firespring_dev_commands/certificate.rb +0 -59
  45. data/lib/firespring_dev_commands/coverage/base.rb +0 -16
  46. data/lib/firespring_dev_commands/coverage/cobertura.rb +0 -86
  47. data/lib/firespring_dev_commands/coverage/none.rb +0 -21
  48. data/lib/firespring_dev_commands/dns/resource.rb +0 -83
  49. data/lib/firespring_dev_commands/docker/desktop.rb +0 -61
  50. data/lib/firespring_dev_commands/eol/node.rb +0 -42
  51. data/lib/firespring_dev_commands/eol/php.rb +0 -50
  52. data/lib/firespring_dev_commands/eol/ruby.rb +0 -42
  53. data/lib/firespring_dev_commands/jira/parent.rb +0 -19
  54. data/lib/firespring_dev_commands/os.rb +0 -35
  55. data/lib/firespring_dev_commands/port.rb +0 -24
  56. data/lib/firespring_dev_commands/target_process/time.rb +0 -32
  57. data/lib/firespring_dev_commands/templates/aws/services/route53.rb +0 -111
  58. data/lib/firespring_dev_commands/templates/certificate.rb +0 -41
@@ -1,61 +0,0 @@
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
- context = Dev::Common.new.run_command(
50
- "docker context inspect --format '{{.Endpoints.docker.Host}}'",
51
- capture: true
52
- ).to_s.strip
53
- raise 'context is empty' unless context
54
-
55
- # If a user based socket has been defined, default to that
56
- ::Docker.url = context
57
- end
58
- end
59
- end
60
- end
61
- end
@@ -1,42 +0,0 @@
1
- module Dev
2
- class EndOfLife
3
- # Class which checks for eol packges referenced by the node package manager
4
- class Node
5
- attr_reader :node, :lockfile
6
-
7
- def initialize(node = Dev::Node.new)
8
- @node = node
9
- @lockfile = File.join(node.local_path, "#{node.package_file.reverse.split('.')[-1].reverse}-lock.json")
10
- end
11
-
12
- # Default to NPM products
13
- def default_products
14
- npm_products
15
- end
16
-
17
- # 1.) Parse the npm lock file
18
- # 2.) Do some package name and version manipulation
19
- # 3.) Return the product if it looks like something that the EOL library tracks
20
- def npm_products
21
- eol = Dev::EndOfLife.new
22
- major_version_only_products = %w(ckeditor jquery)
23
-
24
- [].tap do |ary|
25
- packages = JSON.parse(File.read(lockfile))&.fetch('packages', [])
26
- packages.each do |key, info|
27
- name = key.split('node_modules/').last
28
- product = name
29
-
30
- # Make sure what we found is supported by the EOL library
31
- next unless eol.product?(product)
32
-
33
- version = info['version'].reverse.split('.')[-2..].join('.').reverse.tr('v', '')
34
- version = version.split('.').first if major_version_only_products.include?(product)
35
- version.chop! if version.end_with?('.00')
36
- ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,50 +0,0 @@
1
- module Dev
2
- class EndOfLife
3
- # Class which checks for eol packges referenced by the php package manager
4
- class Php
5
- attr_reader :php, :lockfile
6
-
7
- def initialize(php = Dev::Php.new)
8
- @php = php
9
- @lockfile = File.join(php.local_path, "#{php.package_file.reverse.split('.')[-1].reverse}.lock")
10
- end
11
-
12
- # Default to Composer products
13
- def default_products
14
- composer_products
15
- end
16
-
17
- # 1.) Parse the composer lock file
18
- # 2.) Do some package name and version manipulation
19
- # 3.) Return the product if it looks like something that the EOL library tracks
20
- def composer_products
21
- eol = Dev::EndOfLife.new
22
- major_version_only_products = ['laravel']
23
- laravel_products = ['laravel/framework']
24
- symfony_products = ['symfony/http-client', 'symfony/mailer', 'symfony/mailchimp-mailer']
25
-
26
- [].tap do |ary|
27
- packages = JSON.parse(File.read(lockfile))&.fetch('packages', [])
28
- packages&.each do |package|
29
- name = package['name']
30
- product = if laravel_products.include?(name)
31
- 'laravel'
32
- elsif symfony_products.include?(name)
33
- 'symfony'
34
- else
35
- name
36
- end
37
-
38
- # Make sure what we found is supported by the EOL library
39
- next unless eol.product?(product)
40
-
41
- version = package['version'].reverse.split('.')[-2..].join('.').reverse.tr('v', '')
42
- version = version.split('.').first if major_version_only_products.include?(product)
43
- version.chop! if version.end_with?('.00')
44
- ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,42 +0,0 @@
1
- module Dev
2
- class EndOfLife
3
- # Class which checks for eol packges referenced by the ruby package manager
4
- class Ruby
5
- attr_reader :ruby, :lockfile
6
-
7
- def initialize(ruby = Dev::Ruby.new)
8
- @ruby = ruby
9
- @lockfile = File.join(ruby.local_path, "#{ruby.package_file.reverse.split('.')[-1].reverse}.lock")
10
- end
11
-
12
- # Default to Rubygems products
13
- def default_products
14
- rubygems_products
15
- end
16
-
17
- # 1.) Parse the rubygems lock file
18
- # 2.) Do some package name and version manipulation
19
- # 3.) Return the product if it looks like something that the EOL library tracks
20
- def rubygems_products
21
- eol = Dev::EndOfLife.new
22
- major_version_only_products = []
23
-
24
- [].tap do |ary|
25
- packages = Bundler::LockfileParser.new(Bundler.read_file(lockfile)).specs
26
- packages.each do |package|
27
- name = package.name
28
- product = name
29
-
30
- # Make sure what we found is supported by the EOL library
31
- next unless eol.product?(product)
32
-
33
- version = package.version.to_s.reverse.split('.')[-2..].join('.').reverse.tr('v', '')
34
- version = version.split('.').first if major_version_only_products.include?(product)
35
- version.chop! if version.end_with?('.00')
36
- ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,19 +0,0 @@
1
- module Dev
2
- class Jira
3
- # Contains information on the Jira parent issue
4
- class Parent
5
- attr_accessor :data, :id, :title
6
-
7
- def initialize(data)
8
- @data = data.parent
9
- @id = data.parent['key']
10
- @title = data.parent['fields']['summary']
11
- end
12
-
13
- # Converts the jira parent object to a string representation
14
- def to_s
15
- "[#{id}] #{title}"
16
- end
17
- end
18
- end
19
- end
@@ -1,35 +0,0 @@
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
@@ -1,24 +0,0 @@
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
@@ -1,32 +0,0 @@
1
- module Dev
2
- class TargetProcess
3
- # The class to query time information from Target Process
4
- class Time
5
- # The resource type for the api endpoint
6
- RESOURCE_TYPE = 'Time'.freeze
7
-
8
- # The api path for time requests
9
- PATH = '/Time'.freeze
10
-
11
- attr_accessor :data, :id, :type, :description, :hours, :date, :story, :user
12
-
13
- def initialize(data)
14
- @data = data
15
- @id = data['Id']
16
- @type = data['ResourceType']
17
- @description = data['Description']
18
- @hours = data['Spent']
19
- @date = parse_time(data['Date'])
20
- @story = UserStory.new(data['Assignable']) if data['Assignable']
21
- @user = User.new(data['User']) if data['User']
22
- end
23
-
24
- # Parse the dot net time representation into something that ruby can use
25
- def parse_time(string)
26
- return nil unless string && !string.empty?
27
-
28
- ::Time.at(string.slice(6, 10).to_i)
29
- end
30
- end
31
- end
32
- end
@@ -1,111 +0,0 @@
1
- require_relative '../../base_interface'
2
-
3
- module Dev
4
- module Template
5
- class Aws
6
- module Services
7
- # Class contains rake templates for managing your AWS settings and logging in
8
- class Route53 < Dev::Template::BaseInterface
9
- def create_list_zone_details_task!
10
- # Have to set a local variable to be accessible inside of the instance_eval block
11
- exclude = @exclude
12
-
13
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
14
- return if exclude.include?(:list_details)
15
-
16
- namespace :aws do
17
- namespace :hosted_zone do
18
- desc 'print details for all hosted zones'
19
- task list_details: %w(ensure_aws_credentials) do
20
- route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
21
- route53.list_zone_details
22
- end
23
- end
24
- end
25
- end
26
- end
27
-
28
- # Create the rake task for the hosted zone method
29
- def create_dns_logging_activate_task!
30
- # Have to set a local variable to be accessible inside of the instance_eval block
31
- exclude = @exclude
32
-
33
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
34
- return if exclude.include?(:dns_logging_activate)
35
-
36
- namespace :aws do
37
- namespace :hosted_zone do
38
- namespace :dns_logging do
39
- desc 'Activates query logging for all hosted zones by default.' \
40
- 'This command should be run from the account the hosted zone(s) reside.' \
41
- "\n\t(Required) Specify LOG_GROUP_ARN='arn:aws:logs:REGION:ACCOUNT_ID:' to specify the ARN of the target log group." \
42
- "\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
43
- "\n\t\tComma delimited list."
44
- task activate: %w(ensure_aws_credentials) do
45
- route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
46
- # Use user defined log group.
47
- log_group = ENV.fetch('LOG_GROUP_ARN', nil)
48
- raise 'The Hosted Zone Log Group ARN, LOG_GROUP_ARN, is required' unless log_group
49
-
50
- route53.activate_query_logging(log_group)
51
- end
52
- end
53
- end
54
- end
55
- end
56
- end
57
-
58
- # Create the rake task for the hosted zone method
59
- def create_dns_logging_deactivate_task!
60
- # Have to set a local variable to be accessible inside of the instance_eval block
61
- exclude = @exclude
62
-
63
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
64
- return if exclude.include?(:dns_logging_deactivate)
65
-
66
- namespace :aws do
67
- namespace :hosted_zone do
68
- namespace :dns_logging do
69
- desc 'Deactivates query logging for all hosted zones by default. ' \
70
- 'This command should be run from the account the hosted zone(s) reside.' \
71
- "\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
72
- "\n\t\tComma delimited list."
73
- task deactivate: %w(ensure_aws_credentials) do
74
- route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
75
- route53.deactivate_query_logging
76
- end
77
- end
78
- end
79
- end
80
- end
81
- end
82
-
83
- # Create the rake task for the hosted zone method
84
- def create_list_query_config_task!
85
- # Have to set a local variable to be accessible inside of the instance_eval block
86
- exclude = @exclude
87
-
88
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
89
- return if exclude.include?(:dns_logging_config)
90
-
91
- namespace :aws do
92
- namespace :hosted_zone do
93
- namespace :dns_logging do
94
- desc 'Lists the current config for domain(s). ' \
95
- 'This command should be run from the account the hosted zone(s) reside.' \
96
- "\n\toptionally specify DOMAINS='foo.com,foobar.com' to specify the hosted zones to activate." \
97
- "\n\t\tComma delimited list."
98
- task list_query_configs: %w(ensure_aws_credentials) do
99
- route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
100
- route53.list_query_configs
101
- end
102
- end
103
- end
104
- end
105
- end
106
- end
107
- end
108
- end
109
- end
110
- end
111
- end
@@ -1,41 +0,0 @@
1
- require_relative 'base_interface'
2
-
3
- module Dev
4
- module Template
5
- # Class contains rake templates for managing configured certificates
6
- class Certificate < Dev::Template::BaseInterface
7
- attr_reader :domains, :email, :paths
8
-
9
- def initialize(domains, email:, paths:, exclude: [])
10
- @domains = domains
11
- @email = email
12
- @paths = Array(paths)
13
-
14
- super(exclude:)
15
- end
16
-
17
- # Create the rake task for the generate method
18
- def create_generate_task!
19
- # Have to set a local variable to be accessible inside of the instance_eval block
20
- domains = @domains
21
- email = @email
22
- paths = @paths
23
- exclude = @exclude
24
-
25
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
26
- return if exclude.include?(:generate)
27
-
28
- namespace :certificate do
29
- desc 'Requests a new certificate for the configured domain using the route53 validation and deposits it in the configured paths'
30
- task generate: %w(init_docker ensure_aws_credentials) do
31
- Dev::Docker.new.pull_image('certbot/dns-route53', 'latest')
32
- c = Dev::Certificate.new(domains, email)
33
- c.request
34
- paths.each { |path| c.save(path) }
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end