textutils 0.9.10 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Manifest.txt +0 -3
- data/Rakefile +4 -4
- data/lib/textutils/version.rb +3 -2
- data/lib/textutils.rb +9 -15
- data/test/helper.rb +0 -5
- metadata +53 -40
- data/lib/textutils/reader/hash_reader_v2.rb +0 -61
- data/lib/textutils/reader/line_reader_v2.rb +0 -47
- data/lib/textutils/reader/values_reader_v2.rb +0 -49
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 68baf8d24b589a21d4394a6b18760b349e93d13d
|
4
|
+
data.tar.gz: d8c9a466924b62c4ffa53b88641f7a3e81844ef3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 66214b48ee18a369ccef2b369702aa481350ce58eb8f3174fee473fa642c15238af5cad0a5e0e53250bdd7ffc78dfff06e62e3e738e24fa3178a1f8fbda6a751
|
7
|
+
data.tar.gz: 4e590abefa048fbc971391bd65681dc230a254caacb7b728daded53bb756192e6e43aec34432e8c7beb319a1ebab4d9b4128299fea264594926ed668b05ff9db
|
data/Manifest.txt
CHANGED
@@ -25,11 +25,8 @@ lib/textutils/patterns.rb
|
|
25
25
|
lib/textutils/reader/code_reader.rb
|
26
26
|
lib/textutils/reader/fixture_reader.rb
|
27
27
|
lib/textutils/reader/hash_reader.rb
|
28
|
-
lib/textutils/reader/hash_reader_v2.rb
|
29
28
|
lib/textutils/reader/line_reader.rb
|
30
|
-
lib/textutils/reader/line_reader_v2.rb
|
31
29
|
lib/textutils/reader/values_reader.rb
|
32
|
-
lib/textutils/reader/values_reader_v2.rb
|
33
30
|
lib/textutils/sanitizier.rb
|
34
31
|
lib/textutils/title.rb
|
35
32
|
lib/textutils/title_mapper.rb
|
data/Rakefile
CHANGED
@@ -18,17 +18,17 @@ Hoe.spec 'textutils' do
|
|
18
18
|
self.history_file = 'HISTORY.md'
|
19
19
|
|
20
20
|
self.extra_deps = [
|
21
|
-
['props'],
|
22
|
-
['logutils'],
|
21
|
+
['props', '>=1.1.2'],
|
22
|
+
['logutils', '>=0.6.1'],
|
23
23
|
### 3rd party gems
|
24
24
|
['rubyzip'], ## todo/check: make optional -why? why not??
|
25
|
-
['activesupport']
|
25
|
+
['activesupport'] ## todo/check: really needed? document what methods get used
|
26
26
|
]
|
27
27
|
|
28
28
|
self.licenses = ['Public Domain']
|
29
29
|
|
30
30
|
self.spec_extras = {
|
31
|
-
|
31
|
+
required_ruby_version: '>= 1.9.2'
|
32
32
|
}
|
33
33
|
|
34
34
|
end
|
data/lib/textutils/version.rb
CHANGED
data/lib/textutils.rb
CHANGED
@@ -1,32 +1,29 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
4
3
|
# core and stlibs
|
5
4
|
|
5
|
+
require 'json'
|
6
6
|
require 'yaml'
|
7
|
+
require 'erb'
|
7
8
|
require 'pp'
|
8
|
-
require 'logger'
|
9
|
-
require 'optparse'
|
10
9
|
require 'fileutils'
|
11
|
-
require 'erb'
|
12
|
-
|
13
|
-
# 3rd party gems / libs
|
14
10
|
|
15
|
-
require 'zip'
|
16
11
|
|
12
|
+
# 3rd party gems / libs
|
13
|
+
require 'zip' ### used for .from_zip for readers
|
17
14
|
|
18
|
-
|
15
|
+
### todo/check - document active_support methods that get used
|
19
16
|
require 'active_support/all' # String.starts_with?, Object.blank?, etc.
|
20
17
|
|
18
|
+
|
21
19
|
require 'props'
|
22
|
-
require 'props/db' ## for Prop model --> move create_from fixtures to textutils!!
|
23
20
|
require 'logutils'
|
24
21
|
|
22
|
+
|
25
23
|
# our own code
|
26
24
|
|
27
25
|
require 'textutils/version' ## let version always go first
|
28
26
|
|
29
|
-
|
30
27
|
require 'textutils/patterns' # regex patterns for reuse
|
31
28
|
require 'textutils/sanitizier'
|
32
29
|
|
@@ -54,11 +51,8 @@ require 'textutils/parser/name_parser'
|
|
54
51
|
|
55
52
|
require 'textutils/reader/code_reader'
|
56
53
|
require 'textutils/reader/hash_reader'
|
57
|
-
require 'textutils/reader/hash_reader_v2'
|
58
54
|
require 'textutils/reader/line_reader'
|
59
|
-
require 'textutils/reader/line_reader_v2'
|
60
55
|
require 'textutils/reader/values_reader'
|
61
|
-
require 'textutils/reader/values_reader_v2'
|
62
56
|
require 'textutils/reader/fixture_reader'
|
63
57
|
|
64
58
|
require 'textutils/classifier'
|
@@ -69,5 +63,5 @@ require 'textutils/page' # for book pages and page templates
|
|
69
63
|
|
70
64
|
|
71
65
|
|
72
|
-
|
73
|
-
puts TextUtils.banner if $DEBUG
|
66
|
+
# say hello
|
67
|
+
puts TextUtils.banner if $DEBUG || (defined?($RUBYLIBS_DEBUG) && $RUBYLIBS_DEBUG)
|
data/test/helper.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
## minitest setup
|
5
5
|
|
6
|
-
# require 'minitest/unit'
|
7
6
|
require 'minitest/autorun'
|
8
7
|
|
9
8
|
|
@@ -12,10 +11,6 @@ require 'minitest/autorun'
|
|
12
11
|
# require 'active_support/all' # -- now included in textutils itself
|
13
12
|
|
14
13
|
|
15
|
-
### note: do avoid version conflict require prop n prop/db first
|
16
|
-
require 'props'
|
17
|
-
require 'props/db'
|
18
|
-
|
19
14
|
## our own code
|
20
15
|
|
21
16
|
require 'textutils'
|
metadata
CHANGED
@@ -1,82 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.10.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Gerald Bauer
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: props
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 1.1.2
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.2
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: logutils
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
+
version: 0.6.1
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.6.1
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: rubyzip
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- -
|
45
|
+
- - ">="
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: '0'
|
44
48
|
type: :runtime
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
56
|
name: activesupport
|
49
|
-
requirement:
|
50
|
-
none: false
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - ">="
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
type: :runtime
|
56
63
|
prerelease: false
|
57
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: rdoc
|
60
|
-
requirement:
|
61
|
-
none: false
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
62
72
|
requirements:
|
63
|
-
- - ~>
|
73
|
+
- - "~>"
|
64
74
|
- !ruby/object:Gem::Version
|
65
75
|
version: '4.0'
|
66
76
|
type: :development
|
67
77
|
prerelease: false
|
68
|
-
version_requirements:
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: hoe
|
71
|
-
requirement:
|
72
|
-
none: false
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
73
86
|
requirements:
|
74
|
-
- - ~>
|
87
|
+
- - "~>"
|
75
88
|
- !ruby/object:Gem::Version
|
76
89
|
version: '3.13'
|
77
90
|
type: :development
|
78
91
|
prerelease: false
|
79
|
-
version_requirements:
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.13'
|
80
97
|
description: textutils - Text Filters, Helpers, Readers and More
|
81
98
|
email: ruby-talk@ruby-lang.org
|
82
99
|
executables: []
|
@@ -86,6 +103,7 @@ extra_rdoc_files:
|
|
86
103
|
- Manifest.txt
|
87
104
|
- README.md
|
88
105
|
files:
|
106
|
+
- ".gemtest"
|
89
107
|
- HISTORY.md
|
90
108
|
- Manifest.txt
|
91
109
|
- README.md
|
@@ -113,11 +131,8 @@ files:
|
|
113
131
|
- lib/textutils/reader/code_reader.rb
|
114
132
|
- lib/textutils/reader/fixture_reader.rb
|
115
133
|
- lib/textutils/reader/hash_reader.rb
|
116
|
-
- lib/textutils/reader/hash_reader_v2.rb
|
117
134
|
- lib/textutils/reader/line_reader.rb
|
118
|
-
- lib/textutils/reader/line_reader_v2.rb
|
119
135
|
- lib/textutils/reader/values_reader.rb
|
120
|
-
- lib/textutils/reader/values_reader_v2.rb
|
121
136
|
- lib/textutils/sanitizier.rb
|
122
137
|
- lib/textutils/title.rb
|
123
138
|
- lib/textutils/title_mapper.rb
|
@@ -136,33 +151,31 @@ files:
|
|
136
151
|
- test/test_title_mapper.rb
|
137
152
|
- test/test_unicode_helper.rb
|
138
153
|
- test/test_values_reader.rb
|
139
|
-
- .gemtest
|
140
154
|
homepage: https://github.com/rubylibs/textutils
|
141
155
|
licenses:
|
142
156
|
- Public Domain
|
157
|
+
metadata: {}
|
143
158
|
post_install_message:
|
144
159
|
rdoc_options:
|
145
|
-
- --main
|
160
|
+
- "--main"
|
146
161
|
- README.md
|
147
162
|
require_paths:
|
148
163
|
- lib
|
149
164
|
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
-
none: false
|
151
165
|
requirements:
|
152
|
-
- -
|
166
|
+
- - ">="
|
153
167
|
- !ruby/object:Gem::Version
|
154
168
|
version: 1.9.2
|
155
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
-
none: false
|
157
170
|
requirements:
|
158
|
-
- -
|
171
|
+
- - ">="
|
159
172
|
- !ruby/object:Gem::Version
|
160
173
|
version: '0'
|
161
174
|
requirements: []
|
162
175
|
rubyforge_project:
|
163
|
-
rubygems_version:
|
176
|
+
rubygems_version: 2.4.2
|
164
177
|
signing_key:
|
165
|
-
specification_version:
|
178
|
+
specification_version: 4
|
166
179
|
summary: textutils - Text Filters, Helpers, Readers and More
|
167
180
|
test_files:
|
168
181
|
- test/test_title_finder.rb
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# fix: move into TextUtils namespace/module!!
|
4
|
-
|
5
|
-
## todo/fix: find a better name than HashReaderV2 (HashReaderPlus?) ??
|
6
|
-
|
7
|
-
class HashReaderV2
|
8
|
-
include LogUtils::Logging
|
9
|
-
|
10
|
-
def initialize( name, include_path )
|
11
|
-
@name = name
|
12
|
-
@include_path = include_path
|
13
|
-
|
14
|
-
# map name to name_real_path
|
15
|
-
# name might include !/ for virtual path (gets cut off)
|
16
|
-
# e.g. at-austria!/w-wien/beers becomse w-wien/beers
|
17
|
-
|
18
|
-
pos = @name.index( '!/')
|
19
|
-
if pos.nil?
|
20
|
-
@name_real_path = @name # not found; real path is the same as name
|
21
|
-
else
|
22
|
-
# cut off everything until !/ e.g.
|
23
|
-
# at-austria!/w-wien/beers becomes
|
24
|
-
# w-wien/beers
|
25
|
-
@name_real_path = @name[ (pos+2)..-1 ]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
attr_reader :name
|
30
|
-
attr_reader :name_real_path
|
31
|
-
attr_reader :include_path
|
32
|
-
|
33
|
-
def each
|
34
|
-
path = "#{include_path}/#{name_real_path}.yml"
|
35
|
-
reader = HashReader.from_file( path )
|
36
|
-
|
37
|
-
logger.info "parsing data '#{name}' (#{path})..."
|
38
|
-
|
39
|
-
reader.each do |key, value|
|
40
|
-
yield( key, value )
|
41
|
-
end
|
42
|
-
|
43
|
-
ConfDb::Model::Prop.create_from_fixture!( name, path )
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
def each_typed
|
48
|
-
path = "#{include_path}/#{name_real_path}.yml"
|
49
|
-
reader = HashReader.from_file( path )
|
50
|
-
|
51
|
-
logger.info "parsing data '#{name}' (#{path})..."
|
52
|
-
|
53
|
-
reader.each_typed do |key, value|
|
54
|
-
yield( key, value )
|
55
|
-
end
|
56
|
-
|
57
|
-
ConfDb::Model::Prop.create_from_fixture!( name, path )
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
end # class HashReaderV2
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
|
4
|
-
# fix: move into TextUtils namespace/module!!
|
5
|
-
|
6
|
-
|
7
|
-
class LineReaderV2
|
8
|
-
include LogUtils::Logging
|
9
|
-
|
10
|
-
def initialize( name, include_path )
|
11
|
-
@name = name
|
12
|
-
@include_path = include_path
|
13
|
-
|
14
|
-
# map name to name_real_path
|
15
|
-
# name might include !/ for virtual path (gets cut off)
|
16
|
-
# e.g. at-austria!/w-wien/beers becomse w-wien/beers
|
17
|
-
|
18
|
-
pos = @name.index( '!/')
|
19
|
-
if pos.nil?
|
20
|
-
@name_real_path = @name # not found; real path is the same as name
|
21
|
-
else
|
22
|
-
# cut off everything until !/ e.g.
|
23
|
-
# at-austria!/w-wien/beers becomes
|
24
|
-
# w-wien/beers
|
25
|
-
@name_real_path = @name[ (pos+2)..-1 ]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
attr_reader :name
|
30
|
-
attr_reader :name_real_path
|
31
|
-
attr_reader :include_path
|
32
|
-
|
33
|
-
def each_line
|
34
|
-
path = "#{include_path}/#{name_real_path}.txt"
|
35
|
-
reader = LineReader.from_file( path )
|
36
|
-
|
37
|
-
logger.info "parsing data '#{name}' (#{path})..."
|
38
|
-
|
39
|
-
reader.each_line do |line|
|
40
|
-
yield( line )
|
41
|
-
end
|
42
|
-
|
43
|
-
ConfDb::Model::Prop.create_from_fixture!( name, path )
|
44
|
-
end
|
45
|
-
|
46
|
-
end # class LineReaderV2
|
47
|
-
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# fix: move into TextUtils namespace/module!!
|
4
|
-
|
5
|
-
## todo/fix: find a better name than HashReaderV2 (HashReaderPlus?) ??
|
6
|
-
|
7
|
-
class ValuesReaderV2
|
8
|
-
include LogUtils::Logging
|
9
|
-
|
10
|
-
def initialize( name, include_path, more_attribs={} )
|
11
|
-
@name = name
|
12
|
-
@include_path = include_path
|
13
|
-
@more_attribs = more_attribs
|
14
|
-
|
15
|
-
# map name to name_real_path
|
16
|
-
# name might include !/ for virtual path (gets cut off)
|
17
|
-
# e.g. at-austria!/w-wien/beers becomse w-wien/beers
|
18
|
-
|
19
|
-
pos = @name.index( '!/')
|
20
|
-
if pos.nil?
|
21
|
-
@name_real_path = @name # not found; real path is the same as name
|
22
|
-
else
|
23
|
-
# cut off everything until !/ e.g.
|
24
|
-
# at-austria!/w-wien/beers becomes
|
25
|
-
# w-wien/beers
|
26
|
-
@name_real_path = @name[ (pos+2)..-1 ]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
attr_reader :name
|
31
|
-
attr_reader :name_real_path
|
32
|
-
attr_reader :include_path
|
33
|
-
attr_reader :more_attribs
|
34
|
-
|
35
|
-
def each_line
|
36
|
-
path = "#{include_path}/#{name_real_path}.txt"
|
37
|
-
reader = ValuesReader.new( path, more_attribs )
|
38
|
-
|
39
|
-
logger.info "parsing data '#{name}' (#{path})..."
|
40
|
-
|
41
|
-
reader.each_line do |attribs, values|
|
42
|
-
yield( attribs, values )
|
43
|
-
end
|
44
|
-
|
45
|
-
ConfDb::Model::Prop.create_from_fixture!( name, path )
|
46
|
-
end
|
47
|
-
|
48
|
-
end # class ValuesReaderV2
|
49
|
-
|