mcfs 0.0.2 → 0.0.3

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: 7036585a4107367e905f4f92bd2e0a43c7c5b126
4
- data.tar.gz: 6da3ef4d704728fcfb934bedb304703180e39f05
3
+ metadata.gz: e68304b8deac6b1be4475c261a715bc33d0784f6
4
+ data.tar.gz: a0a9c25658a7f33b0b2fb05eadaee68e2a2abdb8
5
5
  SHA512:
6
- metadata.gz: a298fe05047e1330e62c53a38c911833285d5068a7435e511bf7f97fa3eec0fa071c4af3bb354b03d648c042880d4fb7100ca196d5734e38c4b1eda378383a6f
7
- data.tar.gz: 8a7dbc56d8f9a62febad2da02efc62a64c3305920ba5551941f49dae8ab5ef6d15164b225e90b4052771eb1b32d6713c97328d940cb4f4dc114d2df9e6d15b7e
6
+ metadata.gz: 3072477572eed6471078d6141e6643972d42216a4e79e78bd3e5b60f79e3319459bf6864f23de6f2895b64a7239189dfe5e4d36d74fa7e90e3a3afb08cc8d865
7
+ data.tar.gz: 06835c76f68ae8e728db3fcda6cfe63bb3cf465a1605a1d67de6037f01904bcdee6d3fc09573e73650890ba518beb545529234a29b479e9f093b85cb04d36770
data/bin/mcfs CHANGED
@@ -1,4 +1,2 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'mcfs'
4
-
metadata CHANGED
@@ -1,55 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jinesh Jayakumar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-08 00:00:00.000000000 Z
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: dropbox-sdk
14
+ name: commander
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
20
- - - '='
21
- - !ruby/object:Gem::Version
22
- version: 1.6.4
19
+ version: '0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '1.6'
30
- - - '='
31
- - !ruby/object:Gem::Version
32
- version: 1.6.4
33
- - !ruby/object:Gem::Dependency
34
- name: rfusefs
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1.0'
40
- - - '='
41
- - !ruby/object:Gem::Version
42
- version: 1.0.3
43
- type: :runtime
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '1.0'
50
- - - '='
24
+ - - ">="
51
25
  - !ruby/object:Gem::Version
52
- version: 1.0.3
26
+ version: '0'
53
27
  description: mcfs description
54
28
  email: jineshkj at gmail dot com
55
29
  executables:
@@ -58,10 +32,7 @@ extensions: []
58
32
  extra_rdoc_files: []
59
33
  files:
60
34
  - bin/mcfs
61
- - lib/mcfs.rb
62
- - lib/mcfs/filesystem.rb
63
- - lib/mcfs/stores/dropbox.rb
64
- homepage: https://github.com/jineshkj/mcfs
35
+ homepage: https://github.com/mcfs/mcfs
65
36
  licenses:
66
37
  - LGPLv3
67
38
  metadata: {}
@@ -81,8 +52,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
52
  version: '0'
82
53
  requirements: []
83
54
  rubyforge_project:
84
- rubygems_version: 2.4.5
55
+ rubygems_version: 2.0.14
85
56
  signing_key:
86
57
  specification_version: 4
87
- summary: mcfs summary
58
+ summary: mcfs
88
59
  test_files: []
@@ -1,9 +0,0 @@
1
-
2
- # TODO: need to move dropbox to separate adapter
3
- require 'rfusefs'
4
-
5
- require_relative 'mcfs/filesystem'
6
-
7
- FuseFS.main do |opts|
8
- McFS::Filesystem.new
9
- end
@@ -1,82 +0,0 @@
1
-
2
- require 'set'
3
- require 'yaml'
4
-
5
- require_relative 'stores/dropbox'
6
-
7
- module McFS
8
- class Filesystem
9
-
10
- def initialize
11
- @stores = []
12
- dbcfg1 = YAML.load_file(ENV['HOME'] + '/.mcfs/dropbox1.yml')
13
- dbcfg2 = YAML.load_file(ENV['HOME'] + '/.mcfs/dropbox2.yml')
14
-
15
- @stores << Stores::Dropbox.new(dbcfg1.access_token)
16
- @stores << Stores::Dropbox.new(dbcfg2.access_token)
17
-
18
- end
19
-
20
- def contents(path)
21
- files = []
22
- @stores.each do |store|
23
- files += store.contents(path)
24
- end
25
- files.uniq
26
- end
27
-
28
- def file?(path)
29
- true
30
- end
31
-
32
- def can_write?(path)
33
- true
34
- end
35
-
36
- def read_file(path)
37
- puts "Read File: #{path}"
38
- contents = {}
39
-
40
- @stores.each do |store|
41
- contents.merge! store.read_file(path)
42
- end
43
-
44
- data = ''
45
-
46
- contents.sort.each do |chunk|
47
- data << chunk[1]
48
- end
49
-
50
- data
51
- end
52
-
53
- def write_to(path, str)
54
- puts "write_to: #{path}, #{str}"
55
- buf = ''
56
- cnt = 0
57
- idx = 0
58
-
59
- str.each_byte do |b|
60
- buf << b
61
- cnt += 1
62
-
63
- if cnt == 4096 then
64
- @stores[idx % @stores.size].write_to(path, idx, buf)
65
- buf = ''
66
- idx += 1
67
- cnt = 0
68
- end
69
- end
70
-
71
- if buf.size > 0 then
72
- puts buf.size
73
- puts idx
74
- p @stores
75
- puts @stores[idx % (@stores.size)]
76
- @stores[idx % @stores.size].write_to(path, idx, buf)
77
- end
78
-
79
- end
80
-
81
- end
82
- end
@@ -1,62 +0,0 @@
1
- require 'dropbox_sdk'
2
-
3
- class DropboxConfig
4
- attr_reader :app_key, :app_secret, :access_token, :user_id
5
-
6
- def initialize(key, secret, token, user)
7
- @app_key = key
8
- @app_secret = secret
9
- @access_token = token
10
- @user_id = user
11
- end
12
- end
13
-
14
- module McFS
15
- module Stores
16
-
17
- class Dropbox
18
-
19
- def initialize(token)
20
- @client = DropboxClient.new(token)
21
- end
22
-
23
- # list contents under directory
24
- def contents(dir)
25
- puts "Path: #{dir}"
26
- @client.metadata('/McFS' + dir)['contents'].map do |entry|
27
- # entry['path'].split('/')[-1]
28
- # TODO: File.basename may have issues with path separator
29
- File.basename(entry['path'], '.*')
30
- end
31
- end
32
-
33
- def read_file(path)
34
- puts "Read: #{path}"
35
-
36
- filenames = @client.metadata(File.dirname('/McFS' + path))['contents'].map do |e|
37
- e['path'] if File.basename(e['path'], '.*') == File.basename('/McFS' + path)
38
- end
39
-
40
- contents = {}
41
-
42
- filenames.each do |file|
43
- if file then
44
- puts file
45
-
46
- index = File.extname(file)[1..-1].to_i
47
- data, metadata = @client.get_file_and_metadata(file)
48
- contents[index] = data
49
- end
50
- end
51
-
52
- return contents
53
- end
54
-
55
- def write_to(path, index, str)
56
- puts "write: #{path}, #{index}, #{str}"
57
- @client.put_file('/McFS' + path + ".#{index}", str, true)
58
- end
59
-
60
- end
61
- end
62
- end