sqlite_backups 0.2.1 → 1.0.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
  SHA256:
3
- metadata.gz: 8409eedf7805943faaa85ebb184dee513b9ffaaa4c67b1eb1163368b0f63e062
4
- data.tar.gz: d8ccbd330bf4214f838b8a7011747001b44d8ecfdf22d738412246b908d945d2
3
+ metadata.gz: 5bb9c13242166d4a829d3180417b14d73e90596d04681f254bbf01df69428e62
4
+ data.tar.gz: 94a73e892eb29b04b4bbfc014a6757f25b63676e12c2eed9106a7c8f30237208
5
5
  SHA512:
6
- metadata.gz: 9ec82f3d967d7d5f57d4315c83dc3b11f3fdd2aaf9930b0551f2ee98b4b41cbe09856628dfbe929e33fb0f0bce9df9c2916662c4b7a08876598d7ec345f2d380
7
- data.tar.gz: 7eb1b2a3841b38ec722d23748d6caf2600244354a916bbebc421cc484cd72fadaeca7251aa5e344d6cb6cfc8c6d9239dcfd242c899d7a3b5782304e5ad56f867
6
+ metadata.gz: 59a55dabd43b272df46d54bbd0853c6f5ce86dd35ee3816190ddcfd72a85c508582d997df04688ef7cb84e4e49bc67e584d44a1a39f838e356ecbf3860804b1f
7
+ data.tar.gz: 33868f9a169da2eb35f1f5ab40eb69f6a7a901e5321a0793629e8d63d4c7574155da54f21cfd8e57cdafe878a4d9138fb8ecdbec956fd5ddf80f6c6c9ca2bdba
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # SqliteBackups
1
+ # SQLiteBackups
2
2
 
3
- A dead simple Rails engine to backup your Sqlite databases utilizing Active
3
+ A dead simple Rails engine to backup your SQLite databases utilizing Active
4
4
  Storage.
5
5
 
6
6
  ## Usage
@@ -46,5 +46,7 @@ config.backups.storage_service = :backups
46
46
  config.backups.retention = 1.day
47
47
  ```
48
48
 
49
+ The `storage_service` value points to a defined ActiveStorage service.
50
+
49
51
  ## License
50
52
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -23,7 +23,21 @@ module Backups
23
23
  attr_reader :name, :path, :key
24
24
 
25
25
  def execute_backup
26
- `sqlite3 #{path} '.backup #{backup_path}'`
26
+ sdb = SQLite3::Database.new(path)
27
+ ddb = SQLite3::Database.new(backup_path)
28
+
29
+ b = SQLite3::Backup.new(ddb, "main", sdb, "main")
30
+ current_progress = 0
31
+ begin
32
+ b.step(1)
33
+ progress = (((b.pagecount - b.remaining) / b.pagecount.to_f) * 100.0).to_i
34
+ if progress > current_progress
35
+ current_progress = progress
36
+ print "\r#{current_progress}%"
37
+ end
38
+ end while b.remaining > 0
39
+ b.finish
40
+ puts ""
27
41
  end
28
42
 
29
43
  def compressed_data
@@ -1,3 +1,3 @@
1
1
  module Backups
2
- VERSION = "0.2.1"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlite_backups
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Pezza
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubygems_version: 3.6.8
86
+ rubygems_version: 3.6.9
87
87
  specification_version: 4
88
88
  summary: Simple sqlite backup for Rails
89
89
  test_files: []