firespring_dev_commands 2.2.8.pre.alpha.1 → 2.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 112744c89c38e98a24085c5074065e7ad09e4cd46acf01160f47c96fba987510
4
- data.tar.gz: a899f6fcdec41006c1500b2237727579917640f4d909aa23c14621a58c86b5ad
3
+ metadata.gz: 778ff67e973ecdf910d950b09b6eaae4115696dd611d40681edf117056df6785
4
+ data.tar.gz: cee645397957dcdba5122f3d569cc5800a70b4c6e4695010acd931dba83092d7
5
5
  SHA512:
6
- metadata.gz: bf0f1462d0a0f04217189f43b5bf5c07af6054f3ef634c8b7b26743f503e35e105e9557130356bd8a4f64f85c3bb969bb903cef6bed050cba42bddba8ec3394b
7
- data.tar.gz: 0ccc1bf68fbb77fef0213c1df948cfd9d1799018a42df1a0ecf646d454cca05f43bd8c79e2dc8f567118df4f4af10189618c937d57e0deec7e26787e8eeea348
6
+ metadata.gz: 77939ad333d8c4ac77623c165ca0541d225361276ac3411dc769cd4dbd469b3543a0b255ce92ba1d8d89a019942f0b0aa6266ffa13321454ae42d6a786592a9d
7
+ data.tar.gz: 0a86f1791da0270e490ce8fd0cbe6d81ca4fce991db527e900f6ccfbe9aae157bb16177a3ca285ee389c563cf6c2cf7396862e2d14f1e941cf679d77aeaaaf0f
@@ -67,56 +67,18 @@ module Dev
67
67
  [response.hosted_zone, response.delegation_set]
68
68
  end
69
69
 
70
- def json_details
71
- zone_count = 0
70
+ def list_zone_details
72
71
  zones do |zone|
72
+ puts
73
73
  zone_details, delegation_set = details(zone.id)
74
74
  dns_resource = Dev::Dns::Resource.new(zone_details.name)
75
- zone_count += 1
76
- apex_record = dns_resource.recursive_a_lookup
77
- nameserver_names = dns_resource.recursive_nameserver_lookup
78
- nameserver_ips = nameserver_names.sort.map { |it| dns_resource.recursive_a_lookup(it) }
79
- # Check if the site is dead, no a record or any AWS ips in the lists.
80
- # if apex_record.empty? && (!zone_details.name.chomp('.').include? 'firespring') && (!nameserver_ips.join(', ').include? '205.251')
81
- if !dns_resource.recursive_a_lookup.empty? && (dns_resource.recursive_nameserver_lookup.include? 'ns1.firespring.com')
82
- out_data = {
83
- 'count' => zone_count,
84
- 'dns_name' => zone_details.name.chomp('.'),
85
- 'hosted_zone_id' => zone_details.id,
86
- 'delegation_set_id' => delegation_set.id,
87
- # 'registrar_servers' => dns_resource.registrar_lookup.join(','), # This function is fickle, add with care.
88
- 'reported_nameservers' => nameserver_names.sort.join(', '),
89
- 'reported_ns_ips' => nameserver_ips.join(', '),
90
- 'a_record_ip' => apex_record.sort.join(', ')
91
- }
92
- # Display contents
93
- puts JSON.pretty_generate(out_data)
94
- end
95
- rescue ::Aws::Route53::Errors::Throttling
96
- sleep(1)
97
- retry
98
- end
99
- puts
100
- end
101
75
 
102
- def command_line_details
103
- zone_count = 0
104
- zones do |zone|
105
- zone_details, delegation_set = details(zone.id)
106
- dns_resource = Dev::Dns::Resource.new(zone_details.name)
107
- zone_count += 1
108
- if !dns_resource.recursive_a_lookup.empty? && (dns_resource.recursive_nameserver_lookup.include? 'ns1.firespring.com')
109
- puts
110
- puts "#{zone_count} - #{zone_details.name.chomp('.')} (#{zone_details.id}):"
111
- puts format(' %-50s %s', 'Delegation Set:', delegation_set.id)
112
- puts format(' %-50s %s', 'Delegation Defined Nameservers:', delegation_set.name_servers.sort.join(', '))
113
- puts format(' %-50s %s', 'WHOIS Reported server:', dns_resource.registrar_lookup.join(','))
114
- puts format(' %-50s %s', 'DNS Reported Nameservers:', dns_resource.recursive_nameserver_lookup.sort.join(', '))
115
- puts format(' %-50s %s', 'DNS Reported Nameserver IPs:', dns_resource.recursive_nameserver_lookup.sort.map do |it|
116
- dns_resource.recursive_a_lookup(it)
117
- end.join(', '))
118
- puts format(' %-50s %s', 'Domain Apex IP Resolution:', dns_resource.recursive_a_lookup.sort.join(', '))
119
- end
76
+ puts "#{zone_details.name.chomp('.').light_white} (#{zone_details.id}):"
77
+ puts format(' %-50s %s', 'Delegation Set:', delegation_set.id)
78
+ puts format(' %-50s %s', 'Delegation Defined Nameservers:', delegation_set.name_servers.sort.join(', '))
79
+ puts format(' %-50s %s', 'DNS Reported Nameservers:', dns_resource.recursive_nameserver_lookup.sort.join(', '))
80
+ puts format(' %-50s %s', 'DNS Reported Nameserver IPs:', dns_resource.recursive_nameserver_lookup.sort.map { |it| dns_resource.recursive_a_lookup(it) }.join(', '))
81
+ puts format(' %-50s %s', 'Domain Apex IP Resolution:', dns_resource.recursive_a_lookup.sort.join(', '))
120
82
  rescue ::Aws::Route53::Errors::Throttling
121
83
  sleep(1)
122
84
  retry
@@ -1,5 +1,3 @@
1
- require 'whois'
2
-
3
1
  module Dev
4
2
  class Dns
5
3
  class Resource
@@ -24,14 +22,6 @@ module Dev
24
22
  value.match?(Resolv::IPv6::Regex)
25
23
  end
26
24
 
27
- # Determines the registrar(s) of the given name. Not perfect and can be rate limited.
28
- def registrar_lookup(name = domain)
29
- Whois.whois(name.chomp('.')).parts.map(&:host)
30
- rescue Whois::Error
31
- sleep(0.75)
32
- retry
33
- end
34
-
35
25
  # Recursively determine the correct nameservers for the given domain.
36
26
  # If nameservers are not found, strip subdomains off until we've reached the TLD
37
27
  def recursive_nameserver_lookup(name = domain)
@@ -185,7 +185,7 @@ module Dev
185
185
  end
186
186
 
187
187
  # Checks out the given branch in all repositories with some additional formatting
188
- def checkout_all(branch)
188
+ def checkout_all(branch, default_branch: nil)
189
189
  @success = true
190
190
  puts
191
191
  puts "Checking out #{branch} in each repo".light_yellow if project_dirs.length > 1
@@ -194,7 +194,7 @@ module Dev
194
194
 
195
195
  repo_basename = File.basename(File.realpath(project_dir))
196
196
  puts Dev::Common.new.center_pad(repo_basename).light_green
197
- @success &= checkout(branch, dir: project_dir)
197
+ @success &= checkout(branch, default: default_branch, dir: project_dir)
198
198
  puts Dev::Common.new.center_pad.light_green
199
199
  end
200
200
  puts
@@ -205,7 +205,7 @@ module Dev
205
205
  # Checks out the given branch in the given repo
206
206
  # Defaults to the current directory
207
207
  # optionally raise errors
208
- def checkout(branch, dir: default_project_dir, raise_errors: false)
208
+ def checkout(branch, default: nil, dir: default_project_dir, raise_errors: false)
209
209
  raise 'branch is required' if branch.to_s.strip.empty?
210
210
  return unless File.exist?(dir)
211
211
 
@@ -218,7 +218,7 @@ module Dev
218
218
  # If the branch we are checking out doesn't exist, check out either the staging branch or the main branch
219
219
  actual_branch = branch
220
220
  unless branch_exists?(dir, branch)
221
- actual_branch = [staging_branch, main_branch].uniq.find { |it| branch_exists?(dir, it) }
221
+ actual_branch = [default, staging_branch, main_branch].uniq.find { |it| branch_exists?(dir, it) }
222
222
  puts "Branch #{branch} not found, checking out #{actual_branch} instead".light_yellow
223
223
  end
224
224
 
@@ -6,7 +6,7 @@ module Dev
6
6
  module Services
7
7
  # Class contains rake templates for managing your AWS settings and logging in
8
8
  class Route53 < Dev::Template::BaseInterface
9
- def create_pretty_list_zone_details_task!
9
+ def create_list_zone_details_task!
10
10
  # Have to set a local variable to be accessible inside of the instance_eval block
11
11
  exclude = @exclude
12
12
 
@@ -18,26 +18,7 @@ module Dev
18
18
  desc 'print details for all hosted zones'
19
19
  task list_details: %w(ensure_aws_credentials) do
20
20
  route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
21
- route53.command_line_details
22
- end
23
- end
24
- end
25
- end
26
- end
27
-
28
- def create_json_list_zone_details_task!
29
- # Have to set a local variable to be accessible inside of the instance_eval block
30
- exclude = @exclude
31
-
32
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
33
- return if exclude.include?(:json_details)
34
-
35
- namespace :aws do
36
- namespace :hosted_zone do
37
- desc 'print details for all hosted zones'
38
- task json_details: %w(ensure_aws_credentials) do
39
- route53 = Dev::Aws::Route53.new(ENV['DOMAINS'].to_s.strip.split(','))
40
- route53.json_details
21
+ route53.list_zone_details
41
22
  end
42
23
  end
43
24
  end
@@ -31,13 +31,15 @@ module Dev
31
31
  return if exclude.include?(:checkout)
32
32
 
33
33
  desc 'Checks out a branch for each repo (alias: git:co)' \
34
- "\n\tuse BRANCH=abc123 to specify the branch of code you with to switch to (required)" \
35
- "\n\tIf the branch does not exist, the configured staging or main branch will be checked out"
34
+ "\n\tuse BRANCH=abc123 to specify the branch of code you wish to switch to (required)" \
35
+ "\n\tuse DEFAULT=abc456 to specify the branch of code to fall back to" \
36
+ "\n\tIf branch and default do not exist, the configured staging or main branch will be checked out"
36
37
  task checkout: %w(init) do
37
38
  branch = ENV['BRANCH'].to_s.strip
39
+ default = ENV['DEFAULT'].to_s.strip
38
40
  raise 'branch is required' if branch.empty?
39
41
 
40
- Dev::Git.new.checkout_all(branch)
42
+ Dev::Git.new.checkout_all(branch, default_branch: default)
41
43
  end
42
44
 
43
45
  task co: %w(init checkout) do
@@ -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.2.8.pre.alpha.1'.freeze
9
+ VERSION = '2.3.0.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.2.8.pre.alpha.1
4
+ version: 2.3.0.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-10-30 00:00:00.000000000 Z
11
+ date: 2024-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.157.0
145
+ version: 1.141.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.157.0
152
+ version: 1.141.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: aws-sdk-ssm
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -360,20 +360,6 @@ dependencies:
360
360
  - - "~>"
361
361
  - !ruby/object:Gem::Version
362
362
  version: 2.2.0
363
- - !ruby/object:Gem::Dependency
364
- name: whois
365
- requirement: !ruby/object:Gem::Requirement
366
- requirements:
367
- - - "~>"
368
- - !ruby/object:Gem::Version
369
- version: '6.0'
370
- type: :runtime
371
- prerelease: false
372
- version_requirements: !ruby/object:Gem::Requirement
373
- requirements:
374
- - - "~>"
375
- - !ruby/object:Gem::Version
376
- version: '6.0'
377
363
  description: Ruby library for creating/maintaining your development environment
378
364
  email: opensource@firespring.com
379
365
  executables: []