Class: FasterGemScripts

Inherits:
Object
  • Object
show all
Defined in:
lib/faster_gem_scripts.rb

Class Method Summary collapse

Class Method Details

.clear_caches!Object



17
18
19
20
21
22
23
# File 'lib/faster_gem_scripts.rb', line 17

def self.clear_caches!
 bin_dir = File.dirname(OS.ruby_bin)
 Dir[bin_dir + '/*_bin_location'].each{|file|
   puts 'faster_gem_scripts clearing previously cached file ' + file
   File.delete file   
}    
end

.overwrite(full_path) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/faster_gem_scripts.rb', line 5

def self.overwrite full_path
  contents_should_be = File.read File.dirname(__FILE__) + '/template'
  if File.file?(full_path)
     puts 'faster_gem_scripts: optimizing ' + full_path + '...'
     File.open(full_path, 'wb') do |f| f.write(contents_should_be); end
     bin_loc = full_path + '_bin_location'
     File.delete(bin_loc) if File.exist?(bin_loc)
  else
    puts "unable to find the binary:" + full_path + " you may want to find it and overwrite it yourself using C:\>faster_gem_script file_name (no .bat)"
  end
end