Sha256: 3522b1b58105a0e5ea6e337ea90c40cc9c728bfe0e88c43f362fb0f9485c357d

Contents?: true

Size: 354 Bytes

Versions: 49

Compression:

Stored size: 354 Bytes

Contents

#!/usr/bin/ruby
# frozen_string_literal: true

ARGV[0] || abort('Need arg')
`clang-format -i #{ARGV[0]}`

a = File.read ARGV[0]
a = a.gsub(/(#include.+?\n)+/) do |i|
  i = i.split("\n").sort do |a, b|
    b.size <=> a.size
  end
  i = i.join "\n"
  i += "\n\n"
end

a.gsub!(%r{/\*.+?\*/}m, '')
a.gsub!(%r{//.*?\n}m, "\n")
a.strip!

File.write ARGV[0], a

Version data entries

49 entries across 48 versions & 6 rubygems

Version Path
ufos-1.0.94 ./discourse generator 2/strip_comments.rb
aliens-1.0.94 ./discourse generator 2/strip_comments.rb
freespeech-1.0.94 ./discourse generator 2/strip_comments.rb
elonmusk-1.0.94 ./discourse generator 2/strip_comments.rb
politics-1.0.94 ./discourse generator 2/strip_comments.rb
democracy-1.0.94 ./discourse generator 2/strip_comments.rb
democracy-1.0.93 ./discourse generator 2/strip_comments.rb
ufos-1.0.91 ./discourse generator 2/strip_comments.rb
aliens-1.0.91 ./discourse generator 2/strip_comments.rb
freespeech-1.0.91 ./discourse generator 2/strip_comments.rb
elonmusk-1.0.91 ./discourse generator 2/strip_comments.rb
politics-1.0.91 ./discourse generator 2/strip_comments.rb
politics-1.0.89 ./discourse generator 2/strip_comments.rb
ufos-1.0.87 ./discourse generator 2/strip_comments.rb
aliens-1.0.87 ./discourse generator 2/strip_comments.rb
freespeech-1.0.87 ./discourse generator 2/strip_comments.rb
elonmusk-1.0.87 ./discourse generator 2/strip_comments.rb
politics-1.0.87 ./discourse generator 2/strip_comments.rb
ufos-1.0.88 ./discourse generator 2/strip_comments.rb
aliens-1.0.88 ./discourse generator 2/strip_comments.rb