static_db 0.0.2 → 0.0.4
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 +4 -4
- data/CHANGELOG.md +12 -2
- data/LICENSE.txt +1 -1
- data/README.md +18 -22
- data/Rakefile +13 -0
- data/lib/static_db/dump.rb +3 -7
- data/lib/static_db/engine.rb +0 -2
- data/lib/static_db/initializer.rb +0 -2
- data/lib/static_db/load.rb +0 -2
- data/lib/static_db/tasks/static.rake +0 -2
- data/lib/static_db/version.rb +1 -3
- data/lib/static_db.rb +0 -2
- metadata +17 -56
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02b96ad6eca0c26259e1e12e6ff9b83e770d37d2070487c011f6f2f1472c3a75
|
|
4
|
+
data.tar.gz: b1be8d64e52becc77b4163e3d3d521a42c046a799d73035624015074bf9d077e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29df6c00287bb63cab1b235b610d375521b689d1b4b1cc5823f53b8a395030437e3d119315ae68b7682c2a5266cd80a3c3658346d77a8304547d8e1a3bfe2889
|
|
7
|
+
data.tar.gz: 3d0631350c93afb497bef3b8205135a7ca6207927f67dc6426e8a13dc5fe4dbe3fc941512968097cdb8b305ee6838a7c71da9db8fbc5973f4e43a14d9441e806
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> :warning: This project is not inteded for public usage yet.
|
|
4
|
+
|
|
5
|
+
I will start keeping a changelog as soon as that happens.
|
|
6
|
+
|
|
7
|
+
This project adheres to [Break Versioning](https://www.taoensso.com/break-versioning).
|
|
8
|
+
|
|
9
|
+
## [Unreleased]
|
|
10
|
+
|
|
11
|
+
### Breaking
|
|
12
|
+
|
|
13
|
+
### Non-breaking
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,47 +1,43 @@
|
|
|
1
1
|
[](https://rubygems.org/gems/static_db)
|
|
2
2
|
[](https://github.com/dunkelziffer/static_db/actions)
|
|
3
|
-
[](https://github.com/dunkelziffer/static_db/actions)
|
|
4
3
|
|
|
5
4
|
# static_db
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
Dump DB contents to YAML and load them back again. Aimed at SQLite. Committable to git.
|
|
8
7
|
|
|
9
8
|
## Installation
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
WARNING: This gem modifies the Rails startup sequence. Don't use this gem unless you want to build a static site generator. This gem also creates and drops the DB for you.
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
# my-cool-gem.gemspec
|
|
15
|
-
Gem::Specification.new do |spec|
|
|
16
|
-
# ...
|
|
17
|
-
spec.add_dependency "static_db"
|
|
18
|
-
# ...
|
|
19
|
-
end
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Or adding to your project:
|
|
12
|
+
Add it to your Rails project:
|
|
23
13
|
|
|
24
14
|
```ruby
|
|
25
15
|
# Gemfile
|
|
26
16
|
gem "static_db"
|
|
17
|
+
|
|
18
|
+
# config/initializer/static_db.rb
|
|
19
|
+
StaticDb.configure do |config|
|
|
20
|
+
# `content/data` is the default. You only need this initializer,
|
|
21
|
+
# if you want a custom path.
|
|
22
|
+
config.fixture_path = Rails.root.join("content", "data")
|
|
23
|
+
end
|
|
27
24
|
```
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
## Usage
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
- JRuby >= 9.3.0
|
|
28
|
+
Only use on Rails projects with SQLite. Have a valid `db/schema.rb`. For additional dramatic effect, do a `rails db:drop`.
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
Start your app with `bin/dev`. You will notice that a DB gets created for you. It will be empty.
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
Create some records. Then, stop your server with Ctrl+C.
|
|
37
33
|
|
|
38
|
-
|
|
34
|
+
The DB contents will have been dumped to `content/data`. Your SQLite DB will be gone.
|
|
39
35
|
|
|
40
|
-
|
|
36
|
+
Restart your server with `bin/dev`. Your SQLite DB will be back and populated with all previously stored data, recreated from `content/data`.
|
|
41
37
|
|
|
42
|
-
##
|
|
38
|
+
## Contributing
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/dunkelziffer/static_db](https://github.com/dunkelziffer/static_db).
|
|
45
41
|
|
|
46
42
|
## License
|
|
47
43
|
|
data/Rakefile
ADDED
data/lib/static_db/dump.rb
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
1
|
module StaticDb
|
|
4
2
|
class Dump
|
|
5
3
|
|
|
6
|
-
attr_reader :fixture_path
|
|
4
|
+
attr_reader :fixture_path, :models_to_be_saved
|
|
7
5
|
|
|
8
6
|
def initialize(fixture_path:)
|
|
9
7
|
@fixture_path = Pathname.new(fixture_path)
|
|
@@ -37,9 +35,7 @@ module StaticDb
|
|
|
37
35
|
|
|
38
36
|
errors = []
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
next if model.abstract_class?
|
|
42
|
-
|
|
38
|
+
models_to_be_saved.each do |model|
|
|
43
39
|
model.find_each do |record|
|
|
44
40
|
unless record.valid?
|
|
45
41
|
errors << { model: model.name, slug: record.slug, errors: record.errors.full_messages }
|
|
@@ -65,7 +61,7 @@ module StaticDb
|
|
|
65
61
|
|
|
66
62
|
def dump_fixtures!
|
|
67
63
|
reset_data_directory!
|
|
68
|
-
|
|
64
|
+
models_to_be_saved.each { |model| format_and_write_yaml_file!(model) }
|
|
69
65
|
end
|
|
70
66
|
|
|
71
67
|
def reset_data_directory!
|
data/lib/static_db/engine.rb
CHANGED
data/lib/static_db/load.rb
CHANGED
data/lib/static_db/version.rb
CHANGED
data/lib/static_db.rb
CHANGED
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: static_db
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Klaus Weidinger
|
|
8
|
-
bindir:
|
|
8
|
+
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
@@ -15,73 +15,32 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '7.
|
|
18
|
+
version: '7.2'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '7.
|
|
25
|
+
version: '7.2'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
|
-
name:
|
|
27
|
+
name: ostruct
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
33
|
-
type: :
|
|
34
|
-
prerelease: false
|
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - ">="
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '1.15'
|
|
40
|
-
- !ruby/object:Gem::Dependency
|
|
41
|
-
name: combustion
|
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
|
43
|
-
requirements:
|
|
44
|
-
- - ">="
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: '1.1'
|
|
47
|
-
type: :development
|
|
48
|
-
prerelease: false
|
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - ">="
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '1.1'
|
|
54
|
-
- !ruby/object:Gem::Dependency
|
|
55
|
-
name: rake
|
|
56
|
-
requirement: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - ">="
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: '13.0'
|
|
61
|
-
type: :development
|
|
62
|
-
prerelease: false
|
|
63
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
-
requirements:
|
|
65
|
-
- - ">="
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: '13.0'
|
|
68
|
-
- !ruby/object:Gem::Dependency
|
|
69
|
-
name: rspec
|
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - ">="
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '3.9'
|
|
75
|
-
type: :development
|
|
32
|
+
version: '0.6'
|
|
33
|
+
type: :runtime
|
|
76
34
|
prerelease: false
|
|
77
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
36
|
requirements:
|
|
79
37
|
- - ">="
|
|
80
38
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '
|
|
82
|
-
description:
|
|
39
|
+
version: '0.6'
|
|
40
|
+
description: Dump DB contents to YAML and load them back again. Aimed at SQLite. Committable
|
|
41
|
+
to git.
|
|
83
42
|
email:
|
|
84
|
-
-
|
|
43
|
+
- weidkl@gmx.de
|
|
85
44
|
executables: []
|
|
86
45
|
extensions: []
|
|
87
46
|
extra_rdoc_files: []
|
|
@@ -89,6 +48,7 @@ files:
|
|
|
89
48
|
- CHANGELOG.md
|
|
90
49
|
- LICENSE.txt
|
|
91
50
|
- README.md
|
|
51
|
+
- Rakefile
|
|
92
52
|
- lib/static_db.rb
|
|
93
53
|
- lib/static_db/dump.rb
|
|
94
54
|
- lib/static_db/engine.rb
|
|
@@ -100,12 +60,12 @@ homepage: https://github.com/dunkelziffer/static_db
|
|
|
100
60
|
licenses:
|
|
101
61
|
- MIT
|
|
102
62
|
metadata:
|
|
63
|
+
source_code_uri: https://github.com/dunkelziffer/static_db
|
|
103
64
|
homepage_uri: https://github.com/dunkelziffer/static_db
|
|
104
65
|
changelog_uri: https://github.com/dunkelziffer/static_db/blob/main/CHANGELOG.md
|
|
105
66
|
bug_tracker_uri: https://github.com/dunkelziffer/static_db/issues
|
|
106
67
|
documentation_uri: https://github.com/dunkelziffer/static_db/blob/main/README.md
|
|
107
|
-
|
|
108
|
-
custom_attribute: a, b, c
|
|
68
|
+
rubygems_mfa_required: 'true'
|
|
109
69
|
rdoc_options: []
|
|
110
70
|
require_paths:
|
|
111
71
|
- lib
|
|
@@ -120,7 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
120
80
|
- !ruby/object:Gem::Version
|
|
121
81
|
version: '0'
|
|
122
82
|
requirements: []
|
|
123
|
-
rubygems_version:
|
|
83
|
+
rubygems_version: 4.0.8
|
|
124
84
|
specification_version: 4
|
|
125
|
-
summary:
|
|
85
|
+
summary: Dump DB contents to YAML and load them back again. Aimed at SQLite. Committable
|
|
86
|
+
to git.
|
|
126
87
|
test_files: []
|