aef-linebreak 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING.txt +674 -0
- data/History.txt +68 -0
- data/Manifest.txt +24 -0
- data/README.rdoc +232 -0
- data/Rakefile +21 -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 +125 -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,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aef-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
|
+
date: 2009-08-21 00:00:00 -07:00
|
13
|
+
default_executable: linebreak
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: user-choices
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: popen4
|
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: hoe
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.3.2
|
54
|
+
version:
|
55
|
+
description: Linebreak is a Ruby library and commandline tool for conversion of text between linebreak encoding formats of unix, windows or mac.
|
56
|
+
email:
|
57
|
+
- aef@raxys.net
|
58
|
+
executables:
|
59
|
+
- linebreak
|
60
|
+
extensions: []
|
61
|
+
|
62
|
+
extra_rdoc_files:
|
63
|
+
- History.txt
|
64
|
+
- Manifest.txt
|
65
|
+
- COPYING.txt
|
66
|
+
- README.rdoc
|
67
|
+
files:
|
68
|
+
- History.txt
|
69
|
+
- Manifest.txt
|
70
|
+
- README.rdoc
|
71
|
+
- COPYING.txt
|
72
|
+
- Rakefile
|
73
|
+
- bin/linebreak
|
74
|
+
- lib/aef/linebreak.rb
|
75
|
+
- lib/aef/linebreak/string_extension.rb
|
76
|
+
- lib/aef/linebreak/commands/encode.rb
|
77
|
+
- lib/aef/linebreak/commands/encodings.rb
|
78
|
+
- lib/aef/linebreak/commands/version.rb
|
79
|
+
- lib/aef/linebreak/pathname_conversion.rb
|
80
|
+
- lib/aef/linebreak/linebreak.rb
|
81
|
+
- lib/aef.rb
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
- spec/linebreak_spec.rb
|
84
|
+
- spec/spec.opts
|
85
|
+
- spec/fixtures/unix.txt
|
86
|
+
- spec/fixtures/windows.txt
|
87
|
+
- spec/fixtures/mac.txt
|
88
|
+
- spec/fixtures/unix_windows.txt
|
89
|
+
- spec/fixtures/windows_mac.txt
|
90
|
+
- spec/fixtures/mac_unix.txt
|
91
|
+
- spec/fixtures/unix_windows_mac.txt
|
92
|
+
has_rdoc: false
|
93
|
+
homepage: https://rubyforge.org/projects/aef/
|
94
|
+
licenses:
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options:
|
97
|
+
- --main
|
98
|
+
- README.rdoc
|
99
|
+
- --inline-source
|
100
|
+
- --line-numbers
|
101
|
+
- --title
|
102
|
+
- Linebreak
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: "0"
|
110
|
+
version:
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: "0"
|
116
|
+
version:
|
117
|
+
requirements: []
|
118
|
+
|
119
|
+
rubyforge_project: linebreak
|
120
|
+
rubygems_version: 1.3.5
|
121
|
+
signing_key:
|
122
|
+
specification_version: 3
|
123
|
+
summary: Linebreak is a Ruby library and commandline tool for conversion of text between linebreak encoding formats of unix, windows or mac.
|
124
|
+
test_files: []
|
125
|
+
|