Class: Thrust::Tasks::Nof
- Inherits:
-
Object
- Object
- Thrust::Tasks::Nof
- Defined in:
- lib/thrust/tasks/nof.rb
Constant Summary collapse
- FOCUSED_METHODS =
%w[fit(@ fcontext(@ fdescribe(@]
Instance Method Summary collapse
-
#initialize(executor = Thrust::Executor.new, focused_specs = Thrust::Tasks::FocusedSpecs.new) ⇒ Nof
constructor
A new instance of Nof.
- #run(app_config) ⇒ Object
Constructor Details
#initialize(executor = Thrust::Executor.new, focused_specs = Thrust::Tasks::FocusedSpecs.new) ⇒ Nof
Returns a new instance of Nof.
6 7 8 9 |
# File 'lib/thrust/tasks/nof.rb', line 6 def initialize(executor = Thrust::Executor.new, focused_specs = Thrust::Tasks::FocusedSpecs.new) @executor = executor @focused_specs = focused_specs end |
Instance Method Details
#run(app_config) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/thrust/tasks/nof.rb', line 11 def run(app_config) substitutions = FOCUSED_METHODS.map do |method| unfocused_method = method.sub(/^f/, '') "-e 's/#{method}/#{unfocused_method}/g;'" end focused_spec_files = @focused_specs.run(app_config) unless focused_spec_files.empty? quoted_spec_files = focused_spec_files.map { |file| "\"#{file}\"" }.join(' ') @executor.system_or_exit %Q[sed -i '' #{substitutions.join(' ')} #{quoted_spec_files}] end end |