vos 0.3.15 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/lib/vos.rb +14 -5
- data/lib/vos/box.rb +1 -0
- data/lib/vos/box/vfs.rb +8 -2
- data/lib/vos/drivers/local.rb +6 -17
- data/lib/vos/drivers/s3.rb +10 -13
- data/lib/vos/drivers/s3_vfs_storage.rb +13 -21
- data/lib/vos/drivers/ssh.rb +6 -2
- data/lib/vos/gems.rb +0 -3
- data/lib/vos/helpers/ubuntu.rb +5 -9
- data/spec/box_spec.rb +2 -2
- data/spec/config.example.yml +3 -5
- data/spec/config.yml +3 -5
- data/spec/drivers/local_spec.rb +9 -9
- data/spec/drivers/s3_spec.rb +28 -38
- data/spec/drivers/spec_helper.rb +1 -1
- data/spec/drivers/ssh_spec.rb +10 -10
- data/spec/spec_helper.rb +4 -0
- metadata +4 -27
- data/lib/vos/support.rb +0 -39
data/Rakefile
CHANGED
data/lib/vos.rb
CHANGED
@@ -2,14 +2,15 @@ raise 'ruby 1.9.2 or higher required!' if RUBY_VERSION < '1.9.2'
|
|
2
2
|
|
3
3
|
require 'vos/gems'
|
4
4
|
|
5
|
-
require '
|
5
|
+
require 'vfs'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
module Vos
|
8
|
+
module Drivers
|
9
|
+
end
|
10
|
+
end
|
9
11
|
|
12
|
+
%w(
|
10
13
|
drivers/local
|
11
|
-
drivers/ssh_vfs_storage
|
12
|
-
drivers/ssh
|
13
14
|
|
14
15
|
box/shell
|
15
16
|
box/marks
|
@@ -19,6 +20,14 @@ require 'open3'
|
|
19
20
|
helpers/ubuntu
|
20
21
|
).each{|f| require "vos/#{f}"}
|
21
22
|
|
23
|
+
# Vos::Drivers.class_eval do
|
24
|
+
# autoload :SshVfsStorage, 'vos/drivers/ssh_vfs_storage'
|
25
|
+
# autoload :Ssh, 'vos/drivers/ssh'
|
26
|
+
#
|
27
|
+
# autoload :S3VfsStorage, 'vos/drivers/s3_vfs_storage'
|
28
|
+
# autoload :S3, 'vos/drivers/s3'
|
29
|
+
# end
|
30
|
+
|
22
31
|
unless $vos_dont_mess_with_global_namespace
|
23
32
|
Box = Vos::Box
|
24
33
|
end
|
data/lib/vos/box.rb
CHANGED
data/lib/vos/box/vfs.rb
CHANGED
@@ -2,7 +2,7 @@ module Vos
|
|
2
2
|
class Box
|
3
3
|
module Vfs
|
4
4
|
def to_entry
|
5
|
-
'/'.to_entry_on(self)
|
5
|
+
'/'.to_entry_on(self.driver)
|
6
6
|
end
|
7
7
|
|
8
8
|
def to_file
|
@@ -38,7 +38,13 @@ end
|
|
38
38
|
module Vfs
|
39
39
|
class Dir
|
40
40
|
def bash cmd, *args
|
41
|
-
|
41
|
+
driver.box.bash_without_path "cd #{path} && #{cmd}", *args
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class << self
|
46
|
+
def default_driver
|
47
|
+
::Vos::Box.local.driver
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
data/lib/vos/drivers/local.rb
CHANGED
@@ -1,21 +1,12 @@
|
|
1
|
-
require '
|
1
|
+
require 'open3'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
require 'vfs/drivers/local'
|
2
5
|
|
3
6
|
module Vos
|
4
7
|
module Drivers
|
5
|
-
class Local
|
6
|
-
|
7
|
-
@root = root
|
8
|
-
end
|
9
|
-
|
10
|
-
#
|
11
|
-
# Vfs
|
12
|
-
#
|
13
|
-
include Vfs::Storages::Local::LocalVfsHelper
|
14
|
-
def open &block
|
15
|
-
block.call self if block
|
16
|
-
end
|
17
|
-
def close; end
|
18
|
-
|
8
|
+
class Local < Vfs::Drivers::Local
|
9
|
+
attr_accessor :box
|
19
10
|
|
20
11
|
#
|
21
12
|
# Shell
|
@@ -37,11 +28,9 @@ module Vos
|
|
37
28
|
return code, stdout_and_stderr
|
38
29
|
end
|
39
30
|
|
40
|
-
|
41
31
|
#
|
42
32
|
# Other
|
43
33
|
#
|
44
|
-
def to_s; '' end
|
45
34
|
def host; 'localhost' end
|
46
35
|
end
|
47
36
|
end
|
data/lib/vos/drivers/s3.rb
CHANGED
@@ -4,14 +4,14 @@ require 'vos/drivers/s3_vfs_storage'
|
|
4
4
|
module Vos
|
5
5
|
module Drivers
|
6
6
|
class S3
|
7
|
+
attr_accessor :box
|
7
8
|
attr_reader :connection, :bucket
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@initialization_options, @options = initialization_options, DEFAULT_OPTIONS.merge(options)
|
10
|
+
def initialize options = {}
|
11
|
+
options = options.clone
|
12
|
+
@bucket_name = options.delete(:bucket) || raise("S3 bucket not provided!")
|
13
|
+
@acl = options.delete(:acl) || :public_read
|
14
|
+
@options = options
|
15
15
|
end
|
16
16
|
|
17
17
|
|
@@ -32,11 +32,8 @@ module Vos
|
|
32
32
|
end
|
33
33
|
else
|
34
34
|
unless connection
|
35
|
-
@connection = ::AWS::S3.new self.
|
36
|
-
|
37
|
-
raise("S3 bucket not provided (use Vos::Drivers::S3.new({initialization options ...}, {bucket: '<bucket_name>'}))!")
|
38
|
-
end
|
39
|
-
@bucket = @connection.buckets[bucket]
|
35
|
+
@connection = ::AWS::S3.new self.options.clone
|
36
|
+
@bucket = @connection.buckets[bucket_name]
|
40
37
|
end
|
41
38
|
end
|
42
39
|
end
|
@@ -52,7 +49,7 @@ module Vos
|
|
52
49
|
#
|
53
50
|
# Miscellaneous
|
54
51
|
#
|
55
|
-
def inspect; "<#{self.class.name} #{
|
52
|
+
def inspect; "<#{self.class.name} #{options.merge(bucket: bucket_name).inspect}>" end
|
56
53
|
alias_method :to_s, :inspect
|
57
54
|
|
58
55
|
def _clear
|
@@ -60,7 +57,7 @@ module Vos
|
|
60
57
|
end
|
61
58
|
|
62
59
|
protected
|
63
|
-
attr_reader :
|
60
|
+
attr_reader :options, :bucket_name, :acl
|
64
61
|
end
|
65
62
|
end
|
66
63
|
end
|
@@ -23,24 +23,19 @@ module Vos
|
|
23
23
|
return {dir: true, file: false} if path.empty?
|
24
24
|
|
25
25
|
file = bucket.objects[path]
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
attrs[:file] = file_exists
|
30
|
-
if file_exists
|
26
|
+
if file.exists?
|
27
|
+
attrs = {}
|
28
|
+
attrs[:file] = true
|
31
29
|
attrs[:dir] = false
|
32
|
-
elsif dir_exists? path
|
33
|
-
attrs[:dir] = true
|
34
|
-
else
|
35
|
-
return nil
|
36
|
-
end
|
37
|
-
|
38
|
-
if file_exists
|
39
30
|
attrs[:size] = file.content_length
|
40
31
|
attrs[:updated_at] = file.last_modified
|
32
|
+
attrs
|
33
|
+
# There's no dirs, always returning false
|
34
|
+
# elsif dir_exists? path
|
35
|
+
# attrs[:dir] = true
|
36
|
+
else
|
37
|
+
return nil
|
41
38
|
end
|
42
|
-
|
43
|
-
attrs
|
44
39
|
end
|
45
40
|
|
46
41
|
def set_attributes path, attrs
|
@@ -58,21 +53,18 @@ module Vos
|
|
58
53
|
|
59
54
|
def write_file original_path, append, &block
|
60
55
|
path = normalize_path original_path
|
61
|
-
# TODO2 Performance lost, extra call to check file existence
|
62
|
-
file = bucket.objects[path]
|
63
|
-
file_exist = file.exists?
|
64
|
-
raise "can't write, file #{original_path} already exist!" if !append and file_exist
|
65
56
|
|
57
|
+
file = bucket.objects[path]
|
66
58
|
if append
|
67
59
|
# there's no support for :append in Fog, so we just mimic it
|
68
60
|
writer = Writer.new
|
69
|
-
writer.write file.read if
|
61
|
+
writer.write file.read if file.exists?
|
70
62
|
block.call writer
|
71
|
-
file.write writer.data
|
63
|
+
file.write writer.data, acl: acl
|
72
64
|
else
|
73
65
|
writer = Writer.new
|
74
66
|
block.call writer
|
75
|
-
file.write writer.data
|
67
|
+
file.write writer.data, acl: acl
|
76
68
|
end
|
77
69
|
end
|
78
70
|
|
data/lib/vos/drivers/ssh.rb
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
require 'net/ssh'
|
2
2
|
require 'net/sftp'
|
3
|
+
require 'vos/drivers/ssh_vfs_storage'
|
3
4
|
|
4
5
|
module Vos
|
5
6
|
module Drivers
|
6
7
|
class Ssh
|
8
|
+
attr_accessor :box
|
9
|
+
|
7
10
|
DEFAULT_OPTIONS = {
|
8
11
|
config: true
|
9
12
|
}
|
10
13
|
|
11
|
-
def initialize options = {}
|
14
|
+
def initialize options = {}
|
15
|
+
options = options.clone
|
12
16
|
raise ":host not provided!" unless options[:host]
|
13
|
-
@root = root
|
17
|
+
@root = options.delete(:root) || ''
|
14
18
|
@options = DEFAULT_OPTIONS.merge options
|
15
19
|
|
16
20
|
# config_options = Net::SSH.configuration_for(options[:host])
|
data/lib/vos/gems.rb
CHANGED
data/lib/vos/helpers/ubuntu.rb
CHANGED
@@ -37,13 +37,9 @@ module Vfs
|
|
37
37
|
class Entry
|
38
38
|
def symlink_to entry, options = {}
|
39
39
|
raise "invalid argument!" unless entry.is_a? Entry
|
40
|
-
raise "can't use symlink ('#{self}' and '#{entry}' are on different storages)!" if self.
|
41
|
-
raise "symlink target '' not exist!" unless entry.exist?
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
def symlink_to! entry
|
46
|
-
symlink_to entry, override: true
|
40
|
+
raise "can't use symlink ('#{self}' and '#{entry}' are on different storages)!" if self.driver != entry.driver
|
41
|
+
raise "symlink target '#{entry}' not exist!" unless entry.exist?
|
42
|
+
driver.box.bash "ln -sf #{entry.path} #{path}"
|
47
43
|
end
|
48
44
|
end
|
49
45
|
|
@@ -54,9 +50,9 @@ module Vfs
|
|
54
50
|
raise "#{entry.path} can't be a File!" if entry.file?
|
55
51
|
|
56
52
|
if local? and !entry.local?
|
57
|
-
Box.local.bash("rsync -e 'ssh' -al --delete --stats --progress #{path}/ root@#{entry.
|
53
|
+
Box.local.bash("rsync -e 'ssh' -al --delete --stats --progress #{path}/ root@#{entry.driver.host}:#{entry.path}")
|
58
54
|
elsif entry.local? and !local?
|
59
|
-
Box.local.bash("rsync -e 'ssh' -al --delete --stats --progress root@#{
|
55
|
+
Box.local.bash("rsync -e 'ssh' -al --delete --stats --progress root@#{driver.host}:#{path}/ #{entry.path}")
|
60
56
|
else
|
61
57
|
raise "invalid usage!"
|
62
58
|
end
|
data/spec/box_spec.rb
CHANGED
data/spec/config.example.yml
CHANGED
data/spec/config.yml
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
:host: universal.4ire.net
|
3
3
|
|
4
4
|
:s3:
|
5
|
-
:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
:bucket: :vostest
|
5
|
+
:access_key_id: 'AKIAJRX4FEUREBQ6IYTQ'
|
6
|
+
:secret_access_key: 'hY4RrM40kUYMDjIzD1vKIXCMeGM8Ze9eK2HorKP2'
|
7
|
+
:bucket: :vostest
|
data/spec/drivers/local_spec.rb
CHANGED
@@ -4,17 +4,17 @@ describe Vos::Drivers::Local do
|
|
4
4
|
with_tmp_spec_dir
|
5
5
|
|
6
6
|
before do
|
7
|
-
@
|
7
|
+
@driver = Vos::Drivers::Local.new root: spec_dir
|
8
8
|
end
|
9
9
|
|
10
10
|
it_should_behave_like "vos driver"
|
11
11
|
|
12
|
-
it_should_behave_like 'vfs
|
13
|
-
it_should_behave_like 'vfs
|
14
|
-
it_should_behave_like 'vfs
|
15
|
-
it_should_behave_like 'vfs
|
16
|
-
it_should_behave_like 'vfs
|
17
|
-
it_should_behave_like 'vfs
|
18
|
-
it_should_behave_like 'vfs
|
19
|
-
it_should_behave_like 'vfs
|
12
|
+
it_should_behave_like 'vfs driver basic'
|
13
|
+
it_should_behave_like 'vfs driver attributes basic'
|
14
|
+
it_should_behave_like 'vfs driver files'
|
15
|
+
it_should_behave_like 'vfs driver full attributes for files'
|
16
|
+
it_should_behave_like 'vfs driver dirs'
|
17
|
+
it_should_behave_like 'vfs driver full attributes for dirs'
|
18
|
+
it_should_behave_like 'vfs driver query'
|
19
|
+
it_should_behave_like 'vfs driver tmp dir'
|
20
20
|
end
|
data/spec/drivers/s3_spec.rb
CHANGED
@@ -1,28 +1,25 @@
|
|
1
1
|
require 'drivers/spec_helper'
|
2
2
|
|
3
3
|
require 'aws' rescue LoadError
|
4
|
-
|
5
4
|
if defined? AWS
|
6
|
-
require 'vos/drivers/s3'
|
7
|
-
|
8
5
|
describe 'S3' do
|
9
6
|
before :all do
|
10
|
-
@
|
11
|
-
@
|
7
|
+
@driver = Vos::Drivers::S3.new config[:s3]
|
8
|
+
@driver.open
|
12
9
|
end
|
13
|
-
after(:all){@
|
10
|
+
after(:all){@driver.close}
|
14
11
|
|
15
|
-
before{@
|
16
|
-
after{@
|
12
|
+
before{@driver._clear}
|
13
|
+
after{@driver._clear}
|
17
14
|
|
18
|
-
it_should_behave_like 'vfs
|
19
|
-
it_should_behave_like 'vfs
|
20
|
-
it_should_behave_like 'vfs
|
15
|
+
it_should_behave_like 'vfs driver basic'
|
16
|
+
it_should_behave_like 'vfs driver attributes basic'
|
17
|
+
it_should_behave_like 'vfs driver files'
|
21
18
|
|
22
19
|
describe 'limited attributes' do
|
23
20
|
it "attributes for files" do
|
24
|
-
@
|
25
|
-
attrs = @
|
21
|
+
@driver.write_file('/file', false){|w| w.write 'something'}
|
22
|
+
attrs = @driver.attributes('/file')
|
26
23
|
attrs[:file].should be_true
|
27
24
|
attrs[:dir].should be_false
|
28
25
|
# attrs[:created_at].class.should == Time
|
@@ -33,53 +30,46 @@ if defined? AWS
|
|
33
30
|
|
34
31
|
describe 'limited tmp' do
|
35
32
|
it "tmp dir" do
|
36
|
-
@
|
33
|
+
@driver.tmp.should_not be_nil
|
37
34
|
|
38
35
|
file_path = nil
|
39
|
-
@
|
36
|
+
@driver.tmp do |tmp_dir|
|
40
37
|
file_path = "#{tmp_dir}/file"
|
41
|
-
@
|
38
|
+
@driver.write_file(file_path, false){|w| w.write 'something'}
|
42
39
|
end
|
43
40
|
file_path.should_not be_nil
|
44
|
-
@
|
41
|
+
@driver.attributes(file_path).should be_nil
|
45
42
|
end
|
46
43
|
end
|
47
44
|
|
48
45
|
describe 'limited dirs' do
|
49
46
|
def create_s3_fake_dir dir
|
50
|
-
@
|
47
|
+
@driver.write_file("#{dir}/file.txt", false){|w| w.write 'something'}
|
51
48
|
end
|
52
49
|
|
53
|
-
it "
|
54
|
-
@
|
55
|
-
|
56
|
-
|
57
|
-
attrs = @storage.attributes('/dir')
|
58
|
-
attrs[:file].should be_false
|
59
|
-
attrs[:dir].should be_true
|
60
|
-
|
61
|
-
@storage.delete_dir('/dir')
|
62
|
-
@storage.attributes('/dir').should be_nil
|
50
|
+
it "there's no directories, so it should always return false" do
|
51
|
+
@driver.attributes('/dir').should be_nil
|
52
|
+
@driver.write_file('/dir/file.txt', false){|w| w.write 'something'}
|
53
|
+
@driver.attributes('/dir').should be_nil
|
63
54
|
end
|
64
55
|
|
65
56
|
it 'should delete not-empty directories' do
|
66
|
-
|
67
|
-
|
68
|
-
@storage.write_file('/dir/dir2/file', false){|w| w.write 'something'}
|
69
|
-
@storage.attributes('/dir').should_not be_nil
|
57
|
+
@driver.write_file('/dir/dir2/file', false){|w| w.write 'something'}
|
58
|
+
@driver.attributes('/dir/dir2/file').should_not be_nil
|
70
59
|
|
71
|
-
@
|
72
|
-
@
|
60
|
+
@driver.delete_dir('/dir')
|
61
|
+
@driver.attributes('/dir/dir2/file').should be_nil
|
73
62
|
end
|
74
63
|
|
75
64
|
it 'each' do
|
76
|
-
# -> {@
|
65
|
+
# -> {@driver.each_entry('/not_existing_dir', nil){|path, type| list[path] = type}}.should raise_error
|
77
66
|
|
78
|
-
|
79
|
-
@
|
67
|
+
@driver.write_file('/dir/file', false){|w| w.write 'something'}
|
68
|
+
@driver.write_file('/dir/dir2/file', false){|w| w.write 'something'}
|
69
|
+
@driver.write_file('/other_dir/file', false){|w| w.write 'something'}
|
80
70
|
|
81
71
|
list = {}
|
82
|
-
@
|
72
|
+
@driver.each_entry('/dir', nil){|path, type| list[path] = type}
|
83
73
|
list.should == {'dir2' => :dir, 'file' => :file}
|
84
74
|
end
|
85
75
|
end
|
data/spec/drivers/spec_helper.rb
CHANGED
data/spec/drivers/ssh_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'drivers/spec_helper'
|
|
2
2
|
|
3
3
|
describe Vos::Drivers::Ssh do
|
4
4
|
before :all do
|
5
|
-
@
|
5
|
+
@driver = @driver = Vos::Drivers::Ssh.new(config[:ssh_driver].merge(root: '/vos_test'))
|
6
6
|
@driver.open
|
7
7
|
end
|
8
8
|
|
@@ -18,16 +18,16 @@ describe Vos::Drivers::Ssh do
|
|
18
18
|
|
19
19
|
it_should_behave_like "vos driver"
|
20
20
|
|
21
|
-
it_should_behave_like 'vfs
|
22
|
-
it_should_behave_like 'vfs
|
23
|
-
it_should_behave_like 'vfs
|
24
|
-
it_should_behave_like 'vfs
|
25
|
-
it_should_behave_like 'vfs
|
21
|
+
it_should_behave_like 'vfs driver basic'
|
22
|
+
it_should_behave_like 'vfs driver attributes basic'
|
23
|
+
it_should_behave_like 'vfs driver files'
|
24
|
+
it_should_behave_like 'vfs driver dirs'
|
25
|
+
it_should_behave_like 'vfs driver tmp dir'
|
26
26
|
|
27
27
|
describe 'limited ssh attributes' do
|
28
28
|
it "attributes for dirs" do
|
29
|
-
@
|
30
|
-
attrs = @
|
29
|
+
@driver.create_dir('/dir')
|
30
|
+
attrs = @driver.attributes('/dir')
|
31
31
|
attrs[:file].should be_false
|
32
32
|
attrs[:dir].should be_true
|
33
33
|
# attrs[:created_at].class.should == Time
|
@@ -36,8 +36,8 @@ describe Vos::Drivers::Ssh do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "attributes for files" do
|
39
|
-
@
|
40
|
-
attrs = @
|
39
|
+
@driver.write_file('/file', false){|w| w.write 'something'}
|
40
|
+
attrs = @driver.attributes('/file')
|
41
41
|
attrs[:file].should be_true
|
42
42
|
attrs[:dir].should be_false
|
43
43
|
# attrs[:created_at].class.should == Time
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,33 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08
|
12
|
+
date: 2011-09-08 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: net-ssh
|
16
|
-
requirement: &2785270 !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: *2785270
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: net-sftp
|
27
|
-
requirement: &2784970 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - ! '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *2784970
|
36
14
|
- !ruby/object:Gem::Dependency
|
37
15
|
name: vfs
|
38
|
-
requirement: &
|
16
|
+
requirement: &2832540 !ruby/object:Gem::Requirement
|
39
17
|
none: false
|
40
18
|
requirements:
|
41
19
|
- - ! '>='
|
@@ -43,7 +21,7 @@ dependencies:
|
|
43
21
|
version: '0'
|
44
22
|
type: :runtime
|
45
23
|
prerelease: false
|
46
|
-
version_requirements: *
|
24
|
+
version_requirements: *2832540
|
47
25
|
description:
|
48
26
|
email:
|
49
27
|
executables: []
|
@@ -65,7 +43,6 @@ files:
|
|
65
43
|
- lib/vos/drivers/ssh_vfs_storage.rb
|
66
44
|
- lib/vos/gems.rb
|
67
45
|
- lib/vos/helpers/ubuntu.rb
|
68
|
-
- lib/vos/support.rb
|
69
46
|
- lib/vos.rb
|
70
47
|
- spec/box_spec/emptygit
|
71
48
|
- spec/box_spec.rb
|
data/lib/vos/support.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'net/ssh'
|
3
|
-
require 'net/sftp'
|
4
|
-
|
5
|
-
require 'vfs'
|
6
|
-
Vfs.class_eval do
|
7
|
-
class << self
|
8
|
-
def default_storage
|
9
|
-
::Vos::Box.local
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# class File
|
15
|
-
# class << self
|
16
|
-
# def ensure_dir_exist directory, options = {}
|
17
|
-
# options = options.symbolize_keys
|
18
|
-
# clean = options.delete :clean
|
19
|
-
# raise "unsupported options #{options.keys}!" unless options.empty?
|
20
|
-
#
|
21
|
-
# FileUtils.rm_r directory, force: true if clean and File.exist?(directory)
|
22
|
-
# FileUtils.mkdir_p directory
|
23
|
-
# end
|
24
|
-
#
|
25
|
-
# def copy_dir_content from, to
|
26
|
-
# Dir.glob "#{from}/*" do |item|
|
27
|
-
# FileUtils.cp_r item, to
|
28
|
-
# end
|
29
|
-
# end
|
30
|
-
#
|
31
|
-
# def copy_dir from, to
|
32
|
-
# FileUtils.cp_r from, to
|
33
|
-
# end
|
34
|
-
#
|
35
|
-
# def delete_dir dir
|
36
|
-
# FileUtils.rm_r dir
|
37
|
-
# end
|
38
|
-
# end
|
39
|
-
# end
|