Class: Thrust::Tasks::Trim
- Inherits:
-
Object
- Object
- Thrust::Tasks::Trim
- Defined in:
- lib/thrust/tasks/trim.rb
Instance Method Summary collapse
-
#initialize(executor = Thrust::Executor.new) ⇒ Trim
constructor
A new instance of Trim.
- #run ⇒ Object
Constructor Details
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/thrust/tasks/trim.rb', line 8 def run awk_statement = <<-AWK { if ($1 == "RM" || $1 == "R") print $4; else if ($1 != "D") print $2; } AWK awk_statement.gsub!(%r{\s+}, " ") @executor.system_or_exit %Q[git status --porcelain | awk '#{awk_statement}' | grep -e '.*\.[cmh]$' | xargs sed -i '' -e 's/ / /g;s/ *$//g;'] end |