lib/immosquare-cleaner.rb in immosquare-cleaner-0.1.14 vs lib/immosquare-cleaner.rb in immosquare-cleaner-0.1.16
- old
+ new
@@ -41,11 +41,11 @@
begin
##============================================================##
## .html.erb files
##============================================================##
- if file_path.end_with?(".html.erb")
+ if file_path.end_with?(".html.erb", ".html")
cmds = []
cmds << "bundle exec htmlbeautifier #{file_path} #{ImmosquareCleaner.configuration.htmlbeautifier_options || "--keep-blank-lines 4"}"
cmds << "bundle exec erblint --config #{gem_root}/linters/erb-lint.yml #{file_path} #{ImmosquareCleaner.configuration.erblint_options || "--autocorrect"}"
launch_cmds(cmds)
normalize_last_line(file_path)
@@ -100,11 +100,10 @@
File.write(file_path, formatted_md)
normalize_last_line(file_path)
return
end
-
##============================================================##
## Autres formats
##============================================================##
prettier_parser = nil
prettier_parser = "--parser markdown" if file_path.end_with?(".md.erb")
@@ -113,11 +112,10 @@
puts(e.message)
puts(e.backtrace)
end
end
-
private
def gem_root
File.expand_path("..", __dir__)
end
@@ -150,10 +148,9 @@
##============================================================##
## Read all lines from the file
## https://gist.github.com/guilhermesimoes/d69e547884e556c3dc95
##============================================================##
content = File.read(file_path)
-
##===========================================================================##
## Remove all trailing empty lines at the end of the file
##===========================================================================##
content.gsub!(/#{Regexp.escape(end_of_line)}+\z/, "")