comfy / comfortable-mexican-sofa

ComfortableMexicanSofa is a powerful Ruby on Rails 5.2+ CMS (Content Management System) Engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When exporting snippets there is always an non neccesary trailing space

oscarsan opened this issue · comments

Expected behavior

The space is not really necessary there, and it's adding one each time you export/import, which can be many times in development

Actual behavior

Trailing space should not be added

Steps to reproduce

Create a snippet, export and import it

problem is in seeds.rb on line 96, not sure what those \n are doing there.
https://github.com/comfy/comfortable-mexican-sofa/blob/master/lib/comfortable_mexican_sofa/seeds.rb#L98

    def write_file_content(path, data)
      ::File.open(::File.join(path), "wb") do |f|
        data.each do |item|
          f.write("[#{item[:header]}]\n")
          f.write("#{item[:content]}\n")
       end
     end
  end

System configuration

Rails version: 5.2.1

CMS version: 2.0.17

Ruby version: 2.5.1

commented

I don't actually remember why it's there. Try removing and see if export/import still works correctly. if it does, feel free to submit PR. Thanks!

Well, i fixed this actual striping content, but I will try, because in an environment where you need to constantly import export (maybe this is just me, i'm using highly to move stuff from development to production and vice versa) the content is getting bigger and bigger all the time.

@oscarsan were you able to solve this?