bibliotech 0.6.0 → 0.7.0

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
  SHA1:
3
- metadata.gz: b5cd8c3faadcd6085476fbc3dac6f1d4454ce634
4
- data.tar.gz: e4cd40ae88b8e3e24f85ab1bcf5d22ee838735b3
3
+ metadata.gz: 804c1ec222cfcce3715ea70417d454d27f101d28
4
+ data.tar.gz: 9192572724a7195c5fae93b584ac4918faf7c1bd
5
5
  SHA512:
6
- metadata.gz: bbe5696146f64efdb9c3c0cc54b9c14f64da721f428fb8f5ae12537cc2a747759584866105a713920e2239867337c55fc2b2a2aee06e87e3d4dbadf864d43467
7
- data.tar.gz: 6bced695414d447ec449eaa40fc3c3a20742b70f6640e8e4b1767fcb38e648a9d9a7322b0e1a5bb061a9edddbe7ede0734e3899e0163338354fa3ebb952a0fbe
6
+ metadata.gz: c06ed0372a7bbb3bca55b97679876745fdfa41fca057b918c237fe022ff8b0535830e47cfee74afeb9892e04a5790f749ef780d2f22e345664adbbdd5628fc63
7
+ data.tar.gz: 92f31cb44424be653504b1bf5c7cab93ddf20b1600b7960072d51a22d265a64bebd72ad47ce28a62bb329a8f4cf0f48b0ff25913f73f28a75b212e3b55152a77
@@ -72,7 +72,8 @@ module BiblioTech
72
72
  @shell.run(commands.export(options))
73
73
  end
74
74
 
75
- def create_backup(options)
75
+ def create_backup(options=nil)
76
+ options ||= {}
76
77
  time = Time.now.utc
77
78
  log.warn{ "Creating a backup at #{time}" }
78
79
  pruner = pruner(options)
@@ -21,6 +21,12 @@ module BiblioTech
21
21
  app.import(:backups => { :filename => file })
22
22
  end
23
23
 
24
+ desc "backup", "Create a database backup if needed"
25
+ def backup()
26
+ app = App.new
27
+ app.create_backup
28
+ end
29
+
24
30
  desc "config", "Dumps the configuration as parsed"
25
31
  def config
26
32
  require 'yaml'
@@ -105,8 +105,8 @@ module BiblioTech
105
105
  steps = steps_for(key)
106
106
  steps_chain =
107
107
  begin
108
- [steps, [local] + steps]
109
- rescue MissingConfig
108
+ [[local] + steps, steps]
109
+ rescue MissingConfig => mc
110
110
  [steps]
111
111
  end
112
112
  extract(*steps_chain)
@@ -81,6 +81,7 @@ module BiblioTech
81
81
  namespace :remote_sync do
82
82
  desc "Pull the latest DB dump from the remote server into our local DB"
83
83
  task :down do
84
+ app.remote_cli(remote, "create_backup").must_succeed!
84
85
  result = app.remote_cli(remote, "latest")
85
86
  result.must_succeed!
86
87
  filename = result.stdout.chomp
@@ -6,10 +6,11 @@ module BiblioTech
6
6
  describe Config do
7
7
  include FileSandbox
8
8
 
9
- describe "datatbase.yml" do
9
+ describe "database.yml" do
10
10
  before :each do
11
11
  sandbox.new :file => 'config/database.yml', :with_contents => YAML::dump(
12
12
  {
13
+
13
14
  "development" =>
14
15
  { "username" => 'root',
15
16
  "database" => 'dev_db',
@@ -128,6 +129,29 @@ module BiblioTech
128
129
  end
129
130
  end
130
131
 
132
+ context "environment overrides" do
133
+ let :config_hash do
134
+ { "backups" => {
135
+ "frequency" => 60,
136
+ "keep" => {
137
+ "hourly" => 1
138
+ }},
139
+ "production" => {
140
+ "backups" => {
141
+ "keep" => {
142
+ "hourly" => 12
143
+ }
144
+ }
145
+ },
146
+ "local" => "production"
147
+ }
148
+ end
149
+
150
+ it "should prefer the local config" do
151
+ expect(schedule_array).to contain_exactly([60, 12])
152
+ end
153
+ end
154
+
131
155
  context "mismatched frequency" do
132
156
  let :config_hash do
133
157
  { "backups" => {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bibliotech
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Dorn
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-22 00:00:00.000000000 Z
12
+ date: 2015-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: caliph
@@ -130,7 +130,7 @@ rdoc_options:
130
130
  - --main
131
131
  - doc/README
132
132
  - --title
133
- - bibliotech-0.6.0 Documentation
133
+ - bibliotech-0.7.0 Documentation
134
134
  require_paths:
135
135
  - lib/
136
136
  required_ruby_version: !ruby/object:Gem::Requirement