feidee_utils 0.0.3 → 0.0.4.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/Rakefile +15 -0
- data/lib/feidee_utils/account.rb +1 -1
- data/lib/feidee_utils/category.rb +1 -1
- data/lib/feidee_utils/database.rb +2 -2
- data/lib/feidee_utils/record/modified_record.rb +5 -4
- data/lib/feidee_utils/record.rb +1 -1
- data/lib/feidee_utils/transaction.rb +1 -1
- data/lib/feidee_utils/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43eb6ed91615767e2076fba0ec78114408aa35fa
|
4
|
+
data.tar.gz: 848d8d0862d6bacdf426dfcbf8ec885946c0c3c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbbb122530a60e683227d609b591a0213d6894de9fa4c62082c2e99e3bb22a3ddb281bee6437d522bb761dc86e88b65b3a013d7df41fa6e9abfc4810da752dff
|
7
|
+
data.tar.gz: ccbad9e1153f37397278248659c6e08386f8ced2b9df2609daa459f76055bee7dd7ab08ad08477a2046c9c3d66fd1f85e04299a45b789c7f37b9556dc408158d
|
data/README.md
CHANGED
@@ -12,6 +12,12 @@ A kbf file is in fact a zip file contains a modified SQLite database and other a
|
|
12
12
|
The first 16 bits of the SQLite database is modified so that it could not be read directly by SQLite.
|
13
13
|
The database itself is NOT encrypted. Almost all useful information is in the SQLite database.
|
14
14
|
|
15
|
+
Install
|
16
|
+
---------
|
17
|
+
```bash
|
18
|
+
gem install feidee_utils
|
19
|
+
```
|
20
|
+
|
15
21
|
Usage
|
16
22
|
----------
|
17
23
|
A set of ActiveRecord-like classes are provided to access the information in the backup. See the quick example below.
|
@@ -27,6 +33,19 @@ all_transactions = database.namespaced::Transaction.all
|
|
27
33
|
|
28
34
|
For more examples see ```examples/``` (To be added).
|
29
35
|
|
36
|
+
Supported Entities
|
37
|
+
-----------------
|
38
|
+
|
39
|
+
* Account
|
40
|
+
* Transaction
|
41
|
+
* AccountGroup
|
42
|
+
* Category
|
43
|
+
|
44
|
+
Chinese Characters
|
45
|
+
-----------------
|
46
|
+
|
47
|
+
The database contains many Chinese characters such as builtin category names. Some of the characters are also included in tests. The gem is developed under OSX so presumably the gem should work fine in Unix-like environments with Unicode/UTF8 or whatever the encoding is.
|
48
|
+
|
30
49
|
Why not ActiveRecord
|
31
50
|
----------------
|
32
51
|
Sometimes we have to compare the content of two backups and must open them at the same time.
|
data/Rakefile
CHANGED
@@ -1,9 +1,24 @@
|
|
1
1
|
require 'rake/testtask'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
Rake::TestTask.new do |t|
|
4
5
|
t.libs << 'test'
|
5
6
|
t.pattern = 'test/**/*_test.rb'
|
6
7
|
end
|
7
8
|
|
9
|
+
namespace :sync do
|
10
|
+
desc "Sync source file with the main project."
|
11
|
+
task :source do
|
12
|
+
puts "copying source code..."
|
13
|
+
FileUtils.cp_r Dir.glob("lib/*"), "/Users/muyiliqing/Git/cloud-ruby-dev/lib/"
|
14
|
+
end
|
15
|
+
task :scallion do
|
16
|
+
puts "copying source code..."
|
17
|
+
FileUtils.cp_r Dir.glob("lib/*"), "/Users/muyiliqing/Git/scallion/lib/"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
8
21
|
desc "Run tests"
|
9
22
|
task :default => :test
|
23
|
+
task :deploy => :'sync:source'
|
24
|
+
task :scallion => :'sync:scallion'
|
data/lib/feidee_utils/account.rb
CHANGED
@@ -12,7 +12,7 @@ module FeideeUtils
|
|
12
12
|
raise "Account hidden should be either 0 or 1, but it's #{raw_hidden}.\n" + inspect unless (raw_hidden == 1 or raw_hidden == 0)
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.
|
15
|
+
def self.validate_global_integrity
|
16
16
|
if self.find_by_id(-1) != nil
|
17
17
|
raise "-1 is used as the parent POID placeholder of a parent account. " +
|
18
18
|
"Account of POID -1 should not exist."
|
@@ -13,7 +13,7 @@ module FeideeUtils
|
|
13
13
|
raise "Category usedCount should always be 0, but it's #{field["usedCount"]}.\n" + inspect unless field["usedCount"] == 0
|
14
14
|
end
|
15
15
|
|
16
|
-
def self.
|
16
|
+
def self.validate_global_integrity
|
17
17
|
project_root_code = 2
|
18
18
|
if TypeEnum[project_root_code] != :project_root
|
19
19
|
raise "The type code of project root has been changed, please update the code."
|
@@ -50,9 +50,9 @@ module FeideeUtils
|
|
50
50
|
backup_sqlite_db.close
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
53
|
+
def validate_global_integrity
|
54
54
|
@namespaced.constants.each do |const|
|
55
|
-
@namespaced.const_get(const).
|
55
|
+
@namespaced.const_get(const).validate_global_integrity if const != :Database
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module FeideeUtils
|
2
2
|
class Record
|
3
|
+
# TODO: Reconsider this class and ship full support to all entities.
|
3
4
|
class ModifiedRecord
|
4
5
|
attr_reader :poid
|
5
6
|
attr_reader :base, :head
|
@@ -15,10 +16,10 @@ module FeideeUtils
|
|
15
16
|
end
|
16
17
|
|
17
18
|
class ValuePair
|
18
|
-
attr_reader :
|
19
|
-
def initialize(
|
20
|
-
@old =
|
21
|
-
@new =
|
19
|
+
attr_reader :old_value, :new_value
|
20
|
+
def initialize(old_value, new_value)
|
21
|
+
@old = old_value
|
22
|
+
@new = new_value
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
data/lib/feidee_utils/record.rb
CHANGED
data/lib/feidee_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feidee_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liqing Muyi
|
@@ -133,12 +133,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: 2.0.0
|
134
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - ">"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 1.3.1
|
139
139
|
requirements: []
|
140
140
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.4.
|
141
|
+
rubygems_version: 2.4.6
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: Utils to extract useful information from Feidee Mymoney backup.
|