cmess 0.0.4.157 → 0.0.5.182
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.
- data/ChangeLog +9 -0
- data/README +1 -1
- data/bin/cinderella +7 -1
- data/bin/decode_entities +7 -1
- data/bin/guess_encoding +26 -21
- data/lib/cmess/version.rb +1 -1
- metadata +7 -7
data/ChangeLog
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
= Revision history for cmess
|
2
2
|
|
3
|
+
== 0.0.5 [2008-01-21]
|
4
|
+
|
5
|
+
* Made automatic guessing the default for guess_encoding
|
6
|
+
* Allow to specify input file as argument
|
7
|
+
|
8
|
+
== 0.0.4 [2007-12-18]
|
9
|
+
|
10
|
+
* Added BOM detection
|
11
|
+
|
3
12
|
== 0.0.3 [2007-12-12]
|
4
13
|
|
5
14
|
* Added automatic encoding detection to GuessEncoding. Idea and original
|
data/README
CHANGED
data/bin/cinderella
CHANGED
@@ -56,13 +56,14 @@ options = {
|
|
56
56
|
}
|
57
57
|
|
58
58
|
OptionParser.new(nil, 40) { |opts|
|
59
|
-
opts.banner = "Usage: #{$0} [options]"
|
59
|
+
opts.banner = "Usage: #{$0} [options] [FILE]"
|
60
60
|
|
61
61
|
opts.separator ''
|
62
62
|
opts.separator 'Options:'
|
63
63
|
|
64
64
|
opts.on('-i', '--input FILE', "Input file to read from [Default: STDIN]") { |f|
|
65
65
|
options[:input] = open_file_or_std(f)
|
66
|
+
options[:input_set] = true
|
66
67
|
}
|
67
68
|
|
68
69
|
opts.separator ''
|
@@ -88,6 +89,7 @@ OptionParser.new(nil, 40) { |opts|
|
|
88
89
|
|
89
90
|
opts.on('-I', '--in-place FILE', "Modify file in-place; sets '-i' and '-o'", "(Only really useful in combination with", "the '-r' option)") { |f|
|
90
91
|
options[:input], options[:output] = open_file_in_place(f)
|
92
|
+
options[:input_set] = true
|
91
93
|
|
92
94
|
options[:pot] = options[:output]
|
93
95
|
options[:crop] = options[:output]
|
@@ -175,6 +177,10 @@ char_file = options[:csets].inject(nil) { |path, cset|
|
|
175
177
|
abort "Char file not found for target encoding: #{options[:target_encoding]}" \
|
176
178
|
unless char_file
|
177
179
|
|
180
|
+
if ARGV[0] && !options[:input_set]
|
181
|
+
options[:input] = open_file_or_std(ARGV[0])
|
182
|
+
end
|
183
|
+
|
178
184
|
CMess::Cinderella.pick(
|
179
185
|
options[:input],
|
180
186
|
options[:pot],
|
data/bin/decode_entities
CHANGED
@@ -49,13 +49,14 @@ options = {
|
|
49
49
|
}
|
50
50
|
|
51
51
|
OptionParser.new { |opts|
|
52
|
-
opts.banner = "Usage: #{$0} [options]"
|
52
|
+
opts.banner = "Usage: #{$0} [options] [FILE]"
|
53
53
|
|
54
54
|
opts.separator ''
|
55
55
|
opts.separator 'Options:'
|
56
56
|
|
57
57
|
opts.on('-i', '--input FILE', "Input file to read from [Default: STDIN]") { |f|
|
58
58
|
options[:input] = open_file_or_std(f)
|
59
|
+
options[:input_set] = true
|
59
60
|
}
|
60
61
|
|
61
62
|
opts.on('-o', '--output FILE', "Output file to write to [Default: STDOUT]") { |f|
|
@@ -64,6 +65,7 @@ OptionParser.new { |opts|
|
|
64
65
|
|
65
66
|
opts.on('-I', '--in-place FILE', "Modify file in-place; sets '-i' and '-o'") { |f|
|
66
67
|
options[:input], options[:output] = open_file_in_place(f)
|
68
|
+
options[:input_set] = true
|
67
69
|
}
|
68
70
|
|
69
71
|
opts.separator ''
|
@@ -93,6 +95,10 @@ OptionParser.new { |opts|
|
|
93
95
|
opts.separator "When FILE is -, either STDIN or STDOUT is used (as appropriate)."
|
94
96
|
}.parse!
|
95
97
|
|
98
|
+
if ARGV[0] && !options[:input_set]
|
99
|
+
options[:input] = open_file_or_std(ARGV[0])
|
100
|
+
end
|
101
|
+
|
96
102
|
CMess::DecodeEntities.decode(
|
97
103
|
options[:input],
|
98
104
|
options[:output],
|
data/bin/guess_encoding
CHANGED
@@ -56,25 +56,44 @@ options = {
|
|
56
56
|
:encodings => nil,
|
57
57
|
:additional_encodings => [],
|
58
58
|
:target_encoding => determine_system_encoding,
|
59
|
-
:
|
59
|
+
:manual => false,
|
60
60
|
:chunk_size => nil,
|
61
61
|
:ignore_bom => false
|
62
62
|
}
|
63
63
|
|
64
64
|
OptionParser.new(nil, 40) { |opts|
|
65
|
-
opts.banner = "Usage: #{$0} [options]"
|
65
|
+
opts.banner = "Usage: #{$0} [options] [FILE]"
|
66
66
|
|
67
67
|
opts.separator ''
|
68
68
|
opts.separator 'Options:'
|
69
69
|
|
70
70
|
opts.on('-i', '--input FILE', "Input file to read from [Default: STDIN]") { |f|
|
71
71
|
options[:input] = open_file_or_std(f)
|
72
|
+
options[:input_set] = true
|
73
|
+
}
|
74
|
+
|
75
|
+
opts.separator ''
|
76
|
+
opts.separator ' * Automatic guessing'
|
77
|
+
opts.separator ''
|
78
|
+
|
79
|
+
opts.on('-c', '--chunk-size SIZE', Integer, "Size of chunks input will be read in until a valid encoding", "has been found; by default the whole file will be read") { |s|
|
80
|
+
options[:chunk_size] = s
|
81
|
+
}
|
82
|
+
|
83
|
+
opts.separator ''
|
84
|
+
|
85
|
+
opts.on('-b', '--ignore-bom', "Ignore detected BOM (if any)", "(see below for a list of supported encodings)") {
|
86
|
+
options[:ignore_bom] = true
|
72
87
|
}
|
73
88
|
|
74
89
|
opts.separator ''
|
75
90
|
opts.separator ' * Manual guessing'
|
76
91
|
opts.separator ''
|
77
92
|
|
93
|
+
opts.on('-m', '--manual', "Present variously encoded input for manual encoding guessing") {
|
94
|
+
options[:manual] = true
|
95
|
+
}
|
96
|
+
|
78
97
|
opts.on('-l', '--line LINE', "Line number of input file to use for testing [Default: #{options[:line]}]") { |l|
|
79
98
|
options[:line] = l.to_i
|
80
99
|
|
@@ -101,24 +120,6 @@ OptionParser.new(nil, 40) { |opts|
|
|
101
120
|
options[:target_encoding] = e
|
102
121
|
}
|
103
122
|
|
104
|
-
opts.separator ''
|
105
|
-
opts.separator ' * Automatic guessing'
|
106
|
-
opts.separator ''
|
107
|
-
|
108
|
-
opts.on('-g', '--guess', "Actually guess the encoding of the input, automatically!", "(see below for a list of supported encodings)") {
|
109
|
-
options[:guess] = true
|
110
|
-
}
|
111
|
-
|
112
|
-
opts.on('-c', '--chunk-size SIZE', Integer, "Size of chunks input will be read in until a valid encoding", "has been found; by default the whole file will be read") { |s|
|
113
|
-
options[:chunk_size] = s
|
114
|
-
}
|
115
|
-
|
116
|
-
opts.separator ''
|
117
|
-
|
118
|
-
opts.on('-b', '--ignore-bom', "Ignore detected BOM (if any)", "(see below for a list of supported encodings)") {
|
119
|
-
options[:ignore_bom] = true
|
120
|
-
}
|
121
|
-
|
122
123
|
opts.separator ''
|
123
124
|
opts.separator 'Generic options:'
|
124
125
|
|
@@ -160,7 +161,11 @@ OptionParser.new(nil, 40) { |opts|
|
|
160
161
|
opts.separator "When FILE is -, STDIN is used."
|
161
162
|
}.parse!
|
162
163
|
|
163
|
-
if options[:
|
164
|
+
if ARGV[0] && !options[:input_set]
|
165
|
+
options[:input] = open_file_or_std(ARGV[0])
|
166
|
+
end
|
167
|
+
|
168
|
+
unless options[:manual]
|
164
169
|
puts CGE::Automatic.guess(options[:input], options[:chunk_size], options[:ignore_bom])
|
165
170
|
else
|
166
171
|
options[:target_encoding].call if options[:target_encoding].respond_to?(:call)
|
data/lib/cmess/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmess
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5.182
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-01-
|
12
|
+
date: 2008-01-21 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -86,14 +86,14 @@ homepage: http://prometheus.rubyforge.org/cmess
|
|
86
86
|
post_install_message:
|
87
87
|
rdoc_options:
|
88
88
|
- --all
|
89
|
-
- --inline-source
|
90
|
-
- --charset
|
91
|
-
- UTF-8
|
92
|
-
- --main
|
93
|
-
- README
|
94
89
|
- --title
|
95
90
|
- cmess Application documentation
|
96
91
|
- --line-numbers
|
92
|
+
- --main
|
93
|
+
- README
|
94
|
+
- --inline-source
|
95
|
+
- --charset
|
96
|
+
- UTF-8
|
97
97
|
require_paths:
|
98
98
|
- lib
|
99
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|