flnews_post_proc 1.97 → 1.98

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa27f161228cc732f5616aab7fe09004e3eb958825f329e892af4b9cb625aa59
4
- data.tar.gz: 9dbc236a29cf369bf2e85cede9adfc21b850a7daea91e6a31e082cff92df5a9c
3
+ metadata.gz: 4e56d2153a9d754fc2ff8a7b9f43fe9566de3f5df2283ec76336818cd09bd111
4
+ data.tar.gz: 346b04782bd2247b58740c137e96c29babce1a62d230fced1b38b4face651c20
5
5
  SHA512:
6
- metadata.gz: 141e00ebc889f91459be6c1ae3f774d320d0355f09c7e2a80be8a3a3cb7ac0c4ead09e20ae88e2e14dd5d6cccb3a87f26ee32e1569f74edfa9d43df261f58f8f
7
- data.tar.gz: 4c9977e764575200f0bb33216bfc0648c91f43c1e43f83e12168a8160f9f24a05b4c53c324030209b1e34a1d74cbbb617cbe0d026d8f05208cf1464a8a09d184
6
+ metadata.gz: fca2d991e5a84a4e339056ab6dd9e702dbe6183044d08f232a517cf3704a9b238b0698cad62e0fcc2a2c4175b36b1b59a506afee0b01ac1defc68ee6d60ed501
7
+ data.tar.gz: be0d63a0297cfc746ef4d4528feaf8b684310809b82bf3300e1eee167d0229d84b835ed5b155d5808f5e49289eae5739fda421b6f154efc81ea0ff58de01f2fc
data/changelog.txt ADDED
@@ -0,0 +1,5 @@
1
+ v 1.98
2
+ *) New change log (this file)
3
+ *) In the configuration file, log levels can be in upper case.
4
+ v 1.97
5
+ *) Custom headers are RFC 2047 encoded, if need be.
data/lib/basic_logging.rb CHANGED
@@ -48,7 +48,7 @@ module BasicLogging
48
48
 
49
49
  # set the log level
50
50
  def set_level(lv)
51
- if lv.respond_to?(:to_str) && Levels.keys.include?(lv.strip.to_sym)
51
+ if lv.respond_to?(:to_str) && Levels.keys.include?(lv.downcase.strip.to_sym)
52
52
  lv = Levels[lv.to_sym]
53
53
  elsif lv.respond_to?(:to_sym) && Levels.keys.include?(lv)
54
54
  lv = Levels[lv]
data/lib/body.rb CHANGED
@@ -48,7 +48,6 @@ class String
48
48
  end
49
49
  self.replace( out.join("\r\n"))
50
50
  end
51
-
52
51
  end
53
52
 
54
53
  # An object of this class represents the body of a news-article.
data/lib/version.rb CHANGED
@@ -14,8 +14,8 @@
14
14
  =end
15
15
 
16
16
  PROGNAME = 'flnews_post_proc'
17
- PROGVERSION = "1.97"
17
+ PROGVERSION = "1.98"
18
18
  AUTHORS = "Michael Uplawski"
19
19
  EMAIL = "michael.uplawski@uplawski.eu"
20
20
  YEARS = "2023 - 2026"
21
- SUMMARY = "Custom headers are rfc2047 encoded, if need be"
21
+ SUMMARY = "Modify news posts, before flnews sends them."
data/lib/whiptail_dlg CHANGED
@@ -44,10 +44,10 @@ okcancel=$?
44
44
  read -ra opts <<< $result
45
45
 
46
46
  # comment out -------->
47
- echo "cancel/ok ? $okcancel"
48
- echo $result
49
- echo "${opts[@]}"
50
- echo "${#opts[@]}"
47
+ #echo "cancel/ok ? $okcancel"
48
+ #echo $result
49
+ #echo "${opts[@]}"
50
+ #echo "${#opts[@]}"
51
51
  # <--------
52
52
 
53
53
  # Find deselected options which shall be written to the outfile.
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flnews_post_proc
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.97'
4
+ version: '1.98'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Uplawski
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-06-21 00:00:00.000000000 Z
10
+ date: 2026-06-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: diffy
@@ -58,6 +58,7 @@ extra_rdoc_files: []
58
58
  files:
59
59
  - README.md
60
60
  - bin/flnews_post_proc
61
+ - changelog.txt
61
62
  - doc/fr/html/flnews_post_proc.html
62
63
  - doc/fr/man/flnews_post_proc.1.gz
63
64
  - doc/fr/pdf/flnews_post_proc.pdf
@@ -68,7 +69,6 @@ files:
68
69
  - doc/pdf/flnews_post_proc.pdf
69
70
  - doc/rst/flnews_post_proc.rst
70
71
  - lib/_quoting_style_regexp
71
- - lib/bak_basic_logging.rb
72
72
  - lib/basic_logging.rb
73
73
  - lib/body.rb
74
74
  - lib/color_output.rb
@@ -88,6 +88,7 @@ licenses:
88
88
  metadata:
89
89
  homepage_uri: https://www.uplawski.eu/software/flnews_post_proc/
90
90
  documentation_uri: https://www.uplawski.eu/div/flnews/gem_doc/html/flnews_post_proc.html
91
+ changelog_uri: https://www.uplawski.eu/div/flnews/gem_doc/changelog.txt
91
92
  rdoc_options: []
92
93
  require_paths:
93
94
  - lib
@@ -102,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
103
  - !ruby/object:Gem::Version
103
104
  version: '0'
104
105
  requirements: []
105
- rubygems_version: 4.0.13
106
+ rubygems_version: 4.0.14
106
107
  specification_version: 4
107
- summary: Custom headers are rfc2047 encoded, if need be
108
+ summary: Modify news posts, before flnews sends them.
108
109
  test_files: []
@@ -1,202 +0,0 @@
1
- #!/bin/env ruby
2
- #encoding: UTF-8
3
- =begin
4
- /***************************************************************************
5
- * 2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
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
- #
18
- # Simplified logging.
19
- # See example code at the bottom of this file.
20
- # Execute this file to see the output.
21
- module BasicLogging
22
-
23
- DEBUG = 0
24
- INFO = 1
25
- WARN = 2
26
- ERROR = 3
27
- FATAL = 4
28
- UNKNOWN = nil
29
-
30
- # this is mainly for the translation of method calls into log levels
31
- Levels = {:debug => DEBUG, :info => INFO, :warn => WARN, :error => ERROR,
32
- :fatal => FATAL, :unknown => UNKNOWN}
33
-
34
- @@log_level = UNKNOWN
35
- @@target = STDOUT
36
- @@muted = []
37
-
38
- # do not log, if caller is obj (class or instance)
39
- def self.mute(obj)
40
- name = obj.class == Class ? obj.name.dup : obj.class.name
41
- @@muted << name
42
- end
43
-
44
- # return true if obj is muted and will not log.
45
- def self.is_muted?(obj)
46
- name = obj.class == Class ? obj.name.dup : obj.class.name
47
- @@muted.include?(name)
48
- end
49
-
50
- # set the log level
51
- def set_level(lv)
52
- if lv.respond_to?(:to_str) && Levels.keys.include?(lv.strip.to_sym)
53
- lv = Levels[lv.to_sym]
54
- elsif lv.respond_to?(:to_sym) && Levels.keys.include?(lv)
55
- lv = Levels[lv]
56
- end
57
-
58
- if(!lv || (lv.respond_to?(:to_int) && lv >= DEBUG && lv <= FATAL) )
59
- @@log_level = lv
60
- else
61
- msg = __FILE__.dup << ": ERROR : invalid log level \"" << lv.to_s << "\""
62
- msg << "\n" << "Keepinng old log level " << Levels.keys.detect {| k| Levels[k] == @@log_level}.to_s
63
- STDERR.puts msg
64
- puts msg
65
- end
66
- end
67
-
68
- # set the log target
69
- def set_target(tg)
70
- if tg.respond_to?(:to_io)
71
- @@target = tg
72
- elsif(!File::exist?(tg) || ( File.file?(tg) && File.writable?(tg) ) )
73
- @@target = File.open(tg, 'w+')
74
- elsif !tg || tg.respond_to?(:to_str) && tg.strip.empty?
75
- @@target = nil
76
- else
77
- STDERR.puts __FILE__.dup << ': ERROR : target ' << tg << ' cannot be set'
78
- STDERR.puts "Keeping old target " << @@target.inspect
79
- return
80
- end
81
- end
82
-
83
- # Output log messages, depending on the log level set for the calling class
84
- # and the name of the alias method which is actually called.
85
- def log(message)
86
- if !BasicLogging.is_muted?(self)
87
- # how has this method been called?
88
- mlevel = __callee__
89
- if Levels.has_key?(mlevel) && Levels[mlevel] <= FATAL
90
- # output only for levels equal or above the value that corresponds to
91
- # the calling alias.
92
- format_log( message, mlevel) if @@log_level && Levels[mlevel] >= @@log_level
93
- else
94
- STDERR.puts __FILE__.dup << ": ERROR : invalid log level \"" << mlevel.to_s << "\""
95
- end
96
- end
97
- end
98
-
99
- def target
100
- @@target.path if @@target
101
- end
102
-
103
- def level
104
- @@level.to_s if @@level
105
- end
106
-
107
- # Clear the log (-file)
108
- def clear_log
109
- if @@target && @@target.respond_to?(:truncate)
110
- lock_target{ @@target.truncate(0) }
111
- end
112
- end
113
-
114
- alias :debug :log
115
- alias :info :log
116
- alias :warn :log
117
- alias :error :log
118
- alias :fatal :log
119
-
120
- private
121
-
122
- def lock_target(&block)
123
- begin
124
- if @@target.respond_to?(:flock)
125
- @@target.flock(File::LOCK_EX)
126
- block.call
127
- @@target.flock(File::LOCK_UN)
128
- elsif @@target.respond_to?(:to_io)
129
- block.call
130
- end
131
- rescue => ex
132
- STDERR.puts __FILE__.dup << ": ERROR : cannot lock target (" << ex.message << ")"
133
- end
134
- end
135
-
136
- # 1 format_log for all loggers.
137
- def format_log(message, mlevel)
138
- if @@target
139
- # indicate if a registered class or the registered object of a class is calling.
140
- name = self.class == Class ? self.name.dup << ' [class]' : (self.class.name == 'Object' ? 'Top Level' : self.class.name)
141
- lock_target{@@target.puts '' << name << ' ' << mlevel.to_s << ' ' << Time.now.strftime("%H:%M:%S:%6N") << ': ' << message.gsub("\n", "\n |")}
142
- end
143
- end
144
- end
145
- #---------test: execute file----------
146
- if $0 == __FILE__
147
- Array.extend(BasicLogging)
148
- Array.set_level(BasicLogging::INFO)
149
- Array.info('TEST')
150
- ar = Array.new
151
- ar.extend(BasicLogging)
152
- # --- no output :
153
- l = __LINE__
154
- ar.debug(l.next.to_s << ': debug-test 0')
155
- # output
156
- ar.set_level(BasicLogging::DEBUG)
157
- l = __LINE__
158
- ar.debug(l.next.to_s << ': debug-test 1')
159
-
160
- obj = Object.new
161
- obj.extend(BasicLogging)
162
- obj.set_level(BasicLogging::DEBUG)
163
- puts "--------debug-----------"
164
- obj.debug('debug')
165
- obj.info('info')
166
- obj.warn('warn')
167
- obj.error('error')
168
- obj.fatal('fatal')
169
- puts "--------info-----------"
170
- obj.set_level("info")
171
- obj.debug('debug')
172
- obj.info('info')
173
- obj.warn('warn')
174
- obj.error('error')
175
- obj.fatal('fatal')
176
- puts "--------fatal-----------"
177
- obj.set_level("fatal")
178
- obj.debug('debug')
179
- obj.info('info')
180
- obj.warn('warn')
181
- obj.error('error')
182
- obj.fatal('fatal')
183
- puts "--------UNKNOWN-----------"
184
- obj.set_level(nil)
185
- obj.debug('debug')
186
- obj.info('info')
187
- obj.warn('warn')
188
- obj.error('error')
189
- obj.fatal('fatal')
190
- puts " ------ Output into file ----"
191
- obj.set_target "/tmp/test_log.log"
192
- puts " ------ INFO -----------"
193
- obj.set_level BasicLogging::INFO
194
- obj.info('info output')
195
-
196
- obj.info('info output 2')
197
- puts "---------- invalid -------"
198
- obj.set_target "/dev/sr0"
199
- obj.set_level "power"
200
- end
201
-
202
- # EOF