bin/jailbreak
#!/usr/bin/env ruby
# frozen_string_literal: true
# usage: bin/jailbreak
require 'bundler/setup'
require 'rubocop_challenger'
CLI_FILE_PATH = 'lib/rubocop_challenger/cli.rb'
rubocop = RubocopChallenger::Rubocop::Command.new
# Read any ruby file
cli_file = File.read(CLI_FILE_PATH)
# Modify the file contents
cli_file.sub!('# frozen_string_literal: true', '')
cli_file.sub!("\n", " \n ")
cli_file.concat("\nputs 'hoge'; puts 'fuga'")
cli_file.concat("\narray = []")
cli_file.concat("\narray.sort { |a, b| a.foo <=> b.foo }")
# Write the origin ruby file
File.write(CLI_FILE_PATH, cli_file)
# Regenerate .rubocop_todo.yml
rubocop.auto_gen_config