Fix errors due to the toml gem doesn't dump array of table correctly

See https://github.com/jm/toml/issues/31
This commit is contained in:
Jingwen Owen Ou 2014-03-24 16:39:43 -07:00
Родитель b8a64ac93a
Коммит b2f2a1291a
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -129,8 +129,11 @@ World Module.new {
hub_config = []
yield hub_config
data = { :credentials => hub_config }
File.open(config, 'w') { |cfg| cfg << TOML::Generator.new(data).body }
# the `toml` gem doesn't work well with array of table (https://github.com/mojombo/toml#array-of-tables)
# a temporary solution here to output the right format
# see https://github.com/jm/toml/issues/31
data = hub_config.map { |c| "[[credentials]]\n#{TOML::Generator.new(c).body}" }.join("\n\n")
File.open(config, 'w') { |cfg| cfg << data }
end
define_method(:text_editor_script) do |bash_code|