linebreak 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +2 -0
- data/COPYING.txt +674 -0
- data/History.txt +68 -0
- data/Manifest.txt +24 -0
- data/README.rdoc +232 -0
- data/Rakefile +20 -0
- data/bin/linebreak +68 -0
- data/lib/aef.rb +27 -0
- data/lib/aef/linebreak.rb +18 -0
- data/lib/aef/linebreak/commands/encode.rb +73 -0
- data/lib/aef/linebreak/commands/encodings.rb +88 -0
- data/lib/aef/linebreak/commands/version.rb +38 -0
- data/lib/aef/linebreak/linebreak.rb +122 -0
- data/lib/aef/linebreak/pathname_conversion.rb +44 -0
- data/lib/aef/linebreak/string_extension.rb +24 -0
- data/spec/fixtures/mac.txt +1 -0
- data/spec/fixtures/mac_unix.txt +2 -0
- data/spec/fixtures/unix.txt +3 -0
- data/spec/fixtures/unix_windows.txt +3 -0
- data/spec/fixtures/unix_windows_mac.txt +3 -0
- data/spec/fixtures/windows.txt +3 -0
- data/spec/fixtures/windows_mac.txt +2 -0
- data/spec/linebreak_spec.rb +380 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +138 -0
- metadata +148 -0
- metadata.gz.sig +0 -0
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
# Copyright 2009 Alexander E. Fischer <aef@raxys.net>
|
2
|
+
#
|
3
|
+
# This file is part of Linebreak.
|
4
|
+
#
|
5
|
+
# Linebreak is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
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. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
require 'tempfile'
|
19
|
+
require 'rbconfig'
|
20
|
+
require 'rubygems'
|
21
|
+
require 'popen4'
|
22
|
+
|
23
|
+
require 'lib/aef/linebreak/string_extension'
|
24
|
+
|
25
|
+
module LinebreakSpecHelper
|
26
|
+
INTERPRETER = Pathname(RbConfig::CONFIG['bindir']) + RbConfig::CONFIG['ruby_install_name']
|
27
|
+
FIXTURES_DIR = Pathname('spec/fixtures')
|
28
|
+
|
29
|
+
def executable_path
|
30
|
+
"#{INTERPRETER} bin/linebreak"
|
31
|
+
end
|
32
|
+
|
33
|
+
def fixture_path(name)
|
34
|
+
FIXTURES_DIR + name
|
35
|
+
end
|
36
|
+
|
37
|
+
def windows?
|
38
|
+
RbConfig::CONFIG['target_os'].downcase.include?('win')
|
39
|
+
end
|
40
|
+
|
41
|
+
def unix_fixture
|
42
|
+
"Abcdef\nAbcdef\nAbcdef"
|
43
|
+
end
|
44
|
+
|
45
|
+
def windows_fixture
|
46
|
+
"Abcdef\r\nAbcdef\r\nAbcdef"
|
47
|
+
end
|
48
|
+
|
49
|
+
def mac_fixture
|
50
|
+
"Abcdef\rAbcdef\rAbcdef"
|
51
|
+
end
|
52
|
+
|
53
|
+
def custom_fixture
|
54
|
+
"AbcdeffnordAbcdeffnordAbcdef"
|
55
|
+
end
|
56
|
+
|
57
|
+
def none_fixture
|
58
|
+
"AbcdefAbcdefAbcdef"
|
59
|
+
end
|
60
|
+
|
61
|
+
def unix_windows_fixture
|
62
|
+
unix_fixture + windows_fixture
|
63
|
+
end
|
64
|
+
|
65
|
+
def windows_mac_fixture
|
66
|
+
windows_fixture + mac_fixture
|
67
|
+
end
|
68
|
+
|
69
|
+
def mac_unix_fixture
|
70
|
+
mac_fixture + unix_fixture
|
71
|
+
end
|
72
|
+
|
73
|
+
def unix_windows_mac_fixture
|
74
|
+
unix_fixture + windows_fixture + mac_fixture
|
75
|
+
end
|
76
|
+
|
77
|
+
def version_message
|
78
|
+
<<-EOS
|
79
|
+
Linebreak #{Aef::Linebreak::VERSION}
|
80
|
+
|
81
|
+
Project: https://rubyforge.org/projects/aef/
|
82
|
+
RDoc: http://aef.rubyforge.org/linebreak/
|
83
|
+
Github: http://github.com/aef/linebreak/
|
84
|
+
|
85
|
+
Copyright 2009 Alexander E. Fischer <aef@raxys.net>
|
86
|
+
|
87
|
+
Linebreak is free software: you can redistribute it and/or modify it under the
|
88
|
+
terms of the GNU General Public License as published by the Free Software
|
89
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
90
|
+
version.
|
91
|
+
|
92
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
93
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
94
|
+
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
95
|
+
details.
|
96
|
+
|
97
|
+
You should have received a copy of the GNU General Public License along with
|
98
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
99
|
+
EOS
|
100
|
+
end
|
101
|
+
|
102
|
+
def env(environment = {})
|
103
|
+
raise ArgumentError, 'A block needs to be given' unless block_given?
|
104
|
+
|
105
|
+
backup = {}
|
106
|
+
|
107
|
+
environment.each do |key, value|
|
108
|
+
key, value = key.to_s, value.to_s
|
109
|
+
|
110
|
+
backup[key] = ENV[key]
|
111
|
+
ENV[key] = value
|
112
|
+
end
|
113
|
+
|
114
|
+
result = yield
|
115
|
+
|
116
|
+
backup.each do |key, value|
|
117
|
+
ENV[key] = value
|
118
|
+
end
|
119
|
+
|
120
|
+
result
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.8.7')
|
125
|
+
warn %{\nThe 16 specs of the "encodings" methods fail on 1.8.6 and } +
|
126
|
+
'below because of invalid hash comparison which affects ' +
|
127
|
+
'comparison of the result Sets. This should not be a big problem.'
|
128
|
+
end
|
129
|
+
|
130
|
+
if RUBY_PLATFORM == 'java'
|
131
|
+
warn %{\nAll 6 specs of the "encodings" command fail because JRuby does } +
|
132
|
+
'not support the fork method. This should only affect the specs, the ' +
|
133
|
+
'commandline tool should still work fine.'
|
134
|
+
end
|
135
|
+
|
136
|
+
Spec::Runner.configure do |config|
|
137
|
+
config.include LinebreakSpecHelper
|
138
|
+
end
|
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: linebreak
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander E. Fischer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDKDCCAhCgAwIBAgIBADANBgkqhkiG9w0BAQUFADA6MQwwCgYDVQQDDANhZWYx
|
14
|
+
FTATBgoJkiaJk/IsZAEZFgVyYXh5czETMBEGCgmSJomT8ixkARkWA25ldDAeFw0w
|
15
|
+
OTAyMjUyMDM5MDhaFw0xMDAyMjUyMDM5MDhaMDoxDDAKBgNVBAMMA2FlZjEVMBMG
|
16
|
+
CgmSJomT8ixkARkWBXJheHlzMRMwEQYKCZImiZPyLGQBGRYDbmV0MIIBIjANBgkq
|
17
|
+
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoYtj0qad5/MpbdttITzBH0h1SNe6eO7R
|
18
|
+
7qVeqNYu6qDQAQ0rYc0JhubJCWYrZEJorHEBhUFU6cdQgQOs78wiJaDgkeU7YfXB
|
19
|
+
q2l125kJ8aHkA1ukrK2/DRzp2AHEmzxHIYpXV5/63h+NWjCP+uKvTELYsotS2MKt
|
20
|
+
3d43E0QajsPZu2ZuNFwkroqeue872gMHUldGOVy5WtSd9ajw2xI/CociY6746dL+
|
21
|
+
pYriV3QaYtR/ezeaLpKBLsc5T1UQ07t7Xs7mI281tdmRvpLdP5dQhjzInfio0CJv
|
22
|
+
1Pf5bZUjGG0K9RW2Gb/tGPSYEETiLMubjH61OwBooXKiWR5cs4/1BQIDAQABozkw
|
23
|
+
NzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUSYvjhG2EWnR5kx5l
|
24
|
+
DAewXCkJOVEwDQYJKoZIhvcNAQEFBQADggEBAB2ryDbU4bQtnunKv/AXq4CuO3LS
|
25
|
+
kik9Xhye8E/5dTcsgitCZJXAqx0rHcK0u2EHnjA5CDcdF5JB7XgSvRrQkFWoW/9K
|
26
|
+
lCB4ih+sB2AI2IUiYBeoCGctXdBQ020prqop/oTQEudzFk/gyQ686lp06HdLRt+O
|
27
|
+
HoQjTIab8vmfgIubjPdIRzokMfHbelvhLi+mQfWVghRhs2jpEfdXbL0w5nNw+trp
|
28
|
+
rO70Dw59hduDUOpgpxew+PLbs4vP1tb1QKPG+39C+PZtosbbf1fai0hqYV1txMCx
|
29
|
+
55akF+N8NbO6tpVDy6TMagqa10LfEpiQH6dvDHe/xdAqYOCrXKpmqzwu2PI=
|
30
|
+
-----END CERTIFICATE-----
|
31
|
+
|
32
|
+
date: 2009-08-21 00:00:00 +02:00
|
33
|
+
default_executable:
|
34
|
+
dependencies:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: user-choices
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: rspec
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: popen4
|
57
|
+
type: :development
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: hoe
|
67
|
+
type: :development
|
68
|
+
version_requirement:
|
69
|
+
version_requirements: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 2.3.2
|
74
|
+
version:
|
75
|
+
description: |-
|
76
|
+
Linebreak is a Ruby library and commandline tool for conversion of text
|
77
|
+
between linebreak encoding formats of unix, windows or mac.
|
78
|
+
email:
|
79
|
+
- aef@raxys.net
|
80
|
+
executables:
|
81
|
+
- linebreak
|
82
|
+
extensions: []
|
83
|
+
|
84
|
+
extra_rdoc_files:
|
85
|
+
- History.txt
|
86
|
+
- Manifest.txt
|
87
|
+
- COPYING.txt
|
88
|
+
- README.rdoc
|
89
|
+
files:
|
90
|
+
- History.txt
|
91
|
+
- Manifest.txt
|
92
|
+
- README.rdoc
|
93
|
+
- COPYING.txt
|
94
|
+
- Rakefile
|
95
|
+
- bin/linebreak
|
96
|
+
- lib/aef/linebreak.rb
|
97
|
+
- lib/aef/linebreak/string_extension.rb
|
98
|
+
- lib/aef/linebreak/commands/encode.rb
|
99
|
+
- lib/aef/linebreak/commands/encodings.rb
|
100
|
+
- lib/aef/linebreak/commands/version.rb
|
101
|
+
- lib/aef/linebreak/pathname_conversion.rb
|
102
|
+
- lib/aef/linebreak/linebreak.rb
|
103
|
+
- lib/aef.rb
|
104
|
+
- spec/spec_helper.rb
|
105
|
+
- spec/linebreak_spec.rb
|
106
|
+
- spec/spec.opts
|
107
|
+
- spec/fixtures/unix.txt
|
108
|
+
- spec/fixtures/windows.txt
|
109
|
+
- spec/fixtures/mac.txt
|
110
|
+
- spec/fixtures/unix_windows.txt
|
111
|
+
- spec/fixtures/windows_mac.txt
|
112
|
+
- spec/fixtures/mac_unix.txt
|
113
|
+
- spec/fixtures/unix_windows_mac.txt
|
114
|
+
has_rdoc: true
|
115
|
+
homepage: https://rubyforge.org/projects/aef/
|
116
|
+
licenses: []
|
117
|
+
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options:
|
120
|
+
- --main
|
121
|
+
- README.rdoc
|
122
|
+
- --inline-source
|
123
|
+
- --line-numbers
|
124
|
+
- --title
|
125
|
+
- Linebreak
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: "0"
|
133
|
+
version:
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: "0"
|
139
|
+
version:
|
140
|
+
requirements: []
|
141
|
+
|
142
|
+
rubyforge_project: linebreak
|
143
|
+
rubygems_version: 1.3.4
|
144
|
+
signing_key:
|
145
|
+
specification_version: 3
|
146
|
+
summary: Linebreak is a Ruby library and commandline tool for conversion of text between linebreak encoding formats of unix, windows or mac.
|
147
|
+
test_files: []
|
148
|
+
|
metadata.gz.sig
ADDED
Binary file
|