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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c3a14270441df833087a0cc1051d6b001cd53f7
4
- data.tar.gz: 3bb0fa7c0457ba41ef028248439adeac0f8b4a00
3
+ metadata.gz: 43eb6ed91615767e2076fba0ec78114408aa35fa
4
+ data.tar.gz: 848d8d0862d6bacdf426dfcbf8ec885946c0c3c4
5
5
  SHA512:
6
- metadata.gz: 46c185fc50d1e7479084e99cc9a4f3e613fc1e3650afd3a9308c686d35e051ab48682d50fe5941f891340224d7b0a5b091f0dac4cba004bbc3ad3fc5490ee897
7
- data.tar.gz: 0bf48a47d247e0e30ad7c9c50f88872d8d335bcc7b499ed5d3b52480ac90f3e1a632d5119cb2c68944486a81994fac7aa3b0da06320a1a9964201156e59b9954
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'
@@ -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.validate_integrity_globally
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.validate_integrity_globally
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 validate_integrity_globally
53
+ def validate_global_integrity
54
54
  @namespaced.constants.each do |const|
55
- @namespaced.const_get(const).validate_integrity_globally if const != :Database
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 :old, :new
19
- def initialize(old, new)
20
- @old = old
21
- @new = 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
 
@@ -33,7 +33,7 @@ module FeideeUtils
33
33
  # Do nothing.
34
34
  end
35
35
 
36
- def self.validate_integrity_globally
36
+ def self.validate_global_integrity
37
37
  # Do nothing.
38
38
  end
39
39
 
@@ -64,7 +64,7 @@ module FeideeUtils
64
64
  class TransfersNotPaired < Exception
65
65
  end
66
66
 
67
- def self.validate_integrity_globally
67
+ def self.validate_global_integrity
68
68
  uuids_map = all.inject({}) do |uuids, transaction|
69
69
  if transaction.is_transfer?
70
70
  uuid = transaction.uuid
@@ -1,3 +1,3 @@
1
1
  module FeideeUtils
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4-1'
3
3
  end
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.3
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: '0'
138
+ version: 1.3.1
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.4.8
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.