filebase 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/drivers/yaml.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'extensions/io'
|
3
|
+
class Filebase
|
4
|
+
|
5
|
+
class YAML
|
6
|
+
|
7
|
+
def initialize( root )
|
8
|
+
@root = root
|
9
|
+
end
|
10
|
+
|
11
|
+
def path( key )
|
12
|
+
@root / key + '.yml'
|
13
|
+
end
|
14
|
+
|
15
|
+
def all
|
16
|
+
Dir[ path('*') ].map { |file| YAML.load( File.read( file ) ) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def find( key )
|
20
|
+
( ::YAML.load( File.read( path( key ) ) ) if File.exists?( path( key ) ) ) || nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def save( key, object )
|
24
|
+
File.write( path( key ), object.to_yaml )
|
25
|
+
end
|
26
|
+
|
27
|
+
def delete( key )
|
28
|
+
FileUtils.remove( path( key ) )
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filebase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Yoder
|
@@ -14,6 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: extensions
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
@@ -30,9 +31,10 @@ extensions: []
|
|
30
31
|
extra_rdoc_files: []
|
31
32
|
|
32
33
|
files:
|
33
|
-
- lib/
|
34
|
+
- lib/drivers/yaml.rb
|
35
|
+
- lib/filebase/attributes.rb
|
36
|
+
- lib/filebase/model.rb
|
34
37
|
- lib/filebase.rb
|
35
|
-
- lib/model.rb
|
36
38
|
has_rdoc: true
|
37
39
|
homepage: http://dev.zeraweb.com/waves
|
38
40
|
post_install_message:
|
@@ -55,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
57
|
requirements: []
|
56
58
|
|
57
59
|
rubyforge_project:
|
58
|
-
rubygems_version: 1.0
|
60
|
+
rubygems_version: 1.2.0
|
59
61
|
signing_key:
|
60
62
|
specification_version: 2
|
61
63
|
summary: Simple file-based database with model support.
|