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
#initialize(executor = Thrust::Executor.new) ⇒ Trim
Returns a new instance of Trim.
4 5 6 |
# File 'lib/thrust/tasks/trim.rb', line 4 def initialize(executor = Thrust::Executor.new) @executor = executor end |
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 = " {\n if ($1 == \"RM\" || $1 == \"R\")\n print $4;\n else if ($1 != \"D\")\n print $2;\n }\n AWK\n\n awk_statement.gsub!(%r{\\s+}, \" \")\n\n @executor.system_or_exit %Q[git status --porcelain | awk '\#{awk_statement}' | grep -e '.*\\.[cmh]$' | xargs sed -i '' -e 's/ / /g;s/ *$//g;']\nend\n" |