dictionary_order_sort 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Dictionary Order Sort
2
2
 
3
- Sorts an array of strings in the same manner as the Linux `sort` command running with the `--dictionary-order` option. Only blanks and alphanumeric characters are considered.
3
+ [![Build Status](https://secure.travis-ci.org/ndbroadbent/dictionary_order_sort.png)](http://travis-ci.org/ndbroadbent/dictionary_order_sort)
4
4
 
5
- I created this gem after trying to use the `comm` command in a Capistrano recipe, with the files being sorted in Ruby. `comm` requires the input files to be sorted using the collating sequence specified by `LC_COLLATE', and this defaults to dictionary sort.
5
+ Sorts an array of strings in the same manner as the Linux `sort` command running with the `--dictionary-order` option. Only blanks and alphanumeric characters are considered.
6
6
 
7
- In the end, I just piped the files to the Linux `sort` command, but I decided to write it anyway and release it as a tiny gem.
7
+ I created this gem because I needed to use the `comm` command in a Capistrano recipe, and wanted to sort the list of files in Ruby. `comm` requires the input files to be sorted using the collating sequence specified by `LC_COLLATE', and this defaults to dictionary sort.
8
8
 
9
9
  # Installation
10
10
 
@@ -24,4 +24,4 @@ Use it like this:
24
24
  ["a", "a-2", "_a-3", "abc_", "_def_"].dict_sort
25
25
 
26
26
  #=> ["a", "a-2", "_a-3", "abc_", "_def_"]
27
- ```
27
+ ```
data/Rakefile CHANGED
@@ -5,24 +5,11 @@ ENV["TEST_CORES"] = "1"
5
5
  require 'bundler'
6
6
  Bundler::GemHelper.install_tasks
7
7
 
8
- namespace :test do
9
- task :isolated do
10
- Dir["test/assets*_test.rb"].each do |file|
11
- dash_i = [
12
- 'test',
13
- 'lib',
14
- ]
15
- ruby "-I#{dash_i.join ':'}", file
16
- end
17
- end
18
- end
19
-
20
- Rake::TestTask.new("test:regular") do |t|
8
+ Rake::TestTask.new("test") do |t|
21
9
  t.libs << 'lib'
22
10
  t.libs << 'test'
23
- t.pattern = 'test/**/sprockets*_test.rb'
11
+ t.pattern = 'test/*_test.rb'
24
12
  t.verbose = true
25
13
  end
26
14
 
27
- task :test => ['test:isolated', 'test:regular']
28
15
  task :default => :test
@@ -0,0 +1,5 @@
1
+ class Set
2
+ def dict_sort
3
+ to_a.dict_sort
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module DictionaryOrderSort
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -1 +1,2 @@
1
1
  require 'dictionary_order_sort/array'
2
+ require 'dictionary_order_sort/set'
@@ -9,9 +9,13 @@ class TestArrayDictSort < MiniTest::Unit::TestCase
9
9
  def test_dict_sort
10
10
  arr = ['a', 'a-2', '_a-3', 'abc_', '_def_', 'b', 'ce', 'd_a', '-b_', '___b']
11
11
 
12
- system_sort = `echo #{arr.join("\\\\n")} | sort`.split
12
+ system_sort = `echo #{arr.join("\\\\n")} | sort --dictionary-order`.split
13
13
  ruby_sort = arr.dict_sort
14
14
 
15
15
  assert_equal ruby_sort, system_sort
16
16
  end
17
+
18
+ def test_set
19
+ assert Set.new.respond_to?(:dict_sort)
20
+ end
17
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dictionary_order_sort
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-30 00:00:00.000000000 Z
12
+ date: 2012-11-09 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Sort an array in the same order as `sort --dictionary-sort`
15
15
  email:
@@ -19,6 +19,7 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - lib/dictionary_order_sort.rb
22
+ - lib/dictionary_order_sort/set.rb
22
23
  - lib/dictionary_order_sort/array.rb
23
24
  - lib/dictionary_order_sort/version.rb
24
25
  - MIT-LICENSE
@@ -39,7 +40,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
39
40
  version: '0'
40
41
  segments:
41
42
  - 0
42
- hash: -4262464269304816571
43
+ hash: -2472803673037020292
43
44
  required_rubygems_version: !ruby/object:Gem::Requirement
44
45
  none: false
45
46
  requirements:
@@ -48,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
49
  version: '0'
49
50
  segments:
50
51
  - 0
51
- hash: -4262464269304816571
52
+ hash: -2472803673037020292
52
53
  requirements: []
53
54
  rubyforge_project:
54
55
  rubygems_version: 1.8.24