breakverter 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +25 -6
- data/README.txt +6 -3
- data/bin/breakverter +50 -5
- data/lib/breakverter.rb +1 -1
- data/spec/breakverter_spec.rb +6 -2
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
data/History.txt
CHANGED
@@ -1,15 +1,34 @@
|
|
1
|
+
=== 1.1.1 / 2009-03-08
|
2
|
+
|
3
|
+
* minor enhancement
|
4
|
+
|
5
|
+
* Added a --version command to output version and licensing information
|
6
|
+
* Some test refactoring
|
7
|
+
* Some more comments
|
8
|
+
|
1
9
|
=== 1.1.0 / 2009-03-01
|
2
10
|
|
3
|
-
*
|
4
|
-
|
5
|
-
* Added automated tests for the commandline tool
|
11
|
+
* 2 major enhancements
|
12
|
+
|
13
|
+
* Added automated tests for the commandline tool
|
14
|
+
* Tested compatibility with ruby 1.9.1
|
15
|
+
|
16
|
+
* 1 minor enhancement
|
17
|
+
|
18
|
+
* Added support for custom string linebreak encodings in library
|
6
19
|
|
7
20
|
=== 1.0.1 / 2009-02-24
|
8
21
|
|
9
|
-
*
|
10
|
-
|
22
|
+
* 1 minor enhancement
|
23
|
+
|
24
|
+
* Now tested on Windows XP
|
25
|
+
|
26
|
+
* 1 minor bugfix
|
27
|
+
|
28
|
+
* Bugfixes for commandline use
|
11
29
|
|
12
30
|
=== 1.0.0 / 2009-02-24
|
13
31
|
|
14
|
-
*
|
32
|
+
* 1 major enhancement
|
15
33
|
|
34
|
+
* Birthday!
|
data/README.txt
CHANGED
@@ -10,9 +10,11 @@ to any of these formats.
|
|
10
10
|
|
11
11
|
== FEATURES/PROBLEMS:
|
12
12
|
|
13
|
-
* Usable as library and commandline tool
|
14
|
-
* Tested
|
15
|
-
*
|
13
|
+
* Usable as library and commandline tool
|
14
|
+
* Tested and fully working on:
|
15
|
+
* Windows XP i386 (Ruby 1.8.6)
|
16
|
+
* Ubuntu Linux 8.10 i386_64 (Ruby 1.8.7 and 1.9.1p0)
|
17
|
+
* The commandline tool doesn't work with Ruby 1.9.x because the user-choices gem is not yet updated. A patch is available here: https://rubyforge.org/tracker/index.php?func=detail&aid=24307&group_id=4192&atid=16176
|
16
18
|
|
17
19
|
== SYNOPSIS:
|
18
20
|
|
@@ -38,6 +40,7 @@ The default output encoding is unix. You can set the default with the environmen
|
|
38
40
|
== INSTALL:
|
39
41
|
|
40
42
|
* gem install breakverter
|
43
|
+
* gem install user-choices (only for commandline tool)
|
41
44
|
|
42
45
|
== LICENSE:
|
43
46
|
|
data/bin/breakverter
CHANGED
@@ -17,6 +17,10 @@
|
|
17
17
|
# You should have received a copy of the GNU General Public License
|
18
18
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
|
+
# TODO: If user-choices patch gets accepted, use :one_way => true for --version
|
21
|
+
# TODO: If user-choices patch gets accepted, use :upcase for environment variables
|
22
|
+
|
23
|
+
# If library is not locally accessible, use gem to include it.
|
20
24
|
begin
|
21
25
|
require 'lib/breakverter'
|
22
26
|
rescue LoadError
|
@@ -24,10 +28,11 @@ rescue LoadError
|
|
24
28
|
require 'breakverter'
|
25
29
|
end
|
26
30
|
|
31
|
+
# User friendly message if user-choices is not available
|
27
32
|
begin
|
28
33
|
require 'user-choices'
|
29
34
|
rescue LoadError
|
30
|
-
|
35
|
+
warn "This command needs the user-choices gem to be installed.\n\nSolution: gem install user-choices"; exit false
|
31
36
|
end
|
32
37
|
|
33
38
|
# Application class for commandline interface
|
@@ -38,7 +43,7 @@ class BreakVerter::Application < UserChoices::Command
|
|
38
43
|
def add_sources(builder)
|
39
44
|
builder.add_source(
|
40
45
|
CommandLineSource, :usage,
|
41
|
-
"Usage: #$PROGRAM_NAME [options] input-file [output-file]",
|
46
|
+
"Usage: #$PROGRAM_NAME [options] input-file [output-file]\n\n",
|
42
47
|
"Convert a file with any linebreak encoding to a specific linebreak encoding.\n",
|
43
48
|
"Use the environment variable BREAKVERTER_OUTPUT to specify a default output encoding.\n"
|
44
49
|
)
|
@@ -56,6 +61,10 @@ class BreakVerter::Application < UserChoices::Command
|
|
56
61
|
"Output formatting. Possible settings: #{BreakVerter::BREAKS.keys.join(', ')}")
|
57
62
|
end
|
58
63
|
|
64
|
+
builder.add_choice(:version, :default => false, :type => :boolean) do |cli|
|
65
|
+
cli.uses_switch('-v', '--version', 'Display version and licensing information')
|
66
|
+
end
|
67
|
+
|
59
68
|
builder.add_choice(:filenames, :length => 1..2) {|cli| cli.uses_arglist}
|
60
69
|
end
|
61
70
|
|
@@ -67,18 +76,54 @@ class BreakVerter::Application < UserChoices::Command
|
|
67
76
|
|
68
77
|
# Main program
|
69
78
|
def execute
|
70
|
-
|
71
|
-
|
79
|
+
if @user_choices[:version]
|
80
|
+
klass = Breakverter
|
81
|
+
puts "\n#{klass.name} #{klass::VERSION}"
|
82
|
+
puts DATA.read; exit
|
83
|
+
end
|
84
|
+
|
85
|
+
unless File.exists?(@user_choices[:input_filename])
|
86
|
+
warn "Input file not found (#{@user_choices[:input_filename]})"; exit false
|
87
|
+
end
|
88
|
+
|
89
|
+
unless File.readable?(@user_choices[:input_filename])
|
90
|
+
warn "Input file access denied (#{@user_choices[:input_filename]})"; exit false
|
91
|
+
end
|
92
|
+
|
72
93
|
result = BreakVerter.convert(File.read(@user_choices[:input_filename]), @user_choices[:output].to_sym)
|
73
94
|
|
74
95
|
if @user_choices[:output_filename] == '-'
|
75
96
|
puts result
|
76
97
|
else
|
77
98
|
@user_choices[:output_filename]
|
78
|
-
|
99
|
+
|
100
|
+
unless File.writable?(File.dirname(@user_choices[:output_filename]))
|
101
|
+
warn "Output file access denied (#{@user_choices[:output_filename]})"; exit false
|
102
|
+
end
|
103
|
+
|
79
104
|
File.open(@user_choices[:output_filename], 'w') {|f| f.write(result)}
|
80
105
|
end
|
81
106
|
end
|
82
107
|
end
|
83
108
|
|
84
109
|
S4tUtils.with_pleasant_exceptions {BreakVerter::Application.new.execute}
|
110
|
+
|
111
|
+
__END__
|
112
|
+
|
113
|
+
Project: https://rubyforge.org/projects/aef/
|
114
|
+
RDoc: http://aef.rubyforge.org/breakverter/
|
115
|
+
|
116
|
+
Copyright 2009 Alexander E. Fischer <aef@raxys.net>
|
117
|
+
|
118
|
+
BreakVerter is free software: you can redistribute it and/or modify
|
119
|
+
it under the terms of the GNU General Public License as published by
|
120
|
+
the Free Software Foundation, either version 3 of the License, or
|
121
|
+
(at your option) any later version.
|
122
|
+
|
123
|
+
This program is distributed in the hope that it will be useful,
|
124
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
125
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
126
|
+
GNU General Public License for more details.
|
127
|
+
|
128
|
+
You should have received a copy of the GNU General Public License
|
129
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
data/lib/breakverter.rb
CHANGED
data/spec/breakverter_spec.rb
CHANGED
@@ -43,6 +43,10 @@ module BreakVerterSpecHelper
|
|
43
43
|
def custom_fixture
|
44
44
|
"AbcdeffnordAbcdeffnordAbcdef"
|
45
45
|
end
|
46
|
+
|
47
|
+
def windows?
|
48
|
+
Sys::Uname.sysname.downcase.include?('windows')
|
49
|
+
end
|
46
50
|
end
|
47
51
|
|
48
52
|
describe BreakVerter do
|
@@ -105,7 +109,7 @@ describe BreakVerter do
|
|
105
109
|
end
|
106
110
|
|
107
111
|
it 'should accept BREAKVERTER_OUTPUT environment variable to specify output format' do
|
108
|
-
if
|
112
|
+
if windows?
|
109
113
|
`set BREAKVERTER_OUTPUT=mac`
|
110
114
|
`#{RUBY_PATH} bin/breakverter --output mac spec/fixtures/windows.txt`.should eql(mac_fixture + "\n")
|
111
115
|
else
|
@@ -114,7 +118,7 @@ describe BreakVerter do
|
|
114
118
|
end
|
115
119
|
|
116
120
|
it 'should use output format specified with -o even if BREAKVERTER_OUTPUT environment variable is set' do
|
117
|
-
if
|
121
|
+
if windows?
|
118
122
|
`set BREAKVERTER_OUTPUT=windows`
|
119
123
|
`#{RUBY_PATH} bin/breakverter -o mac spec/fixtures/unix.txt`.should eql(mac_fixture + "\n")
|
120
124
|
else
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: breakverter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander E. Fischer
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
55akF+N8NbO6tpVDy6TMagqa10LfEpiQH6dvDHe/xdAqYOCrXKpmqzwu2PI=
|
30
30
|
-----END CERTIFICATE-----
|
31
31
|
|
32
|
-
date: 2009-03-
|
32
|
+
date: 2009-03-08 00:00:00 +01:00
|
33
33
|
default_executable:
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|