source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | backup/backup | https://github.com/backup/backup | vagrant/spec/live/notifier/mail_spec.rb | Ruby | mit | 4,871 | master | 4,572 | require File.expand_path('../../../spec_helper', __FILE__)
# To run these tests, you need to setup your Mail credentials in
# /vagrant/spec/live.yml
#
module Backup
describe Notifier::Mail,
:if => BackupSpec::LIVE['notifier']['mail']['specs_enabled'] == true do
# These tests send actual emails. Check your mai... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/support/package.rb | Ruby | mit | 4,871 | master | 2,506 | module BackupSpec
class Package
include Backup::Utilities::Helpers
extend Forwardable
def_delegators :tarfile, :manifest, :contents, :[]
attr_reader :model
def initialize(model)
@model = model
end
def exist?
!files.empty? && files.all? {|f| File.exist?(f) }
end
def ... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/support/custom_matchers.rb | Ruby | mit | 4,871 | master | 2,020 | # Matches the contents of a TarFile (or PerformedJob.package)
# against the given manifest.
#
# Usage:
#
# performed_job = backup_perform :trigger
#
# expect( performed_job.package ).to match_manifest(<<-EOS)
# 51200 my_backup/archives/my_archive.tar
# 8099 my_backup/databases/MySQL/backup_test_0... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/support/example_helpers.rb | Ruby | mit | 4,871 | master | 6,891 | module BackupSpec
PROJECT_ROOT = '/backup.git'
CONFIG_TEMPLATE = Backup::Template.new.result('cli/config')
LOCAL_STORAGE_PATH = '/home/vagrant/Storage'
ALT_CONFIG_PATH = '/home/vagrant/Backup_alt'
LOCAL_SYNC_PATH = '/home/vagrant/sync_root'
GPG_HOME_DIR = '/home/vagrant/gpg_home' # default would be ~/.gnupg... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/support/tar_file.rb | Ruby | mit | 4,871 | master | 1,623 | module BackupSpec
class TarFile
include Backup::Utilities::Helpers
attr_reader :path
def initialize(path)
@path = path
end
def manifest
@manifest ||= begin
if File.exist?(path.to_s)
%x[#{ utility(:tar) } -tvf #{ path } 2>/dev/null]
else
''
... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/support/performed_job.rb | Ruby | mit | 4,871 | master | 225 | module BackupSpec
class PerformedJob
attr_reader :model, :logger, :package
def initialize(model)
@model = model
@logger = Backup::Logger.saved.shift
@package = Package.new(model)
end
end
end |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/support/gpg_keys.rb | Ruby | mit | 4,871 | master | 13,166 | module BackupSpec
GPGKeys = Hash.new {|h,k| h[k] = {} }
GPGKeys[:backup01][:long_id] = '8F5D150616325C61'
GPGKeys[:backup01][:public] = <<-EOS
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (GNU/Linux)
mI0EUBR6CwEEAMVSlFtAXO4jXYnVFAWy6chyaMw+gXOFKlWojNXOOKmE3SujdLKh
kWqnafx7VNrb8cjq... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/support/logger.rb | Ruby | mit | 4,871 | master | 317 | module Backup
class Logger
class << self
alias _clear! clear!
def clear!
saved << logger
_clear!
end
def saved
@saved ||= []
end
private
alias _reset! reset!
def reset!
@saved = nil
_reset!
end
end
end
end |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/splitter_spec.rb | Ruby | mit | 4,871 | master | 700 | require File.expand_path('../../spec_helper', __FILE__)
module Backup
describe Splitter do
specify 'suffix length may be configured' do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
split_into_chunks_of 1, 5
archive :my_archive do |archive|
ar... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/archive_spec.rb | Ruby | mit | 4,871 | master | 9,230 | require File.expand_path('../../spec_helper', __FILE__)
module Backup
describe Archive do
shared_examples 'GNU or BSD tar' do
specify 'All directories, no compression, with/without :root' do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
archive :archi... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/config_spec.rb | Ruby | mit | 4,871 | master | 1,930 | require File.expand_path('../../spec_helper', __FILE__)
describe 'Backup Configuration' do
specify 'Models may be preconfigured' do
create_config <<-EOS
preconfigure 'MyModel' do
archive :archive_a do |archive|
archive.add '~/test_data/dir_a'
end
compress_with Gzip
... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/database/postgresql_spec.rb | Ruby | mit | 4,871 | master | 3,302 | require File.expand_path('../../../spec_helper', __FILE__)
module Backup
describe 'Database::PostgreSQL' do
describe 'All Databases' do
specify 'With compression' do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
database PostgreSQL
compress_... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/database/mongodb_spec.rb | Ruby | mit | 4,871 | master | 7,603 | require File.expand_path('../../../spec_helper', __FILE__)
module Backup
describe 'Database::MongoDB' do
describe 'Single Database' do
specify 'All collections' do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
database MongoDB do |db|
db.n... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/database/riak_spec.rb | Ruby | mit | 4,871 | master | 1,223 | require File.expand_path('../../../spec_helper', __FILE__)
module Backup
describe 'Database::Riak' do
specify 'No Compression' do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
database Riak
store_with Local
end
EOS
# --tmp-path must be cha... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/database/redis_spec.rb | Ruby | mit | 4,871 | master | 2,579 | require File.expand_path('../../../spec_helper', __FILE__)
module Backup
describe 'Database::Redis' do
shared_examples 'redis specs' do
specify 'No Compression' do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
database Redis do |db|
db.mod... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/database/mysql_spec.rb | Ruby | mit | 4,871 | master | 4,420 | require File.expand_path('../../../spec_helper', __FILE__)
module Backup
describe 'Database::MySQL' do
describe 'All Databases' do
specify 'All tables' do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
database MySQL do |db|
db.name = :... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/encryptor/gpg_spec.rb | Ruby | mit | 4,871 | master | 11,810 | require File.expand_path('../../../spec_helper', __FILE__)
module Backup
describe Encryptor::GPG do
specify ':asymmetric mode with preloaded and imported keys' do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
archive :my_archive do |archive|
archive.ad... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/syncer/rsync/pull_spec.rb | Ruby | mit | 4,871 | master | 8,232 | require File.expand_path('../../../../spec_helper', __FILE__)
module Backup
describe Syncer::RSync::Pull do
context 'using :ssh mode' do
specify 'single directory' do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
sync_with RSync::Pull do |rsync|
... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/syncer/rsync/push_spec.rb | Ruby | mit | 4,871 | master | 8,097 | require File.expand_path('../../../../spec_helper', __FILE__)
module Backup
describe Syncer::RSync::Push do
context 'using :ssh mode' do
specify 'single directory' do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
sync_with RSync::Push do |rsync|
... |
github | backup/backup | https://github.com/backup/backup | vagrant/spec/acceptance/syncer/rsync/local_spec.rb | Ruby | mit | 4,871 | master | 2,151 | require File.expand_path('../../../../spec_helper', __FILE__)
module Backup
describe Syncer::RSync::Local do
specify 'single directory' do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
sync_with RSync::Local do |rsync|
rsync.path = '~/Storage'
... |
github | backup/backup | https://github.com/backup/backup | integration/tasks/fileset_builder.rb | Ruby | mit | 4,871 | master | 744 | # encoding: utf-8
class FilesetBuilder
def create(root_dir, dir_name, total, file_size)
create_dir(root_dir, dir_name)
create_fileset(File.join(root_dir, dir_name), total, file_size)
end
def create_dir(parent_dir, dir_name)
dir = File.join(parent_dir, dir_name)
Dir.mkdir(dir) unless Dir.exist?(d... |
github | backup/backup | https://github.com/backup/backup | integration/tasks/files.rake | Ruby | mit | 4,871 | master | 433 | # encoding: utf-8
require File.expand_path("../fileset_builder", __FILE__)
directory "tmp"
directory "tmp/test_data"
namespace :integration do
desc "Create test files"
task files: ["tmp", "tmp/test_data"] do
fb = FilesetBuilder.new
test_dirs = { "dir_a" => 3, "dir_b" => 3, "dir_c" => 3, "dir_d" => 1 }
... |
github | backup/backup | https://github.com/backup/backup | integration/acceptance/archive_spec.rb | Ruby | mit | 4,871 | master | 1,363 | # encoding: utf-8
require File.expand_path("../../spec_helper", __FILE__)
module Backup
describe Archive do
specify "All directories, no compression, without :root" do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, 'a description') do
archive :archive_a do |archive|
... |
github | backup/backup | https://github.com/backup/backup | integration/acceptance/splitter_spec.rb | Ruby | mit | 4,871 | master | 684 | require File.expand_path("../../spec_helper", __FILE__)
describe Backup::Splitter do
specify "suffix length may be configured" do
create_model :my_backup, <<-EOS
Backup::Model.new(:my_backup, "a description") do
split_into_chunks_of 1, 5
archive :my_archive do |archive|
archive.a... |
github | backup/backup | https://github.com/backup/backup | integration/support/logger.rb | Ruby | mit | 4,871 | master | 334 | # encoding: utf-8
module Backup
class Logger
class << self
alias _clear! clear!
def clear!
saved << logger
_clear!
end
def saved
@saved ||= []
end
private
alias _reset! reset!
def reset!
@saved = nil
_reset!
end
... |
github | backup/backup | https://github.com/backup/backup | integration/support/example_helpers.rb | Ruby | mit | 4,871 | master | 4,835 | # encoding: utf-8
module BackupSpec
CONFIG_TEMPLATE = Backup::Template.new.result("cli/config")
PROJECT_ROOT = "/usr/src/backup".freeze
LOCAL_STORAGE_PATH = File.join(PROJECT_ROOT, "tmp", "Storage")
module ExampleHelpers
# Creates the config.rb file.
#
# By default, this will be created as ~/Backu... |
github | backup/backup | https://github.com/backup/backup | integration/support/match_manifest.rb | Ruby | mit | 4,871 | master | 2,018 | # encoding: utf-8
# Matches the contents of a TarFile (or PerformedJob.package)
# against the given manifest.
#
# Usage:
#
# performed_job = backup_perform :trigger
#
# expect(performed_job.package).to match_manifest(<<-EOS)
# 51200 my_backup/archives/my_archive.tar
# 8099 my_backup/databases/My... |
github | backup/backup | https://github.com/backup/backup | integration/support/performed_job.rb | Ruby | mit | 4,871 | master | 244 | # encoding: utf-8
module BackupSpec
class PerformedJob
attr_reader :model, :logger, :package
def initialize(model)
@model = model
@logger = Backup::Logger.saved.shift
@package = Package.new(model)
end
end
end |
github | backup/backup | https://github.com/backup/backup | integration/support/package.rb | Ruby | mit | 4,871 | master | 2,523 | # encoding: utf-8
module BackupSpec
class Package
include Backup::Utilities::Helpers
extend Forwardable
def_delegators :tarfile, :manifest, :contents, :[]
attr_reader :model
def initialize(model)
@model = model
end
def exist?
!files.empty? && files.all? { |f| File.exist?(f)... |
github | backup/backup | https://github.com/backup/backup | integration/support/tarfile.rb | Ruby | mit | 4,871 | master | 1,650 | # encoding: utf-8
module BackupSpec
class TarFile
include Backup::Utilities::Helpers
attr_reader :path
def initialize(path)
@path = path
end
def manifest
@manifest ||= begin
if File.exist?(path.to_s)
`#{ utility(:tar) } -tvf #{ path } 2>/dev/null`
else
... |
github | backup/backup | https://github.com/backup/backup | lib/backup.rb | Ruby | mit | 4,871 | master | 4,869 | # Load Ruby Core Libraries
require "time"
require "fileutils"
require "tempfile"
require "syslog"
require "yaml"
require "etc"
require "forwardable"
require "thread"
require "open4"
require "thor"
require "shellwords"
require "excon"
# Include response.inspect in error messages.
Excon.defaults[:debug_response] = true... |
github | backup/backup | https://github.com/backup/backup | lib/backup/binder.rb | Ruby | mit | 4,871 | master | 446 | module Backup
class Binder
##
# Creates a new Backup::Notifier::Binder instance. Loops through the provided
# Hash to set instance variables
def initialize(key_and_values)
key_and_values.each do |key, value|
instance_variable_set("@#{key}", value)
end
end
##
# Returns ... |
github | backup/backup | https://github.com/backup/backup | lib/backup/model.rb | Ruby | mit | 4,871 | master | 14,825 | module Backup
class Model
class Error < Backup::Error; end
class FatalError < Backup::FatalError; end
class << self
##
# The Backup::Model.all class method keeps track of all the models
# that have been instantiated. It returns the @all class variable,
# which contains an array of... |
github | backup/backup | https://github.com/backup/backup | lib/backup/package.rb | Ruby | mit | 4,871 | master | 1,086 | module Backup
class Package
##
# The time when the backup initiated (in format: 2011.02.20.03.29.59)
attr_accessor :time
##
# The trigger which initiated the backup process
attr_reader :trigger
##
# Extension for the final archive file(s)
attr_accessor :extension
##
# Se... |
github | backup/backup | https://github.com/backup/backup | lib/backup/archive.rb | Ruby | mit | 4,871 | master | 4,604 | module Backup
class Archive
class Error < Backup::Error; end
include Utilities::Helpers
attr_reader :name, :options
##
# Adds a new Archive to a Backup Model.
#
# Backup::Model.new(:my_backup, 'My Backup') do
# archive :my_archive do |archive|
# archive.add 'pat... |
github | backup/backup | https://github.com/backup/backup | lib/backup/config.rb | Ruby | mit | 4,871 | master | 3,992 | require "backup/config/dsl"
require "backup/config/helpers"
module Backup
module Config
class Error < Backup::Error; end
DEFAULTS = {
config_file: "config.rb",
data_path: ".data",
tmp_path: ".tmp"
}
class << self
include Utilities::Helpers
attr_reader :user, :root_pat... |
github | backup/backup | https://github.com/backup/backup | lib/backup/utilities.rb | Ruby | mit | 4,871 | master | 6,989 | module Backup
module Utilities
class Error < Backup::Error; end
UTILITIES_NAMES = %w[
tar cat split sudo chown hostname
gzip bzip2
mongo mongodump mysqldump innobackupex
pg_dump pg_dumpall redis-cli riak-admin
gpg openssl
rsync ssh
sendmail exim
send_nsca
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/template.rb | Ruby | mit | 4,871 | master | 1,213 | require "erb"
module Backup
class Template
# Holds a binding object. Nil if not provided.
attr_accessor :binding
##
# Creates a new instance of the Backup::Template class
# and optionally takes an argument that can be either a binding object, a Hash or nil
def initialize(object = nil)
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/cli.rb | Ruby | mit | 4,871 | master | 11,374 | ##
# Build the Backup Command Line Interface using Thor
module Backup
class CLI < Thor
class Error < Backup::Error; end
class FatalError < Backup::FatalError; end
##
# [Perform]
#
# The only required option is the --trigger [-t].
# If --config-file, --data-path, --tmp-path or --log-path
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/cleaner.rb | Ruby | mit | 4,871 | master | 3,694 | module Backup
module Cleaner
class Error < Backup::Error; end
class << self
##
# Logs warnings if any temporary files still exist
# from the last time this model/trigger was run,
# then removes the files.
def prepare(model)
messages = []
packaging_folder = File.... |
github | backup/backup | https://github.com/backup/backup | lib/backup/pipeline.rb | Ruby | mit | 4,871 | master | 4,574 | module Backup
class Pipeline
class Error < Backup::Error; end
include Utilities::Helpers
attr_reader :stderr, :errors
def initialize
@commands = []
@success_codes = []
@errors = []
@stderr = ""
end
##
# Adds a command to be executed in the pipeline.
# Each c... |
github | backup/backup | https://github.com/backup/backup | lib/backup/packager.rb | Ruby | mit | 4,871 | master | 3,529 | module Backup
module Packager
class Error < Backup::Error; end
class << self
include Utilities::Helpers
##
# Build the final package for the backup model.
def package!(model)
@package = model.package
@encryptor = model.encryptor
@splitter = model.splitter
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/logger.rb | Ruby | mit | 4,871 | master | 5,584 | require "backup/logger/console"
require "backup/logger/logfile"
require "backup/logger/syslog"
require "backup/logger/fog_adapter"
module Backup
class Logger
class Config
class Logger < Struct.new(:class, :options)
def enabled?
options.enabled?
end
end
class DSL < Str... |
github | backup/backup | https://github.com/backup/backup | lib/backup/errors.rb | Ruby | mit | 4,871 | master | 1,379 | module Backup
# Provides cascading errors with formatted messages.
# See the specs for details.
module NestedExceptions
def self.included(klass)
klass.extend(Module.new do
def wrap(wrapped_exception, msg = nil)
new(msg, wrapped_exception)
end
end)
end
def initial... |
github | backup/backup | https://github.com/backup/backup | lib/backup/splitter.rb | Ruby | mit | 4,871 | master | 2,604 | module Backup
class Splitter
include Utilities::Helpers
attr_reader :package, :chunk_size, :suffix_length
def initialize(model, chunk_size, suffix_length)
@package = model.package
@chunk_size = chunk_size
@suffix_length = suffix_length
end
##
# This is called as part of th... |
github | backup/backup | https://github.com/backup/backup | lib/backup/cloud_io/cloud_files.rb | Ruby | mit | 4,871 | master | 9,980 | require "backup/cloud_io/base"
require "fog"
require "digest/md5"
module Backup
module CloudIO
class CloudFiles < Base
class Error < Backup::Error; end
MAX_FILE_SIZE = 1024**3 * 5 # 5 GiB
MAX_SLO_SIZE = 1024**3 * 5000 # 1000 segments @ 5 GiB
SEGMENT_BUFFER = 1024**2 # ... |
github | backup/backup | https://github.com/backup/backup | lib/backup/cloud_io/base.rb | Ruby | mit | 4,871 | master | 933 | module Backup
module CloudIO
class Error < Backup::Error; end
class FileSizeError < Backup::Error; end
class Base
attr_reader :max_retries, :retry_waitsec
def initialize(options = {})
@max_retries = options[:max_retries]
@retry_waitsec = options[:retry_waitsec]
end
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/cloud_io/s3.rb | Ruby | mit | 4,871 | master | 8,402 | require "backup/cloud_io/base"
require "fog"
require "digest/md5"
require "base64"
require "stringio"
module Backup
module CloudIO
class S3 < Base
class Error < Backup::Error; end
MAX_FILE_SIZE = 1024**3 * 5 # 5 GiB
MAX_MULTIPART_SIZE = 1024**4 * 5 # 5 TiB
attr_reader :access... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/pushover.rb | Ruby | mit | 4,871 | master | 1,887 | require "uri"
module Backup
module Notifier
class Pushover < Base
##
# The API User Token
attr_accessor :user
##
# The API Application Token
attr_accessor :token
##
# The user's device identifier to sent the message directly to,
# rather than all of the use... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/prowl.rb | Ruby | mit | 4,871 | master | 1,813 | require "uri"
module Backup
module Notifier
class Prowl < Base
##
# Application name
# Tell something like your server name. Example: "Server1 Backup"
attr_accessor :application
##
# API-Key
# Create a Prowl account and request an API key on prowlapp.com.
attr_acc... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/flowdock.rb | Ruby | mit | 4,871 | master | 2,447 | require "flowdock"
module Backup
module Notifier
class FlowDock < Base
##
# The Flowdock API token
attr_accessor :token
##
# Who the notification should appear from
attr_accessor :from_name
# Which email the notification should appear from
attr_accessor :from_ema... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/zabbix.rb | Ruby | mit | 4,871 | master | 1,649 | module Backup
module Notifier
class Zabbix < Base
attr_accessor :zabbix_host
attr_accessor :zabbix_port
attr_accessor :service_name
attr_accessor :service_host
attr_accessor :item_key
def initialize(model, &block)
super
instance_eval(&block) if block_given?... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/campfire.rb | Ruby | mit | 4,871 | master | 1,637 | require "json"
module Backup
module Notifier
class Campfire < Base
##
# Campfire api authentication token
attr_accessor :api_token
##
# Campfire account's subdomain
attr_accessor :subdomain
##
# Campfire account's room id
attr_accessor :room_id
def i... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/pagerduty.rb | Ruby | mit | 4,871 | master | 2,258 | require "pagerduty"
module Backup
module Notifier
class PagerDuty < Base
##
# PagerDuty Service API Key. Should be a 32 character hex string.
attr_accessor :service_key
##
# Determines if a backup with a warning should resolve an incident rather
# than trigger one.
#
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/mail.rb | Ruby | mit | 4,871 | master | 6,709 | require "mail"
module Backup
module Notifier
class Mail < Base
##
# Mail delivery method to be used by the Mail gem.
#
# Supported methods:
#
# [:smtp - ::Mail::SMTP (default)]
# Settings used by this method:
# {#address}, {#port}, {#domain}, {#user_name}, {#pa... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/twitter.rb | Ruby | mit | 4,871 | master | 1,533 | require "twitter"
module Backup
module Notifier
class Twitter < Base
##
# Twitter consumer key credentials
attr_accessor :consumer_key, :consumer_secret
##
# OAuth credentials
attr_accessor :oauth_token, :oauth_token_secret
def initialize(model, &block)
super
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/hipchat.rb | Ruby | mit | 4,871 | master | 3,086 | require "hipchat"
module Backup
module Notifier
class Hipchat < Base
##
# The Hipchat API token
attr_accessor :token
##
# The Hipchat API version
# Either 'v1' or 'v2' (default is 'v1')
attr_accessor :api_version
##
# Who the notification should appear from... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/base.rb | Ruby | mit | 4,871 | master | 3,523 | module Backup
module Notifier
class Error < Backup::Error; end
class Base
include Utilities::Helpers
include Config::Helpers
##
# When set to true, the user will be notified by email
# when a backup process ends without raising any exceptions
attr_accessor :on_success
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/nagios.rb | Ruby | mit | 4,871 | master | 1,872 | module Backup
module Notifier
class Nagios < Base
##
# Host of Nagios server to notify on backup completion.
attr_accessor :nagios_host
##
# Port of Nagios server to notify on backup completion.
attr_accessor :nagios_port
##
# Nagios nrpe configuration file.
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/command.rb | Ruby | mit | 4,871 | master | 2,653 | module Backup
module Notifier
class Command < Base
##
# Command to execute.
#
# Make sure it is accessible from your $PATH, or provide
# the absolute path to the command.
attr_accessor :command
##
# Arguments to pass to the command.
#
# Must be an array... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/slack.rb | Ruby | mit | 4,871 | master | 3,901 | require "uri"
require "json"
module Backup
module Notifier
class Slack < Base
##
# The incoming webhook url
attr_accessor :webhook_url
##
# The channel to send messages to
attr_accessor :channel
##
# The username to display along with the notification
attr_... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/ses.rb | Ruby | mit | 4,871 | master | 3,317 | require "aws-sdk"
require "mail"
module Backup
module Notifier
class Ses < Base
##
# Amazon Simple Email Service (SES) Credentials
attr_accessor :access_key_id, :secret_access_key, :use_iam_profile
##
# SES Region
attr_accessor :region
##
# Sender Email Address
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/datadog.rb | Ruby | mit | 4,871 | master | 3,064 | require "dogapi"
module Backup
module Notifier
class DataDog < Base
##
# The DataDog API key
attr_accessor :api_key
##
# The title of the event
attr_accessor :title
attr_deprecate :text,
version: "4.2",
message: "Please use the `message` attribute. For ... |
github | backup/backup | https://github.com/backup/backup | lib/backup/notifier/http_post.rb | Ruby | mit | 4,871 | master | 3,680 | require "uri"
module Backup
module Notifier
class HttpPost < Base
##
# URI to post notification to.
#
# URI scheme may be `http` or `https`.
#
# If Basic Authentication is needed, supply the `user:password` in the URI.
# e.g. 'https://user:pass@www.example.com/path'
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/compressor/bzip2.rb | Ruby | mit | 4,871 | master | 789 | module Backup
module Compressor
class Bzip2 < Base
##
# Specify the level of compression to use.
#
# Values should be a single digit from 1 to 9.
# Note that setting the level to either extreme may or may not
# give the desired result. Be sure to check the documentation
#... |
github | backup/backup | https://github.com/backup/backup | lib/backup/compressor/gzip.rb | Ruby | mit | 4,871 | master | 2,240 | module Backup
module Compressor
class Gzip < Base
class Error < Backup::Error; end
extend Utilities::Helpers
##
# Specify the level of compression to use.
#
# Values should be a single digit from 1 to 9.
# Note that setting the level to either extreme may or may not
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/compressor/base.rb | Ruby | mit | 4,871 | master | 743 | module Backup
module Compressor
class Base
include Utilities::Helpers
include Config::Helpers
##
# Yields to the block the compressor command and filename extension.
def compress_with
log!
yield @cmd, @ext
end
private
##
# Return the compres... |
github | backup/backup | https://github.com/backup/backup | lib/backup/compressor/custom.rb | Ruby | mit | 4,871 | master | 1,278 | module Backup
module Compressor
class Custom < Base
##
# Specify the system command to invoke a compressor,
# including any command-line arguments.
# e.g. @compressor.command = 'pbzip2 -p2 -4'
#
# The data to be compressed will be piped to the command's STDIN,
# and it sh... |
github | backup/backup | https://github.com/backup/backup | lib/backup/syncer/base.rb | Ruby | mit | 4,871 | master | 1,599 | module Backup
module Syncer
class Base
include Utilities::Helpers
include Config::Helpers
##
# Path to store the synced files/directories to
attr_accessor :path
##
# Flag for mirroring the files/directories
attr_accessor :mirror
##
# Optional user-def... |
github | backup/backup | https://github.com/backup/backup | lib/backup/syncer/rsync/push.rb | Ruby | mit | 4,871 | master | 6,185 | module Backup
module Syncer
module RSync
class Push < Base
##
# Mode of operation
#
# [:ssh (default)]
# Connects to the remote via SSH.
# Does not use an rsync daemon on the remote.
#
# [:ssh_daemon]
# Connects to the remote via ... |
github | backup/backup | https://github.com/backup/backup | lib/backup/syncer/rsync/base.rb | Ruby | mit | 4,871 | master | 1,428 | module Backup
module Syncer
module RSync
class Base < Syncer::Base
##
# Additional String or Array of options for the rsync cli
attr_accessor :additional_rsync_options
attr_accessor :archive
def initialize(syncer_id = nil, &block)
super
instance_e... |
github | backup/backup | https://github.com/backup/backup | lib/backup/syncer/rsync/local.rb | Ruby | mit | 4,871 | master | 522 | module Backup
module Syncer
module RSync
class Local < Base
def perform!
log!(:started)
create_dest_path!
run("#{rsync_command} #{paths_to_push} '#{dest_path}'")
log!(:finished)
end
private
# Expand path, since this is local and she... |
github | backup/backup | https://github.com/backup/backup | lib/backup/syncer/rsync/pull.rb | Ruby | mit | 4,871 | master | 1,312 | module Backup
module Syncer
module RSync
class Pull < Push
def perform!
log!(:started)
write_password_file!
create_dest_path!
run("#{rsync_command} #{host_options}#{paths_to_pull} " \
"'#{dest_path}'")
log!(:finished)
ensure
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/syncer/cloud/local_file.rb | Ruby | mit | 4,871 | master | 2,788 | require "digest/md5"
module Backup
module Syncer
module Cloud
class LocalFile
attr_reader :path
attr_accessor :md5
class << self
# Returns a Hash of LocalFile objects for each file within +dir+,
# except those matching any of the +excludes+.
# Hash key... |
github | backup/backup | https://github.com/backup/backup | lib/backup/syncer/cloud/cloud_files.rb | Ruby | mit | 4,871 | master | 2,137 | require "backup/cloud_io/cloud_files"
module Backup
module Syncer
module Cloud
class CloudFiles < Base
class Error < Backup::Error; end
##
# Rackspace CloudFiles Credentials
attr_accessor :username, :api_key
##
# Rackspace CloudFiles Container
attr_... |
github | backup/backup | https://github.com/backup/backup | lib/backup/syncer/cloud/base.rb | Ruby | mit | 4,871 | master | 5,761 | module Backup
module Syncer
module Cloud
class Error < Backup::Error; end
class Base < Syncer::Base
MUTEX = Mutex.new
##
# Number of threads to use for concurrency.
#
# Default: 0 (no concurrency)
attr_accessor :thread_count
##
# Numbe... |
github | backup/backup | https://github.com/backup/backup | lib/backup/syncer/cloud/s3.rb | Ruby | mit | 4,871 | master | 2,984 | require "backup/cloud_io/s3"
module Backup
module Syncer
module Cloud
class S3 < Base
class Error < Backup::Error; end
##
# Amazon Simple Storage Service (S3) Credentials
attr_accessor :access_key_id, :secret_access_key, :use_iam_profile
##
# Amazon S3 buck... |
github | backup/backup | https://github.com/backup/backup | lib/backup/config/dsl.rb | Ruby | mit | 4,871 | master | 3,227 | module Backup
module Config
# Context for loading user config.rb and model files.
class DSL
class Error < Backup::Error; end
Model = Backup::Model
class << self
private
# List the available database, storage, syncer, compressor, encryptor
# and notifier constants. T... |
github | backup/backup | https://github.com/backup/backup | lib/backup/config/helpers.rb | Ruby | mit | 4,871 | master | 4,248 | require "ostruct"
module Backup
module Config
module Helpers
def self.included(klass)
klass.extend ClassMethods
end
module ClassMethods
def defaults
@defaults ||= Config::Defaults.new
if block_given?
yield @defaults
else
@d... |
github | backup/backup | https://github.com/backup/backup | lib/backup/encryptor/open_ssl.rb | Ruby | mit | 4,871 | master | 2,309 | module Backup
module Encryptor
class OpenSSL < Base
BASE_OPTIONS = [
"aes-256-cbc",
"-pbkdf2",
"-iter", "310000" # As per OWASP "Password Storage Cheat Sheet"
].freeze
##
# The password that'll be used to encrypt the backup. This
# password will be required t... |
github | backup/backup | https://github.com/backup/backup | lib/backup/encryptor/base.rb | Ruby | mit | 4,871 | master | 576 | module Backup
module Encryptor
class Base
include Utilities::Helpers
include Config::Helpers
def initialize
load_defaults!
end
private
##
# Return the encryptor name, with Backup namespace removed
def encryptor_name
self.class.to_s.sub("Backup::",... |
github | backup/backup | https://github.com/backup/backup | lib/backup/encryptor/gpg.rb | Ruby | mit | 4,871 | master | 27,681 | module Backup
module Encryptor
##
# The GPG Encryptor allows you to encrypt your final archive using GnuPG,
# using one of three {#mode modes} of operation.
#
# == First, setup defaults in your +config.rb+ file
#
# Configure the {#keys} Hash using {.defaults} in your +config.rb+
# to s... |
github | backup/backup | https://github.com/backup/backup | lib/backup/database/postgresql.rb | Ruby | mit | 4,871 | master | 3,386 | module Backup
module Database
class PostgreSQL < Base
class Error < Backup::Error; end
##
# Name of the database that needs to get dumped.
# To dump all databases, set this to `:all` or leave blank.
# +username+ must be a PostgreSQL superuser to run `pg_dumpall`.
attr_accessor... |
github | backup/backup | https://github.com/backup/backup | lib/backup/database/mongodb.rb | Ruby | mit | 4,871 | master | 4,886 | module Backup
module Database
class MongoDB < Base
class Error < Backup::Error; end
##
# Name of the database that needs to get dumped
attr_accessor :name
##
# Credentials for the specified database
attr_accessor :username, :password, :authdb
##
# Connectiv... |
github | backup/backup | https://github.com/backup/backup | lib/backup/database/openldap.rb | Ruby | mit | 4,871 | master | 2,416 | module Backup
module Database
class OpenLDAP < Base
class Error < Backup::Error; end
##
# Name of the ldap backup
attr_accessor :name
##
# run slapcat under sudo if needed
# make sure to set SUID on a file, to let you run the file with permissions of file owner
# ... |
github | backup/backup | https://github.com/backup/backup | lib/backup/database/riak.rb | Ruby | mit | 4,871 | master | 2,357 | module Backup
module Database
class Riak < Base
##
# Node is the node from which to perform the backup.
# Default: riak@127.0.0.1
attr_accessor :node
##
# Cookie is the Erlang cookie/shared secret used to connect to the node.
# Default: riak
attr_accessor :cookie
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/database/base.rb | Ruby | mit | 4,871 | master | 2,833 | module Backup
module Database
class Error < Backup::Error; end
class Base
include Utilities::Helpers
include Config::Helpers
attr_reader :model, :database_id, :dump_path
##
# If given, +database_id+ will be appended to the #dump_filename.
# This is required if multiple D... |
github | backup/backup | https://github.com/backup/backup | lib/backup/database/mysql.rb | Ruby | mit | 4,871 | master | 5,432 | module Backup
module Database
class MySQL < Base
class Error < Backup::Error; end
##
# Name of the database that needs to get dumped
# To dump all databases, set this to `:all` or leave blank.
attr_accessor :name
##
# Credentials for the specified database
attr_ac... |
github | backup/backup | https://github.com/backup/backup | lib/backup/database/redis.rb | Ruby | mit | 4,871 | master | 4,669 | module Backup
module Database
class Redis < Base
class Error < Backup::Error; end
MODES = [:copy, :sync]
##
# Mode of operation.
#
# [:copy]
# Copies the redis dump file specified by {#rdb_path}.
# This data will be current as of the last RDB Snapshot
# ... |
github | backup/backup | https://github.com/backup/backup | lib/backup/database/sqlite.rb | Ruby | mit | 4,871 | master | 1,290 | module Backup
module Database
class SQLite < Base
class Error < Backup::Error; end
##
# Path to the sqlite3 file
attr_accessor :path
##
# Path to sqlite utility (optional)
attr_accessor :sqlitedump_utility
##
# Creates a new instance of the SQLite adapter o... |
github | backup/backup | https://github.com/backup/backup | lib/backup/logger/console.rb | Ruby | mit | 4,871 | master | 1,131 | module Backup
class Logger
class Console
class Options
##
# Disables all console output.
#
# This may also be set on the command line using +--quiet+.
#
# If +--no-quiet+ is used on the command line, console output
# will be enabled and any setting her... |
github | backup/backup | https://github.com/backup/backup | lib/backup/logger/syslog.rb | Ruby | mit | 4,871 | master | 3,565 | module Backup
class Logger
class Syslog
class Options
##
# Enables logging to the system's Syslog compatible logger.
#
# This may also be enabled using +--syslog+ on the command line.
#
# If +--no-syslog+ is used on the command line, this will be
# dis... |
github | backup/backup | https://github.com/backup/backup | lib/backup/logger/fog_adapter.rb | Ruby | mit | 4,871 | master | 581 | # require only the logger
require "formatador"
require "fog/core/logger"
module Backup
class Logger
module FogAdapter
class << self
# Logged as :info so these won't generate warnings.
# This is mostly to keep STDOUT clean and to provide
# supplemental messages for our own warnings.
... |
github | backup/backup | https://github.com/backup/backup | lib/backup/logger/logfile.rb | Ruby | mit | 4,871 | master | 4,097 | module Backup
class Logger
class Logfile
class Error < Backup::Error; end
class Options
##
# Enable the use of Backup's log file.
#
# While not necessary, as this is +true+ by default,
# this may also be set on the command line using +--logfile+.
#
... |
github | ankane/blazer | https://github.com/ankane/blazer | Rakefile | Ruby | mit | 4,779 | master | 533 | require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new do |t|
t.pattern = "test/*_test.rb"
end
task default: :test
%w(
athena bigquery cassandra drill druid elasticsearch
hive ignite influxdb mysql neo4j opensearch
postgresql presto redshift salesforce snowflake
soda spark sqlite sqlserver
... |
github | ankane/blazer | https://github.com/ankane/blazer | blazer.gemspec | Ruby | mit | 4,779 | master | 788 | require_relative "lib/blazer/version"
Gem::Specification.new do |spec|
spec.name = "blazer"
spec.version = Blazer::VERSION
spec.summary = "Explore your data with SQL. Easily create charts and dashboards, and share them with your team."
spec.homepage = "https://github.com/ankane/blazer... |
github | ankane/blazer | https://github.com/ankane/blazer | Gemfile | Ruby | mit | 4,779 | master | 814 | source "https://rubygems.org"
gemspec
gem "rake"
gem "minitest"
gem "combustion"
gem "rails", "~> 8.1.0"
gem "pg"
gem "sqlite3"
gem "mysql2"
gem "trilogy"
gem "propshaft"
# data sources
# gem "activerecord7-redshift-adapter-pennylane"
# gem "aws-sdk-athena"
# gem "aws-sdk-glue"
# gem "cassandra-driver"
# gem "sorted... |
github | ankane/blazer | https://github.com/ankane/blazer | app/controllers/blazer/queries_controller.rb | Ruby | mit | 4,779 | master | 14,879 | module Blazer
class QueriesController < BaseController
before_action :set_query, only: [:show, :edit, :update, :destroy, :refresh]
before_action :set_data_source, only: [:tables, :docs, :schema, :cancel]
def home
set_queries(1000)
if params[:filter]
@dashboards = [] # TODO show my da... |
github | ankane/blazer | https://github.com/ankane/blazer | app/controllers/blazer/base_controller.rb | Ruby | mit | 4,779 | master | 4,611 | module Blazer
class BaseController < ApplicationController
# skip filters
filters = _process_action_callbacks.map(&:filter) - [:activate_authlogic]
skip_before_action(*filters, raise: false)
skip_after_action(*filters, raise: false)
skip_around_action(*filters, raise: false)
clear_helpers
... |
github | ankane/blazer | https://github.com/ankane/blazer | app/controllers/blazer/checks_controller.rb | Ruby | mit | 4,779 | master | 1,515 | module Blazer
class ChecksController < BaseController
before_action :set_check, only: [:edit, :update, :destroy, :run]
def index
state_order = [nil, "disabled", "error", "timed out", "failing", "passing"]
@checks = Blazer::Check.joins(:query).includes(:query).order("blazer_queries.name, blazer_ch... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.