easy_io 0.4.3 → 0.6.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/registry.rb +1 -1
- data/lib/easy_io.rb +2 -4
- 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: 2c000857d73c6af588e9628d5d650f05228bd4dc1a4f6345c4f49b2554aea9f1
|
4
|
+
data.tar.gz: 30083c8699ece00b37669210f78abd9509134bcfc58a084d88d8356205bc5140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 595515c0bc933c1a5f6634f7bec878e574998c0ecef0b409666170eeedfc35b1bfa82661ec1ff9087b293c02bfaa512db56cf8fd77dfdf0f4dccdd8be2607998
|
7
|
+
data.tar.gz: ee65e5a8b3208f99b645515db88e82ae634dfa68e2cb905b9ac237a7fe3ae9a6ebfd6abaf222f035b1bdcd3dcf51da01830e5ece4c49a72ddca0d33381f2dd09
|
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/registry.rb
CHANGED
data/lib/easy_io.rb
CHANGED
@@ -23,10 +23,8 @@ require 'fileutils'
|
|
23
23
|
require 'tmpdir'
|
24
24
|
require 'os'
|
25
25
|
require 'digest'
|
26
|
-
|
27
|
-
|
28
|
-
require 'win32api'
|
29
|
-
end
|
26
|
+
require 'sys/filesystem'
|
27
|
+
require 'win32/registry' if OS.windows? && !defined?(::Win32::Registry)
|
30
28
|
|
31
29
|
require_relative 'easy_io/config'
|
32
30
|
require_relative 'easy_io/disk'
|
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.6.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-12-01 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
|