Class: SecureDBFields::DBDeployment::DeploymentBundle
- Inherits:
-
Object
- Object
- SecureDBFields::DBDeployment::DeploymentBundle
- Defined in:
- lib/secure_db_fields/db_deployment.rb
Constant Summary collapse
- BUNDLE_FILES =
[ ["db_deployment/mysql/Makefile", "Makefile"], ["db_deployment/mysql/README.md", "README.md"], ["db_deployment/mysql/bin/common", "bin/common", 0o755], ["db_deployment/mysql/bin/doctor", "bin/doctor", 0o755], ["db_deployment/mysql/bin/install", "bin/install", 0o755], ["db_deployment/mysql/bin/enable", "bin/enable", 0o755], ["db_deployment/mysql/bin/disable", "bin/disable", 0o755], ["db_deployment/mysql/bin/status", "bin/status", 0o755], ["db_deployment/mysql/bin/verify", "bin/verify", 0o755], ["db_deployment/mysql/bin/uninstall", "bin/uninstall", 0o755], ["db_deployment/mysql/sql/install.sql", "sql/install.sql"], ["db_deployment/mysql/sql/uninstall.sql", "sql/uninstall.sql"], ["db_deployment/mysql/sql/examples.sql", "sql/examples.sql"], ["mysql_udf/src/secure_db_fields_mysql.c", "src/secure_db_fields_mysql.c"], ["mysql_udf/src/mysql_udf_abi_57.h", "src/mysql_udf_abi_57.h"], ["ext/secure_db_fields/secure_db_fields_core.c", "src/secure_db_fields_core.c"], ["ext/secure_db_fields/secure_db_fields_core.h", "src/secure_db_fields_core.h"] ].freeze
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #bundle_name ⇒ Object
-
#initialize(output, force: false) ⇒ DeploymentBundle
constructor
A new instance of DeploymentBundle.
- #write! ⇒ Object
Constructor Details
#initialize(output, force: false) ⇒ DeploymentBundle
Returns a new instance of DeploymentBundle.
224 225 226 227 |
# File 'lib/secure_db_fields/db_deployment.rb', line 224 def initialize(output, force: false) @output = output @force = force end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
222 223 224 |
# File 'lib/secure_db_fields/db_deployment.rb', line 222 def output @output end |
Instance Method Details
#bundle_name ⇒ Object
250 251 252 |
# File 'lib/secure_db_fields/db_deployment.rb', line 250 def bundle_name "secure_db_fields-mysql-#{SecureDBFields::VERSION}" end |
#write! ⇒ Object
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/secure_db_fields/db_deployment.rb', line 229 def write! path = File.(output) raise Error, "#{path} already exists (use --force)" if File.exist?(path) && !@force FileUtils.mkdir_p(File.dirname(path)) tmp = File.join(File.dirname(path), "secure-db-fields-db-bundle-#{Process.pid}-#{SecureRandom.hex(8)}.tar.gz.tmp") Zlib::GzipWriter.open(tmp) do |gz| Gem::Package::TarWriter.new(gz) do |tar| BUNDLE_FILES.each do |src, dst, mode| add_file(tar, src, dst, mode || 0o644) end add_text(tar, "VERSION", SecureDBFields::VERSION + "\n") add_text(tar, "BUNDLE_FORMAT", BUNDLE_FORMAT_VERSION.to_s + "\n") add_text(tar, "SHA256SUMS", checksums) end end File.rename(tmp, path) ensure File.delete(tmp) if defined?(tmp) && File.exist?(tmp) end |