Skip to content

Instantly share code, notes, and snippets.

@tumf
Created April 1, 2011 20:25
Show Gist options
  • Save tumf/898790 to your computer and use it in GitHub Desktop.
Save tumf/898790 to your computer and use it in GitHub Desktop.
=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