Sha256: fb0a2141b82535a4e7eb91aaeb0ac91d4c525a07702bb0dd8107a29ef9d42f1d
Contents?: true
Size: 769 Bytes
Versions: 1
Compression:
Stored size: 769 Bytes
Contents
module Repper # Service object for exe/repper module Command module_function PARSE_ERROR_EXIT_STATUS = 1 def call(argv) if argv.count == 0 format_stdio else format_files(argv) end end def format_stdio input = STDIN.read output = format(input) print output end def format(string) Codemod.call(string) rescue Repper::Error => e warn "Parsing failed: #{e.class} - #{e.message}" exit PARSE_ERROR_EXIT_STATUS end def format_files(paths) paths.grep(/\.rb\z/).each { |path| format_file(path) } end def format_file(path) code = File.read(path) formatted_code = format(code) File.write(path, formatted_code) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
repper-1.1.0 | lib/repper/command.rb |