Skip to content

Commit

Permalink
Make Psych use same output format as localeapp.com
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismcg committed Jun 12, 2012
1 parent afb6f2e commit c3bbed4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/localeapp/updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions spec/localeapp/updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.