martilla 0.2.4 → 0.2.5

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: 63cd9b654795526e816bc135725eef85a473b5fd6ddd3c6b008243c0c9281db6
4
- data.tar.gz: 1b377281710bae60a4c50960c833fd215b30bcbff21b17f1cb2e6e3d94755fcd
3
+ metadata.gz: e11427e483a11fc6fcbbe33321c6625d0f946e637769ffe5c5b395170c045f46
4
+ data.tar.gz: 4a7191dfaeeb06c4a128a3b55d387c5f2648c8a88882fda12ca2d661713bd056
5
5
  SHA512:
6
- metadata.gz: d937688007f0805054a2fd7929903033e4c9983617909401a79d623b5138507ef596569937f2887a464e8060f588b35d513a316974dc104370774555c82ded02
7
- data.tar.gz: d8e94f577d29e344c2210399517dcd0a3d170e845bd21ea65161a317d2df467932b4ba2c70007786ea8ce791fb941bcc50128e2cf18f8dc2e376eb3ea73f6069
6
+ metadata.gz: 3a8f234b16c3d79e8b3395157e83c1626b0d7494aaa86f77d4540b2025a075f6b0e63e26657fbe2af9c47a20abe24f0f1f12fc54523a1dc71b91ea645cc6549f
7
+ data.tar.gz: cf3cdfa4bb8523bf507480970e8dba6ef34c2d972e2f7a21bbde1cb85f259a30d4e9fde31ae31866ea8d4feef8683e17f38caee68361f86ff6fff1d295b071e1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- martilla (0.2.4)
4
+ martilla (0.2.5)
5
5
  aws-sdk-s3 (~> 1.49)
6
6
  aws-sdk-ses (~> 1.26)
7
7
  memoist (~> 0.16.0)
@@ -0,0 +1,7 @@
1
+ module Martilla
2
+ class Component
3
+ def bash(command)
4
+ `bash -c \"#{command}\"`
5
+ end
6
+ end
7
+ end
@@ -1,7 +1,7 @@
1
1
  require 'forwardable'
2
2
 
3
3
  module Martilla
4
- class Database
4
+ class Database < Component
5
5
  attr_reader :options
6
6
 
7
7
  def initialize(config)
@@ -2,9 +2,9 @@ module Martilla
2
2
  class Mysql < Database
3
3
  def dump(tmp_file:, gzip:)
4
4
  if gzip
5
- `set -o pipefail && mysqldump #{connection_arguments} | gzip -c > #{tmp_file}`
5
+ bash("set -o pipefail && mysqldump #{connection_arguments} | gzip -c > #{tmp_file}")
6
6
  else
7
- `mysqldump #{connection_arguments} > #{tmp_file}`
7
+ bash("mysqldump #{connection_arguments} > #{tmp_file}")
8
8
  end
9
9
 
10
10
  return if $?.success?
@@ -2,9 +2,9 @@ module Martilla
2
2
  class Postgres < Database
3
3
  def dump(tmp_file:, gzip:)
4
4
  if gzip
5
- `set -o pipefail && pg_dump #{connection_string} | gzip -c > #{tmp_file}`
5
+ bash("set -o pipefail && pg_dump #{connection_string} | gzip -c > #{tmp_file}")
6
6
  else
7
- `pg_dump #{connection_string} > #{tmp_file}`
7
+ bash("pg_dump #{connection_string} > #{tmp_file}")
8
8
  end
9
9
 
10
10
  return if $?.success?
@@ -1,7 +1,7 @@
1
1
  require 'forwardable'
2
2
 
3
3
  module Martilla
4
- class Notifier
4
+ class Notifier < Component
5
5
  attr_reader :options
6
6
 
7
7
  def initialize(config)
@@ -1,7 +1,7 @@
1
1
  require 'forwardable'
2
2
 
3
3
  module Martilla
4
- class Storage
4
+ class Storage < Component
5
5
  attr_reader :options
6
6
 
7
7
  def initialize(config)
@@ -1,7 +1,7 @@
1
1
  module Martilla
2
2
  class Local < Storage
3
3
  def persist(tmp_file:, gzip:)
4
- `mv #{tmp_file} #{output_filename(gzip)}`
4
+ bash("mv #{tmp_file} #{output_filename(gzip)}")
5
5
  return nil if $?.success?
6
6
  raise Error.new("Local storage failed with code #{$?.exitstatus}")
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module Martilla
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
data/lib/martilla.rb CHANGED
@@ -2,6 +2,7 @@ require 'martilla/version'
2
2
  require 'martilla/cli'
3
3
 
4
4
  require 'martilla/backup'
5
+ require 'martilla/component'
5
6
 
6
7
  require 'martilla/database'
7
8
  require 'martilla/databases/mysql'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: martilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Valverde
@@ -202,6 +202,7 @@ files:
202
202
  - lib/martilla.rb
203
203
  - lib/martilla/backup.rb
204
204
  - lib/martilla/cli.rb
205
+ - lib/martilla/component.rb
205
206
  - lib/martilla/database.rb
206
207
  - lib/martilla/databases/mysql.rb
207
208
  - lib/martilla/databases/postgres.rb