line_ending 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/CHANGELOG +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.me +3 -0
- data/Rakefile +8 -0
- data/lib/line_ending.rb +18 -0
- data/lib/line_ending/version.rb +3 -0
- data/line_ending.gemspec +22 -0
- data/test/test_line_ending.rb +41 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 34e908fcc12f45f607a2ffea964625de5d2453a5
|
4
|
+
data.tar.gz: e8c6a06d5aa4a5d227a9cefe592728fa94b70238
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fccec0bca44b3ce9bf70e1ee1b54787abe7c3794534287061912232e7ad6cee10a2e569271a5979008d713bffcdd237ebb8716ffd559a691ff518f1acdee1cee
|
7
|
+
data.tar.gz: 8548d9b30cc67ab89495cad9e5363f294ad503a78038ad0080311aca47c46440fbadf3477bf8ed71c0fdc097de707f73de7437d35112a1178587dea833f72f75
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.me
ADDED
data/Rakefile
ADDED
data/lib/line_ending.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "line_ending/version"
|
2
|
+
|
3
|
+
module LineEnding
|
4
|
+
|
5
|
+
module Ending
|
6
|
+
Mac = "\r"
|
7
|
+
Windows = "\r\n"
|
8
|
+
Unix = "\n"
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.included(cls)
|
12
|
+
include Ending
|
13
|
+
end
|
14
|
+
|
15
|
+
def change_line_ending(input, new_ending)
|
16
|
+
input.gsub(/(\n)|(\r\n?)/, Ending.const_get(new_ending))
|
17
|
+
end
|
18
|
+
end
|
data/line_ending.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'line_ending/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "line_ending"
|
8
|
+
spec.version = LineEnding::VERSION
|
9
|
+
spec.authors = ["Stephan Kaag"]
|
10
|
+
spec.email = ["stephan@ka.ag"]
|
11
|
+
spec.description = "A little mixin to change the line endings of files. Supports Mac, Unix and Windows ending conversions."
|
12
|
+
spec.summary = "Mixin to fix line endings of files"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler"
|
3
|
+
|
4
|
+
Bundler.require(:default, :test)
|
5
|
+
|
6
|
+
require "minitest/autorun"
|
7
|
+
require "minitest/pride"
|
8
|
+
|
9
|
+
class TestLineEnding < MiniTest::Unit::TestCase
|
10
|
+
|
11
|
+
class TLE
|
12
|
+
include LineEnding
|
13
|
+
end
|
14
|
+
|
15
|
+
def setup
|
16
|
+
@tle = TLE.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def teardown
|
20
|
+
@tle = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
module Samples
|
24
|
+
Mac = ["a\rb\rc\r", "a\rb\rc\r\r\r", "a\rb\rc\r\r"]
|
25
|
+
Unix = ["a\nb\nc\n", "a\nb\nc\n\n\n", "a\nb\nc\n\n"]
|
26
|
+
Windows = ["a\r\nb\r\nc\r\n", "a\r\nb\r\nc\r\n\r\n\r\n", "a\r\nb\r\nc\r\n\r\n"]
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_string_to_string
|
30
|
+
Samples.constants.each do |ending1|
|
31
|
+
Samples.constants.each do |ending2|
|
32
|
+
3.times do |i|
|
33
|
+
expectation = Samples.const_get(ending2)[i]
|
34
|
+
value = @tle.change_line_ending(Samples.const_get(ending1)[i], ending2)
|
35
|
+
|
36
|
+
assert_equal value, expectation
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: line_ending
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephan Kaag
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A little mixin to change the line endings of files. Supports Mac, Unix
|
42
|
+
and Windows ending conversions.
|
43
|
+
email:
|
44
|
+
- stephan@ka.ag
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- CHANGELOG
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.me
|
54
|
+
- Rakefile
|
55
|
+
- lib/line_ending.rb
|
56
|
+
- lib/line_ending/version.rb
|
57
|
+
- line_ending.gemspec
|
58
|
+
- test/test_line_ending.rb
|
59
|
+
homepage:
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.0.3
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Mixin to fix line endings of files
|
83
|
+
test_files:
|
84
|
+
- test/test_line_ending.rb
|