dataman 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemtest +0 -0
- data/Manifest.txt +3 -0
- data/lib/dataman.rb +1 -1
- data/lib/dataman/dataman.rb +54 -0
- data/lib/dataman/version.rb +2 -2
- data/test/helper.rb +11 -0
- data/test/test_sqlite.rb +24 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c662d309986ce5f9cb5de3865ba0691d9c4d9acd
|
4
|
+
data.tar.gz: e7c440bfbcbc7471b419a3566efcfa26820f8d9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c627ccf5ef65fab9a46e2ab401f14e598285a1f273ab78a2a90fa85482ff7fc8b7757132bfa56b4ca7b11eccb6a7ed10d44f0a792b43ffc6b82a2b85ddc377cd
|
7
|
+
data.tar.gz: f44ff044f59863dd48f5525793d5afb9f7fc93ea89bf5d67587221c5210a1280a2194be3700660a1441b1105f104bbd22954f53b91d04e4c21aae191042e7117
|
data/.gemtest
ADDED
File without changes
|
data/Manifest.txt
CHANGED
data/lib/dataman.rb
CHANGED
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Dataman
|
4
|
+
|
5
|
+
class Dataman
|
6
|
+
|
7
|
+
def initialize( config )
|
8
|
+
@config = config # db config connection spec hash
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
def clean
|
13
|
+
db_adapter = @config[ 'adapter' ]
|
14
|
+
|
15
|
+
### for sqlite3 delete/remove single-file database
|
16
|
+
if db_adapter == 'sqlite3'
|
17
|
+
db_database = @config[ 'database' ]
|
18
|
+
|
19
|
+
## check:
|
20
|
+
## if in memory e.g. ':memory:' no delete/clean needed!!!
|
21
|
+
|
22
|
+
FileUtils.rm( db_database ) if File.exists?( db_database )
|
23
|
+
else
|
24
|
+
puts "[Dataman] clean: do nothing; no clean steps configured for db adapter >#{db_adapter}<"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
def connect
|
30
|
+
pp @config
|
31
|
+
ActiveRecord::Base.establish_connection( @config )
|
32
|
+
|
33
|
+
db_adapter = @config[ 'adapter' ]
|
34
|
+
|
35
|
+
## try to speed up sqlite
|
36
|
+
## see http://www.sqlite.org/pragma.html
|
37
|
+
if db_adapter == 'sqlite3'
|
38
|
+
c = ActiveRecord::Base.connection
|
39
|
+
|
40
|
+
## check:
|
41
|
+
## if in memory e.g. ':memory:' no pragma needed!!
|
42
|
+
|
43
|
+
c.execute( 'PRAGMA synchronous=OFF;' )
|
44
|
+
c.execute( 'PRAGMA journal_mode=OFF;' )
|
45
|
+
c.execute( 'PRAGMA temp_store=MEMORY;' )
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
end # class Dataman
|
52
|
+
|
53
|
+
end # module Dataman
|
54
|
+
|
data/lib/dataman/version.rb
CHANGED
data/test/helper.rb
ADDED
data/test/test_sqlite.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_sqlite.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
class TestSqlite < MiniTest::Test
|
11
|
+
|
12
|
+
def test_connect
|
13
|
+
m = Dataman::Dataman.new( adapter: 'sqlite3', database: ':memory:' )
|
14
|
+
m.connect
|
15
|
+
|
16
|
+
assert true # if we get here - test success
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_clean
|
20
|
+
## to be done
|
21
|
+
assert true # if we get here - test success
|
22
|
+
end
|
23
|
+
|
24
|
+
end # class TestSqlite
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dataman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -47,12 +47,16 @@ extra_rdoc_files:
|
|
47
47
|
- Manifest.txt
|
48
48
|
- README.md
|
49
49
|
files:
|
50
|
+
- ".gemtest"
|
50
51
|
- HISTORY.md
|
51
52
|
- Manifest.txt
|
52
53
|
- README.md
|
53
54
|
- Rakefile
|
54
55
|
- lib/dataman.rb
|
56
|
+
- lib/dataman/dataman.rb
|
55
57
|
- lib/dataman/version.rb
|
58
|
+
- test/helper.rb
|
59
|
+
- test/test_sqlite.rb
|
56
60
|
homepage: https://github.com/textkit/dataman
|
57
61
|
licenses:
|
58
62
|
- Public Domain
|
@@ -79,4 +83,5 @@ rubygems_version: 2.4.2
|
|
79
83
|
signing_key:
|
80
84
|
specification_version: 4
|
81
85
|
summary: dataman - dataset manager using datafiles
|
82
|
-
test_files:
|
86
|
+
test_files:
|
87
|
+
- test/test_sqlite.rb
|