lib/cuketagger/tagger.rb
# The expected format of a cuketagger command
The expected format of a cuketagger command
The expected format of a cuketagger command
def parse(file_path, write)
      return unless feature_to_change?(file_path)
      content = File.readlines(file_path)
      feature_model = CukeModeler::FeatureFile.new(file_path).feature
      io = write ? File.open(file_path, 'w') : $stdout
      begin
        taggable_things = collect_taggable_models(feature_model)
        taggable_things.sort! { |a, b| a.source_line <=> b.source_line }
        taggable_things.each do |thing|
          next unless thing_to_tag?(thing)
          alterations.each do |alteration|
            alter_thing(thing, alteration, content)
          end
        end
        content = content.join
        io.write(content)
      ensure
        io.close unless io == $stdout
      end
    end
def parse ( file_path , write ) return unless feature_to_change? ( file_path ) content = File . readlines ( file_path ) feature_model = CukeModeler :: FeatureFile . new ( file_path ) . feature io = write ? File . open ( file_path , 'w' ) : $stdout begin taggable_things = collect_taggable_models ( feature_model ) taggable_things . sort! { | a , b | a . source_line <=> b . source_line } taggable_things . each do | thing | next unless thing_to_tag? ( thing ) alterations . each do | alteration | alter_thing ( thing , alteration , content ) end end content = content . join io . write ( content ) ensure io . close unless io == $stdout end end
The expected format of a cuketagger command
The expected format of a cuketagger command
# Elements must be altered in the order that they appear in the file in order to # guarantee that any line adjustments are applied appropriately.
file_path
<not_specific>
write
<not_specific>