Sha256: b687151f3976c83e50725630e7ca8610914980d5057eab12ea7c6db01ce2fd1e

Contents?: true

Size: 685 Bytes

Versions: 9

Compression:

Stored size: 685 Bytes

Contents

module FeatureGateCleaner
  def self.clean(gate_name)
    matching_string = "(FeatureGate::Manager.gate(\s|\\()[\\\"\\']#{gate_name}[\\\"\\'])|(<%\s*end\s*#\s*#{gate_name}\s*%>)"

    `grep -r -l -E "#{matching_string}" #{Dir.pwd}/app/views/ | while IFS= read -r file; do grep -v -E "#{matching_string}" "$file" > "$file".cleaned; mv "$file"{.cleaned,}; done`

    matching_string = "FeatureGate::Manager.gate_page(\s|\\()[\\\"\\']#{gate_name}[\\\"\\']"

    `grep -r -l -E "#{matching_string}" #{Dir.pwd}/app/controllers/ | while IFS= read -r file; do grep -v -E "#{matching_string}" "$file" > "$file".cleaned; mv "$file"{.cleaned,}; done`

    puts "#{gate_name} cleaned!"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
feature_gate-0.2.6 lib/feature_gate_cleaner.rb
feature_gate-0.2.5 lib/feature_gate_cleaner.rb
feature_gate-0.2.4 lib/feature_gate_cleaner.rb
feature_gate-0.2.3 lib/feature_gate_cleaner.rb
feature_gate-0.2.2 lib/feature_gate_cleaner.rb
feature_gate-0.2.1 lib/feature_gate_cleaner.rb
feature_gate-0.2.0 lib/feature_gate_cleaner.rb
feature_gate-0.1.9 lib/feature_gate_cleaner.rb
feature_gate-0.1.8 lib/feature_gate_cleaner.rb