Created
April 1, 2011 20:25
-
-
Save tumf/898790 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
require 'rails-stirng-executer' | |
include 'MyApp' | |
=end | |
require "fileutils" | |
class String | |
def self.exec_stat_path | |
File.join(Rails.root,"log","commands.stat") | |
end | |
def self.rm_exec_stat_path | |
FileUtils.rm(String.exec_stat_path) if File.exists?(String.exec_stat_path) | |
end | |
def exec debug = false | |
if Rails.env == "test" | |
File.open(String.exec_stat_path,"a") { |stat| | |
stat.puts self | |
} | |
end | |
Rails.logger.info "exec: '%s'" % [self] | |
if defined? Application.config.shell_exec == "method" and | |
Application.config.shell_exec == :fake | |
Rails.logger.info "--> [FAKE RUNNER]" | |
"" | |
else | |
`#{self}` | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment