viewworkbook 0.1.3 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +126 -0
- data/bin/viewworkbook +12 -10
- data/lib/action.rb +6 -14
- data/lib/basic_logging.rb +178 -0
- data/lib/cell.rb +9 -18
- data/lib/color_output.rb +16 -0
- data/lib/column.rb +9 -17
- data/lib/file_checking.rb +36 -11
- data/lib/menu.rb +7 -23
- data/lib/row.rb +8 -16
- data/lib/scrollable.rb +8 -17
- data/lib/sheetdata.rb +41 -57
- data/lib/sheetinterface.rb +10 -24
- data/lib/translating.rb +6 -12
- data/lib/user_input.rb +4 -11
- data/lib/viewworkbook.rb +20 -31
- data/viewworkbook.gemspec +20 -0
- metadata +19 -38
- data/lib/log.conf +0 -62
- data/lib/logging.rb +0 -195
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: viewworkbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Uplawski
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: roo
|
@@ -30,46 +30,26 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.4.0
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: roo-xls
|
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.0
|
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
|
-
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: 1.0.0
|
53
33
|
- !ruby/object:Gem::Dependency
|
54
34
|
name: ruby-filemagic
|
55
35
|
requirement: !ruby/object:Gem::Requirement
|
56
36
|
requirements:
|
57
37
|
- - "~>"
|
58
38
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0.
|
39
|
+
version: '0.3'
|
60
40
|
- - ">="
|
61
41
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.
|
42
|
+
version: 0.3.2
|
63
43
|
type: :runtime
|
64
44
|
prerelease: false
|
65
45
|
version_requirements: !ruby/object:Gem::Requirement
|
66
46
|
requirements:
|
67
47
|
- - "~>"
|
68
48
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0.
|
49
|
+
version: '0.3'
|
70
50
|
- - ">="
|
71
51
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0.
|
52
|
+
version: 0.3.2
|
73
53
|
description: View spreadsheet files in a text-console.
|
74
54
|
email: michael.uplawski@uplawski.eu
|
75
55
|
executables:
|
@@ -77,20 +57,20 @@ executables:
|
|
77
57
|
extensions: []
|
78
58
|
extra_rdoc_files: []
|
79
59
|
files:
|
60
|
+
- README.md
|
80
61
|
- bin/viewworkbook
|
81
62
|
- doc/html/viewworkbook.html
|
82
63
|
- doc/license.txt
|
83
64
|
- doc/man/viewworkbook.1.gz
|
84
65
|
- doc/rst/viewworkbook.rst
|
85
66
|
- lib/action.rb
|
67
|
+
- lib/basic_logging.rb
|
86
68
|
- lib/busy_indicator/busy_function_test.rb
|
87
69
|
- lib/busy_indicator/busy_indicator.rb
|
88
70
|
- lib/cell.rb
|
89
71
|
- lib/color_output.rb
|
90
72
|
- lib/column.rb
|
91
73
|
- lib/file_checking.rb
|
92
|
-
- lib/log.conf
|
93
|
-
- lib/logging.rb
|
94
74
|
- lib/menu.rb
|
95
75
|
- lib/row.rb
|
96
76
|
- lib/scrollable.rb
|
@@ -100,11 +80,12 @@ files:
|
|
100
80
|
- lib/translations
|
101
81
|
- lib/user_input.rb
|
102
82
|
- lib/viewworkbook.rb
|
103
|
-
|
83
|
+
- viewworkbook.gemspec
|
84
|
+
homepage: http://rubygems.org/gems/viewworkbook
|
104
85
|
licenses:
|
105
|
-
-
|
86
|
+
- Nonstandard
|
106
87
|
metadata: {}
|
107
|
-
post_install_message:
|
88
|
+
post_install_message:
|
108
89
|
rdoc_options: []
|
109
90
|
require_paths:
|
110
91
|
- lib
|
@@ -112,17 +93,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
93
|
requirements:
|
113
94
|
- - ">="
|
114
95
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
96
|
+
version: '3.0'
|
116
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
98
|
requirements:
|
118
99
|
- - ">="
|
119
100
|
- !ruby/object:Gem::Version
|
120
101
|
version: '0'
|
121
102
|
requirements:
|
122
|
-
- roo, roo-xls, filemagic
|
123
|
-
|
124
|
-
|
125
|
-
signing_key:
|
103
|
+
- roo, roo-xls, ruby-filemagic
|
104
|
+
rubygems_version: 3.4.20
|
105
|
+
signing_key:
|
126
106
|
specification_version: 4
|
127
|
-
summary:
|
107
|
+
summary: New logging module, new License, runtime-dependencies corrected.Better support
|
108
|
+
for SoftMaker's PMDX format
|
128
109
|
test_files: []
|
data/lib/log.conf
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
#encoding: UTF-8
|
2
|
-
=begin
|
3
|
-
/***************************************************************************
|
4
|
-
* ©2013 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 GNU General Public License as published by *
|
8
|
-
* the Free Software Foundation; either version 3 of the License, or *
|
9
|
-
* (at your option) any later version. *
|
10
|
-
* *
|
11
|
-
* This program is distributed in the hope that it will be useful, *
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
14
|
-
* GNU General Public License for more details. *
|
15
|
-
* *
|
16
|
-
* You should have received a copy of the GNU General Public License *
|
17
|
-
* along with this program; if not, write to the *
|
18
|
-
* Free Software Foundation, Inc., *
|
19
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
20
|
-
***************************************************************************/
|
21
|
-
|
22
|
-
A simplified logger configuration. Set the level for each individual logger
|
23
|
-
below. Choose a different log-device or log-file if you like. Keep the
|
24
|
-
formatting intact. Do not change other sections of this file.
|
25
|
-
=end
|
26
|
-
|
27
|
-
# Do not touch from here ----->
|
28
|
-
require 'logger'
|
29
|
-
|
30
|
-
debug = Logger::DEBUG
|
31
|
-
info = Logger::INFO
|
32
|
-
error = Logger::ERROR
|
33
|
-
fatal = Logger::FATAL
|
34
|
-
warn = Logger::WARN
|
35
|
-
unknown = Logger::UNKNOWN
|
36
|
-
{
|
37
|
-
# <---------------- to here !
|
38
|
-
|
39
|
-
# Enter your settings here, but take into consideration that not all
|
40
|
-
# the named classes will really produce readable output. Well, you can
|
41
|
-
# always try... Either name just the log-level or make the log-level
|
42
|
-
# precede the output-device or output-file like in the examples.
|
43
|
-
|
44
|
-
# Example: naming a log-file
|
45
|
-
# :HtmlBuilder => [info, 'C:\temp\htmlbuilder.log']
|
46
|
-
# :HtmlBuilder => [debug, '/tmp/htmlbuilder.log'],
|
47
|
-
|
48
|
-
:ViewWorkBook => debug,
|
49
|
-
:SheetInterface => debug,
|
50
|
-
:Action => info,
|
51
|
-
:Menu => info,
|
52
|
-
:SheetData => info,
|
53
|
-
:Row => info,
|
54
|
-
:Cell => info,
|
55
|
-
:Column => info,
|
56
|
-
:Scrollable => debug,
|
57
|
-
:AnsiEscapedText => debug,
|
58
|
-
|
59
|
-
# And ignore the remainder, too.
|
60
|
-
}
|
61
|
-
|
62
|
-
#eof
|
data/lib/logging.rb
DELETED
@@ -1,195 +0,0 @@
|
|
1
|
-
#encoding: UTF-8
|
2
|
-
=begin
|
3
|
-
/***************************************************************************
|
4
|
-
* ©2011-2016 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 GNU General Public License as published by *
|
8
|
-
* the Free Software Foundation; either version 3 of the License, or *
|
9
|
-
* (at your option) any later version. *
|
10
|
-
* *
|
11
|
-
* This program is distributed in the hope that it will be useful, *
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
14
|
-
* GNU General Public License for more details. *
|
15
|
-
* *
|
16
|
-
* You should have received a copy of the GNU General Public License *
|
17
|
-
* along with this program; if not, write to the *
|
18
|
-
* Free Software Foundation, Inc., *
|
19
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
20
|
-
***************************************************************************/
|
21
|
-
=end
|
22
|
-
require 'logger'
|
23
|
-
require_relative 'file_checking'
|
24
|
-
|
25
|
-
$DEBUG = :DEBUG
|
26
|
-
|
27
|
-
=begin Creates a member @log and precede its output with the name of the class
|
28
|
-
of the object.
|
29
|
-
Example for a class-level logger:
|
30
|
-
# --------------------
|
31
|
-
class TClass
|
32
|
-
self.extend(Logging)
|
33
|
-
@@log = init_logger(STDOUT)
|
34
|
-
def test_log
|
35
|
-
@@log.info('class-level logger called from instance: ' << @@log.to_s)
|
36
|
-
@log = @@log
|
37
|
-
@log.info('AGAIN: class-level logger called from instance: ' << @log.to_s)
|
38
|
-
end
|
39
|
-
def self::test_log
|
40
|
-
@log.info('class-level logger called from class: ' << @log.to_s)
|
41
|
-
@@log.info('AGAIN: class-level logger called from class: ' << @@log.to_s)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
#---------------------
|
45
|
-
Example for a object-level logger:
|
46
|
-
ATTN! This means 1 logger per object.
|
47
|
-
# --------------------
|
48
|
-
class TClass
|
49
|
-
include Logging
|
50
|
-
def initialize
|
51
|
-
init_logger(STDOUT, Logger::DEBUG)
|
52
|
-
end
|
53
|
-
def test_log
|
54
|
-
@log.debug('called test_log() ')
|
55
|
-
end
|
56
|
-
end
|
57
|
-
=end
|
58
|
-
module Logging
|
59
|
-
include File_Checking
|
60
|
-
|
61
|
-
@@have_log = false
|
62
|
-
@@LOG_CONF = File.dirname(File.absolute_path(__FILE__)) << File::Separator << 'log.conf'
|
63
|
-
|
64
|
-
# Call this method in an instance-method (e.g. initialize() ) to define the
|
65
|
-
# object-level logger; i.e. an object-specific member @log.
|
66
|
-
# Call this method within the class-definition for a class-level logger; i.e.
|
67
|
-
# a member @log for class-level acces.
|
68
|
-
# The method returns the logger, so you can actually do what you want with it.
|
69
|
-
def init_logger(target = STDOUT, level = Logger::INFO)
|
70
|
-
# Prepare for a class-level logger. This is actually quite cool.
|
71
|
-
|
72
|
-
# ---> Ingeniuous code starts here
|
73
|
-
cn = (self.class == Class ? name : self.class.name)
|
74
|
-
# <--- Ingeniuous code ends here
|
75
|
-
|
76
|
-
# allow to override the set log-levels with an
|
77
|
-
# external configuration (log.conf).
|
78
|
-
log_conf(cn)
|
79
|
-
# Or use the defaults as set here or elsewhere...
|
80
|
-
|
81
|
-
@level ||= level
|
82
|
-
@target ||= target
|
83
|
-
|
84
|
-
@log = Logger.new(@target)
|
85
|
-
@log.level = @level
|
86
|
-
|
87
|
-
@log.formatter = proc do |severity, datetime, progname, msg|
|
88
|
-
t = Time.now
|
89
|
-
"#{cn}: #{severity} #{t.hour}-#{t.min}-#{t.sec}: #{msg}\n"
|
90
|
-
end
|
91
|
-
if ! @@have_log
|
92
|
-
@log.debug cn.dup << ' reading logging-configuration from ' << @@LOG_CONF
|
93
|
-
@@have_log = true
|
94
|
-
@log.debug('level is ' << level.to_s)
|
95
|
-
end
|
96
|
-
return @log
|
97
|
-
end
|
98
|
-
|
99
|
-
# Set the log-target to an IO object.
|
100
|
-
def log_target=(target)
|
101
|
-
@target = target
|
102
|
-
@log = Logger.new(@@target)
|
103
|
-
@log.level = @level
|
104
|
-
end
|
105
|
-
|
106
|
-
# set the log-level
|
107
|
-
def log_level=(level)
|
108
|
-
@level = level
|
109
|
-
@log.level = @level
|
110
|
-
end
|
111
|
-
|
112
|
-
private
|
113
|
-
|
114
|
-
# Override or set the log-level and target-device, as set in a file 'log.conf'.
|
115
|
-
# I do not like the look of this, but it works just the way I want it to.
|
116
|
-
# "HEAVANS! Isn't there a standard way to do this in Ruby, for Christ's sake?", you say.
|
117
|
-
# Heck, I don't care. <= Read that again, I say.
|
118
|
-
def log_conf(cn = nil)
|
119
|
-
config = level = target = nil
|
120
|
-
# puts 'log-config is in ' << @@LOG_CONF
|
121
|
-
if(File::exist?(@@LOG_CONF) )
|
122
|
-
begin
|
123
|
-
conf = File.read(@@LOG_CONF)
|
124
|
-
config = instance_eval(conf)
|
125
|
-
rescue Exception => ex
|
126
|
-
STDERR.puts "WARNING! Cannot evaluate the logger-configuration!" << ' ' << ex.message
|
127
|
-
STDERR.puts "Default log-levels apply."
|
128
|
-
end
|
129
|
-
else
|
130
|
-
puts "Default log-levels apply."
|
131
|
-
end
|
132
|
-
|
133
|
-
if(config && config.respond_to?(:to_hash) )
|
134
|
-
config.default = nil
|
135
|
-
if cn
|
136
|
-
config = config[cn.to_sym]
|
137
|
-
else
|
138
|
-
config = config[self.class.name.to_sym]
|
139
|
-
end
|
140
|
-
|
141
|
-
if(config )
|
142
|
-
if(config.respond_to?(:to_ary) && config.size == 2)
|
143
|
-
@level, @target = config
|
144
|
-
@target.downcase!
|
145
|
-
logdir = File.dirname(@target)
|
146
|
-
msg = file_check(logdir, :exist?, :directory?, :writable?)
|
147
|
-
if(msg)
|
148
|
-
STDERR.puts "WARNING! A logfile for '%s' cannot be written to %s (%s)!" %[self.class.name, logdir, msg]
|
149
|
-
@target = nil
|
150
|
-
end
|
151
|
-
else
|
152
|
-
@level = config
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
######### test
|
160
|
-
if __FILE__ == $0
|
161
|
-
class TClass
|
162
|
-
# class level ---->
|
163
|
-
self.extend(Logging)
|
164
|
-
@@log = init_logger(STDOUT, Logger::INFO)
|
165
|
-
# <------
|
166
|
-
# object-level ---->
|
167
|
-
include Logging
|
168
|
-
# <---------
|
169
|
-
|
170
|
-
def test_log
|
171
|
-
@@log.info('class-level logger called from instance: ' << @@log.to_s)
|
172
|
-
#@log = @@log # works too
|
173
|
-
@log = TClass.class_eval{@log}
|
174
|
-
@log.info('AGAIN: class-level logger called from instance: ' << @log.to_s)
|
175
|
-
@log.debug("you won't see this on log-level INFO")
|
176
|
-
|
177
|
-
# object-level ---->
|
178
|
-
init_logger
|
179
|
-
# <-----------
|
180
|
-
@log.info("That's a different thing: " << @log.to_s << " - object-level logger!")
|
181
|
-
|
182
|
-
end
|
183
|
-
def self::test_log
|
184
|
-
@log.info('class-level logger called from class: ' << @log.to_s)
|
185
|
-
@@log.info('AGAIN: class-level logger called from class: ' << @log.to_s)
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
TClass.new.test_log # class-logger + 1st object-logger
|
190
|
-
TClass.new.test_log # same class-logger + 2nd object-logger
|
191
|
-
|
192
|
-
TClass::test_log # same class-logger
|
193
|
-
puts 'And just say it once clearly: THIS IS COOOL!!'
|
194
|
-
end
|
195
|
-
#EOF
|