viewworkbook 1.0 → 1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/viewworkbook +10 -0
- data/doc/html/viewworkbook.html +34 -60
- data/doc/man/viewworkbook.1.gz +0 -0
- data/lib/sheetdata.rb +6 -7
- data/lib/translating.rb +1 -2
- data/lib/viewworkbook.rb +8 -4
- data/viewworkbook.gemspec +17 -15
- metadata +116 -103
- data/lib/file_checking.rb +0 -112
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f97f7f1cdd935098d172c91768b0fccce10145b0a698aedaafc31d0088049352
|
|
4
|
+
data.tar.gz: cdbf537eafafafd3a526d1b153ad359d9de56495a76e78e1be4f72b068964501
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28b217697527fa170a61f94069ad9ccd6d18fbab3ce2c4e6866340bc88a32d9f48a0fd8311e0d7f77db36fe0d99144fbeab1f8662cc9a115982f572a6287a2c1
|
|
7
|
+
data.tar.gz: 0f9da7243c3c2ed63e6222cc6d5294ae09c86819b598d1d51031ef1530a15ed1e67fe1a6d188a019a75df1253f0303bb2db14f60a469489c796c93bc8aec93c9
|
data/bin/viewworkbook
CHANGED
|
@@ -25,9 +25,19 @@ BasicLogging::set_level BasicLogging::INFO
|
|
|
25
25
|
# BasicLogging::set_target "/tmp/viewworkbook.log"
|
|
26
26
|
# BasicLogging::set_level BasicLogging::DEBUG
|
|
27
27
|
|
|
28
|
+
def usage
|
|
29
|
+
msg = '' << 'Usage: '
|
|
30
|
+
msg << yellow("\n\tviewworkbook [file]")
|
|
31
|
+
msg << "\n\tWhere \"file\" is a spreadsheet file."
|
|
32
|
+
puts msg
|
|
33
|
+
end
|
|
34
|
+
|
|
28
35
|
if(ARGV.compact.empty?)
|
|
29
36
|
puts purple("\n\tYou must name a valid spreadsheet file! Aborting\n")
|
|
37
|
+
usage
|
|
30
38
|
puts
|
|
31
39
|
exit false
|
|
32
40
|
end
|
|
33
41
|
ViewWorkBook.new(ARGV[0])
|
|
42
|
+
|
|
43
|
+
|
data/doc/html/viewworkbook.html
CHANGED
|
@@ -1,67 +1,30 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
3
3
|
<head>
|
|
4
|
-
<meta name="generator" content="vim - Vi Improved, a programmer's editor; HTML Tidy for Linux version 5.
|
|
4
|
+
<meta name="generator" content="vim - Vi Improved, a programmer's editor; HTML Tidy for Linux version 5.9.20
|
|
5
5
|
"/>
|
|
6
6
|
<meta charset="utf-8" />
|
|
7
|
+
<link rel="preload" as="font" crossorigin="" href=
|
|
8
|
+
"https://www.uplawski.eu/fonts/Classica/Classica-Book.ttf" type=
|
|
9
|
+
"font/ttf" />
|
|
10
|
+
<link rel="preload" as="font" crossorigin="" href=
|
|
11
|
+
"https://www.uplawski.eu/fonts/Classica/Classica-Bold.ttf" type=
|
|
12
|
+
"font/ttf" />
|
|
13
|
+
<link rel="preload" as="font" crossorigin="" href=
|
|
14
|
+
"https://www.uplawski.eu/fonts/Classica/Classica-BookOblique.ttf"
|
|
15
|
+
type="font/ttf" />
|
|
16
|
+
<link rel="preload" as="font" crossorigin="" href=
|
|
17
|
+
"https://www.uplawski.eu/fonts/Fertigo_PRO.otf" type=
|
|
18
|
+
"font/otf" />
|
|
19
|
+
<link rel="icon" type="/image/x-icon" href=
|
|
20
|
+
"images/favicon_Schreibfeder.ico" />
|
|
7
21
|
<meta name="viewport" content=
|
|
8
22
|
"width=device-width, initial-scale=1" />
|
|
9
23
|
<title>Viewworkbook</title>
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
:Author: Michael Uplawski
|
|
15
|
-
:Contact: michael.uplawski@uplawski.eu
|
|
16
|
-
:License: WTFPL 2.0, see http://www.wtfpl.net/about/
|
|
17
|
-
|
|
18
|
-
Stylesheet for use with Docutils.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
body {
|
|
22
|
-
background-color:#300020;
|
|
23
|
-
font-family: Verdana,Helvetica,Univers;
|
|
24
|
-
color:#f0f0f0;
|
|
25
|
-
color:#f0f0f0;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
h1 {color:cyan;font-size:1.5em;}
|
|
29
|
-
h1.title {color:#a0a0f0;font-size:2em;}
|
|
30
|
-
h2 {color:#ffffa0;}
|
|
31
|
-
|
|
32
|
-
p, ul.simple, ol.simple, dt {margin-left:2em;}
|
|
33
|
-
p.first {font-weight:bold;}
|
|
34
|
-
dd {margin-left:4em;}
|
|
35
|
-
td {color:#f0f080;}
|
|
36
|
-
|
|
37
|
-
/* correct left margin of nested block tags*/
|
|
38
|
-
dd {}
|
|
39
|
-
dd p, li p {margin-left:0;}
|
|
40
|
-
dd * ul {margin-left:0 ! important; }
|
|
41
|
-
dd ul {margin-left:0 ! important; }
|
|
42
|
-
dd dl dt, dd dl dd {margin-left:0 ! important;}
|
|
43
|
-
dt {font-weight:bold;}
|
|
44
|
-
dt, dd {color:#f0f0f0}
|
|
45
|
-
|
|
46
|
-
tt.docutils {color:#000080;
|
|
47
|
-
background-color:#a080a0;
|
|
48
|
-
padding-left:3px;
|
|
49
|
-
padding-right:3px;
|
|
50
|
-
white-space:nowrap;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
a.external {color:#ff90ff;}
|
|
54
|
-
|
|
55
|
-
blockquote {background-color:#400020;
|
|
56
|
-
padding:0.5em;
|
|
57
|
-
border-radius:1em;
|
|
58
|
-
border-style:dotted;
|
|
59
|
-
border-width:0.5pt;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/*]]>*/
|
|
64
|
-
</style>
|
|
24
|
+
<link rel="stylesheet" href="../html/viewworkbook.css" type=
|
|
25
|
+
"text/css" />
|
|
26
|
+
<link rel="stylesheet" href="../html/fonts.css" type=
|
|
27
|
+
"text/css" />
|
|
65
28
|
</head>
|
|
66
29
|
<body>
|
|
67
30
|
<main id="viewworkbook">
|
|
@@ -392,11 +355,22 @@
|
|
|
392
355
|
</dd>
|
|
393
356
|
</dl>
|
|
394
357
|
</blockquote>
|
|
395
|
-
</section>
|
|
396
358
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
359
|
+
<section id="this-document">
|
|
360
|
+
<h3>This document</h3>
|
|
361
|
+
|
|
362
|
+
<p>©Michael Uplawski <<a class="reference external"
|
|
363
|
+
href="mailto:michael.uplawski@uplawski.eu">michael.uplawski@uplawski.eu</a>></p>
|
|
364
|
+
|
|
365
|
+
<p>License: <a class="reference external" href=
|
|
366
|
+
"https://creativecommons.org/licenses/by-nd/4.0/">CC BY-ND
|
|
367
|
+
4.0</a></p>
|
|
368
|
+
|
|
369
|
+
<p>Date: 2026-04-26</p>
|
|
370
|
+
|
|
371
|
+
<p><strong>Ω</strong>
|
|
372
|
+
</p>
|
|
373
|
+
</section>
|
|
400
374
|
</section>
|
|
401
375
|
</main>
|
|
402
376
|
</body>
|
data/doc/man/viewworkbook.1.gz
CHANGED
|
Binary file
|
data/lib/sheetdata.rb
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
***************************************************************************/
|
|
16
16
|
=end
|
|
17
17
|
|
|
18
|
-
require '
|
|
18
|
+
require 'marcel'
|
|
19
19
|
require 'roo'
|
|
20
20
|
require 'roo-xls'
|
|
21
21
|
|
|
@@ -33,6 +33,7 @@ XLS_MIME = "application/vnd.ms-excel"
|
|
|
33
33
|
XLSX_MIME = "application/zip"
|
|
34
34
|
CSV_MIME = "text/plain"
|
|
35
35
|
# SoftMaker Office
|
|
36
|
+
PMD_MIME = "application/x-ole-storage"
|
|
36
37
|
PMDX_MIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
37
38
|
|
|
38
39
|
=begin
|
|
@@ -50,15 +51,13 @@ class SheetData
|
|
|
50
51
|
@@file = file
|
|
51
52
|
if !@@workbook
|
|
52
53
|
begin
|
|
53
|
-
|
|
54
|
-
mtype =
|
|
55
|
-
fm = FileMagic.fm
|
|
56
|
-
magic = fm.fd(File.new(file) ).split(';')[0]
|
|
54
|
+
|
|
55
|
+
mtype = Marcel::MimeType.for(File.new(file) )
|
|
57
56
|
@@workbook = case mtype
|
|
58
57
|
when ODS_MIME
|
|
59
58
|
debug('ODS')
|
|
60
59
|
Roo::Spreadsheet::open(@@file, extension: :ods )
|
|
61
|
-
when
|
|
60
|
+
when XLS_MIME, PMD_MIME
|
|
62
61
|
debug('XLS')
|
|
63
62
|
Roo::Spreadsheet::open(@@file, extension: :xls )
|
|
64
63
|
when XLSX_MIME, PMDX_MIME
|
|
@@ -67,7 +66,7 @@ class SheetData
|
|
|
67
66
|
when CSV_MIME
|
|
68
67
|
raise IOError.new('CSV is not yet supported, sorry')
|
|
69
68
|
else
|
|
70
|
-
raise IOError.new('Mime-Type is ' << mtype <<
|
|
69
|
+
raise IOError.new('Mime-Type is ' << mtype << ". Is this supposed to be a spreadsheet?")
|
|
71
70
|
end
|
|
72
71
|
rescue Exception => ex
|
|
73
72
|
msg = 'ERROR! File %s is not supported: %s' %[@@file, ex.message]
|
data/lib/translating.rb
CHANGED
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
RD = File.expand_path(File.dirname(__FILE__) ) + File::SEPARATOR if !defined?(RD)
|
|
20
20
|
|
|
21
21
|
require 'yaml'
|
|
22
|
-
require_relative 'file_checking'
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
# A way to produce translated text in a ruby-program.
|
|
@@ -40,7 +39,7 @@ module Translating
|
|
|
40
39
|
r = ENV['LANG']
|
|
41
40
|
if(r)
|
|
42
41
|
@@lang = r[0, 2]
|
|
43
|
-
elsif(
|
|
42
|
+
elsif( File::exist?(@@lang_file) && File::readable?(@@lang_file) && File::size(@@lang_file) >= 2)
|
|
44
43
|
File::open(@@lang_file, 'r') {|f| @@lang = f.readline}
|
|
45
44
|
@@lang.chomp!.downcase! if @@lang
|
|
46
45
|
end
|
data/lib/viewworkbook.rb
CHANGED
|
@@ -17,14 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
require 'tempfile'
|
|
19
19
|
require_relative 'basic_logging'
|
|
20
|
-
require_relative 'file_checking'
|
|
21
20
|
require_relative 'sheetinterface'
|
|
22
21
|
require_relative 'sheetdata'
|
|
23
22
|
require_relative 'color_output'
|
|
24
23
|
|
|
25
24
|
class ViewWorkBook
|
|
26
25
|
include BasicLogging
|
|
27
|
-
include File_Checking
|
|
28
26
|
|
|
29
27
|
attr_reader :workbook
|
|
30
28
|
|
|
@@ -35,8 +33,14 @@ class ViewWorkBook
|
|
|
35
33
|
debug('workbook file will be ' << (path ? path : 'N I L'))
|
|
36
34
|
|
|
37
35
|
if(wb)
|
|
38
|
-
msg =
|
|
39
|
-
|
|
36
|
+
msg = ''
|
|
37
|
+
|
|
38
|
+
[:exist?, :file?, :readable?].each do |cond|
|
|
39
|
+
if ! File.send(cond, path)
|
|
40
|
+
msg = "\n\t not " << cond.to_s.split('?')[0]
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
if(msg.empty?)
|
|
40
44
|
begin
|
|
41
45
|
@workbook = SheetData.workbook(path)
|
|
42
46
|
view_sheet if @workbook
|
data/viewworkbook.gemspec
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
+
require_relative 'lib/version'
|
|
2
|
+
require 'date'
|
|
3
|
+
|
|
1
4
|
Gem::Specification.new do |s|
|
|
2
|
-
s.name =
|
|
3
|
-
s.version =
|
|
4
|
-
s.date = '
|
|
5
|
-
s.summary =
|
|
6
|
-
s.summary << "Ruby 4.0 compatibility, "
|
|
7
|
-
s.summary << "Minor Bug-fix."
|
|
5
|
+
s.name = PROGNAME
|
|
6
|
+
s.version = VERSION
|
|
7
|
+
s.date = Date.today.strftime('%F')
|
|
8
|
+
s.summary = SUMMARY
|
|
8
9
|
s.description = "View spreadsheet files in a text-console."
|
|
9
|
-
s.authors =
|
|
10
|
-
s.email =
|
|
11
|
-
s.files = %w~action.rb scrollable.rb cell.rb column.rb row.rb color_output.rb menu.rb sheetdata.rb translating.rb user_input.rb
|
|
10
|
+
s.authors = AUTHORS
|
|
11
|
+
s.email = EMAIL
|
|
12
|
+
s.files = %w~action.rb scrollable.rb cell.rb column.rb row.rb color_output.rb menu.rb sheetdata.rb translating.rb user_input.rb basic_logging.rb sheetinterface.rb translations viewworkbook.rb~.collect{|f| 'lib/' << f} +
|
|
12
13
|
%w~license.txt rst/viewworkbook.rst man/viewworkbook.1.gz html/viewworkbook.html~.collect{|f| 'doc/' << f} +
|
|
13
14
|
%w~busy_function_test.rb busy_indicator.rb~.collect{|f| 'lib/busy_indicator/' << f} + ["README.md", "viewworkbook.gemspec"]
|
|
14
15
|
s.homepage = 'http://rubygems.org/gems/viewworkbook'
|
|
15
|
-
s.requirements = 'roo, roo-xls,
|
|
16
|
-
s.add_runtime_dependency 'roo', '~>
|
|
17
|
-
s.add_runtime_dependency 'roo-xls', '~>
|
|
18
|
-
s.add_runtime_dependency '
|
|
16
|
+
s.requirements = 'roo, roo-xls, marcel'
|
|
17
|
+
s.add_runtime_dependency 'roo', '~> 3.0', '>= 3.0.0'
|
|
18
|
+
s.add_runtime_dependency 'roo-xls', '~> 2.0', '>= 2.0.0'
|
|
19
|
+
s.add_runtime_dependency 'marcel', '~> 1.2', '>= 1.2.1'
|
|
19
20
|
s.executables = 'viewworkbook'
|
|
20
|
-
s.license = '
|
|
21
|
+
s.license = 'WTFPL'
|
|
21
22
|
s.required_ruby_version = '>= 4.0'
|
|
22
23
|
s.metadata = {
|
|
23
24
|
"homepage_uri" => 'https://www.uplawski.eu/software/viewworkbook/',
|
|
24
|
-
"documentation_uri" => 'https://www.uplawski.eu/software/viewworkbook/viewworkbook.html'
|
|
25
|
+
"documentation_uri" => 'https://www.uplawski.eu/software/viewworkbook/viewworkbook.html',
|
|
26
|
+
"changelog_uri" => 'https://www.uplawski.eu/software/viewworkbook/changes.txt'
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
end
|
metadata
CHANGED
|
@@ -1,128 +1,141 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: viewworkbook
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: "1.1"
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- Michael Uplawski
|
|
7
|
+
- Michael Uplawski
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-08-15 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: roo
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
-
|
|
17
|
+
- ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: "3.0"
|
|
20
|
+
-
|
|
21
|
+
- ">="
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: 3.0.0
|
|
24
|
+
type: :runtime
|
|
25
|
+
prerelease: false
|
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
27
|
+
requirements:
|
|
28
|
+
-
|
|
29
|
+
- ~>
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: "3.0"
|
|
32
|
+
-
|
|
33
|
+
- ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: 3.0.0
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: roo-xls
|
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
|
39
|
+
requirements:
|
|
40
|
+
-
|
|
41
|
+
- ~>
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: "2.0"
|
|
44
|
+
-
|
|
45
|
+
- ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 2.0.0
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
-
|
|
53
|
+
- ~>
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: "2.0"
|
|
56
|
+
-
|
|
57
|
+
- ">="
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: 2.0.0
|
|
60
|
+
- !ruby/object:Gem::Dependency
|
|
61
|
+
name: marcel
|
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
64
|
+
-
|
|
65
|
+
- ~>
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: "1.2"
|
|
68
|
+
-
|
|
69
|
+
- ">="
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: 1.2.1
|
|
72
|
+
type: :runtime
|
|
73
|
+
prerelease: false
|
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
75
|
+
requirements:
|
|
76
|
+
-
|
|
77
|
+
- ~>
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: "1.2"
|
|
80
|
+
-
|
|
81
|
+
- ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: 1.2.1
|
|
72
84
|
description: View spreadsheet files in a text-console.
|
|
73
85
|
email: michael.uplawski@uplawski.eu
|
|
74
86
|
executables:
|
|
75
|
-
- viewworkbook
|
|
87
|
+
- viewworkbook
|
|
76
88
|
extensions: []
|
|
77
89
|
extra_rdoc_files: []
|
|
78
90
|
files:
|
|
79
|
-
- README.md
|
|
80
|
-
- bin/viewworkbook
|
|
81
|
-
- doc/html/viewworkbook.html
|
|
82
|
-
- doc/license.txt
|
|
83
|
-
- doc/man/viewworkbook.1.gz
|
|
84
|
-
- doc/rst/viewworkbook.rst
|
|
85
|
-
- lib/action.rb
|
|
86
|
-
- lib/basic_logging.rb
|
|
87
|
-
- lib/busy_indicator/busy_function_test.rb
|
|
88
|
-
- lib/busy_indicator/busy_indicator.rb
|
|
89
|
-
- lib/cell.rb
|
|
90
|
-
- lib/color_output.rb
|
|
91
|
-
- lib/column.rb
|
|
92
|
-
- lib/
|
|
93
|
-
- lib/
|
|
94
|
-
- lib/
|
|
95
|
-
- lib/
|
|
96
|
-
- lib/
|
|
97
|
-
- lib/
|
|
98
|
-
- lib/
|
|
99
|
-
- lib/
|
|
100
|
-
- lib/
|
|
101
|
-
-
|
|
102
|
-
|
|
103
|
-
homepage: http://rubygems.org/gems/viewworkbook
|
|
91
|
+
- README.md
|
|
92
|
+
- bin/viewworkbook
|
|
93
|
+
- doc/html/viewworkbook.html
|
|
94
|
+
- doc/license.txt
|
|
95
|
+
- doc/man/viewworkbook.1.gz
|
|
96
|
+
- doc/rst/viewworkbook.rst
|
|
97
|
+
- lib/action.rb
|
|
98
|
+
- lib/basic_logging.rb
|
|
99
|
+
- lib/busy_indicator/busy_function_test.rb
|
|
100
|
+
- lib/busy_indicator/busy_indicator.rb
|
|
101
|
+
- lib/cell.rb
|
|
102
|
+
- lib/color_output.rb
|
|
103
|
+
- lib/column.rb
|
|
104
|
+
- lib/menu.rb
|
|
105
|
+
- lib/row.rb
|
|
106
|
+
- lib/scrollable.rb
|
|
107
|
+
- lib/sheetdata.rb
|
|
108
|
+
- lib/sheetinterface.rb
|
|
109
|
+
- lib/translating.rb
|
|
110
|
+
- lib/translations
|
|
111
|
+
- lib/user_input.rb
|
|
112
|
+
- lib/viewworkbook.rb
|
|
113
|
+
- viewworkbook.gemspec
|
|
114
|
+
homepage: "http://rubygems.org/gems/viewworkbook"
|
|
104
115
|
licenses:
|
|
105
|
-
-
|
|
116
|
+
- WTFPL
|
|
106
117
|
metadata:
|
|
107
|
-
homepage_uri: https://www.uplawski.eu/software/viewworkbook/
|
|
108
|
-
documentation_uri: https://www.uplawski.eu/software/viewworkbook/viewworkbook.html
|
|
118
|
+
homepage_uri: "https://www.uplawski.eu/software/viewworkbook/"
|
|
119
|
+
documentation_uri: "https://www.uplawski.eu/software/viewworkbook/viewworkbook.html"
|
|
120
|
+
changelog_uri: "https://www.uplawski.eu/software/viewworkbook/changes.txt"
|
|
109
121
|
rdoc_options: []
|
|
110
122
|
require_paths:
|
|
111
|
-
- lib
|
|
123
|
+
- lib
|
|
112
124
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
125
|
requirements:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
126
|
+
-
|
|
127
|
+
- ">="
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
version: "4.0"
|
|
117
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
131
|
requirements:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
132
|
+
-
|
|
133
|
+
- ">="
|
|
134
|
+
- !ruby/object:Gem::Version
|
|
135
|
+
version: "0"
|
|
122
136
|
requirements:
|
|
123
|
-
- roo, roo-xls,
|
|
124
|
-
rubygems_version: 4.0.
|
|
137
|
+
- "roo, roo-xls, marcel"
|
|
138
|
+
rubygems_version: 4.1.0.dev
|
|
125
139
|
specification_version: 4
|
|
126
|
-
summary:
|
|
127
|
-
Minor Bug-fix.
|
|
140
|
+
summary: View spreadsheets in a terminal
|
|
128
141
|
test_files: []
|
data/lib/file_checking.rb
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
#encoding: UTF-8
|
|
2
|
-
=begin
|
|
3
|
-
/***************************************************************************
|
|
4
|
-
* ©2011-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
|
5
|
-
* *
|
|
6
|
-
* This program is free software; you can redistribute it and/or modify *
|
|
7
|
-
* it under the terms of the WTFPL 2.0 or later, see *
|
|
8
|
-
* http://www.wtfpl.net/about/ *
|
|
9
|
-
* *
|
|
10
|
-
* This program is distributed in the hope that it will be useful, *
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
13
|
-
* *
|
|
14
|
-
***************************************************************************/
|
|
15
|
-
=end
|
|
16
|
-
|
|
17
|
-
require 'filemagic'
|
|
18
|
-
|
|
19
|
-
=begin
|
|
20
|
-
A module to facilitate frequently occuring checks on
|
|
21
|
-
file-system objects
|
|
22
|
-
=end
|
|
23
|
-
module File_Checking
|
|
24
|
-
|
|
25
|
-
@@text_messages = {
|
|
26
|
-
:exist? => "does not exist!",
|
|
27
|
-
:exist => "does not exist!",
|
|
28
|
-
:readable? => "is not readable!",
|
|
29
|
-
:readable => "is not readable!",
|
|
30
|
-
:executable? => "is not executable!",
|
|
31
|
-
:executable => "is not executable!",
|
|
32
|
-
:writable? => "is not writable!",
|
|
33
|
-
:writable => "is not writable!",
|
|
34
|
-
:directory? => "is not a directory!",
|
|
35
|
-
:directory => "is not a directory!",
|
|
36
|
-
:file? => "is not a file!",
|
|
37
|
-
:file => "is not a file!",
|
|
38
|
-
:type => "is not of the sought file-type (not '%s', but '%s')!",
|
|
39
|
-
:type? => "is not of the sought file-type (not '%s', but '%s')!",
|
|
40
|
-
:mime => "does not have the sought mime-type (not '%s', but '%s')!",
|
|
41
|
-
:mime? => "does not have the sought mime-type (not '%s', but '%s')!",
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
# Checks if the file with the name from the first
|
|
45
|
-
# parameter has the properties, listed in the second.
|
|
46
|
-
# The messages parameter is an array of one or several
|
|
47
|
-
# of :exist?, :readable?, :writable?, :directory? or
|
|
48
|
-
# their string-representations, respectively.
|
|
49
|
-
# Returns nil in case of success, otherwise an
|
|
50
|
-
# informative message, describing the first negative
|
|
51
|
-
# test-result.
|
|
52
|
-
def file_check(file, *messages)
|
|
53
|
-
File_Checking.file_check(file, *messages)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# Checks if the file with the name from the first
|
|
57
|
-
# parameter has the properties, listed in the second.
|
|
58
|
-
# The messages parameter is an array of one or all
|
|
59
|
-
# of :exist?, :readable?, :writable?, :directory? or
|
|
60
|
-
# their string-representations, respectively.
|
|
61
|
-
# Returns nil in case of success, otherwise an
|
|
62
|
-
# informative message, describing the first negative
|
|
63
|
-
# test-result.
|
|
64
|
-
def self.file_check(file, *messages)
|
|
65
|
-
msg = nil
|
|
66
|
-
if(file && messages.respond_to?(:to_ary) && !messages.empty?)
|
|
67
|
-
messages.each do |k|
|
|
68
|
-
if(! k.to_s.end_with?('?'))
|
|
69
|
-
k = (k.to_s << '?').to_sym
|
|
70
|
-
end
|
|
71
|
-
@log.debug ('checking ' << k.to_s) if @log
|
|
72
|
-
if(msg == nil && File.respond_to?(k) && ! File.send(k, file.to_s))
|
|
73
|
-
msg = "#{file} #{@@text_messages[k.to_sym]}"
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
msg
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def self.mime_check(file, mime_type)
|
|
81
|
-
fm = FileMagic.mime
|
|
82
|
-
fd = fm.fd(File.new(file) ).split(';')[0]
|
|
83
|
-
if fd != mime_type.strip
|
|
84
|
-
return file.dup << ' ' << (@@text_messages[:mime] %[mime_type, fd])
|
|
85
|
-
end
|
|
86
|
-
return nil
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
def self.magic_check(file, magic)
|
|
90
|
-
fm = FileMagic.fm
|
|
91
|
-
fd = fm.fd(File.new(file) ).split(';')[0]
|
|
92
|
-
if fd != magic.strip
|
|
93
|
-
return file.dup << ' ' << (@@text_messages[:type] %[magic, fd])
|
|
94
|
-
end
|
|
95
|
-
return nil
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
end # module
|
|
99
|
-
|
|
100
|
-
=begin
|
|
101
|
-
# example
|
|
102
|
-
|
|
103
|
-
include File_Checking
|
|
104
|
-
msg = file_check('some_file.txt', [:exist?, :readable?, 'writable'])
|
|
105
|
-
# same as
|
|
106
|
-
# msg = file_check('some_file.txt', [:exist, :readable, 'writable?'])
|
|
107
|
-
|
|
108
|
-
msg ||= magic_check('some_file.txt', [:type?], 'OpenDocument Text'
|
|
109
|
-
msg ||= mime_check('some_file.txt', [:mime?], 'application/vnd.oasis.opendocument.text'
|
|
110
|
-
puts msg if msg
|
|
111
|
-
=end
|
|
112
|
-
# E O F
|