Permalink
Browse files

Make Psych use same output format as localeapp.com

  • Loading branch information...
1 parent afb6f2e commit c3bbed48456d3755c28cb2d20f47dbdc154ce73f @chrismcg chrismcg committed Jun 12, 2012
Showing with 14 additions and 1 deletion.
  1. +1 −1 lib/localeapp/updater.rb
  2. +13 −0 spec/localeapp/updater_spec.rb
View
2 lib/localeapp/updater.rb
@@ -35,7 +35,7 @@ def update(data)
def generate_yaml(translations)
if defined? Psych
- Psych.dump(translations)[4..-1]
+ Psych.dump(translations, :line_width => -1)[4..-1]
else
translations.ya2yaml[5..-1]
end
View
13 spec/localeapp/updater_spec.rb
@@ -129,4 +129,17 @@ def do_update(data)
})
File.exist?(File.join(@yml_dir, 'ja.yml')).should be_false
end
+
+ if defined? Psych
+ it "doesn't try to wrap long lines in the output" do
+ do_update({
+ 'translations' => {
+ 'en' => { 'foo' => ('bar ' * 30) }
+ },
+ 'locales' => ['en'],
+ 'deleted' => []
+ })
+ File.read(File.join(@yml_dir, 'en.yml')).should match(/foo: ! 'bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar '/m)
+ end
+ end
end

0 comments on commit c3bbed4

Please sign in to comment.