breakverter 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/COPYING.txt CHANGED
@@ -672,5 +672,3 @@ may consider it more useful to permit linking proprietary applications with
672
672
  the library. If this is what you want to do, use the GNU Lesser General
673
673
  Public License instead of this License. But first, please read
674
674
  <http://www.gnu.org/philosophy/why-not-lgpl.html>.
675
-
676
-
data/History.txt CHANGED
@@ -1,3 +1,22 @@
1
+ === 1.2.0 / 2009-04-05
2
+
3
+ * 2 major enhancements
4
+
5
+ * Namespaced into module Aef
6
+ * Instance method added for on demand inclusion into the String class
7
+
8
+ * 5 minor enhancements
9
+
10
+ * Better metadata for gem
11
+ * Test refactoring
12
+ * Minor refactorings
13
+ * Improved documentation
14
+ * Added test for --version command
15
+
16
+ * 1 minor bugfix
17
+
18
+ * Fixed some bugs related to Ruby 1.8.6
19
+
1
20
  === 1.1.1 / 2009-03-08
2
21
 
3
22
  * minor enhancement
data/Manifest.txt CHANGED
@@ -1,10 +1,11 @@
1
1
  History.txt
2
2
  Manifest.txt
3
- README.txt
3
+ README.rdoc
4
4
  COPYING.txt
5
5
  Rakefile
6
6
  bin/breakverter
7
7
  lib/breakverter.rb
8
+ lib/breakverter/breakverter.rb
8
9
  spec/breakverter_spec.rb
9
10
  spec/fixtures/unix.txt
10
11
  spec/fixtures/windows.txt
data/README.rdoc ADDED
@@ -0,0 +1,161 @@
1
+ = BreakVerter
2
+
3
+ * Project: https://rubyforge.org/projects/aef/
4
+ * RDoc: http://aef.rubyforge.org/breakverter/
5
+ * Github: http://github.com/aef/breakverter/
6
+
7
+ == DESCRIPTION:
8
+
9
+ BreakVerter is a Ruby library and commandline tool for conversion of text
10
+ between linebreak encoding formats of unix, windows or mac.
11
+
12
+ == FEATURES/PROBLEMS:
13
+
14
+ * Usable as library and commandline tool
15
+ * Tested and fully working on:
16
+ * Ubuntu Linux 8.10 i386_64 (Ruby 1.8.7 and 1.9.1p0)
17
+ * Debian GNU/Linux 4.0 i386 (Ruby 1.8.6)
18
+ * Windows XP i386 (Ruby 1.8.6)
19
+ * The commandline tool doesn't work with Ruby 1.9.x because the user-choices gem
20
+ is not yet updated. A patch is available here:
21
+ https://rubyforge.org/tracker/index.php?func=detail&aid=24307&group_id=4192&atid=16176
22
+
23
+ == SYNOPSIS:
24
+
25
+ === Commandline
26
+
27
+ The default output encoding is unix. You can also choose mac and windows.
28
+
29
+ breakverter -o windows unix.txt windows.txt
30
+
31
+ If no target file is specified the output will be sent to STDOUT.
32
+
33
+ breakverter -o windows mac.txt > windows.txt
34
+
35
+ You can set the default with the environment variable BREAKVERTER_OUTPUT.
36
+
37
+ export BREAKVERTER_OUTPUT=mac
38
+
39
+ breakverter windows.txt mac.txt
40
+
41
+ === Library
42
+
43
+ First of all you have to load the BreakVerter gem:
44
+
45
+ require 'breakverter'
46
+
47
+ You can put strings or objects responding to to_s into the convert method and
48
+ optionally define a target linebreak encoding. The default encoding is :unix.
49
+ You can also choose :mac and :windows. Notice that the :mac encoding is
50
+ deprecated. Modern Apple machines also use :unix linebreak encoding.
51
+
52
+ windows_string = "Abcdef\r\nAbcdef\r\nAbcdef"
53
+
54
+ Aef::BreakVerter.convert(windows_string, :unix) #=> "Abcdef\nAbcdef\nAbcdef"
55
+
56
+ Alternatively you could include BreakVerter into the String class and use it in
57
+ the following way:
58
+
59
+ class String
60
+ include Aef::BreakVerter
61
+ end
62
+
63
+ "Abcdef\nAbcdef\nAbcdef".linebreaks(:mac) #=> "Abcdef\rAbcdef\rAbcdef"
64
+
65
+ == REQUIREMENTS:
66
+
67
+ * rubygems
68
+
69
+ === Additional for commandline
70
+ * user-choices
71
+
72
+ === Additional for automated testing
73
+ * hoe
74
+ * rspec
75
+ * sys-uname
76
+
77
+ == INSTALL:
78
+
79
+ === Normal
80
+
81
+ gem install breakverter
82
+
83
+ Additionally for the commandline tool:
84
+
85
+ gem install user-choices
86
+
87
+ === High security (recommended)
88
+
89
+ There is a high security installation option available through rubygems. It is
90
+ highly recommended over the normal installation, although it may be a bit less
91
+ comfortable. To use the installation method, you will need my public key, which
92
+ I use for cryptographic signatures on all my gems. You can find the public key
93
+ and more detailed verification information in the aef-certificates section of my
94
+ rubyforge project[https://rubyforge.org/frs/?group_id=7890&release_id=31749]
95
+
96
+ Add the key to your rubygems' trusted certificates by the following command:
97
+
98
+ gem cert --add aef.pem
99
+
100
+ Now you can install the gem while automatically verifying it's signature by the
101
+ following command:
102
+
103
+ gem install breakverter -P HighSecurity
104
+
105
+ Please notice that you will need other keys for dependent libraries, so you may
106
+ have to install dependencies manually.
107
+
108
+ === Automated testing
109
+
110
+ You can test this package through rspec on your system. First find the path
111
+ where the gem was installed to:
112
+
113
+ gem which breakverter
114
+
115
+ Go into the root directory of the installed gem and run the following command
116
+ to start the test runner:
117
+
118
+ rake spec
119
+
120
+ On Windows systems you have to run the following instead:
121
+
122
+ spec spec/**/*_spec.rb
123
+
124
+ If something goes wrong you should be noticed through failing examples.
125
+
126
+ == DEVELOPMENT:
127
+
128
+ This software is developed in the source code management system git hosted
129
+ at github.com. You can download the most recent sourcecode through the following
130
+ command:
131
+
132
+ git clone git://github.com/aef/breakverter.git
133
+
134
+ Help on making this software better is always very appreciated. If you want your
135
+ changes to be included in the official release, please send me a patch through
136
+ the project's tracker[https://rubyforge.org/tracker/?group_id=7890] at
137
+ rubyforge.org. You can generate a patch-file by the following command:
138
+
139
+ git diff > patch.diff
140
+
141
+ Please make sure to write tests for your changes and notice that I can't promise
142
+ to include your changes before reviewing them.
143
+
144
+ == LICENSE:
145
+
146
+ Copyright 2009 Alexander E. Fischer <aef@raxys.net>
147
+
148
+ This file is part of BreakVerter.
149
+
150
+ BreakVerter is free software: you can redistribute it and/or modify
151
+ it under the terms of the GNU General Public License as published by
152
+ the Free Software Foundation, either version 3 of the License, or
153
+ (at your option) any later version.
154
+
155
+ This program is distributed in the hope that it will be useful,
156
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
157
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
158
+ GNU General Public License for more details.
159
+
160
+ You should have received a copy of the GNU General Public License
161
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
data/Rakefile CHANGED
@@ -4,12 +4,16 @@ require 'rubygems'
4
4
  require 'hoe'
5
5
  require './lib/breakverter.rb'
6
6
 
7
- Hoe.new('breakverter', BreakVerter::VERSION) do |p|
7
+ Hoe.new('breakverter', Aef::BreakVerter::VERSION) do |p|
8
8
  p.rubyforge_name = 'aef'
9
9
  p.developer('Alexander E. Fischer', 'aef@raxys.net')
10
- p.extra_dev_deps = %w{rspec user-choices sys-uname}
11
- p.testlib = 'spec'
12
- p.test_globs = ['spec/**/*_spec.rb']
10
+ p.extra_dev_deps = %w{user-choices rspec sys-uname}
11
+ p.url = 'https://rubyforge.org/projects/aef/'
12
+ p.readme_file = 'README.rdoc'
13
+ p.extra_rdoc_files = %w{README.rdoc}
14
+ p.spec_extras = {
15
+ :rdoc_options => ['--main', 'README.rdoc', '--inline-source', '--line-numbers', '--title', 'BreakVerter']
16
+ }
13
17
  end
14
18
 
15
19
  # vim: syntax=Ruby
data/bin/breakverter CHANGED
@@ -36,7 +36,7 @@ rescue LoadError
36
36
  end
37
37
 
38
38
  # Application class for commandline interface
39
- class BreakVerter::Application < UserChoices::Command
39
+ class Aef::BreakVerter::Application < UserChoices::Command
40
40
  include UserChoices
41
41
 
42
42
  # Prepare configuration sources
@@ -55,31 +55,50 @@ class BreakVerter::Application < UserChoices::Command
55
55
 
56
56
  # Define configuration options
57
57
  def add_choices(builder)
58
- output_values = BreakVerter::BREAKS.keys.map{|key| key.to_s}
58
+ output_values = Aef::BreakVerter::BREAKS.keys.map{|key| key.to_s}
59
59
  builder.add_choice(:output, :default => 'unix', :type => output_values) do |cli|
60
60
  cli.uses_option('-o', '--output PLATFORM',
61
- "Output formatting. Possible settings: #{BreakVerter::BREAKS.keys.join(', ')}")
61
+ "Output formatting. Possible settings: #{Aef::BreakVerter::BREAKS.keys.join(', ')}")
62
62
  end
63
63
 
64
64
  builder.add_choice(:version, :default => false, :type => :boolean) do |cli|
65
65
  cli.uses_switch('-v', '--version', 'Display version and licensing information')
66
66
  end
67
67
 
68
- builder.add_choice(:filenames, :length => 1..2) {|cli| cli.uses_arglist}
68
+ builder.add_choice(:filenames, :length => 0..2) {|cli| cli.uses_arglist}
69
69
  end
70
70
 
71
71
  # Manual option post processing
72
72
  def postprocess_user_choices
73
+ version if @user_choices[:version]
74
+
73
75
  @user_choices[:input_filename] = @user_choices[:filenames][0]
74
76
  @user_choices[:output_filename] = @user_choices[:filenames][1] || '-'
75
77
  end
76
78
 
79
+ # Version and licensing information output
80
+ def version
81
+ name = 'BreakVerter'
82
+ puts "#{name} #{Aef::BreakVerter::VERSION}"
83
+ puts
84
+ puts 'Project: https://rubyforge.org/projects/aef/'
85
+ puts "RDoc: http://aef.rubyforge.org/#{name.downcase}/"
86
+ puts "Github: http://github.com/aef/#{name.downcase}/"
87
+ puts
88
+ puts 'Copyright 2009 Alexander E. Fischer <aef@raxys.net>'
89
+ # Read and print licensing information from the top of this file
90
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('1.8.6')
91
+ puts File.read(__FILE__).map{|line| line[2..-1]}[5..17]
92
+ else
93
+ puts File.read(__FILE__).lines.map{|line| line[2..-1]}[5..17]
94
+ end
95
+ exit
96
+ end
97
+
77
98
  # Main program
78
99
  def execute
79
- if @user_choices[:version]
80
- klass = Breakverter
81
- puts "\n#{klass.name} #{klass::VERSION}"
82
- puts DATA.read; exit
100
+ unless @user_choices[:input_filename]
101
+ warn 'No input file given'; exit false
83
102
  end
84
103
 
85
104
  unless File.exists?(@user_choices[:input_filename])
@@ -90,7 +109,7 @@ class BreakVerter::Application < UserChoices::Command
90
109
  warn "Input file access denied (#{@user_choices[:input_filename]})"; exit false
91
110
  end
92
111
 
93
- result = BreakVerter.convert(File.read(@user_choices[:input_filename]), @user_choices[:output].to_sym)
112
+ result = Aef::BreakVerter.convert(File.read(@user_choices[:input_filename]), @user_choices[:output].to_sym)
94
113
 
95
114
  if @user_choices[:output_filename] == '-'
96
115
  puts result
@@ -106,24 +125,4 @@ class BreakVerter::Application < UserChoices::Command
106
125
  end
107
126
  end
108
127
 
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/>.
128
+ S4tUtils.with_pleasant_exceptions {Aef::BreakVerter::Application.new.execute}
@@ -0,0 +1,45 @@
1
+ # Copyright 2009 Alexander E. Fischer <aef@raxys.net>
2
+ #
3
+ # This file is part of BreakVerter.
4
+ #
5
+ # BreakVerter 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
+ # BreakVerter is Ruby library and commandline tool for conversion of text
19
+ # between linebreak encoding formats of unix, windows or mac.
20
+ module Aef::BreakVerter
21
+ VERSION = '1.2.0'
22
+
23
+ BREAKS = {
24
+ :unix => "\n",
25
+ :windows => "\r\n",
26
+ :mac => "\r"
27
+ }
28
+
29
+ # Convert a file with any linebreak encoding to a specific linebreak encoding.
30
+ #
31
+ # If given output_encoding is not a key of BREAKS, all linebreaks are replaced
32
+ # with output_encoding's content itself.
33
+ def self.convert(input, output_encoding = :unix)
34
+ if input.respond_to?(:to_s) then input = input.to_s
35
+ else raise 'Input has to be a string or must support to_s' end
36
+
37
+ input.gsub(/\r(?:\n)?|\n/, BREAKS[output_encoding] || output_encoding)
38
+ end
39
+
40
+ # Shortcut for direct receiver conversion, for example if BreakVerter is
41
+ # included into the string class
42
+ def linebreaks(output_encoding = :unix)
43
+ Aef::BreakVerter.convert(self, output_encoding)
44
+ end
45
+ end
data/lib/breakverter.rb CHANGED
@@ -15,24 +15,15 @@
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
- # Module containing a single method
19
- module BreakVerter
20
- VERSION = '1.1.1'
21
-
22
- BREAKS = {
23
- :unix => "\n",
24
- :windows => "\r\n",
25
- :mac => "\r"
26
- }
18
+ # Namespace for projects of Alexander E. Fischer <aef@raxys.net>
19
+ #
20
+ # If you want to be able to simply type Example instead of Aef::Example to
21
+ # address classes in this namespace simply write the following before using the
22
+ # classes:
23
+ #
24
+ # include Aef
25
+ module Aef
27
26
 
28
- # Convert a file with any linebreak encoding to a specific linebreak encoding.
29
- #
30
- # If given output_encoding is not a key of BREAKS, all linebreaks are replaced
31
- # with output_encoding's content itself.
32
- def self.convert(input, output_encoding = :unix)
33
- if input.respond_to?(:to_s) then input = input.to_s
34
- else raise 'Input has to be a string or must support to_s' end
27
+ end
35
28
 
36
- input.gsub(/\r(?:\n)?|\n/, BREAKS[output_encoding] || output_encoding)
37
- end
38
- end
29
+ require File.join(File.dirname(__FILE__), 'breakverter/breakverter')
@@ -21,13 +21,25 @@ require 'tempfile'
21
21
  require 'rubygems'
22
22
  require 'sys/uname'
23
23
 
24
- # If there is a way to get the executable path of the currently running ruby
25
- # interpreter, please tell me how.
26
- warn 'Attention: If the ruby interpreter to be tested with is not ruby in the' +
27
- 'default path, you have to change this manually in spec/breakverter_spec.rb'
28
- RUBY_PATH = 'ruby'
29
-
30
24
  module BreakVerterSpecHelper
25
+ # If there is a way to get the executable path of the currently running ruby
26
+ # interpreter, please tell me how.
27
+ warn 'Attention: If the ruby interpreter to be tested with is not ruby in the' +
28
+ "default path, you have to change this manually in #{__FILE__} line #{__LINE__ + 1}"
29
+ RUBY_PATH = 'ruby'
30
+
31
+ def executable_path
32
+ "#{RUBY_PATH} bin/breakverter"
33
+ end
34
+
35
+ def fixture_path(name)
36
+ File.join('spec/fixtures', name)
37
+ end
38
+
39
+ def windows?
40
+ Sys::Uname.sysname.downcase.include?('windows')
41
+ end
42
+
31
43
  def unix_fixture
32
44
  "Abcdef\nAbcdef\nAbcdef"
33
45
  end
@@ -43,86 +55,82 @@ module BreakVerterSpecHelper
43
55
  def custom_fixture
44
56
  "AbcdeffnordAbcdeffnordAbcdef"
45
57
  end
46
-
47
- def windows?
48
- Sys::Uname.sysname.downcase.include?('windows')
49
- end
50
58
  end
51
59
 
52
- describe BreakVerter do
60
+ describe Aef::BreakVerter do
53
61
  include BreakVerterSpecHelper
54
62
 
55
- describe 'library' do
63
+ context 'library' do
56
64
  it 'should convert correctly from unix to windows format' do
57
- BreakVerter.convert(unix_fixture, :windows).should eql(windows_fixture)
65
+ Aef::BreakVerter.convert(unix_fixture, :windows).should eql(windows_fixture)
58
66
  end
59
67
 
60
68
  it 'should convert correctly from unix to mac format' do
61
- BreakVerter.convert(unix_fixture, :mac).should eql(mac_fixture)
69
+ Aef::BreakVerter.convert(unix_fixture, :mac).should eql(mac_fixture)
62
70
  end
63
71
 
64
72
  it 'should convert correctly from unix to a custom format' do
65
- BreakVerter.convert(unix_fixture, 'fnord').should eql(custom_fixture)
73
+ Aef::BreakVerter.convert(unix_fixture, 'fnord').should eql(custom_fixture)
66
74
  end
67
75
 
68
76
  it 'should convert correctly from windows to unix format' do
69
- BreakVerter.convert(windows_fixture, :unix).should eql(unix_fixture)
77
+ Aef::BreakVerter.convert(windows_fixture, :unix).should eql(unix_fixture)
70
78
  end
71
79
 
72
80
  it 'should convert correctly from windows to mac format' do
73
- BreakVerter.convert(windows_fixture, :mac).should eql(mac_fixture)
81
+ Aef::BreakVerter.convert(windows_fixture, :mac).should eql(mac_fixture)
74
82
  end
75
83
 
76
84
  it 'should convert correctly from unix to a custom format' do
77
- BreakVerter.convert(windows_fixture, 'fnord').should eql(custom_fixture)
85
+ Aef::BreakVerter.convert(windows_fixture, 'fnord').should eql(custom_fixture)
78
86
  end
79
87
 
80
88
  it 'should convert correctly from mac to unix format' do
81
- BreakVerter.convert(mac_fixture, :unix).should eql(unix_fixture)
89
+ Aef::BreakVerter.convert(mac_fixture, :unix).should eql(unix_fixture)
82
90
  end
83
91
 
84
92
  it 'should convert correctly from mac to windows format' do
85
- BreakVerter.convert(mac_fixture, :windows).should eql(windows_fixture)
93
+ Aef::BreakVerter.convert(mac_fixture, :windows).should eql(windows_fixture)
86
94
  end
87
95
 
88
96
  it 'should convert correctly from unix to a custom format' do
89
- BreakVerter.convert(mac_fixture, 'fnord').should eql(custom_fixture)
97
+ Aef::BreakVerter.convert(mac_fixture, 'fnord').should eql(custom_fixture)
90
98
  end
91
99
  end
92
100
 
93
- describe 'commandline tool' do
101
+ context 'commandline tool' do
94
102
  it 'should use unix as default format' do
95
- `#{RUBY_PATH} bin/breakverter spec/fixtures/windows.txt`.should eql(unix_fixture + "\n")
103
+ `#{executable_path} #{fixture_path('windows.txt')}`.should eql(unix_fixture + "\n")
96
104
  end
97
105
 
98
106
  it 'should accept -o option to specify output format' do
99
- `#{RUBY_PATH} bin/breakverter -o mac spec/fixtures/unix.txt`.should eql(mac_fixture + "\n")
107
+ `#{executable_path} -o mac #{fixture_path('unix.txt')}`.should eql(mac_fixture + "\n")
100
108
  end
101
109
 
102
110
  it 'should also accept --output option to specify output format' do
103
- `#{RUBY_PATH} bin/breakverter -o windows spec/fixtures/mac.txt`.should eql(windows_fixture + "\n")
111
+ `#{executable_path} --output windows #{fixture_path('mac.txt')}`.should eql(windows_fixture + "\n")
104
112
  end
105
113
 
106
114
  it 'should abort on invalid output formats' do
107
115
  puts "\nAn error output after this line is expected behavior, simply ignore it:\n"
108
- `#{RUBY_PATH} bin/breakverter -o fnord spec/fixtures/mac.txt`.should be_empty
116
+ `#{executable_path} -o fnord #{fixture_path('mac.txt')}`.should be_empty
109
117
  end
110
118
 
111
119
  it 'should accept BREAKVERTER_OUTPUT environment variable to specify output format' do
112
120
  if windows?
113
121
  `set BREAKVERTER_OUTPUT=mac`
114
- `#{RUBY_PATH} bin/breakverter --output mac spec/fixtures/windows.txt`.should eql(mac_fixture + "\n")
122
+ `#{executable_path} --output mac #{fixture_path('windows.txt')}`.should eql(mac_fixture + "\n")
115
123
  else
116
- `env BREAKVERTER_OUTPUT=mac #{RUBY_PATH} bin/breakverter --output mac spec/fixtures/windows.txt`.should eql(mac_fixture + "\n")
124
+ `env BREAKVERTER_OUTPUT=mac #{executable_path} --output mac #{fixture_path('windows.txt')}`.should eql(mac_fixture + "\n")
117
125
  end
118
126
  end
119
127
 
120
128
  it 'should use output format specified with -o even if BREAKVERTER_OUTPUT environment variable is set' do
121
129
  if windows?
122
130
  `set BREAKVERTER_OUTPUT=windows`
123
- `#{RUBY_PATH} bin/breakverter -o mac spec/fixtures/unix.txt`.should eql(mac_fixture + "\n")
131
+ `#{executable_path} -o mac #{fixture_path('unix.txt')}`.should eql(mac_fixture + "\n")
124
132
  else
125
- `env BREAKVERTER_OUTPUT=windows #{RUBY_PATH} bin/breakverter -o mac spec/fixtures/unix.txt`.should eql(mac_fixture + "\n")
133
+ `env BREAKVERTER_OUTPUT=windows #{executable_path} -o mac #{fixture_path('unix.txt')}`.should eql(mac_fixture + "\n")
126
134
  end
127
135
  end
128
136
 
@@ -132,10 +140,36 @@ describe BreakVerter do
132
140
  temp_file.close
133
141
  temp_file.unlink
134
142
 
135
- `#{RUBY_PATH} bin/breakverter --output windows spec/fixtures/unix.txt #{location}`.should be_empty
143
+ `#{executable_path} --output windows #{fixture_path('unix.txt')} #{location}`.should be_empty
136
144
 
137
145
  File.read(location).should eql(windows_fixture)
138
146
  File.unlink(location)
139
147
  end
148
+
149
+ it 'should display correct version and licensing information with the --version switch' do
150
+ message = <<-EOF
151
+ BreakVerter 1.2.0
152
+
153
+ Project: https://rubyforge.org/projects/aef/
154
+ RDoc: http://aef.rubyforge.org/breakverter/
155
+ Github: http://github.com/aef/breakverter/
156
+
157
+ Copyright 2009 Alexander E. Fischer <aef@raxys.net>
158
+
159
+ BreakVerter is free software: you can redistribute it and/or modify
160
+ it under the terms of the GNU General Public License as published by
161
+ the Free Software Foundation, either version 3 of the License, or
162
+ (at your option) any later version.
163
+
164
+ This program is distributed in the hope that it will be useful,
165
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
166
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
167
+ GNU General Public License for more details.
168
+
169
+ You should have received a copy of the GNU General Public License
170
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
171
+ EOF
172
+ `#{executable_path} --version`.should eql(message)
173
+ end
140
174
  end
141
175
  end
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.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander E. Fischer
@@ -29,11 +29,11 @@ cert_chain:
29
29
  55akF+N8NbO6tpVDy6TMagqa10LfEpiQH6dvDHe/xdAqYOCrXKpmqzwu2PI=
30
30
  -----END CERTIFICATE-----
31
31
 
32
- date: 2009-03-08 00:00:00 +01:00
32
+ date: 2009-04-05 00:00:00 +02:00
33
33
  default_executable:
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
- name: rspec
36
+ name: user-choices
37
37
  type: :development
38
38
  version_requirement:
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: "0"
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
- name: user-choices
46
+ name: rspec
47
47
  type: :development
48
48
  version_requirement:
49
49
  version_requirements: !ruby/object:Gem::Requirement
@@ -70,9 +70,9 @@ dependencies:
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: 1.8.2
73
+ version: 1.11.0
74
74
  version:
75
- description: BreakVerter is able to convert a string encoded in unix, windows or mac format to any of these formats.
75
+ description: BreakVerter is a Ruby library and commandline tool for conversion of text between linebreak encoding formats of unix, windows or mac.
76
76
  email:
77
77
  - aef@raxys.net
78
78
  executables:
@@ -82,29 +82,31 @@ extensions: []
82
82
  extra_rdoc_files:
83
83
  - History.txt
84
84
  - Manifest.txt
85
- - README.txt
86
85
  - COPYING.txt
87
- - spec/fixtures/unix.txt
88
- - spec/fixtures/windows.txt
89
- - spec/fixtures/mac.txt
86
+ - README.rdoc
90
87
  files:
91
88
  - History.txt
92
89
  - Manifest.txt
93
- - README.txt
90
+ - README.rdoc
94
91
  - COPYING.txt
95
92
  - Rakefile
96
93
  - bin/breakverter
97
94
  - lib/breakverter.rb
95
+ - lib/breakverter/breakverter.rb
98
96
  - spec/breakverter_spec.rb
99
97
  - spec/fixtures/unix.txt
100
98
  - spec/fixtures/windows.txt
101
99
  - spec/fixtures/mac.txt
102
100
  has_rdoc: true
103
- homepage: "Project: https://rubyforge.org/projects/aef/"
101
+ homepage: https://rubyforge.org/projects/aef/
104
102
  post_install_message:
105
103
  rdoc_options:
106
104
  - --main
107
- - README.txt
105
+ - README.rdoc
106
+ - --inline-source
107
+ - --line-numbers
108
+ - --title
109
+ - BreakVerter
108
110
  require_paths:
109
111
  - lib
110
112
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -125,6 +127,6 @@ rubyforge_project: aef
125
127
  rubygems_version: 1.3.1
126
128
  signing_key:
127
129
  specification_version: 2
128
- summary: BreakVerter is able to convert a string encoded in unix, windows or mac format to any of these formats.
129
- test_files:
130
- - spec/breakverter_spec.rb
130
+ summary: BreakVerter is a Ruby library and commandline tool for conversion of text between linebreak encoding formats of unix, windows or mac.
131
+ test_files: []
132
+
metadata.gz.sig CHANGED
Binary file
data/README.txt DELETED
@@ -1,63 +0,0 @@
1
- = BreakVerter
2
-
3
- * Project: https://rubyforge.org/projects/aef/
4
- * RDoc: http://aef.rubyforge.org/breakverter/
5
-
6
- == DESCRIPTION:
7
-
8
- BreakVerter is able to convert a string encoded in unix, windows or mac format
9
- to any of these formats.
10
-
11
- == FEATURES/PROBLEMS:
12
-
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
18
-
19
- == SYNOPSIS:
20
-
21
- * In commandline:
22
-
23
- breakverter -o windows unix.txt windows.txt
24
-
25
- The default output encoding is unix. You can set the default with the environment variable BREAKVERTER_OUTPUT. If no target file is specified the output will be sent to STDOUT.
26
-
27
- * As library:
28
-
29
- require 'breakverter'
30
-
31
- windows_string = "Abcdef\r\nAbcdef\r\nAbcdef"
32
-
33
- BreakVerter.convert(windows_string, :unix) #=> "Abcdef\nAbcdef\nAbcdef"
34
-
35
- == REQUIREMENTS:
36
-
37
- * user-choices (Only for the commandline tool)
38
- * rspec (Only for automated testing)
39
-
40
- == INSTALL:
41
-
42
- * gem install breakverter
43
- * gem install user-choices (only for commandline tool)
44
-
45
- == LICENSE:
46
-
47
- Copyright 2009 Alexander E. Fischer <aef@raxys.net>
48
-
49
- This file is part of BreakVerter.
50
-
51
- BreakVerter is free software: you can redistribute it and/or modify
52
- it under the terms of the GNU General Public License as published by
53
- the Free Software Foundation, either version 3 of the License, or
54
- (at your option) any later version.
55
-
56
- This program is distributed in the hope that it will be useful,
57
- but WITHOUT ANY WARRANTY; without even the implied warranty of
58
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
59
- GNU General Public License for more details.
60
-
61
- You should have received a copy of the GNU General Public License
62
- along with this program. If not, see <http://www.gnu.org/licenses/>.
63
-