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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c4d460b55d93b8481fd086ceb8898e46a5c93d0
4
- data.tar.gz: 3908847c3566d5f563161aafffa28287dfa96f8e
3
+ metadata.gz: c662d309986ce5f9cb5de3865ba0691d9c4d9acd
4
+ data.tar.gz: e7c440bfbcbc7471b419a3566efcfa26820f8d9d
5
5
  SHA512:
6
- metadata.gz: 44b7ca23e1f758b18648cf3cdc75462ed2492bb80a5822341bdf21aa04bab96062e43a54b1bc3ef6f06be5a8b16007e739b56d97c9338248684ee303e3498d75
7
- data.tar.gz: 07d7d02cc60db5f995a828f9efbc2ebe50a5c15a7942f20b33ee379c3bcdd71f13cdca3da106d4986cc791001b1c5d52ab4e2bf55d1ec52b769613f39c159e6d
6
+ metadata.gz: c627ccf5ef65fab9a46e2ab401f14e598285a1f273ab78a2a90fa85482ff7fc8b7757132bfa56b4ca7b11eccb6a7ed10d44f0a792b43ffc6b82a2b85ddc377cd
7
+ data.tar.gz: f44ff044f59863dd48f5525793d5afb9f7fc93ea89bf5d67587221c5210a1280a2194be3700660a1441b1105f104bbd22954f53b91d04e4c21aae191042e7117
File without changes
@@ -3,4 +3,7 @@ Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
5
  lib/dataman.rb
6
+ lib/dataman/dataman.rb
6
7
  lib/dataman/version.rb
8
+ test/helper.rb
9
+ test/test_sqlite.rb
@@ -4,7 +4,7 @@
4
4
  # our own code
5
5
 
6
6
  require 'dataman/version' ## let version always go first
7
-
7
+ require 'dataman/dataman'
8
8
 
9
9
 
10
10
 
@@ -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
+
@@ -3,8 +3,8 @@
3
3
  module Dataman
4
4
 
5
5
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
6
- MINOR = 0
7
- PATCH = 1
6
+ MINOR = 1
7
+ PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
@@ -0,0 +1,11 @@
1
+
2
+ ## minitest setup
3
+ require 'minitest/autorun'
4
+
5
+ ## deps
6
+ require 'sportdb/models' # note: will include worlddb (and activerecord machinery)
7
+ require 'datafile'
8
+
9
+ ## our own code
10
+ require 'dataman'
11
+
@@ -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.1
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-07 00:00:00.000000000 Z
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