Permalink
Browse files

finishing touches

  • Loading branch information...
1 parent a3689fb commit eead292552f31307085247465247ac7f4a1554ef @bernardo bernardo committed Nov 29, 2011
Showing with 15 additions and 8 deletions.
  1. +12 −1 i18n_yaml_sorter.gemspec
  2. +1 −5 lib/i18n_yaml_sorter.rb
  3. +2 −2 lib/tasks/i18n_yaml_sorter.rake
View
@@ -19,17 +19,28 @@ Gem::Specification.new do |s|
]
s.files = [
".document",
+ "Gemfile",
+ "Gemfile.lock",
"LICENSE",
"README.rdoc",
"Rakefile",
"VERSION",
"bin/sort_yaml",
"i18n_yaml_sorter.gemspec",
"lib/i18n_yaml_sorter.rb",
+ "lib/i18n_yaml_sorter/railtie.rb",
+ "lib/i18n_yaml_sorter/sorter.rb",
+ "lib/tasks/i18n_yaml_sorter.rake",
"test/helper.rb",
"test/in.yml",
+ "test/in_rails.yml",
+ "test/in_simple.yml",
"test/out.yml",
- "test/test_i18n_yaml_sorter.rb"
+ "test/out_rails.yml",
+ "test/out_simple.yml",
+ "test/test_i18n_yaml_sorter.rb",
+ "textmate/YAML Sort.tmbundle/Commands/Sort YAML.tmCommand",
+ "textmate/YAML Sort.tmbundle/info.plist"
]
s.homepage = "http://github.com/redealumni/i18n_yaml_sorter"
s.licenses = ["MIT"]
View
@@ -1,6 +1,2 @@
require 'i18n_yaml_sorter/sorter'
-require 'i18n_yaml_sorter/railtie'
-
-module I18nYamlSorter
-
-end
+require 'i18n_yaml_sorter/railtie'
@@ -5,10 +5,10 @@ namespace :i18n do
desc "Sort locales keys in alphabetic order. Sort all locales if no path parameter given"
task :sort, [:path_to_file] => :environment do |t , args|
- locales = args[:path_to_file] || Dir.glob("#{RAILS_ROOT}/config/locales/**/*.yml")
+ locales = args[:path_to_file] || Dir.glob("#{Rails.root}/config/locales/**/*.yml")
locales.each do |locale_path|
- sorted_contents = File.open(locale_path) { |f| I18nYAMLSorter::Sorter.new(f).sort }
+ sorted_contents = File.open(locale_path) { |f| I18nYamlSorter::Sorter.new(f).sort }
File.open(locale_path, 'w') { |f| f << sorted_contents}
end
end

0 comments on commit eead292

Please sign in to comment.