easy_io 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/easy_io/disk.rb +30 -42
- data/lib/easy_io.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d46961a39a7863a0280667c35b02284d8ca3b7bcd735f88e44c3dffb8b2b15c4
|
4
|
+
data.tar.gz: b3a4cead726774f3a652e752e82557fc46c495d09d7ba6d61c0edd5e334367f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 748cf34c8bb70f806f59d73699002f926038bd3a4329d400969d3c4a90627101ba0c95eb44d6a2269eab22b3b880676eebad782fc72a0ed906284fe91cd0ee47
|
7
|
+
data.tar.gz: 9b256811b2114bf57c8001a9d65e9ea4988d9ac242ca49a128017fe3c000bae3026611236d72657b7472a79fee043e0b27051ee55d51aace8595068afab76e8c
|
data/lib/easy_io/disk.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
module EasyIO
|
2
2
|
module Disk
|
3
|
-
unless defined? GetDiskFreeSpaceEx
|
4
|
-
GetDiskFreeSpaceEx = Win32API.new('kernel32', 'GetDiskFreeSpaceEx', 'PPPP', 'I') if OS.windows? # TODO: make this cross platform. sys-filesystem gem maybe?
|
5
|
-
end
|
6
|
-
|
7
3
|
module_function
|
8
4
|
|
9
5
|
def free_space(path)
|
@@ -13,11 +9,7 @@ module EasyIO
|
|
13
9
|
raise "Cannot check free space for #{path} - The path was not found." if root_folder.nil? || root_folder.empty?
|
14
10
|
root_folder = EasyFormat::Directory.ensure_trailing_slash(root_folder)
|
15
11
|
|
16
|
-
|
17
|
-
GetDiskFreeSpaceEx.call(root_folder, 0, 0, free)
|
18
|
-
free = free.unpack1('Q')
|
19
|
-
|
20
|
-
(free / 1024.0 / 1024.0).round(2)
|
12
|
+
(Sys::Filesystem.stat(root_folder).bytes_free / 1024.0 / 1024.0).round(2)
|
21
13
|
end
|
22
14
|
|
23
15
|
def size(path)
|
@@ -27,11 +19,7 @@ module EasyIO
|
|
27
19
|
raise "Cannot check free space for #{path} - The path was not found." if root_folder.nil? || root_folder.empty?
|
28
20
|
root_folder = EasyFormat::Directory.ensure_trailing_slash(root_folder)
|
29
21
|
|
30
|
-
|
31
|
-
GetDiskFreeSpaceEx.call(root_folder, 0, total, 0)
|
32
|
-
total = total.unpack1('Q')
|
33
|
-
|
34
|
-
(total / 1024.0 / 1024.0).round(2)
|
22
|
+
(Sys::Filesystem.stat(root_folder).bytes_total / 1024.0 / 1024.0).round(2)
|
35
23
|
end
|
36
24
|
|
37
25
|
def move_files(search_string, destination_folder)
|
@@ -81,33 +69,33 @@ module EasyIO
|
|
81
69
|
end
|
82
70
|
end
|
83
71
|
|
84
|
-
# When credentials are nil, the current user will be used
|
85
|
-
def cross_domain_copy(source_folder, destination_folder, source_credentials: nil, destination_credentials: nil, file_filter: '*')
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
def _cross_domain_entry_copy(source_entry, destination_entry, source_credentials: nil, destination_credentials: nil)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
72
|
+
# # When credentials are nil, the current user will be used
|
73
|
+
# def cross_domain_copy(source_folder, destination_folder, source_credentials: nil, destination_credentials: nil, file_filter: '*')
|
74
|
+
# # require 'win32/process'
|
75
|
+
# Dir.glob("#{source_folder}/#{file_filter}").each do |source_entry|
|
76
|
+
# destination_entry = source_entry.sub(source_folder, destination_folder)
|
77
|
+
# _cross_domain_entry_copy(source_entry, destination_entry, source_credentials: source_credentials, destination_credentials: destination_credentials)
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
|
81
|
+
# def _cross_domain_entry_copy(source_entry, destination_entry, source_credentials: nil, destination_credentials: nil)
|
82
|
+
# source_credentials ||= :current_user
|
83
|
+
# destination_credentials ||= :current_user
|
84
|
+
|
85
|
+
# # TODO: loop and read to async buffer and write as it goes
|
86
|
+
# if source_credentials == :current_user
|
87
|
+
# # TODO: read to memeory
|
88
|
+
# else
|
89
|
+
# Process.create(command_line: ?, domain: source_credentials['domain'], with_logon: source_credentials['user_name'], password: source_credentials['password'])
|
90
|
+
# # TODO: read to memory
|
91
|
+
# end
|
92
|
+
|
93
|
+
# if destination_credentials == :current_user
|
94
|
+
# # TODO: write from memory
|
95
|
+
# else
|
96
|
+
# Process.create(etc)
|
97
|
+
# # TODO: write from memory
|
98
|
+
# end
|
99
|
+
# end
|
112
100
|
end
|
113
101
|
end
|
data/lib/easy_io.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Munoz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: easy_format
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sys-filesystem
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1'
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
- amunoz951@gmail.com
|
@@ -100,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
114
|
- !ruby/object:Gem::Version
|
101
115
|
version: '0'
|
102
116
|
requirements: []
|
103
|
-
rubygems_version: 3.0.3
|
117
|
+
rubygems_version: 3.0.3.1
|
104
118
|
signing_key:
|
105
119
|
specification_version: 4
|
106
120
|
summary: Ruby library for ease of running commands with realtime output and return
|