Class: JSONCop::Command::Uninstall
- Inherits:
-
JSONCop::Command
- Object
- CLAide::Command
- JSONCop::Command
- JSONCop::Command::Uninstall
- Defined in:
- lib/jsoncop/command/uninstall.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Uninstall
constructor
A new instance of Uninstall.
- #run ⇒ Object
Methods inherited from JSONCop::Command
Constructor Details
#initialize(argv) ⇒ Uninstall
Returns a new instance of Uninstall.
8 9 10 |
# File 'lib/jsoncop/command/uninstall.rb', line 8 def initialize(argv) super end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jsoncop/command/uninstall.rb', line 12 def run Dir.glob("**/*.swift").each do |file_path| jsoncop_generate_start = /jsoncop: generate\-start/ jsoncop_generate_end = /jsoncop: generate\-end/ content = File.read file_path if content.match(jsoncop_generate_start) && content.match(jsoncop_generate_end) content.gsub!(/\/\/ jsoncop: generate-start[^$]*jsoncop: generate\-end/, "") end File.write file_path, content end end |