Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Slithtly updated project setup and documentation. Made tests run on 1…

….9.3.
  • Loading branch information...
commit 28461cacde2af5f2464f4fbe93e64556d1f76261 1 parent 8af66ac
Alexander E. Fischer authored
29 .autotest
... ... @@ -1,29 +0,0 @@
1   -# -*- ruby -*-
2   -
3   -module Autotest::GnomeNotify
4   -
5   - # Time notification will be displayed before disappearing automatically
6   - EXPIRATION_IN_SECONDS = 2
7   - ERROR_STOCK_ICON = "gtk-dialog-error"
8   - SUCCESS_STOCK_ICON = "gtk-dialog-info"
9   -
10   - # Convenience method to send an error notification message
11   - #
12   - # [stock_icon] Stock icon name of icon to display
13   - # [title] Notification message title
14   - # [message] Core message for the notification
15   - def self.notify stock_icon, title, message
16   - options = "-t #{EXPIRATION_IN_SECONDS * 1000} -i #{stock_icon}"
17   - system "notify-send #{options} '#{title}' '#{message}'"
18   - end
19   -
20   - Autotest.add_hook :red do |at|
21   - notify ERROR_STOCK_ICON, "Tests failed", "#{at.files_to_test.size} tests failed"
22   - end
23   -
24   - Autotest.add_hook :green do |at|
25   - notify SUCCESS_STOCK_ICON, "All tests passed, good job!", ""
26   - end
27   -
28   -end
29   -
1  .rspec
... ... @@ -0,0 +1 @@
  1 +--color
8 .travis.yml
... ... @@ -0,0 +1,8 @@
  1 +rvm:
  2 + - 1.8.7
  3 + - 1.9.2
  4 + - 1.9.3
  5 + - rbx-18mode
  6 + - rbx-19mode
  7 + - jruby-18mode
  8 + - jruby-19mode
5 .yardopts
... ... @@ -0,0 +1,5 @@
  1 +--protected
  2 +--no-private
  3 +-
  4 +HISTORY.md
  5 +LICENSE.md
23 Gemfile
... ... @@ -0,0 +1,23 @@
  1 +# encoding: UTF-8
  2 +=begin
  3 +Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2012
  4 +
  5 +This file is part of Linebreak.
  6 +
  7 +Permission to use, copy, modify, and/or distribute this software for any
  8 +purpose with or without fee is hereby granted, provided that the above
  9 +copyright notice and this permission notice appear in all copies.
  10 +
  11 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  12 +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  13 +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14 +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  15 +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  16 +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17 +PERFORMANCE OF THIS SOFTWARE.
  18 +=end
  19 +
  20 +source 'http://rubygems.org'
  21 +
  22 +# Specify your gem's dependencies in weekling.gemspec
  23 +gemspec
32 History.txt → History.md
Source Rendered
... ... @@ -1,4 +1,16 @@
1   -=== 1.3.1 / 2009-09-14
  1 +2.0.0 / 2012-??-??
  2 +==================
  3 +
  4 +* 1 major enhancement
  5 +
  6 + * Changed to ISC based license
  7 +
  8 +* 1 minor enhancement
  9 +
  10 + * Slightly restructured project
  11 +
  12 +1.3.1 / 2009-09-14
  13 +==================
2 14
3 15 * 1 major bugfix
4 16
@@ -8,7 +20,8 @@
8 20
9 21 * Implemented autoloading
10 22
11   -=== 1.3.0 / 2009-08-11
  23 +1.3.0 / 2009-08-11
  24 +==================
12 25
13 26 * 3 major enhancements
14 27
@@ -23,7 +36,8 @@
23 36 * Used the Pathname class where possible
24 37 * Upgraded to use the latest hoe gem
25 38
26   -=== 1.2.0 / 2009-04-05
  39 +1.2.0 / 2009-04-05
  40 +==================
27 41
28 42 * 2 major enhancements
29 43
@@ -42,7 +56,8 @@
42 56
43 57 * Fixed some bugs related to Ruby 1.8.6
44 58
45   -=== 1.1.1 / 2009-03-08
  59 +1.1.1 / 2009-03-08
  60 +==================
46 61
47 62 * minor enhancement
48 63
@@ -50,7 +65,8 @@
50 65 * Some test refactoring
51 66 * Some more comments
52 67
53   -=== 1.1.0 / 2009-03-01
  68 +1.1.0 / 2009-03-01
  69 +==================
54 70
55 71 * 2 major enhancements
56 72
@@ -61,7 +77,8 @@
61 77
62 78 * Added support for custom string linebreak encodings in library
63 79
64   -=== 1.0.1 / 2009-02-24
  80 +1.0.1 / 2009-02-24
  81 +==================
65 82
66 83 * 1 minor enhancement
67 84
@@ -71,7 +88,8 @@
71 88
72 89 * Bugfixes for commandline use
73 90
74   -=== 1.0.0 / 2009-02-24
  91 +1.0.0 / 2009-02-24
  92 +==================
75 93
76 94 * 1 major enhancement
77 95
23 Manifest.txt
... ... @@ -1,23 +0,0 @@
1   -History.txt
2   -Manifest.txt
3   -README.rdoc
4   -COPYING.txt
5   -Rakefile
6   -bin/linebreak
7   -lib/aef/linebreak.rb
8   -lib/aef/linebreak/string_extension.rb
9   -lib/aef/linebreak/commands/encode.rb
10   -lib/aef/linebreak/commands/encodings.rb
11   -lib/aef/linebreak/commands/version.rb
12   -lib/aef/linebreak/pathname_conversion.rb
13   -lib/aef/linebreak/linebreak.rb
14   -spec/spec_helper.rb
15   -spec/linebreak_spec.rb
16   -spec/spec.opts
17   -spec/fixtures/unix.txt
18   -spec/fixtures/windows.txt
19   -spec/fixtures/mac.txt
20   -spec/fixtures/unix_windows.txt
21   -spec/fixtures/windows_mac.txt
22   -spec/fixtures/mac_unix.txt
23   -spec/fixtures/unix_windows_mac.txt
240 README.md
Source Rendered
... ... @@ -0,0 +1,240 @@
  1 +Linebreak
  2 +=========
  3 +
  4 +[![Build Status](https://secure.travis-ci.org/aef/linebreak.png)](
  5 +https://secure.travis-ci.org/aef/linebreak)
  6 +
  7 +* [Documentation][1]
  8 +* [Project][2]
  9 +
  10 + [1]: http://rdoc.info/projects/aef/linebreak/
  11 + [2]: http://github.com/aef/linebreak/
  12 +
  13 +Description
  14 +-----------
  15 +
  16 +Linebreak is a Ruby library and commandline tool for conversion of text
  17 +between linebreak encoding formats of unix, windows or mac.
  18 +
  19 +Earlier versions of Linebreak were called BreakVerter.
  20 +
  21 +Features / Problems
  22 +-------------------
  23 +
  24 +This projects tries to conform to:
  25 +
  26 +* [Semantic Versioning (2.0.0-rc.1)][5]
  27 +* [Ruby Packaging Standard (0.5-draft)][6]
  28 +* [Ruby Style Guide][7]
  29 +* [Gem Packaging: Best Practices][8]
  30 +
  31 + [5]: http://semver.org/
  32 + [6]: http://chneukirchen.github.com/rps/
  33 + [7]: https://github.com/bbatsov/ruby-style-guide
  34 + [8]: http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices
  35 +
  36 +Additional facts:
  37 +
  38 +* Written purely in Ruby.
  39 +* Intended to be used with Ruby 1.8.7 or higher.
  40 +
  41 +Synopsis
  42 +--------
  43 +
  44 +This documentation defines the public interface of the library. Don't rely
  45 +on elements marked as private. Those should be hidden in the documentation
  46 +by default.
  47 +
  48 +### Loading
  49 +
  50 +In most cases you want to load the library by the following command:
  51 +
  52 +~~~~~ ruby
  53 +require 'linebreak'
  54 +~~~~~
  55 +
  56 +In a bundler Gemfile you should use the following:
  57 +
  58 +~~~~~ ruby
  59 +gem 'linebreak'
  60 +~~~~~
  61 +
  62 +### Library
  63 +
  64 +You can put strings or objects responding to to_s into the method and
  65 +optionally define a target linebreak encoding. The default encoding is :unix.
  66 +You can also choose :mac and :windows. Notice that the :mac encoding is
  67 +deprecated. Modern Apple machines also use :unix linebreak encoding, while
  68 +Commodore machines also use the :mac linebreak encoding.
  69 +
  70 +~~~~~ ruby
  71 +windows_string = "Abcdef\r\nAbcdef\r\nAbcdef"
  72 +
  73 +Aef::Linebreak.encode(windows_string, :unix)
  74 +#=> "Abcdef\nAbcdef\nAbcdef"
  75 +~~~~~
  76 +
  77 +You can detect which decoding systems are used in a string:
  78 +
  79 +~~~~~ ruby
  80 +mixed_unix_and_mac_string = "Abcdef\rAbcdef\nAbcdef"
  81 +
  82 +Aef::Linebreak.encodings(mixed_unix_and_mac_string)
  83 +#=> #<Set: {:unix, :mac}>
  84 +~~~~~
  85 +
  86 +You can also easily ensure that a string contains exactly the linebreak
  87 +encodings you expect it to contain:
  88 +
  89 +~~~~~ ruby
  90 +mixed_windows_and_mac_string = "Abcdef\r\nAbcdef\rAbcdef"
  91 +
  92 +Aef::Linebreak.encoding?(mixed_windows_and_mac_string, :windows)
  93 +#=> false
  94 +
  95 +Aef::Linebreak.encoding?(mixed_windows_and_mac_string, :windows, :mac)
  96 +#=> true
  97 +~~~~~
  98 +
  99 +Note that the expected linebreak systems could also be given as an array or a
  100 +set.
  101 +
  102 +Alternatively you could include Linebreak into the String class and use it in
  103 +the following way:
  104 +
  105 +~~~~~ ruby
  106 +require 'aef/linebreak/string_extension'
  107 +
  108 +"Abcdef\nAbcdef\nAbcdef".linebreak_encode(:mac)
  109 +#=> "Abcdef\rAbcdef\rAbcdef"
  110 +
  111 +"Abcdef\r\nAbcdef\nAbcdef".linebreak_encodings
  112 +#=> #<Set: {:unix, :windows}>
  113 +
  114 +"Abcdef\nAbcdef\nAbcdef".linebreak_encoding?(:unix, :windows)
  115 +#=> false
  116 +
  117 +"Abcdef\nAbcdef\nAbcdef".linebreak_encoding?(:unix)
  118 +#=> true
  119 +~~~~~
  120 +
  121 +### Command-line tool
  122 +
  123 +The default output encoding is unix. You can also choose mac and windows.
  124 +
  125 + linebreak encode --system windows unix.txt windows.txt
  126 +
  127 +If no target file is specified the output will be sent to STDOUT.
  128 +
  129 + linebreak encode --system windows mac.txt > windows.txt
  130 +
  131 +You can set the default with the environment variable LINEBREAK_SYSTEM.
  132 +
  133 + export LINEBREAK_SYSTEM=mac
  134 +
  135 + linebreak encode windows.txt mac.txt
  136 +
  137 +If you do not specify an output file, output will be put to STDOUT. If you also
  138 +do not specify an input file, input will be expected from STDIN.
  139 +
  140 +You can also detect the linebreak systems contained in a file in the following
  141 +way:
  142 +
  143 + linebreak encodings windows_mac.txt
  144 +
  145 +If you want to ensure that a file contains the exact encodings systems you
  146 +specified, you can use the following command:
  147 +
  148 + linebreak encodings --ensure unix,windows,mac unix.txt
  149 +
  150 +The results will be outputted. In case of a file containing other linebreak
  151 +encoding systems there will be an exit code of 1.
  152 +
  153 +It is also possible to specify multiple input files or none to expect input from
  154 +STDIN.
  155 +
  156 +Requirements
  157 +------------
  158 +
  159 +* Ruby 1.8.7 or higher
  160 +* user-choices for command line tool
  161 +
  162 +Installation
  163 +------------
  164 +
  165 +On *nix systems you may need to prefix the command with sudo to get root
  166 +privileges.
  167 +
  168 +### High security (recommended)
  169 +
  170 +There is a high security installation option available through rubygems. It is
  171 +highly recommended over the normal installation, although it may be a bit less
  172 +comfortable. To use the installation method, you will need my public key, which
  173 +I use for cryptographic signatures on all my gems. You can find the public key
  174 +here: http://aef.name/crypto/aef-gem.pem
  175 +
  176 +Add the key to your rubygems' trusted certificates by the following command:
  177 +
  178 + gem cert --add aef-gem.pem
  179 +
  180 +Now you can install the gem while automatically verifying it's signature by the
  181 +following command:
  182 +
  183 + gem install linebreak -P HighSecurity
  184 +
  185 +Please notice that you may need other keys for dependent libraries, so you may
  186 +have to install dependencies manually.
  187 +
  188 +### Normal
  189 +
  190 + gem install linebreak
  191 +
  192 +### Automated testing
  193 +
  194 +Go into the root directory of the installed gem and run the following command
  195 +to fetch all development dependencies:
  196 +
  197 + bundle
  198 +
  199 +Afterwards start the test runner:
  200 +
  201 + rake spec
  202 +
  203 +If something goes wrong you should be noticed through failing examples.
  204 +
  205 +Development
  206 +-----------
  207 +
  208 +This software is developed in the source code management system git hosted
  209 +at github.com. You can download the most recent sourcecode through the
  210 +following command:
  211 +
  212 + git clone https://github.com/aef/linebreak.git
  213 +
  214 +Help on making this software better is always very appreciated. If you want
  215 +your changes to be included in the official release, please clone my project
  216 +on github.com, create a named branch to commit and push your changes in and
  217 +send me a pull request afterwards.
  218 +
  219 +Please make sure to write tests for your changes so that I won't break them
  220 +when changing other things on the library. Also notice that I can't promise
  221 +to include your changes before reviewing them.
  222 +
  223 +License
  224 +-------
  225 +
  226 +Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2012
  227 +
  228 +This file is part of Linebreak.
  229 +
  230 +Permission to use, copy, modify, and/or distribute this software for any
  231 +purpose with or without fee is hereby granted, provided that the above
  232 +copyright notice and this permission notice appear in all copies.
  233 +
  234 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  235 +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  236 +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  237 +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  238 +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  239 +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  240 +PERFORMANCE OF THIS SOFTWARE.
233 README.rdoc
Source Rendered
... ... @@ -1,233 +0,0 @@
1   -= Linebreak
2   -
3   -* Project: https://rubyforge.org/projects/linebreak/
4   -* RDoc: http://rdoc.info/projects/aef/linebreak/
5   -* RDoc: http://linebreak.rubyforge.org/
6   -* Github: http://github.com/aef/linebreak/
7   -
8   -== DESCRIPTION:
9   -
10   -Linebreak is a Ruby library and commandline tool for conversion of text
11   -between linebreak encoding formats of unix, windows or mac.
12   -
13   -== FEATURES/PROBLEMS:
14   -
15   -* Completely written in Ruby
16   -* Core class extensions are optionally loadable
17   -* Tested and fully working on:
18   - * Ubuntu Linux 9.04 i386_64
19   - * Ruby 1.8.7p72
20   - * Ruby 1.9.1p129
21   - * JRuby 1.3.1 (22 tests fail, but it's fully usable)
22   - * Debian GNU/Linux 4.0 i386
23   - * Ruby 1.8.6
24   - * Windows XP i386
25   - * Ruby 1.8.6 (tests fail completely because of problems with popen4)
26   -* The commandline tool does only work with a patched user-choices gem on Ruby
27   - 1.9 or higher. See the INSTALL section for further instructions.
28   -
29   -== SYNOPSIS:
30   -
31   -=== Commandline
32   -
33   -The default output encoding is unix. You can also choose mac and windows.
34   -
35   - linebreak encode --system windows unix.txt windows.txt
36   -
37   -If no target file is specified the output will be sent to STDOUT.
38   -
39   - linebreak encode --system windows mac.txt > windows.txt
40   -
41   -You can set the default with the environment variable LINEBREAK_SYSTEM.
42   -
43   - export LINEBREAK_SYSTEM=mac
44   -
45   - linebreak encode windows.txt mac.txt
46   -
47   -If you do not specify an output file, output will be put to STDOUT. If you also
48   -do not specify an input file, input will be expected from STDIN.
49   -
50   -You can also detect the linebreak systems contained in a file in the following
51   -way:
52   -
53   - linebreak encodings windows_mac.txt
54   -
55   -If you want to ensure that a file contains the exact encodings systems you
56   -specified, you can use the following command:
57   -
58   - linebreak encodings --ensure unix,windows,mac unix.txt
59   -
60   -The results will be outputted. In case of a file containing other linebreak
61   -encoding systems there will be an exit code of 1.
62   -
63   -It is also possible to specify multiple input files or none to expect input from
64   -STDIN.
65   -
66   -=== Library
67   -
68   -First of all you have to load the Linebreak gem:
69   -
70   - require 'aef/linebreak'
71   -
72   -You can put strings or objects responding to to_s into the method and
73   -optionally define a target linebreak encoding. The default encoding is :unix.
74   -You can also choose :mac and :windows. Notice that the :mac encoding is
75   -deprecated. Modern Apple machines also use :unix linebreak encoding, while
76   -Commodore machines also use the :mac linebreak encoding.
77   -
78   - windows_string = "Abcdef\r\nAbcdef\r\nAbcdef"
79   -
80   - Aef::Linebreak.encode(windows_string, :unix)
81   - #=> "Abcdef\nAbcdef\nAbcdef"
82   -
83   -You can detect which decoding systems are used in a string:
84   -
85   - mixed_unix_and_mac_string = "Abcdef\rAbcdef\nAbcdef"
86   -
87   - Aef::Linebreak.encodings(mixed_unix_and_mac_string)
88   - #=> #<Set: {:unix, :mac}>
89   -
90   -You can also easily ensure that a string contains exactly the linebreak
91   -encodings you expect it to contain:
92   -
93   - mixed_windows_and_mac_string = "Abcdef\r\nAbcdef\rAbcdef"
94   -
95   - Aef::Linebreak.encoding?(mixed_windows_and_mac_string, :windows)
96   - #=> false
97   -
98   - Aef::Linebreak.encoding?(mixed_windows_and_mac_string, :windows, :mac)
99   - #=> true
100   -
101   -Note that the expected linebreak systems could also be given as an array or a
102   -set.
103   -
104   -Alternatively you could include Linebreak into the String class and use it in
105   -the following way:
106   -
107   - require 'aef/linebreak/string_extension'
108   -
109   - "Abcdef\nAbcdef\nAbcdef".linebreak_encode(:mac)
110   - #=> "Abcdef\rAbcdef\rAbcdef"
111   -
112   - "Abcdef\r\nAbcdef\nAbcdef".linebreak_encodings
113   - #=> #<Set: {:unix, :windows}>
114   -
115   - "Abcdef\nAbcdef\nAbcdef".linebreak_encoding?(:unix, :windows)
116   - #=> false
117   -
118   - "Abcdef\nAbcdef\nAbcdef".linebreak_encoding?(:unix)
119   - #=> true
120   -
121   -== REQUIREMENTS:
122   -
123   -* rubygems
124   -
125   -=== Additional for commandline
126   -* user-choices
127   -
128   -=== Additional for automated testing
129   -* hoe
130   -* rspec
131   -* popen4
132   -
133   -== INSTALL:
134   -
135   -On *nix systems you may need to prefix the command with sudo to get root
136   -privileges.
137   -
138   -If you want to use the commandline tool you need to install the following gem
139   -manually:
140   -
141   - gem install user-choices
142   -
143   -On Ruby 1.9 or higher you need to install an inofficially updated version from
144   -github instead:
145   -
146   - gem install qoobaa-user-choices --source http://gems.github.com
147   -
148   -You could also patch the normal user-choices gem yourself with a patch written
149   -by me. You can find it here: https://rubyforge.org/tracker/index.php?func=detail&aid=24307&group_id=4192&atid=16176
150   -
151   -=== High security (recommended)
152   -
153   -There is a high security installation option available through rubygems. It is
154   -highly recommended over the normal installation, although it may be a bit less
155   -comfortable. To use the installation method, you will need my public key, which
156   -I use for cryptographic signatures on all my gems. You can find the public key
157   -and more detailed verification information in the aef-certificates section of my
158   -rubyforge project[https://rubyforge.org/frs/?group_id=7890&release_id=31749]
159   -
160   -Add the key to your rubygems' trusted certificates by the following command:
161   -
162   - gem cert --add aef.pem
163   -
164   -Now you can install the gem while automatically verifying it's signature by the
165   -following command:
166   -
167   - gem install linebreak --ignore-dependencies -P HighSecurity
168   -
169   -Please notice that you may need other keys for dependent libraries, so you may
170   -have to install dependencies manually.
171   -
172   -=== Normal (insecure)
173   -
174   - gem install linebreak
175   -
176   -=== Github (also insecure)
177   -
178   -Alternatively you could install linebreak from github which may be a bit more
179   -up to date. The version may however not be as stable as the normal gem and there
180   -is no way to install the gem securely. Therefore this is not recommended.
181   -
182   - gem install aef-linebreak --source http://gems.github.com
183   -
184   -=== Automated testing
185   -
186   -You can test this package through rspec on your system. First find the path
187   -where the gem was installed to:
188   -
189   - gem which aef/linebreak
190   -
191   -Go into the root directory of the installed gem and run the following command
192   -to start the test runner:
193   -
194   - rake spec
195   -
196   -If something goes wrong you should be noticed through failing examples.
197   -
198   -== DEVELOPMENT:
199   -
200   -This software is developed in the source code management system git hosted
201   -at github.com. You can download the most recent sourcecode through the following
202   -command:
203   -
204   - git clone git://github.com/aef/linebreak.git
205   -
206   -Help on making this software better is always very appreciated. If you want your
207   -changes to be included in the official release, please send me a patch through
208   -the project's tracker[https://rubyforge.org/tracker/?group_id=7890] at
209   -rubyforge.org. You can generate a patch-file by the following command:
210   -
211   - git diff > patch.diff
212   -
213   -Please make sure to write tests for your changes and notice that I can't promise
214   -to include your changes before reviewing them.
215   -
216   -== LICENSE:
217   -
218   -Copyright 2009 Alexander E. Fischer <aef@raxys.net>
219   -
220   -This file is part of Linebreak.
221   -
222   -Linebreak is free software: you can redistribute it and/or modify
223   -it under the terms of the GNU General Public License as published by
224   -the Free Software Foundation, either version 3 of the License, or
225   -(at your option) any later version.
226   -
227   -This program is distributed in the hope that it will be useful,
228   -but WITHOUT ANY WARRANTY; without even the implied warranty of
229   -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
230   -GNU General Public License for more details.
231   -
232   -You should have received a copy of the GNU General Public License
233   -along with this program. If not, see <http://www.gnu.org/licenses/>.
47 Rakefile
@@ -17,26 +17,31 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 17 PERFORMANCE OF THIS SOFTWARE.
18 18 =end
19 19
20   -require 'rubygems'
21   -require 'hoe'
22   -
23   -Hoe.spec('linebreak') do
24   - developer('Alexander E. Fischer', 'aef@raxys.net')
25   -
26   - self.rubyforge_name = 'linebreak'
27   - self.extra_dev_deps = {
28   - 'user-choices' => '>= 1.1.6',
29   - 'rspec' => '>= 1.2.8',
30   - 'popen4' => '>= 0.1.2'
31   - }
32   - self.url = 'https://rubyforge.org/projects/linebreak/'
33   - self.readme_file = 'README.rdoc'
34   - self.extra_rdoc_files = %w{README.rdoc}
35   - self.spec_extras = {
36   - :rdoc_options => ['--main', 'README.rdoc', '--inline-source', '--line-numbers', '--title', 'Linebreak']
37   - }
38   - self.rspec_options = ['--options', 'spec/spec.opts']
39   - self.remote_rdoc_dir = ''
  20 +require 'rake'
  21 +require 'pathname'
  22 +require 'bundler/gem_tasks'
  23 +require 'yard'
  24 +require 'rspec/core/rake_task'
  25 +
  26 +RSpec::Core::RakeTask.new
  27 +
  28 +YARD::Rake::YardocTask.new('doc')
  29 +
  30 +desc "Removes temporary project files"
  31 +task :clean do
  32 + %w{doc coverage pkg .yardoc .rbx Gemfile.lock}.map{|name| Pathname.new(name) }.each do |path|
  33 + path.rmtree if path.exist?
  34 + end
  35 +
  36 + Pathname.glob('*.gem').each &:delete
  37 + Pathname.glob('**/*.rbc').each &:delete
  38 +end
  39 +
  40 +desc "Opens an interactive console with the library loaded"
  41 +task :console do
  42 + require 'pry'
  43 + require 'linebreak'
  44 + Pry.start
40 45 end
41 46
42   -# vim: syntax=Ruby
  47 +task :default => :spec
2  bin/linebreak
... ... @@ -1,7 +1,7 @@
1 1 #!/usr/bin/env ruby
2 2 # encoding: UTF-8
3 3 =begin
4   -Copyright Alexander E. Fischer <aef@raxys.net>, 2012
  4 +Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2012
5 5
6 6 This file is part of Linebreak.
7 7
26 lib/aef/linebreak/commands/version.rb
@@ -21,20 +21,18 @@
21 21
22 22 class Aef::Linebreak::VersionCommand
23 23 def execute
24   - name = 'Linebreak'
25   - puts "#{name} #{Aef::Linebreak::VERSION}"
26   - puts
27   - puts 'Project: https://rubyforge.org/projects/linebreak/'
28   - puts "RDoc: http://#{name.downcase}.rubyforge.org/"
29   - puts "Github: http://github.com/aef/#{name.downcase}/"
30   - puts
31   - puts 'Copyright 2009 Alexander E. Fischer <aef@raxys.net>'
32   - # Read and print licensing information from the top of this file
33   - if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('1.8.6')
34   - puts File.read(__FILE__).map{|line| line[2..-1]}[3..15]
35   - else
36   - puts File.read(__FILE__).lines.map{|line| line[2..-1]}[3..15]
37   - end
  24 + # Read licensing information from the top of this file
  25 + license = File.read(__FILE__)[/=begin\n(.*)\n=end/m, 1]
  26 +
  27 + puts <<-TEXT
  28 +Linebreak #{Aef::Linebreak::VERSION}
  29 +
  30 +Project: https://github.com/aef/linebreak/
  31 +Documentation: http://rubydoc.info/aef/linebreak/
  32 +
  33 +#{license}
  34 + TEXT
  35 +
38 36 exit false
39 37 end
40 38 end
4 lib/aef/linebreak/linebreak.rb
@@ -33,8 +33,6 @@ module Aef::Linebreak
33 33 autoload :EncodingsCommand, 'aef/linebreak/commands/encodings'
34 34 autoload :VersionCommand, 'aef/linebreak/commands/version'
35 35
36   - VERSION = '1.3.1'
37   -
38 36 BREAK_BY_SYSTEM = {
39 37 :unix => "\n",
40 38 :windows => "\r\n",
@@ -124,3 +122,5 @@ def linebreak_encode(system_or_replacement = :unix)
124 122 Aef::Linebreak.encode(self, system_or_replacement)
125 123 end
126 124 end
  125 +
  126 +require 'aef/linebreak/version'
30 lib/aef/linebreak/version.rb
... ... @@ -0,0 +1,30 @@
  1 +# encoding: UTF-8
  2 +=begin
  3 +Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2012
  4 +
  5 +This file is part of Linebreak.
  6 +
  7 +Permission to use, copy, modify, and/or distribute this software for any
  8 +purpose with or without fee is hereby granted, provided that the above
  9 +copyright notice and this permission notice appear in all copies.
  10 +
  11 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  12 +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  13 +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14 +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  15 +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  16 +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17 +PERFORMANCE OF THIS SOFTWARE.
  18 +=end
  19 +
  20 +module Aef
  21 + module Linebreak
  22 +
  23 + # The currently loaded library version
  24 + #
  25 + # Using Semantic Versioning (2.0.0-rc.1) rules
  26 + # @see http://semver.org/
  27 + VERSION = '2.0.0pre.1'.freeze
  28 +
  29 + end
  30 +end
4 lib/linebreak.rb
@@ -19,6 +19,4 @@
19 19
20 20 require 'aef/linebreak'
21 21
22   -String.call(:include, Aef::Linebreak)
23   -
24   -::Linebreak = Aef::Linebreak unless defined?(::Linebreak)
  22 +String.send(:include, Aef::Linebreak)
75 linebreak.gemspec
@@ -17,46 +17,41 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 17 PERFORMANCE OF THIS SOFTWARE.
18 18 =end
19 19
  20 +require File.expand_path('../lib/aef/linebreak/version', __FILE__)
  21 +
20 22 Gem::Specification.new do |s|
21   - s.name = %q{linebreak}
22   - s.version = "1.3.1"
23   -
24   - s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
25   - s.authors = ["Alexander E. Fischer"]
26   - s.date = %q{2009-09-16}
27   - s.default_executable = %q{linebreak}
28   - s.description = %q{Linebreak is a Ruby library and commandline tool for conversion of text
29   -between linebreak encoding formats of unix, windows or mac.}
30   - s.email = ["aef@raxys.net"]
31   - s.executables = ["linebreak"]
32   - s.extra_rdoc_files = ["History.txt", "Manifest.txt", "COPYING.txt", "README.rdoc"]
33   - s.files = ["History.txt", "Manifest.txt", "README.rdoc", "COPYING.txt", "Rakefile", "bin/linebreak", "lib/aef/linebreak.rb", "lib/aef/linebreak/string_extension.rb", "lib/aef/linebreak/commands/encode.rb", "lib/aef/linebreak/commands/encodings.rb", "lib/aef/linebreak/commands/version.rb", "lib/aef/linebreak/pathname_conversion.rb", "lib/aef/linebreak/linebreak.rb", "spec/spec_helper.rb", "spec/linebreak_spec.rb", "spec/spec.opts", "spec/fixtures/unix.txt", "spec/fixtures/windows.txt", "spec/fixtures/mac.txt", "spec/fixtures/unix_windows.txt", "spec/fixtures/windows_mac.txt", "spec/fixtures/mac_unix.txt", "spec/fixtures/unix_windows_mac.txt"]
34   - s.homepage = %q{https://rubyforge.org/projects/linebreak/}
35   - s.rdoc_options = ["--main", "README.rdoc", "--inline-source", "--line-numbers", "--title", "Linebreak"]
  23 + s.name = 'linebreak'
  24 + s.version = Aef::Linebreak::VERSION.dup
  25 + s.authors = ['Alexander E. Fischer']
  26 + s.email = ['aef@raxys.net']
  27 + s.homepage = 'http://github.com/aef/linebreak'
  28 + s.license = 'ISC'
  29 + s.summary = 'Easy linebreak system conversion'
  30 + s.description = <<-DESCRIPTION
  31 +Linebreak is a Ruby library and commandline tool for conversion of text
  32 +between linebreak encoding formats of unix, windows or mac.
  33 + DESCRIPTION
  34 +
  35 + s.rubyforge_project = nil
  36 + s.has_rdoc = 'yard'
  37 + s.extra_rdoc_files = ['HISTORY.md', 'LICENSE.md']
  38 +
  39 + s.files = `git ls-files`.lines.map(&:chomp)
  40 + s.test_files = `git ls-files -- {test,spec,features}/*`.lines.map(&:chomp)
  41 + s.executables = `git ls-files -- bin/*`.lines.map{|f| File.basename(f.chomp) }
36 42 s.require_paths = ["lib"]
37   - s.rubyforge_project = %q{linebreak}
38   - s.rubygems_version = %q{1.3.5}
39   - s.summary = %q{Linebreak is a Ruby library and commandline tool for conversion of text between linebreak encoding formats of unix, windows or mac.}
40   -
41   - if s.respond_to? :specification_version then
42   - current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43   - s.specification_version = 3
44   -
45   - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46   - s.add_development_dependency(%q<rspec>, [">= 1.2.8"])
47   - s.add_development_dependency(%q<popen4>, [">= 0.1.2"])
48   - s.add_development_dependency(%q<user-choices>, [">= 1.1.6"])
49   - s.add_development_dependency(%q<hoe>, [">= 2.3.2"])
50   - else
51   - s.add_dependency(%q<rspec>, [">= 1.2.8"])
52   - s.add_dependency(%q<popen4>, [">= 0.1.2"])
53   - s.add_dependency(%q<user-choices>, [">= 1.1.6"])
54   - s.add_dependency(%q<hoe>, [">= 2.3.2"])
55   - end
56   - else
57   - s.add_dependency(%q<rspec>, [">= 1.2.8"])
58   - s.add_dependency(%q<popen4>, [">= 0.1.2"])
59   - s.add_dependency(%q<user-choices>, [">= 1.1.6"])
60   - s.add_dependency(%q<hoe>, [">= 2.3.2"])
61   - end
  43 +
  44 + s.required_ruby_version = '>= 1.8.7'
  45 +
  46 + s.add_development_dependency('bundler', '~> 1.0.21')
  47 + s.add_development_dependency('rake', '~> 0.9.2')
  48 + s.add_development_dependency('rspec', '~> 2.6.0')
  49 + s.add_development_dependency('simplecov', '~> 0.5.4')
  50 + s.add_development_dependency('pry', '~> 0.9.8')
  51 + s.add_development_dependency('yard', '~> 0.7.5')
  52 + s.add_development_dependency('maruku', '~> 0.6.0')
  53 + s.add_development_dependency('popen4', '~> 0.1.2')
  54 +
  55 + s.cert_chain = "#{ENV['GEM_CERT_CHAIN']}".split(':')
  56 + s.signing_key = ENV['GEM_SIGNING_KEY']
62 57 end
7 nbproject/project.properties
... ... @@ -1,7 +0,0 @@
1   -javac.classpath=
2   -main.file=
3   -platform.active=Ruby
4   -source.encoding=UTF-8
5   -src.bin.dir=bin
6   -src.lib.dir=lib
7   -test.spec.dir=spec
16 nbproject/project.xml
... ... @@ -1,16 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<project xmlns="http://www.netbeans.org/ns/project/1">
3   - <type>org.netbeans.modules.ruby.rubyproject</type>
4   - <configuration>
5   - <data xmlns="http://www.netbeans.org/ns/ruby-project/1">
6   - <name>linebreak</name>
7   - <source-roots>
8   - <root id="src.lib.dir"/>
9   - <root id="src.bin.dir"/>
10   - </source-roots>
11   - <test-roots>
12   - <root id="test.spec.dir"/>
13   - </test-roots>
14   - </data>
15   - </configuration>
16   -</project>
38 spec/linebreak_spec.rb
... ... @@ -1,21 +1,23 @@
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 it under the
6   -# terms of the GNU General Public License as published by the Free Software
7   -# Foundation, either version 3 of the License, or (at your option) any later
8   -# version.
9   -#
10   -# This program is distributed in the hope that it will be useful, but WITHOUT
11   -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12   -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13   -# details.
14   -#
15   -# You should have received a copy of the GNU General Public License along with
16   -# this program. If not, see <http://www.gnu.org/licenses/>.
17   -
18   -require 'spec/spec_helper'
  1 +# encoding: UTF-8
  2 +=begin
  3 +Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2012
  4 +
  5 +This file is part of Linebreak.
  6 +
  7 +Permission to use, copy, modify, and/or distribute this software for any
  8 +purpose with or without fee is hereby granted, provided that the above
  9 +copyright notice and this permission notice appear in all copies.
  10 +
  11 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  12 +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  13 +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14 +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  15 +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  16 +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17 +PERFORMANCE OF THIS SOFTWARE.
  18 +=end
  19 +
  20 +require 'spec_helper'
19 21
20 22 describe Aef::Linebreak do
21 23 include LinebreakSpecHelper
75 spec/spec_helper.rb
... ... @@ -1,28 +1,27 @@
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   -
  1 +# encoding: UTF-8
  2 +=begin
  3 +Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2012
  4 +
  5 +This file is part of Linebreak.
  6 +
  7 +Permission to use, copy, modify, and/or distribute this software for any
  8 +purpose with or without fee is hereby granted, provided that the above
  9 +copyright notice and this permission notice appear in all copies.
  10 +
  11 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  12 +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  13 +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14 +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  15 +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  16 +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17 +PERFORMANCE OF THIS SOFTWARE.
  18 +=end
  19 +
  20 +require 'rspec'
18 21 require 'tempfile'
19 22 require 'rbconfig'
20   -require 'rubygems'
21 23 require 'popen4'
22   -
23   -$LOAD_PATH.unshift('lib')
24   -
25   -require 'aef/linebreak/string_extension'
  24 +require 'linebreak'
26 25
27 26 module LinebreakSpecHelper
28 27 INTERPRETER = Pathname(RbConfig::CONFIG['bindir']) + RbConfig::CONFIG['ruby_install_name']
@@ -80,24 +79,24 @@ def version_message
80 79 <<-EOS
81 80 Linebreak #{Aef::Linebreak::VERSION}
82 81
83   -Project: https://rubyforge.org/projects/linebreak/
84   -RDoc: http://linebreak.rubyforge.org/
85   -Github: http://github.com/aef/linebreak/
  82 +Project: https://github.com/aef/linebreak/
  83 +Documentation: http://rubydoc.info/aef/linebreak/
86 84
87   -Copyright 2009 Alexander E. Fischer <aef@raxys.net>
  85 +Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2012
88 86
89   -Linebreak is free software: you can redistribute it and/or modify it under the
90   -terms of the GNU General Public License as published by the Free Software
91   -Foundation, either version 3 of the License, or (at your option) any later
92   -version.
  87 +This file is part of Linebreak.
93 88
94   -This program is distributed in the hope that it will be useful, but WITHOUT
95   -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
96   -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
97   -details.
  89 +Permission to use, copy, modify, and/or distribute this software for any
  90 +purpose with or without fee is hereby granted, provided that the above
  91 +copyright notice and this permission notice appear in all copies.
98 92
99   -You should have received a copy of the GNU General Public License along with
100   -this program. If not, see <http://www.gnu.org/licenses/>.
  93 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  94 +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  95 +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  96 +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  97 +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  98 +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  99 +PERFORMANCE OF THIS SOFTWARE.
101 100 EOS
102 101 end
103 102
@@ -123,7 +122,7 @@ def env(environment = {})
123 122 end
124 123 end
125 124
126   -if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.8.7')
  125 +if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('1.8.7')
127 126 warn %{\nThe 16 specs of the "encodings" methods fail on 1.8.6 and } +
128 127 'below because of invalid hash comparison which affects ' +
129 128 'comparison of the result Sets. This should not be a big problem.'
@@ -135,6 +134,6 @@ def env(environment = {})
135 134 'commandline tool should still work fine.'
136 135 end
137 136
138   -Spec::Runner.configure do |config|
  137 +RSpec.configure do |config|
139 138 config.include LinebreakSpecHelper
140 139 end

0 comments on commit 28461ca

Please sign in to comment.
Something went wrong with that request. Please try again.