mfs 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +31 -1
- data/lib/mfs.rb +2 -3
- data/lib/mfs/version.rb +1 -1
- data/spec/integration_spec.rb +28 -0
- data/spec/spec_helper.rb +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea0b039aa36c2924464ab857e64aadec8dcbe9de
|
4
|
+
data.tar.gz: f88b8cf769f6eda04b976a14a04e271516785ae7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e46136f0097e80a7f83785d6ad90d3e6dd660d2e26f0b4bad27d9b7a1ec2713338bf3c5dfdfed2d7ae21b3a1ae565bd71e1f921c6fbaa20e9c2aa979d553b9f9
|
7
|
+
data.tar.gz: cfda348f83660a8c0859e2a5e53624765fc365b801c211ee1b86304a1803f37ffa5948711bc071e5b47db1b3806c00ebbe4b2c8d33b380010fead2472dbf5842
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,19 +1,49 @@
|
|
1
1
|
Mongo File Store
|
2
2
|
================
|
3
3
|
|
4
|
-
Mongo File Store is a library for adding small files from the filesystem to MongoDB.
|
4
|
+
Mongo File Store is a library for adding small files from the filesystem to MongoDB using Mongoid.
|
5
5
|
|
6
6
|
Status
|
7
7
|
------
|
8
8
|
[![Code Climate](https://codeclimate.com/github/SoftwareWithFriends/mfs.png)](https://codeclimate.com/github/SoftwareWithFriends/mfs)
|
9
9
|
[![Build Status](https://api.travis-ci.org/SoftwareWithFriends/mfs.png?branch=master)](https://travis-ci.org/SoftwareWithFriends/mfs)
|
10
10
|
|
11
|
+
Install
|
12
|
+
-------
|
13
|
+
```
|
14
|
+
gem install mfs
|
15
|
+
```
|
16
|
+
|
11
17
|
Purpose
|
12
18
|
-------
|
13
19
|
* Shared Set of Files
|
14
20
|
* Attach Metadata to Files
|
15
21
|
* Retrieve Files based on metadata
|
16
22
|
|
23
|
+
Usage
|
24
|
+
-----
|
25
|
+
```ruby
|
26
|
+
require 'mfs'
|
27
|
+
entry = Mfs::Loader.load_file('path/to/file')
|
28
|
+
entry.filepath
|
29
|
+
entry.filename
|
30
|
+
entry.created_at
|
31
|
+
entry.data
|
32
|
+
|
33
|
+
# Set arbitrary Meta-data fields
|
34
|
+
Mfs::Loader.load_file('path/to/file',test_field: true)
|
35
|
+
entry = Mfs::Entry.where(test_field: true).first
|
36
|
+
|
37
|
+
# Load all files in a directory structure
|
38
|
+
entries = Mfs::Loader.load_directory('path/to/files')
|
39
|
+
|
40
|
+
# Load all files and set meta-data
|
41
|
+
entries = Mfs::Loader.load_directory('path/to/files') do |filename|
|
42
|
+
{has_a: filename.include('a')}
|
43
|
+
end
|
44
|
+
|
45
|
+
```
|
46
|
+
|
17
47
|
Limitations
|
18
48
|
-----------
|
19
49
|
* No File Hierarchy
|
data/lib/mfs.rb
CHANGED
data/lib/mfs/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Mfs
|
4
|
+
describe "Integration" do
|
5
|
+
before do
|
6
|
+
Loader.load_directory('spec/fixtures/files') do |filename|
|
7
|
+
{even: (filename[-1].to_i % 2 == 0) ? true : false}
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "find even entries" do
|
12
|
+
before do
|
13
|
+
@entries = Entry.where(even: true)
|
14
|
+
end
|
15
|
+
subject { @entries }
|
16
|
+
its(:count) { should eq 5 }
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "find odd entries" do
|
21
|
+
before do
|
22
|
+
@entries = Entry.where(even: false)
|
23
|
+
end
|
24
|
+
subject { @entries }
|
25
|
+
its(:count) { should eq 6 }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Johson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- spec/fixtures/files/file8
|
101
101
|
- spec/fixtures/files/file9
|
102
102
|
- spec/fixtures/files/sub/file11
|
103
|
+
- spec/integration_spec.rb
|
103
104
|
- spec/loader_spec.rb
|
104
105
|
- spec/mfs_spec.rb
|
105
106
|
- spec/spec_helper.rb
|
@@ -140,6 +141,7 @@ test_files:
|
|
140
141
|
- spec/fixtures/files/file8
|
141
142
|
- spec/fixtures/files/file9
|
142
143
|
- spec/fixtures/files/sub/file11
|
144
|
+
- spec/integration_spec.rb
|
143
145
|
- spec/loader_spec.rb
|
144
146
|
- spec/mfs_spec.rb
|
145
147
|
- spec/spec_helper.rb
|