Advertisement
Guest User

Untitled

a guest
May 4th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. require 'pry'
  2. require 'utilise'
  3.  
  4. files = Dir.glob('features/**/*.feature')
  5. reg = Regexp.new(/(\n)(\s{2}# [\w\s]+(?:\n)|)(\s{2}(?:@[\-\w ]+)+(?:\n)|)(\s{2}Scenario:)/)
  6.  
  7. numbers = ([1] * 10 + [2] * 10 + [3] * 10)
  8.  
  9. # for testing purposes
  10. # files = ['features/brandwatch/dashboards/components/general/mentions/views/table_view.feature']
  11.  
  12. files.each do |file|
  13. contents = File.read(file)
  14. split = contents.split(reg)
  15.  
  16. feature = split.shift
  17.  
  18. if feature.include?('@community')
  19. feature.sub!('@community', "@community-#{numbers.shift}")
  20. puts "updated: #{file}"
  21. end
  22.  
  23. feature << split.join()
  24.  
  25. File.open(file, 'w') { |f| f.write(feature) }
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement