harbr 0.2.10 → 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/exe/harbr +225 -150
  4. data/lib/examples/container.toml +13 -0
  5. data/lib/harbr/container.rb +14 -10
  6. data/lib/harbr/host.rb +21 -0
  7. data/lib/harbr/version.rb +1 -1
  8. data/lib/harbr.rb +21 -6
  9. data/vendor/bundle/ruby/3.2.0/cache/dddr-1.0.8.gem +0 -0
  10. data/vendor/bundle/ruby/3.2.0/cache/dddr-1.1.0.gem +0 -0
  11. data/vendor/bundle/ruby/3.2.0/cache/dddr-1.1.1.gem +0 -0
  12. data/vendor/bundle/ruby/3.2.0/cache/net-ssh-7.2.1.gem +0 -0
  13. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/.DS_Store +0 -0
  14. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/.rspec +3 -0
  15. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/.standard.yml +3 -0
  16. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/CHANGELOG.md +5 -0
  17. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/CODE_OF_CONDUCT.md +84 -0
  18. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/LICENSE.txt +21 -0
  19. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/README.md +96 -0
  20. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/Rakefile +10 -0
  21. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/hero.png +0 -0
  22. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/lib/dddr/version.rb +5 -0
  23. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/lib/dddr.rb +205 -0
  24. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.0.8/sig/dddr.rbs +4 -0
  25. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/.DS_Store +0 -0
  26. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/.rspec +3 -0
  27. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/.standard.yml +3 -0
  28. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/CHANGELOG.md +5 -0
  29. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/CODE_OF_CONDUCT.md +84 -0
  30. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/LICENSE.txt +21 -0
  31. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/README.md +96 -0
  32. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/Rakefile +10 -0
  33. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/hero.png +0 -0
  34. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/lib/dddr/version.rb +5 -0
  35. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/lib/dddr.rb +182 -0
  36. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.0/sig/dddr.rbs +4 -0
  37. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/.DS_Store +0 -0
  38. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/.rspec +3 -0
  39. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/.standard.yml +3 -0
  40. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/CHANGELOG.md +5 -0
  41. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/CODE_OF_CONDUCT.md +84 -0
  42. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/LICENSE.txt +21 -0
  43. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/README.md +96 -0
  44. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/Rakefile +10 -0
  45. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/hero.png +0 -0
  46. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/lib/dddr/version.rb +5 -0
  47. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/lib/dddr.rb +184 -0
  48. data/vendor/bundle/ruby/3.2.0/gems/dddr-1.1.1/sig/dddr.rbs +4 -0
  49. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/.dockerignore +6 -0
  50. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/.github/FUNDING.yml +1 -0
  51. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/.github/config/rubocop_linter_action.yml +4 -0
  52. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/.github/workflows/ci-with-docker.yml +44 -0
  53. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/.github/workflows/ci.yml +94 -0
  54. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/.github/workflows/rubocop.yml +16 -0
  55. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/.gitignore +15 -0
  56. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/.rubocop.yml +22 -0
  57. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/.rubocop_todo.yml +1081 -0
  58. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/CHANGES.txt +738 -0
  59. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/DEVELOPMENT.md +23 -0
  60. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/Dockerfile +29 -0
  61. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/Dockerfile.openssl3 +17 -0
  62. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/Gemfile +13 -0
  63. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/Gemfile.noed25519 +12 -0
  64. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/Gemfile.norbnacl +12 -0
  65. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/ISSUE_TEMPLATE.md +30 -0
  66. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/LICENSE.txt +19 -0
  67. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/Manifest +132 -0
  68. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/README.md +298 -0
  69. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/Rakefile +192 -0
  70. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/SECURITY.md +4 -0
  71. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/THANKS.txt +110 -0
  72. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/appveyor.yml +58 -0
  73. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/docker-compose.yml +25 -0
  74. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/agent.rb +284 -0
  75. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/certificate.rb +183 -0
  76. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/constants.rb +20 -0
  77. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/ed25519.rb +186 -0
  78. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/ed25519_loader.rb +31 -0
  79. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/key_manager.rb +327 -0
  80. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/methods/abstract.rb +79 -0
  81. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/methods/hostbased.rb +72 -0
  82. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/methods/keyboard_interactive.rb +77 -0
  83. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/methods/none.rb +34 -0
  84. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/methods/password.rb +80 -0
  85. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/methods/publickey.rb +137 -0
  86. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/pageant.rb +497 -0
  87. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/pub_key_fingerprint.rb +43 -0
  88. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/session.rb +172 -0
  89. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/buffer.rb +449 -0
  90. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/buffered_io.rb +202 -0
  91. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/config.rb +406 -0
  92. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/channel.rb +694 -0
  93. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/constants.rb +33 -0
  94. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/event_loop.rb +123 -0
  95. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/keepalive.rb +59 -0
  96. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/session.rb +712 -0
  97. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/term.rb +180 -0
  98. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/errors.rb +106 -0
  99. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/key_factory.rb +218 -0
  100. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/known_hosts.rb +265 -0
  101. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/loggable.rb +62 -0
  102. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/packet.rb +106 -0
  103. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/prompt.rb +62 -0
  104. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/proxy/command.rb +123 -0
  105. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/proxy/errors.rb +16 -0
  106. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/proxy/http.rb +98 -0
  107. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/proxy/https.rb +50 -0
  108. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/proxy/jump.rb +54 -0
  109. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/proxy/socks4.rb +67 -0
  110. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/proxy/socks5.rb +140 -0
  111. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/service/forward.rb +426 -0
  112. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/test/channel.rb +147 -0
  113. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/test/extensions.rb +173 -0
  114. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/test/kex.rb +46 -0
  115. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/test/local_packet.rb +53 -0
  116. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/test/packet.rb +101 -0
  117. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/test/remote_packet.rb +40 -0
  118. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/test/script.rb +180 -0
  119. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/test/socket.rb +65 -0
  120. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/test.rb +94 -0
  121. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/algorithms.rb +524 -0
  122. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/chacha20_poly1305_cipher.rb +117 -0
  123. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/chacha20_poly1305_cipher_loader.rb +17 -0
  124. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/cipher_factory.rb +128 -0
  125. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/constants.rb +40 -0
  126. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/ctr.rb +115 -0
  127. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/abstract.rb +97 -0
  128. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/md5.rb +10 -0
  129. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/md5_96.rb +9 -0
  130. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/none.rb +13 -0
  131. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/ripemd160.rb +11 -0
  132. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/sha1.rb +11 -0
  133. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/sha1_96.rb +9 -0
  134. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/sha2_256.rb +11 -0
  135. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/sha2_256_96.rb +9 -0
  136. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/sha2_256_etm.rb +12 -0
  137. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/sha2_512.rb +11 -0
  138. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/sha2_512_96.rb +9 -0
  139. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac/sha2_512_etm.rb +12 -0
  140. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/hmac.rb +47 -0
  141. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/identity_cipher.rb +65 -0
  142. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/abstract.rb +130 -0
  143. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/abstract5656.rb +72 -0
  144. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/curve25519_sha256.rb +39 -0
  145. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/curve25519_sha256_loader.rb +30 -0
  146. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb +37 -0
  147. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/diffie_hellman_group14_sha256.rb +11 -0
  148. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +122 -0
  149. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +72 -0
  150. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb +11 -0
  151. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb +39 -0
  152. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/ecdh_sha2_nistp384.rb +21 -0
  153. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex/ecdh_sha2_nistp521.rb +21 -0
  154. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/kex.rb +31 -0
  155. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/key_expander.rb +30 -0
  156. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/openssl.rb +274 -0
  157. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/openssl_cipher_extensions.rb +8 -0
  158. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/packet_stream.rb +301 -0
  159. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/server_version.rb +77 -0
  160. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/session.rb +354 -0
  161. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/transport/state.rb +208 -0
  162. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/verifiers/accept_new.rb +33 -0
  163. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/verifiers/accept_new_or_local_tunnel.rb +33 -0
  164. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/verifiers/always.rb +58 -0
  165. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/verifiers/never.rb +19 -0
  166. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/version.rb +68 -0
  167. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh.rb +338 -0
  168. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/net-ssh-public_cert.pem +20 -0
  169. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/net-ssh.gemspec +46 -0
  170. data/vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/support/ssh_tunnel_bug.rb +65 -0
  171. data/vendor/bundle/ruby/3.2.0/specifications/dddr-1.0.8.gemspec +27 -0
  172. data/vendor/bundle/ruby/3.2.0/specifications/dddr-1.1.0.gemspec +27 -0
  173. data/vendor/bundle/ruby/3.2.0/specifications/dddr-1.1.1.gemspec +27 -0
  174. data/vendor/bundle/ruby/3.2.0/specifications/net-ssh-7.2.1.gemspec +38 -0
  175. metadata +174 -9
  176. data/config/manifest.yml +0 -5
  177. data/lib/harbr/job.rb +0 -252
  178. data/lib/harbr/lxd/job.rb +0 -119
  179. data/lib/harbr/lxd/setup.rb +0 -45
@@ -0,0 +1,182 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sdbm"
4
+ require "securerandom"
5
+ require "date"
6
+ require "ostruct"
7
+
8
+ require_relative "dddr/version"
9
+
10
+ module Dddr
11
+ def self.configuration
12
+ @configuration ||= OpenStruct.new
13
+ end
14
+
15
+ def self.configure
16
+ configuration.env = ENV["DDDR_ENV"] || "development"
17
+ configuration.data_dir = "/var/dddr"
18
+ configuration.container = "#{File.basename(Dir.pwd)}"
19
+ yield(configuration) if block_given?
20
+ end
21
+
22
+ class Error < StandardError; end
23
+
24
+ module Entity
25
+ def self.included(base)
26
+ base.extend(ClassMethods)
27
+ end
28
+
29
+ attr_accessor :uid, :created_at, :last_updated_at, :deleted, :deleted_at
30
+
31
+ module ClassMethods
32
+ def queries(&block)
33
+ @queries_module ||= Module.new
34
+ @queries_module.module_eval(&block)
35
+ end
36
+
37
+ def const_missing(name)
38
+ if name == :Repository
39
+ create_repository_for(self)
40
+ else
41
+ super
42
+ end
43
+ end
44
+
45
+ private
46
+
47
+ def create_repository_for(entity_class)
48
+ repository_class = Class.new(RepositoryBase) do
49
+ define_singleton_method(:new) do |*args|
50
+ super(entity_class)
51
+ end
52
+ end
53
+
54
+ repository_class.include(@queries_module) if instance_variable_defined?(:@queries_module)
55
+
56
+ const_set(:Repository, repository_class)
57
+ end
58
+ end
59
+
60
+ class RepositoryBase
61
+ def initialize(entity_class)
62
+ @entity_class = entity_class
63
+ setup_data_directory(entity_class)
64
+ end
65
+
66
+ def setup_data_directory(entity_class)
67
+ env = Dddr.configuration.env
68
+ data_dir = Dddr.configuration.data_dir
69
+ container = Dddr.configuration.container
70
+ unless Dir.exist?(data_dir)
71
+ if data_dir.include?("/var/")
72
+ `sudo mkdir -p #{data_dir}/#{container}/#{env}/`
73
+ `sudo chown $USER #{data_dir}/#{container}/#{env}/`
74
+ else
75
+ `mkdir -p #{data_dir}/#{container}/#{env}/`
76
+ end
77
+ end
78
+ @name = "#{data_dir}/#{container}/#{env}/#{entity_class.name.downcase}"
79
+ end
80
+
81
+ def count
82
+ all.count
83
+ end
84
+
85
+ def add(entity)
86
+ uid = SecureRandom.uuid
87
+ entity.uid = uid
88
+ entity.created_at ||= DateTime.now.to_s
89
+ entity.last_updated_at ||= entity.created_at
90
+
91
+ SDBM.open(@name) do |db|
92
+ db[uid] = Marshal.dump(entity.to_hash)
93
+ end
94
+ uid
95
+ end
96
+
97
+ alias_method :create, :add
98
+ alias_method :insert, :add
99
+ alias_method :put, :add
100
+ alias_method :append, :add
101
+ alias_method :store, :add
102
+
103
+ def update(entity)
104
+ return unless entity.uid
105
+ entity.last_updated_at = DateTime.now.to_s
106
+ SDBM.open(@name) do |db|
107
+ db[entity.uid] = Marshal.dump(entity.to_hash)
108
+ end
109
+ entity
110
+ end
111
+
112
+ alias_method :modify, :update
113
+ alias_method :change, :update
114
+ alias_method :edit, :update
115
+ alias_method :revise, :update
116
+ alias_method :alter, :update
117
+
118
+ def delete(entity)
119
+ return unless entity.uid
120
+ SDBM.open(@name) do |db|
121
+ db.delete(entity.uid)
122
+ end
123
+ end
124
+
125
+ alias_method :remove, :delete
126
+ alias_method :erase, :delete
127
+ alias_method :discard, :delete
128
+ alias_method :destroy, :delete
129
+ alias_method :wipe, :delete
130
+
131
+ def get(uid)
132
+ SDBM.open(@name) do |db|
133
+ data = db[uid]
134
+ return unless data
135
+
136
+ entity = @entity_class.new
137
+ entity.from_hash(uid, Marshal.load(data))
138
+ entity
139
+ end
140
+ end
141
+
142
+ alias_method :find, :get
143
+
144
+ def all
145
+ result = []
146
+ SDBM.open(@name) do |db|
147
+ db.each do |key, value|
148
+ entity = @entity_class.new
149
+ entity.from_hash(key, Marshal.load(value))
150
+ result << entity unless entity.deleted
151
+ end
152
+ end
153
+ result
154
+ end
155
+ end
156
+
157
+ def to_hash
158
+ result = {}
159
+ instance_variables.each do |var_name|
160
+ attribute_name = var_name.to_s[1..].to_sym
161
+ result[attribute_name] = instance_variable_get(var_name)
162
+ end
163
+ result
164
+ end
165
+
166
+ def new?
167
+ created_at.nil?
168
+ end
169
+
170
+ def from_hash(uid, data_hash)
171
+ self.uid = uid
172
+ data_hash.each do |attribute, value|
173
+ attribute = attribute.to_sym
174
+ if respond_to?("#{attribute}=")
175
+ send("#{attribute}=", value)
176
+ end
177
+ end
178
+ end
179
+ end
180
+ end
181
+
182
+ Dddr.configure
@@ -0,0 +1,4 @@
1
+ module Dddr
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/testdouble/standard
3
+ ruby_version: 2.6
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-10-29
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at delaney@vidtreone.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Delaney Burke
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,96 @@
1
+ ![Alt text](hero.png)
2
+
3
+ # DDDr: Domain Driven Design Repository
4
+
5
+ ## Overview
6
+
7
+ "DDDr" is a Ruby gem designed to simplify the implementation of data repositories in a Domain-Driven Design (DDD) architecture. It provides a clean, easy-to-use interface for abstracting data access, so you can focus on domain logic rather than database operations.
8
+
9
+ ## Features
10
+
11
+ * Easy-to-use Entity and Repository classes
12
+ * Built-in UUID generation for entities
13
+ * In-memory storage using SDBM
14
+ * Date and time tracking for entities
15
+ * CRUD operation support
16
+ * Extensible query and association methods
17
+
18
+ ## Installation
19
+
20
+ To install, add the gem to your application's @Gemfile@:
21
+
22
+ <pre>
23
+ gem 'dddr'
24
+ </pre>
25
+
26
+ Then run:
27
+
28
+ <pre>
29
+ bundle install
30
+ </pre>
31
+
32
+ Alternatively, you can install the gem manually:
33
+
34
+ <pre>
35
+ gem install dddr
36
+ </pre>
37
+
38
+ ## Usage
39
+
40
+ ### Creating an Entity
41
+
42
+ Include the @Dddr::Entity@ module in your class:
43
+
44
+ <pre>
45
+ class MyEntity
46
+ include Dddr::Entity
47
+ attr_accessor :name, :email
48
+ end
49
+ </pre>
50
+
51
+ ### Using the Repository
52
+
53
+ <pre>
54
+ repository = MyEntity::Repository.new
55
+ entity = MyEntity.new
56
+ entity.name = "John Doe"
57
+ entity.email = "john.doe@example.com"
58
+
59
+ # Adding the entity
60
+ uid = repository.add(entity)
61
+
62
+ # Updating the entity
63
+ entity.name = "Jane Doe"
64
+ updated_entity = repository.update(entity)
65
+
66
+ # Deleting the entity
67
+ repository.delete(entity)
68
+
69
+ # Fetching an entity by UID
70
+ fetched_entity = repository.get(uid)
71
+ </pre>
72
+
73
+ ### Custom Queries
74
+
75
+ Define custom queries using the @queries@ method within your entity class.
76
+
77
+ <pre>
78
+ class MyEntity
79
+ include Dddr::Entity
80
+ attr_accessor :name, :email
81
+
82
+ queries do
83
+ def find_by_email(email)
84
+ # Custom query logic here
85
+ end
86
+ end
87
+ end
88
+ </pre>
89
+
90
+ You can then execute the custom query like this:
91
+
92
+ <pre>
93
+ repository = MyEntity::Repository.new
94
+ repository.find_by_email("john.doe@example.com")
95
+ </pre>
96
+
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[spec standard]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dddr
4
+ VERSION = "1.1.1"
5
+ end
@@ -0,0 +1,184 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sdbm"
4
+ require "securerandom"
5
+ require "date"
6
+ require "ostruct"
7
+
8
+ require_relative "dddr/version"
9
+
10
+ module Dddr
11
+ def self.configuration
12
+ @configuration ||= OpenStruct.new
13
+ end
14
+
15
+ def self.configure
16
+ configuration.env = ENV["DDDR_ENV"] || "development"
17
+ configuration.data_dir = "/var/dddr"
18
+ configuration.container = nil
19
+ yield(configuration) if block_given?
20
+ end
21
+
22
+ class Error < StandardError; end
23
+
24
+ module Entity
25
+ def self.included(base)
26
+ base.extend(ClassMethods)
27
+ end
28
+
29
+ attr_accessor :uid, :created_at, :last_updated_at, :deleted, :deleted_at
30
+
31
+ module ClassMethods
32
+ def queries(&block)
33
+ @queries_module ||= Module.new
34
+ @queries_module.module_eval(&block)
35
+ end
36
+
37
+ def const_missing(name)
38
+ if name == :Repository
39
+ create_repository_for(self)
40
+ else
41
+ super
42
+ end
43
+ end
44
+
45
+ private
46
+
47
+ def create_repository_for(entity_class)
48
+ repository_class = Class.new(RepositoryBase) do
49
+ define_singleton_method(:new) do |*args|
50
+ super(entity_class)
51
+ end
52
+ end
53
+
54
+ repository_class.include(@queries_module) if instance_variable_defined?(:@queries_module)
55
+
56
+ const_set(:Repository, repository_class)
57
+ end
58
+ end
59
+
60
+ class RepositoryBase
61
+ def initialize(entity_class)
62
+ @entity_class = entity_class
63
+ setup_data_directory(entity_class)
64
+ end
65
+
66
+ def setup_data_directory(entity_class)
67
+ env = Dddr.configuration.env
68
+ data_dir = Dddr.configuration.data_dir
69
+ container = Dddr.configuration.container
70
+ raise Dddr::Error, "Container name is required" unless container
71
+
72
+ unless Dir.exist?(data_dir)
73
+ if data_dir.include?("/var/")
74
+ `sudo mkdir -p #{data_dir}/#{container}/#{env}/`
75
+ `sudo chown $USER #{data_dir}/#{container}/#{env}/`
76
+ else
77
+ `mkdir -p #{data_dir}/#{container}/#{env}/`
78
+ end
79
+ end
80
+ @name = "#{data_dir}/#{container}/#{env}/#{entity_class.name.downcase}"
81
+ end
82
+
83
+ def count
84
+ all.count
85
+ end
86
+
87
+ def add(entity)
88
+ uid = SecureRandom.uuid
89
+ entity.uid = uid
90
+ entity.created_at ||= DateTime.now.to_s
91
+ entity.last_updated_at ||= entity.created_at
92
+
93
+ SDBM.open(@name) do |db|
94
+ db[uid] = Marshal.dump(entity.to_hash)
95
+ end
96
+ uid
97
+ end
98
+
99
+ alias_method :create, :add
100
+ alias_method :insert, :add
101
+ alias_method :put, :add
102
+ alias_method :append, :add
103
+ alias_method :store, :add
104
+
105
+ def update(entity)
106
+ return unless entity.uid
107
+ entity.last_updated_at = DateTime.now.to_s
108
+ SDBM.open(@name) do |db|
109
+ db[entity.uid] = Marshal.dump(entity.to_hash)
110
+ end
111
+ entity
112
+ end
113
+
114
+ alias_method :modify, :update
115
+ alias_method :change, :update
116
+ alias_method :edit, :update
117
+ alias_method :revise, :update
118
+ alias_method :alter, :update
119
+
120
+ def delete(entity)
121
+ return unless entity.uid
122
+ SDBM.open(@name) do |db|
123
+ db.delete(entity.uid)
124
+ end
125
+ end
126
+
127
+ alias_method :remove, :delete
128
+ alias_method :erase, :delete
129
+ alias_method :discard, :delete
130
+ alias_method :destroy, :delete
131
+ alias_method :wipe, :delete
132
+
133
+ def get(uid)
134
+ SDBM.open(@name) do |db|
135
+ data = db[uid]
136
+ return unless data
137
+
138
+ entity = @entity_class.new
139
+ entity.from_hash(uid, Marshal.load(data))
140
+ entity
141
+ end
142
+ end
143
+
144
+ alias_method :find, :get
145
+
146
+ def all
147
+ result = []
148
+ SDBM.open(@name) do |db|
149
+ db.each do |key, value|
150
+ entity = @entity_class.new
151
+ entity.from_hash(key, Marshal.load(value))
152
+ result << entity unless entity.deleted
153
+ end
154
+ end
155
+ result
156
+ end
157
+ end
158
+
159
+ def to_hash
160
+ result = {}
161
+ instance_variables.each do |var_name|
162
+ attribute_name = var_name.to_s[1..].to_sym
163
+ result[attribute_name] = instance_variable_get(var_name)
164
+ end
165
+ result
166
+ end
167
+
168
+ def new?
169
+ created_at.nil?
170
+ end
171
+
172
+ def from_hash(uid, data_hash)
173
+ self.uid = uid
174
+ data_hash.each do |attribute, value|
175
+ attribute = attribute.to_sym
176
+ if respond_to?("#{attribute}=")
177
+ send("#{attribute}=", value)
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
183
+
184
+ Dddr.configure
@@ -0,0 +1,4 @@
1
+ module Dddr
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
@@ -0,0 +1,6 @@
1
+ # Remove Git
2
+ .git/
3
+ .gitignore
4
+
5
+ docker-compose.yml
6
+ README.md
@@ -0,0 +1 @@
1
+ github: [mfazekas]
@@ -0,0 +1,4 @@
1
+ rubocop_fail_level: "convention"
2
+
3
+ versions:
4
+ rubocop: "1.27.0"
@@ -0,0 +1,44 @@
1
+ name: Test
2
+ on:
3
+ pull_request:
4
+ push: { branches: master }
5
+
6
+ jobs:
7
+ test:
8
+ name: Run test suite with docker
9
+ runs-on: ubuntu-latest
10
+ env:
11
+ COMPOSE_FILE: docker-compose.yml
12
+
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v3
16
+
17
+ - name: Build docker images
18
+ run: docker-compose build
19
+
20
+ - name: Run ruby 2.6
21
+ run: docker-compose run ruby-2.6
22
+
23
+ - name: Run ruby 2.7
24
+ run: docker-compose run ruby-2.7
25
+
26
+ - name: Run ruby 3.0
27
+ run: docker-compose run ruby-3.0
28
+
29
+ - name: Run ruby 3.1
30
+ run: docker-compose run ruby-3.1
31
+
32
+ test_openssl3:
33
+ name: Run test suite with docker and openssl 3.0
34
+ runs-on: ubuntu-latest
35
+
36
+ steps:
37
+ - name: Checkout code
38
+ uses: actions/checkout@v3
39
+
40
+ - name: Build docker images
41
+ run: docker build -t netssh_openssl3 -f Dockerfile.openssl3 .
42
+
43
+ - name: Run ruby 3.0 with openssl3
44
+ run: docker run --rm netssh_openssl3