rogerdpack-rbeautify 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/rbeautify +3 -3
 - metadata +1 -1
 
    
        data/bin/rbeautify
    CHANGED
    
    | 
         @@ -192,13 +192,13 @@ module RBeautify 
     | 
|
| 
       192 
192 
     | 
    
         
             
                     dest,error = beautify_string(source,"stdin")
         
     | 
| 
       193 
193 
     | 
    
         
             
                     print dest
         
     | 
| 
       194 
194 
     | 
    
         
             
                  else # named file source
         
     | 
| 
       195 
     | 
    
         
            -
                     source = File. 
     | 
| 
      
 195 
     | 
    
         
            +
                     source = File.open(path, 'rb') do |file| file.read; end
         
     | 
| 
       196 
196 
     | 
    
         
             
                     dest,error = beautify_string(source,path)
         
     | 
| 
       197 
197 
     | 
    
         
             
                     if(source != dest)
         
     | 
| 
       198 
198 
     | 
    
         
             
                        # make a backup copy
         
     | 
| 
       199 
     | 
    
         
            -
                        File.open(path + "~"," 
     | 
| 
      
 199 
     | 
    
         
            +
                        File.open(path + "~","wb") { |f| f.write(source) }
         
     | 
| 
       200 
200 
     | 
    
         
             
                        # overwrite the original
         
     | 
| 
       201 
     | 
    
         
            -
                        File.open(path," 
     | 
| 
      
 201 
     | 
    
         
            +
                        File.open(path,"wb") { |f| f.write(dest) }
         
     | 
| 
       202 
202 
     | 
    
         
             
                     end
         
     | 
| 
       203 
203 
     | 
    
         
             
                  end
         
     | 
| 
       204 
204 
     | 
    
         
             
                  return error
         
     |