Skip to content

Instantly share code, notes, and snippets.

@fredjean
fredjean / jobs.rb
Created July 29, 2012 17:31 — forked from ahoward/jobs.rb
./script/jobs
#!/usr/bin/env ruby
# encoding: utf-8
# setup
#
require 'fileutils'
script = File.expand_path(__FILE__).gsub(%r|\breleases/\d+\b|, 'current')
script_dir = File.dirname(script)
rails_root = File.dirname(script_dir)
dirs = ["output/test/deepdir", "testdir", "another"]
task :default => dirs
dirs.each do |dir|
directory dir
end
# fjean@Prometheus ~/dev/gist-806422
# master* $ rake -t -v [13:22:23]
class Object
# An object is blank if it's false, empty, or a whitespace string.
# For example, "", " ", +nil+, [], and {} are blank.
#
# This simplifies
#
# if !address.nil? && !address.empty?
#
# to
#
>> x = java.lang.reflect.Array.newInstance(java.lang.Class.forName("java.lang.String"), 0)
=> #<#<Class:01x4657104d>:0x7def534e @java_object=#<Java::JavaArray:0x6b466679>>
>> x.blank?
=> false
>> x.length
=> 0
>> x[0]
ArgumentError: index out of bounds for java array (0 for length 0)
from (irb):5:in `[]'
from (irb):5
(setq ruby-deep-indent-paren nil)
(setq ruby-deep-arglist nil)
config = ['kestrel-1:22133', 'kestrel-2:22133']
config << {:pool_name => 'async'}
client = MemCache.new(config)
if RUBY_PLATFORM =~ /java/i
# Based on instructions from http://www.mikeperham.com/2009/03/03/using-memcache-client-16x-in-rails-23/
# Brain surgery to use our own version of memcache-client without
# having to modify activesupport directly.
# Unload any previous instance of the class
if Object.const_defined? :MemCache
Object.instance_eval { remove_const :MemCache }
end
# Ensure that the memcache-client path is at the front of the loadpath
init:
No ivy:settings found for the default reference 'ivy.instance'. A default instance will be used
[ivy:info] :: Ivy 2.0.0-beta1 - 20071206070608 :: http://ant.apache.org/ivy/ ::
:: loading settings :: file = /Users/fjean/Projects/kestrel/ivy/ivysettings.xml
[ivy:info] [xml parsing: file:/Users/fjean/Projects/kestrel/ivy/ivy.xml:9:5: cvc-complex-type.3.2.2: Attribute 'e:testclass' is not allowed to appear in element 'info'. in file:/Users/fjean/Projects/kestrel/ivy/ivy.xml
[ivy:info] , xml parsing: file:/Users/fjean/Projects/kestrel/ivy/ivy.xml:9:5: cvc-complex-type.3.2.2: Attribute 'e:jarclassname' is not allowed to appear in element 'info'. in file:/Users/fjean/Projects/kestrel/ivy/ivy.xml
[ivy:info] , xml parsing: file:/Users/fjean/Projects/kestrel/ivy/ivy.xml:9:5: cvc-complex-type.3.2.2: Attribute 'e:buildpackage' is not allowed to appear in element 'info'. in file:/Users/fjean/Projects/kestrel/ivy/ivy.xml
[ivy:info] ]
BUILD FAILED
[05/29/09 12:03:37 (15063)] ERROR : Caught exception undefined method `[]' for nil:NilClass try
ing to get connection to DB for explain. Config:
[05/29/09 12:03:37 (15063)] ERROR : /export/glassfish/domains/domain1/applications/j2ee-modules
/junction2/WEB-INF/vendor/plugins/newrelic_rpm/lib/new_relic/transaction_sample.rb:256:in `get_
connection'
/export/glassfish/domains/domain1/applications/j2ee-modules/junction2/WEB-INF/vendor/plugins/ne
wrelic_rpm/lib/new_relic/transaction_sample.rb:160:in `explain_sql'
/export/glassfish/domains/domain1/applications/j2ee-modules/junction2/WEB-INF/vendor/plugins/ne
wrelic_rpm/lib/new_relic/transaction_sample.rb:156:in `each'
/export/glassfish/domains/domain1/applications/j2ee-modules/junction2/WEB-INF/vendor/plugins/ne
# Configuration file for "pkg-get"
# man pkg-get for details on the program
url=http://kenai.com/downloads/kenai-packages/dist
# If you are behind a firewall, set one of these as appropriate
ftp_proxy=http://mailin02:3128
http_proxy=http://mailin02:3128
export http_proxy ftp_proxy