-
Notifications
You must be signed in to change notification settings - Fork 11
/
Rakefile
56 lines (46 loc) · 1.5 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
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
require_relative 'lib/cmess/version'
begin
require 'hen'
Hen.lay! {{
gem: {
name: %q{cmess},
version: CMess::VERSION,
summary: <<-EOT,
Assist with handling messed up encodings (Currently includes the
following tools: #{Dir['bin/*'].map { |e| File.basename(e) }.sort.join(', ')})
EOT
author: %q{Jens Wille},
email: %q{jens.wille@gmail.com},
license: %q{AGPL-3.0},
homepage: :blackwinter,
extra_files: FileList['data/**/*'].to_a,
dependencies: {
htmlentities: '~> 4.3',
nuggets: '~> 1.5',
safe_yaml: '~> 1.0'
},
required_ruby_version: '>= 1.9.3'
}
}}
rescue LoadError => err
warn "Please install the `hen' gem. (#{err})"
end
namespace :guess_encoding do
desc 'Compare actual encoding and automatic guess of example files'
task :check_examples do
require_relative 'lib/cmess'
require_relative 'lib/cmess/guess_encoding'
e = CMess::GuessEncoding::Encoding
Dir[File.expand_path('../example/guess_encoding/??.*.txt', __FILE__)].sort.each { |example|
language, encoding = File.basename(example, '.txt').split('.')
encoding.upcase!
result = CMess::GuessEncoding::Automatic.guess(File.open(example))
puts '%s %s/%-11s => %s' % [case result
when e::UNKNOWN then '?'
when e::ASCII then '#'
when encoding then '+'
else '-'
end, language, encoding, result]
}
end
end