dnsmadeeasy 0.4.0 → 1.0.3

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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +5 -10
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +5 -4
  5. data/.rubocop_todo.yml +251 -143
  6. data/CLAUDE.md +67 -0
  7. data/Gemfile +9 -1
  8. data/README.md +854 -0
  9. data/Rakefile +4 -4
  10. data/dnsmadeeasy.gemspec +56 -32
  11. data/docs/badges/coverage_badge.svg +21 -0
  12. data/docs/dry-cli-based-tools.webloc +8 -0
  13. data/docs/plan-zone-management.md +756 -0
  14. data/docs/plans/01-plan-ruby4-baseline.md +38 -0
  15. data/docs/plans/02-plan-dry-cli-launcher.md +44 -0
  16. data/docs/plans/03-plan-account-command.md +43 -0
  17. data/docs/plans/04-plan-zone-record-model.md +48 -0
  18. data/docs/plans/05-plan-zone-parser.md +41 -0
  19. data/docs/plans/06-plan-zone-formatter.md +43 -0
  20. data/docs/plans/07-plan-zone-export.md +58 -0
  21. data/docs/plans/08-plan-zone-diff.md +42 -0
  22. data/docs/plans/09-plan-zone-apply.md +69 -0
  23. data/docs/plans/10-plan-docs-cleanup.md +55 -0
  24. data/docs/plans/11-plan-zone-cli-arguments.md +114 -0
  25. data/docs/spec-zone-management.md +242 -0
  26. data/exe/dme +13 -2
  27. data/exe/dmez +6 -0
  28. data/lib/dme.rb +7 -2
  29. data/lib/dnsmadeeasy/api/client.rb +32 -26
  30. data/lib/dnsmadeeasy/cli/box_output.rb +9 -0
  31. data/lib/dnsmadeeasy/cli/commands/account.rb +222 -0
  32. data/lib/dnsmadeeasy/cli/commands/base.rb +119 -0
  33. data/lib/dnsmadeeasy/cli/commands/legacy_operation.rb +30 -0
  34. data/lib/dnsmadeeasy/cli/commands/version.rb +22 -0
  35. data/lib/dnsmadeeasy/cli/commands/zone.rb +392 -0
  36. data/lib/dnsmadeeasy/cli/commands.rb +19 -0
  37. data/lib/dnsmadeeasy/cli/input.rb +14 -0
  38. data/lib/dnsmadeeasy/cli/launcher.rb +53 -0
  39. data/lib/dnsmadeeasy/cli/message_helpers.rb +93 -0
  40. data/lib/dnsmadeeasy/cli/reported_error.rb +10 -0
  41. data/lib/dnsmadeeasy/credentials/api_keys.rb +11 -9
  42. data/lib/dnsmadeeasy/credentials.rb +0 -1
  43. data/lib/dnsmadeeasy/runner.rb +24 -24
  44. data/lib/dnsmadeeasy/types.rb +19 -0
  45. data/lib/dnsmadeeasy/version.rb +2 -1
  46. data/lib/dnsmadeeasy/zone/aname_flattener.rb +63 -0
  47. data/lib/dnsmadeeasy/zone/apply_executor.rb +189 -0
  48. data/lib/dnsmadeeasy/zone/apply_result.rb +22 -0
  49. data/lib/dnsmadeeasy/zone/diff.rb +152 -0
  50. data/lib/dnsmadeeasy/zone/file.rb +26 -0
  51. data/lib/dnsmadeeasy/zone/parser.rb +172 -0
  52. data/lib/dnsmadeeasy/zone/plan.rb +28 -0
  53. data/lib/dnsmadeeasy/zone/plan_action.rb +29 -0
  54. data/lib/dnsmadeeasy/zone/plan_renderer.rb +91 -0
  55. data/lib/dnsmadeeasy/zone/provider_record.rb +18 -0
  56. data/lib/dnsmadeeasy/zone/record.rb +44 -0
  57. data/lib/dnsmadeeasy/zone/record_set.rb +23 -0
  58. data/lib/dnsmadeeasy/zone/remote_adapter.rb +94 -0
  59. data/lib/dnsmadeeasy/zone/remote_records.rb +26 -0
  60. data/lib/dnsmadeeasy/zone/serializer.rb +119 -0
  61. data/lib/dnsmadeeasy.rb +61 -27
  62. metadata +212 -39
  63. data/.dme-help.png +0 -0
  64. data/README.adoc +0 -690
data/Rakefile CHANGED
@@ -10,15 +10,15 @@ def shell(*args)
10
10
  end
11
11
 
12
12
  task :permissions do
13
- shell('rm -rf pkg/ tmp/' )
14
- shell("chmod -v o+r,g+r * */* */*/* */*/*/* */*/*/*/* */*/*/*/*/*")
15
- shell("find . -type d -exec chmod o+x,g+x {} \\;")
13
+ shell('rm -rf pkg/ tmp/')
14
+ shell('chmod -v o+r,g+r * */* */*/* */*/*/* */*/*/*/* */*/*/*/*/*')
15
+ shell('find . -type d -exec chmod o+x,g+x {} \\;')
16
16
  end
17
17
 
18
18
  task build: :permissions
19
19
 
20
20
  YARD::Rake::YardocTask.new(:doc) do |t|
21
- t.files = %w(lib/**/*.rb exe/*.rb - README.md LICENSE.txt)
21
+ t.files = %w[lib/**/*.rb exe/*.rb - README.md LICENSE.txt]
22
22
  t.options.unshift('--title', 'DNS Client for DnsMadeEasy')
23
23
  t.after = -> { exec('open doc/index.html') }
24
24
  end
data/dnsmadeeasy.gemspec CHANGED
@@ -8,48 +8,64 @@ require 'dnsmadeeasy/version'
8
8
 
9
9
  # rubocop:todo Naming/HeredocDelimiterCase
10
10
  DnsMadeEasy::DESCRIPTION = <<~eof
11
- This is an authoratative and fully-featured API client for the DNS Provider "DnsMadeEasy.com".
12
-
13
- This library offers both a rich Ruby API that you can use to automate DNS record management, as well
14
- as a rich CLI interface with the command line executable "dme" installed when you install the gem.
15
- The gem additionally supports storing credentials in the ~/.dnsmadeeasy/credentials.yml
16
- file, supports multiple accounts, encryption, and more.
17
-
18
- If you are using Chef consider using the "dnsmadeeasy" Chef Cookbook, while uses this gem behind
19
- the scenes: https://supermarket.chef.io/cookbooks/dnsmadeeasy<br />
20
-
21
- ACKNOWLEDGEMENTS:
22
-
23
- 1. This gem is based on the original work contributed by Wanelo.com to the
24
- now abandonded "dnsmadeeasy-rest-api" client.
25
-
26
- 2. We also wish to thank the gem author Phil Cohen who
27
- kindly yielded the "dnsmadeeasy" RubyGems namespace to this gem.
28
-
29
- 3. We also thank Praneeth Are for contributing the support for secondary domains in 0.3.5.
11
+ This gem ships "dmez" a Terraform-style command line tool for the
12
+ DNS provider DnsMadeEasy.com — together with an authoritative,
13
+ fully-featured Ruby client for their REST API v2.0.
14
+
15
+ The dmez CLI manages your zones as standard DNS zone files with the
16
+ familiar read -> plan -> apply loop: "dmez zone export" writes a
17
+ canonical, TTL-lossless zone file with fixed aligned columns;
18
+ "dmez zone plan" diffs it against the live records (conservatively:
19
+ deletes are skipped by default and ambiguous record groups are
20
+ flagged for manual review); "dmez zone apply" executes the plan in
21
+ merge, add-only, or delete-only mode. Zone files can also be
22
+ validated and formatted, ANAME records are preserved as first-class
23
+ citizens (with optional --strict-rfc flattening on export), and
24
+ every account API operation is available under "dmez account".
25
+
26
+ The Ruby API supports storing credentials in
27
+ ~/.dnsmadeeasy/credentials.yml, including multiple accounts and
28
+ sym-encrypted values.
29
+
30
+ ACKNOWLEDGEMENTS:
31
+
32
+ 1. This gem is based on the original work contributed by Wanelo.com to the
33
+ now abandonded "dnsmadeeasy-rest-api" client.
34
+
35
+ 2. We also wish to thank the gem author Phil Cohen who
36
+ kindly yielded the "dnsmadeeasy" RubyGems namespace to this gem.
37
+
38
+ 3. We also thank Praneeth Are for contributing the support for
39
+ secondary domains in 0.3.5.
30
40
  eof
31
41
 
32
42
  Gem::Specification.new do |spec|
33
43
  spec.name = 'dnsmadeeasy'
34
44
  spec.version = DnsMadeEasy::VERSION
35
- spec.authors = ['Konstantin Gredeskoul', 'Arnoud Vermeer', 'Paul Henry', 'James Hart', 'Phil Cohen', 'Praneeth Are']
36
- spec.email = %w(kigster@gmail.com letuboy@gmail.com hjhart@gmail.com)
45
+ spec.authors = ['Konstantin Gredeskoul', 'Arnoud Vermeer', 'Paul Henry', 'James Hart', 'Phil Cohen',
46
+ 'Praneeth Are']
47
+ spec.email = %w[kigster@gmail.com letuboy@gmail.com hjhart@gmail.com]
37
48
  spec.summary = DnsMadeEasy::DESCRIPTION
38
49
  spec.description = DnsMadeEasy::DESCRIPTION
39
50
  spec.post_install_message = <<~EOF
40
- Thank you for using the DnsMadeEasy ruby gem, the Ruby client
41
- API for DnsMadeEasy.com's SDK v2. Please note that this gem
42
- comes with a rich command line utility 'dme' which you can use
43
- instead of the ruby API if you prefer. Run `dme` with no
44
- arguments to see the help message.
45
-
46
- You can also store (multi-account) credentials in a YAML file in
47
- your home directory. For more information, please see README at:
48
- https://github.com/kigster/dnsmadeeasy
51
+ Thank you for installing the DnsMadeEasy ruby gem, which ships
52
+ the 'dmez' CLI manage your DNS zones as plain zone files with
53
+ a Terraform-style workflow:
54
+
55
+ dmez zone export yourdomain.com --output=yourdomain.com.zone
56
+ dmez zone plan yourdomain.com yourdomain.com.zone
57
+ dmez zone apply yourdomain.com yourdomain.com.zone
58
+
59
+ Run `dmez --help` to see all commands (the old 'dme' executable
60
+ is deprecated). A full Ruby API client is included as well, with
61
+ (multi-account) credentials support via a YAML file in your home
62
+ directory. For more information, please see the README at:
63
+ https://github.com/kigster/dnsmadeeasy
49
64
  EOF
50
65
 
51
66
  spec.homepage = 'https://github.com/kigster/dnsmadeeasy'
52
67
  spec.license = 'MIT'
68
+ spec.required_ruby_version = '~> 4.0'
53
69
 
54
70
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
55
71
  f.match(%r{^(test|spec|features)/})
@@ -61,10 +77,17 @@ Gem::Specification.new do |spec|
61
77
 
62
78
  spec.add_dependency 'awesome_print'
63
79
  spec.add_dependency 'colored2'
80
+ spec.add_dependency 'dns-zonefile'
81
+ spec.add_dependency 'dry-cli'
82
+ spec.add_dependency 'dry-monads'
83
+ spec.add_dependency 'dry-struct'
84
+ spec.add_dependency 'dry-types'
64
85
  spec.add_dependency 'hashie'
65
86
  spec.add_dependency 'sym'
87
+ spec.add_dependency 'tsort'
88
+ spec.add_dependency 'tty-box'
89
+ spec.add_dependency 'tty-spinner'
66
90
 
67
- spec.add_development_dependency 'bundler'
68
91
  spec.add_development_dependency 'rake'
69
92
  spec.add_development_dependency 'relaxed-rubocop'
70
93
  spec.add_development_dependency 'rspec'
@@ -74,5 +97,6 @@ Gem::Specification.new do |spec|
74
97
  spec.add_development_dependency 'webmock'
75
98
  spec.add_development_dependency 'yard'
76
99
 
77
- # spec.add_development_dependency 'aruba'
100
+ spec.add_development_dependency 'aruba'
101
+ spec.metadata['rubygems_mfa_required'] = 'true'
78
102
  end
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="99" height="20">
3
+ <linearGradient id="b" x2="0" y2="100%">
4
+ <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
5
+ <stop offset="1" stop-opacity=".1"/>
6
+ </linearGradient>
7
+ <mask id="a">
8
+ <rect width="99" height="20" rx="3" fill="#fff"/>
9
+ </mask>
10
+ <g mask="url(#a)">
11
+ <path fill="#555" d="M0 0h63v20H0z"/>
12
+ <path fill="#4c1" d="M63 0h36v20H63z"/>
13
+ <path fill="url(#b)" d="M0 0h99v20H0z"/>
14
+ </g>
15
+ <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
16
+ <text x="31.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
17
+ <text x="31.5" y="14">coverage</text>
18
+ <text x="80" y="15" fill="#010101" fill-opacity=".3">93%</text>
19
+ <text x="80" y="14">93%</text>
20
+ </g>
21
+ </svg>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>URL</key>
6
+ <string>https://kig.re/2020/09/07/writing-cli-tools-ruby-migrating-github-issues-to-pivotal-tracker.html</string>
7
+ </dict>
8
+ </plist>