i18n_yaml_sorter_2 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +35 -0
- data/LICENSE +20 -0
- data/README.rdoc +236 -0
- data/Rakefile +6 -0
- data/VERSION +1 -0
- data/bin/sort_yaml +38 -0
- data/i18n_yaml_sorter.gemspec +54 -0
- data/lib/i18n_yaml_sorter.rb +2 -0
- data/lib/i18n_yaml_sorter/railtie.rb +10 -0
- data/lib/i18n_yaml_sorter/sorter.rb +128 -0
- data/lib/tasks/i18n_yaml_sorter.rake +16 -0
- data/test/helper.rb +18 -0
- data/test/in.yml +66 -0
- data/test/in_rails.yml +239 -0
- data/test/in_simple.yml +28 -0
- data/test/out.yml +61 -0
- data/test/out_rails.yml +220 -0
- data/test/out_simple.yml +28 -0
- data/test/test_i18n_yaml_sorter.rb +48 -0
- data/textmate/YAML Sort.tmbundle/Commands/Sort YAML.tmCommand +22 -0
- data/textmate/YAML Sort.tmbundle/info.plist +10 -0
- metadata +118 -0
data/test/out_simple.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
en-US:
|
2
|
+
# Note that our comments are important:
|
3
|
+
# Don't let your yaml sorter delete them!
|
4
|
+
apples: >
|
5
|
+
Apples are fine,
|
6
|
+
just don't eat your
|
7
|
+
iPods!
|
8
|
+
bananas: |
|
9
|
+
Bananas are "nice":
|
10
|
+
- They are <b> sweet </b>.
|
11
|
+
this: not a key
|
12
|
+
|
13
|
+
That is why everyone like bananas!
|
14
|
+
grapes: We dont' eat them.
|
15
|
+
pt-BR:
|
16
|
+
# Note how this is a nice way of inputing
|
17
|
+
# paragraphs of text in YAML.
|
18
|
+
apples: >
|
19
|
+
Maçãs são boas,
|
20
|
+
só não coma
|
21
|
+
seus iPods!
|
22
|
+
bananas: |
|
23
|
+
Bananas são "legais":
|
24
|
+
- Elas são <b> doces </b>.
|
25
|
+
isto: não é chave
|
26
|
+
|
27
|
+
Por isto todos gostam de bananas!
|
28
|
+
grapes: Não comemos elas.
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class TestI18nYamlSorter < Test::Unit::TestCase
|
4
|
+
def test_should_sort_complex_sample_file
|
5
|
+
open(File.dirname(__FILE__) + '/in.yml') do |file|
|
6
|
+
sorter = I18nYamlSorter::Sorter.new(file)
|
7
|
+
open(File.dirname(__FILE__) + '/out.yml') do |expected_out|
|
8
|
+
assert_equal expected_out.read, sorter.sort
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_should_rails_i18n_default_file
|
14
|
+
open(File.dirname(__FILE__) + '/in_rails.yml') do |file|
|
15
|
+
sorter = I18nYamlSorter::Sorter.new(file)
|
16
|
+
open(File.dirname(__FILE__) + '/out_rails.yml') do |expected_out|
|
17
|
+
assert_equal expected_out.read, sorter.sort
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_should_sort_simple_text_file
|
23
|
+
open(File.dirname(__FILE__) + '/in_simple.yml') do |file|
|
24
|
+
sorter = I18nYamlSorter::Sorter.new(file)
|
25
|
+
open(File.dirname(__FILE__) + '/out_simple.yml') do |expected_out|
|
26
|
+
assert_equal expected_out.read, sorter.sort
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_should_not_alter_the_serialized_yaml
|
32
|
+
#ordering should'n t change a thing, since hashes don't have order in Ruby
|
33
|
+
open(File.dirname(__FILE__) + '/in.yml') do |file|
|
34
|
+
sorter = I18nYamlSorter::Sorter.new(file)
|
35
|
+
present = YAML::load(file.read)
|
36
|
+
file.rewind
|
37
|
+
future = YAML::load(sorter.sort)
|
38
|
+
assert_equal present, future
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_command_line_should_work_in_stdin
|
43
|
+
output = `#{File.dirname(__FILE__)}/../bin/sort_yaml < #{File.dirname(__FILE__)}/in.yml`
|
44
|
+
open(File.dirname(__FILE__) + '/out.yml') do |expected_out|
|
45
|
+
assert_equal expected_out.read, output
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>beforeRunningCommand</key>
|
6
|
+
<string>nop</string>
|
7
|
+
<key>command</key>
|
8
|
+
<string>sort_yaml</string>
|
9
|
+
<key>input</key>
|
10
|
+
<string>selection</string>
|
11
|
+
<key>keyEquivalent</key>
|
12
|
+
<string>@S</string>
|
13
|
+
<key>name</key>
|
14
|
+
<string>Sort YAML</string>
|
15
|
+
<key>output</key>
|
16
|
+
<string>replaceSelectedText</string>
|
17
|
+
<key>scope</key>
|
18
|
+
<string>source.yaml</string>
|
19
|
+
<key>uuid</key>
|
20
|
+
<string>190B37B2-9070-4F27-97DA-10ABC11EEF2D</string>
|
21
|
+
</dict>
|
22
|
+
</plist>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>name</key>
|
6
|
+
<string>YAML Sort</string>
|
7
|
+
<key>uuid</key>
|
8
|
+
<string>9C66740A-912D-4940-92C7-60B6D5984871</string>
|
9
|
+
</dict>
|
10
|
+
</plist>
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: i18n_yaml_sorter_2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bernardo de Pádua
|
8
|
+
- compiledwrong
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2081-04-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
description: " Allows you to deep sort YAML files that are mainly composed of \n nested
|
57
|
+
hashes and string values. Great to sort your rails I18n YAML files. You can easily\n
|
58
|
+
\ add it to a textmate bundle, rake task, or just use the included regular comand
|
59
|
+
line tool. \n "
|
60
|
+
email:
|
61
|
+
- berpasan@gmail.com
|
62
|
+
- compiledwrong+i18n_yaml_sorter@gmail.com
|
63
|
+
executables:
|
64
|
+
- sort_yaml
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files:
|
67
|
+
- LICENSE
|
68
|
+
- README.rdoc
|
69
|
+
files:
|
70
|
+
- ".document"
|
71
|
+
- Gemfile
|
72
|
+
- Gemfile.lock
|
73
|
+
- LICENSE
|
74
|
+
- README.rdoc
|
75
|
+
- Rakefile
|
76
|
+
- VERSION
|
77
|
+
- bin/sort_yaml
|
78
|
+
- i18n_yaml_sorter.gemspec
|
79
|
+
- lib/i18n_yaml_sorter.rb
|
80
|
+
- lib/i18n_yaml_sorter/railtie.rb
|
81
|
+
- lib/i18n_yaml_sorter/sorter.rb
|
82
|
+
- lib/tasks/i18n_yaml_sorter.rake
|
83
|
+
- test/helper.rb
|
84
|
+
- test/in.yml
|
85
|
+
- test/in_rails.yml
|
86
|
+
- test/in_simple.yml
|
87
|
+
- test/out.yml
|
88
|
+
- test/out_rails.yml
|
89
|
+
- test/out_simple.yml
|
90
|
+
- test/test_i18n_yaml_sorter.rb
|
91
|
+
- textmate/YAML Sort.tmbundle/Commands/Sort YAML.tmCommand
|
92
|
+
- textmate/YAML Sort.tmbundle/info.plist
|
93
|
+
homepage: http://github.com/redealumni/i18n_yaml_sorter
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.6.14
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: A I18n YAML deep sorter that will keep your locales organized and not screw
|
117
|
+
up your text formating
|
118
|
+
test_files: []
|