./working.J/data.J/jekyll-epub-0.0.3/lib/jekyll/epub.rb
filename = self.config['epub']['name']
filename += ".epub" unless File.extname(filename) == ".epub"
$stderr.puts "** Create epub file #{filename} in #{Dir.pwd}..."
%x(zip -X9 \"#{filename}\" mimetype)
%x(zip -Xr9D \"#{filename}\" * -xi mimetype)
end
end
end
#===============================================================#
./working.J/data.J/jshint_on_rails-1.0.3/lib/jshint/lint.rb
private
def call_java_with_output(jar, mainClass, arguments = "")
%x(java -cp #{jar} #{mainClass} #{arguments})
end
def call_java_with_status(jar, mainClass, arguments = "")
#===============================================================#
./working.J/data.J/JonathanTron-specjour-0.2.5.1/lib/specjour/cpu.rb
protected
def self.command(cmd)
%x(#{cmd})
end
end
end
#===============================================================#
./working.J/data.J/jeg-0.2.1/test/docs.rb
abort("jeg is not in path") if %x{jeg -h}.empty?
class T < Test::Unit::TestCase
jeg_file=%x(which jeg).chomp
examples = File.readlines(jeg_file).grep(/jeg .*=>/)
examples.each_with_index do |line,idx|
define_method("test_#{idx}") do
#===============================================================#
./working.J/data.J/jslint_on_rails-1.1.1/lib/jslint/lint.rb
private
def call_java_with_output(jar, mainClass, arguments = "")
%x(java -cp #{jar} #{mainClass} #{arguments})
end
def call_java_with_status(jar, mainClass, arguments = "")
#===============================================================#
./working.J/data.J/joelind-twitter-0.10.2/examples/oauth.rb
rsecret = oauth.request_token.secret
puts "> redirecting you to twitter to authorize..."
%x(open #{oauth.request_token.authorize_url})
print "> what was the PIN twitter provided you with? "
pin = gets.chomp
#===============================================================#
./working.J/data.J/joelind-twitter-0.10.2/examples/connect.rb
})
# authorize in browser
%x(open #{oauth.request_token.authorize_url})
end
#===============================================================#
./working.J/data.J/jlind-twitter-0.9.9/examples/oauth.rb
rsecret = oauth.request_token.secret
puts "> redirecting you to twitter to authorize..."
%x(open #{oauth.request_token.authorize_url})
print "> what was the PIN twitter provided you with? "
pin = gets.chomp
#===============================================================#
./working.J/data.J/jlind-twitter-0.9.9/examples/connect.rb
})
# authorize in browser
%x(open #{oauth.request_token.authorize_url})
end
#===============================================================#
./working.J/data.J/jalalidate-0.3.2/lib/jalalidate.rb
# [%j] Day of the year (1..366)
# [%m] Month of the year (1..12)
# [%w] Day of the week (Sunday is 0, 0..6)
# [%x] Preferred representation for the date alone, no time in format YY/M/D
# [%y] Year without a century (00..99)
# [%Y] Year with century
# [%H] Hour of the day, 24-hour clock (00..23)
#===============================================================#
./working.J/data.J/jruby-bloomfilter-1.0.13/spec/serialization_spec.rb
@filter << 'hello'
@filter << 'world'
@path = Tempfile.new('bloomfilter').path
%x(rm -rf /tmp/bloomfilter_spec)
@path2 = "/tmp/bloomfilter_spec/test1/test2/test3"
end
#===============================================================#
./working.E/data.E/exception_string-0.1.2/spec/spec_exception_string.rb
def exec(code, *libs)
libs.map! { |l| "-r#{l}" }
%x(#{ruby} #{libs} -e "#{code}" 2>&1)
end
end
#===============================================================#
./working.E/data.E/erails-2.1.2/lib/rails/gem_dependency.rb
def install
cmd = "#{gem_command} #{install_command.join(' ')}"
puts cmd
puts %x(#{cmd})
end
def unpack_to(directory)
#===============================================================#
./working.E/data.E/eventioz-pdf-writer-1.0/demo/qr-language.rb
%Q(interpolation and backslashes)
%(interpolation and backslashes)
`echo command interpretation with interpolation and backslashes`
%x(echo command interpretation with interpolation and backslashes)
EOS
h3 "Backslashes"
#===============================================================#
./working.E/data.E/encryptor-1.1.3/test/encryptor_test.rb
class EncryptorTest < Test::Unit::TestCase
algorithms = %x(openssl list-cipher-commands).split
key = Digest::SHA256.hexdigest(([Time.now.to_s] * rand(3)).join)
iv = Digest::SHA256.hexdigest(([Time.now.to_s] * rand(3)).join)
original_value = Digest::SHA256.hexdigest(([Time.now.to_s] * rand(3)).join)
#===============================================================#
./working.E/data.E/ephemeral_response-0.4.0/examples/white_list.rb
puts
listing_cmd = %(ls #{File.expand_path(EphemeralResponse::Configuration.fixture_directory)})
puts listing_cmd
puts %x(#{listing_cmd})
#===============================================================#
./working.E/data.E/eagle-0.0.3/lib/eagle/config.rb
end
def hostname
@data['hostname'] ||%x(hostname)
end
#### singleton config
#===============================================================#
./working.E/data.E/encryption-1.1.6/spec/encryption/symmetric_instance_spec.rb
encryptor.cipher.should == cipher
end
%x(openssl list-cipher-commands).split.each do |cipher|
next if ['base64', 'zlib'].include? cipher
describe 'with cipher ' + cipher do
#===============================================================#
./working.E/data.E/encryption-1.1.6/spec/encryption/symmetric_global_spec.rb
Encryption.cipher.should == cipher
end
%x(openssl list-cipher-commands).split.each do |cipher|
next if ['base64', 'zlib'].include? cipher
describe 'with cipher ' + cipher do
#===============================================================#
./working.E/data.E/es-scout-5.3.0/lib/es-scout/server.rb
# captures a list of processes running at this moment
def take_snapshot
info "Taking a process snapshot"
ps=%x(ps aux).split("\n")[1..-1].join("\n") # get rid of the header line
@checkin[:snapshot]=ps
rescue Exception
error "unable to capture processes on this server. #{$!.message}"
#===============================================================#
./working.E/data.E/eden-0.1.1/test/string_tokenization_test.rb
end
def test_should_expand_backquote_string_delimited_literals
@sf.stubs(:source).returns("%x(rah\#{@rah})")
@sf.tokenize!
tokens = @sf.lines[0].tokens
assert_equal 5, tokens.size
assert_equal "%x(rah\#", tokens[0].content
assert_equal :backquote_string, tokens[0].type
assert_equal :lcurly, tokens[1].type
assert_equal "@rah", tokens[2].content
#===============================================================#
./working.E/data.E/editserver-0.1.6/lib/editserver.rb
'mate' => 'mate -w',
'mvim' => 'mvim --nofork --servername EDITSERVER', # does not return when app must be launched
'bbedit' => 'bbedit -w' # does not open file properly when app is launched
}.reject { |k,v| not File.executable? %x(which #{k.shellsplit[0]}).chomp }
attr_reader :editors
#===============================================================#
./working.E/data.E/editserver-0.1.6/lib/editserver/terminal/vim.rb
define_editor *%w[vim --servername EDITSERVER --remote-tab-wait]
def server_available?
%x(vim --serverlist).split("\n").map { |l| l.strip.upcase }.include? 'EDITSERVER'
end
def start_server
#===============================================================#
./working.E/data.E/editserver-0.1.6/lib/editserver/editor.rb
attr_accessor :command
def define_editor editor, *params
@command = [%x(which #{editor}).chomp, *params]
end
@@terminal = nil
--
return
end
out = %x(#{(cmd + [file]).shelljoin} 2>&1).chomp
if $?.exitstatus.zero?
out
#===============================================================#
./working.E/data.E/events_emitter-0.1.3/lib/events_emitter/graphite.rb
end
def hostname
@hostname ||= %x(hostname -s).strip
end
def send_batch
#===============================================================#
./working.E/data.E/encryptor2-1.0.0/test/encryptor_test.rb
class EncryptorTest < Test::Unit::TestCase
algorithms = %x(openssl list-cipher-commands).split
key = Digest::SHA256.hexdigest(([Time.now.to_s] * rand(3)).join)
iv = Digest::SHA256.hexdigest(([Time.now.to_s] * rand(3)).join)
salt = Time.now.to_i.to_s
#===============================================================#
./working.B/data.B/balepc-zombie_passenger_killer-0.2.1/lib/zombie_passenger_killer/reaper.rb
# return array of pids reported from passenger-status command, nil if passenger-status doesn't run
def passenger_pids
pids = %x(#{'rvmsudo ' if @rvm_sudo}passenger-status|grep PID).split("\n").map { |x| x.strip.match(/PID: \d*/).to_s.split[1].to_i }
pids if $?.exitstatus.zero?
end
def process_status
%x(ps -eo pid,pcpu,args|grep -v grep|grep '#{@pattern}').split("\n").map do |line|
values = line.strip.split[0..1]
{:pid => values.first.to_i, :cpu => values.last.to_f}
end
#===============================================================#
./working.B/data.B/battlestation-0.0.3/lib/battlestation/operations/executable_check.rb
private
def executable_exists?
files = %x(/usr/bin/env which #{filename}).split
return files.any? && File.executable?(files.first)
end
end
#===============================================================#
./working.B/data.B/battlestation-0.0.3/lib/battlestation/operations/process_check.rb
private
def process_running?
processes = %x(ps aux | grep -i #{identifier} | grep -v grep).split
return processes.any?
end
end
#===============================================================#
./working.B/data.B/bones-git-1.3.0/lib/bones/plugins/git.rb
task :dev_version do |t|
tag = "%s-%s" % [config.name, config.version]
rgxp = Regexp.new(Regexp.escape(config.version) + '-(\w+)')
str = quiet { %x(git describe --tags --match #{tag}) }
m = rgxp.match(str)
if m
config.version << ".#{m[1]}"
#===============================================================#
./working.B/data.B/bistro_car-0.2.2/lib/bistro_car.rb
file = Tempfile.new('script.coffee')
file.write(source)
file.close
%x(coffee -p #{file.path})
end
attr_accessor :mode, :minify
#===============================================================#
./working.B/data.B/bigbang-0.0.7/lib/bigbang/ec2-git-bootstrap.rb
class Ec2BootstrapGenerator
def generate_from_dir(path)
basedir = File.dirname(__FILE__) + "/../../"
tmp=%x(mktemp -d /tmp/gen-ec2-userdata.XXXXX).strip
%x(mkdir -p #{tmp}/data)
%x(cp -r #{path}/* #{tmp}/data/)
%x(cp #{basedir}/src/* #{tmp})
tmptar=%x(mktemp /tmp/gen-ec2-userdata.XXXXX.tar.gz).strip
%x(tar -czf #{tmptar} -C #{tmp} .)
File.new("#{basedir}/src/bootstrap.sh").read +
File.new(tmptar).read
end
def generate_from_hash(h)
tmp=%x(mktemp -d /tmp/gen-ec2-userdata.XXXXX).strip
h.each_pair do |k,v|
f = File.new("#{tmp}/#{k}", "w")
f.write(v)
--
end
generate_from_dir(tmp).tap do |r|
%x(rm -fr #{tmp})
end
end
end
#===============================================================#
./working.B/data.B/backofen-0.0.1/lib/backofen/prototype.rb
patch_index_file_path = File.join(tmp_repo_path, 'patch_index')
puts "Creating patches.."
%x(cd #{path} && git diff -p > patch_working)
%x(cd #{path} && git diff --cached -p > patch_index)
# Apply patches to tmp clone
%x(mv #{path}/patch_working #{patch_working_file_path})
%x(mv #{path}/patch_index #{patch_index_file_path})
puts "Applying patches.."
%x(cd #{tmp_repo_path} && git apply patch_working)
%x(cd #{tmp_repo_path} && git apply patch_index)
# Prepare Rails
if File.exist?(File.join(path, 'config', 'database.yml'))
puts "Found a Rails application.."
# Simply the most beautiful way to determine a Rails app
%x(cp #{path}/config/database.yml #{tmp_repo_path}/config/)
end
# Run rspec && cucumber
#===============================================================#
./working.B/data.B/bio-basespace-sdk-0.1.7/lib/basespace/api/api_client.rb
# +headers+:: Header of the PUT call.
# +trans_file+:: Path to the file that should be transferred.
def put_call(resource_path, post_data, headers, trans_file)
return %x(curl -H "x-access-token:#{@api_key}" -H "Content-MD5:#{headers['Content-MD5'].strip}" -T "#{trans_file}" -X PUT #{resource_path})
end
# Deserialize a boolean value to a Ruby object.
#===============================================================#
./working.B/data.B/bench_press-0.3.1/lib/bench_press/cli.rb
end
def git_email
@git_email ||= %x(git config --global --get user.email).strip
end
def optparse
#===============================================================#
./working.B/data.B/basiszwo-reflection-0.5.1/lib/reflection/command/stash.rb
private
def move_stash_repository_git_index_to_target(source, target)
%x(mv #{source} #{target})
end
def commit_and_push_files(repository_path, target)
--
end
def move_stash_repository_git_index_back(source, target)
%x(mv #{source} #{target})
end
end
#===============================================================#
./working.B/data.B/basiszwo-reflection-0.5.1/lib/reflection/repository.rb
def push
# repo = Git.open(self.path)
Reflection.log.debug "Pushing commit.."
Reflection.log.debug(%x((cd #{self.path} && git push --force)))
# Reflection.log.debug(repo.push)
end
def pull
Reflection.log.debug "Pulling in #{self.path}.."
Reflection.log.debug(%x((cd #{self.path} && git pull --rebase)))
end
end
#===============================================================#
./working.B/data.B/basiszwo-reflection-0.5.1/lib/reflection/directory/base.rb
def clean!
Reflection.log.debug "Cleaning #{self.path}/.."
%x(rm -r #{self.path}/*)
end
def parent
--
def copy_git_index_to(target_path)
Reflection.log.debug "Copying git-index '#{self.git_index}' to #{target_path}"
%x(cp -R #{self.git_index} #{target_path})
end
def get_git_index_from(target_path)
Reflection.log.debug "Getting git-index from #{target_path}"
%x(rm -rf #{self.git_index}) if File.exists?(self.git_index)
%x(mkdir -p #{self.path})
%x(mv -f #{File.join(target_path, '/.git')} #{File.join(self.path, "/")})
end
def move_content_to(target_path)
Reflection.log.debug "Moving content to '#{target_path}'.."
%x(mv #{File.join(self.path, '/*')} #{File.join(target_path, '/')})
# %x(cp -R #{File.join(self.path, '/.')} #{target_path})
# %x(rm -rf #{self.path})
end
end
#===============================================================#
./working.B/data.B/basiszwo-reflection-0.5.1/lib/reflection/rails/database.rb
def run(command)
# Reflection.log.debug "-- #{command}"
%x(#{command})
end
#===============================================================#
./working.B/data.B/bravo-0.4.0/lib/bravo/auth_data.rb
opts += " -c #{Bravo.cert}"
unless File.exists?(todays_datafile)
%x(#{File.dirname(__FILE__)}/../../wsaa-client.sh #{opts})
end
@data = YAML.load_file(todays_datafile).each do |k, v|
#===============================================================#
./working.B/data.B/build-tool-0.6.9/lib/build-tool/vcs/git-svn.rb
# Is the git executable available?
def git_svn_available
return @git_svn_available unless @git_svn_available.nil?
%x( git svn --help 2>&1 )
@git_svn_available = $?.success?
return @git_svn_available
end
#===============================================================#
./working.B/data.B/build-tool-0.6.9/lib/build-tool/vcs/svn.rb
# Is the git executable available?
def svn_available?
return @svn_available unless @svn_available.nil?
%x( svn --version 2>&1 )
@svn_available = $?.success?
return @svn_available
end
#===============================================================#
./working.B/data.B/build-tool-0.6.9/lib/build-tool/vcs/mercurial.rb
def hg_available?()
return @hg_available unless @hg_available.nil?
%x( hg --version 2>&1 )
@hg_available = $?.success?
return @hg_available
end
#===============================================================#
./working.B/data.B/build-tool-0.6.9/lib/build-tool/vcs/bazar.rb
# Is the git executable available?
def bzr_available?()
return @bzr_available unless @bzr_available.nil?
%x( bzr --version 2>&1 )
@bzr_available = $?.success?
return @bzr_available
end
#===============================================================#
./working.B/data.B/build-tool-0.6.9/lib/mj/vcs/git.rb
# Is the git executable available?
def self.git_available?()
return @git_available unless @git_available.nil?
%x( git --version 2>&1 )
@git_available = $?.success?
return @git_available
end
#===============================================================#
./working.B/data.B/brief_mail-0.0.3/test/scm_adapters/git_test.rb
config = MiniTest::Mock.new
assert adapter = BriefMail::SCMAdapters::Git.new(config)
# %x() is syntatic sugar for backtick (`) method:
adapter.stub(:`, %(Command output)) do
config.expect :previous_revision, 1
config.expect :from_user, {}
#===============================================================#
./working.B/data.B/brief_mail-0.0.3/lib/brief_mail/scm_adapters/git.rb
# Implementation is a little hacky; we run a git command and parse the
# output.
cmd = %(git submodule)
%x(#{cmd}).split(/\n/).map {|line| line.split(" ")[1] }
end
# Returns the SHA-1 given submodule is at in given root repository SHA-1.
--
# Finding the SHA-1 that each submodule uses for a given commit is a
# little hacky; we run a git command and parse the output.
cmd = %(git ls-tree %s %s) % [root_sha, submodule_name]
%x(#{cmd}).split(" ")[2]
end
# Yield for each submodule previous_revision and current_revision for
--
def diff_stat
cmd = %(git diff %s.. --stat --color=never) % @config.previous_revision
%x(#{cmd})
end
def log
cmd = %(git log %s.. --pretty='%s' --date=short --reverse --color=never) %
[@config.previous_revision, format]
%x(#{cmd})
end
def subdirs_log
--
cmd = %(git log %s..%s --pretty='%s' --date=short --reverse --color=never) %
[prev_sha, cur_sha, format]
%x(#{cmd})
end
end
--
cmd = %(git diff %s..%s --stat --color=never) %
[prev_sha, cur_sha]
%x(#{cmd})
end
end
#===============================================================#
./working.D/data.D/deputy-0.1.58/lib/deputy.rb
end
def self.real_ip
%x(host $(hostname))[/\d+.\d+.\d+.\d+/]
end
def self.add_query_to_url(url, query)
#===============================================================#
./working.D/data.D/discuz_robot-0.1.0/lib/discuz_robot.rb
cmd += " -D #{@cookie_file}" if options[:save_cookie]
cmd += %Q( "#{url}")
puts cmd
%x(#{cmd})
end
def post url, data, options = {}
--
cmd += %Q( -d "#{data}")
cmd += %Q( "#{url}")
puts cmd
%x(#{cmd})
end
end
end
#===============================================================#
./working.D/data.D/duck_map-0.8.4/lib/duck_map/sync.rb
end
begin
output = %x(git log --format='%ci' -- #{view} | head -n 1)
if output.blank?
DuckMap.console " : cannot get date from GIT for file: #{view}"
else
#===============================================================#
./working.D/data.D/deanswerify-0.0.1/lib/deanswerify.rb
# Processes the input files, removing all answer blocks
def process_result
# Get a list of filenames to parse, and ignore the .git folder
files = %x(find #{@options[:directory]} -type f -not -iwholename '*.git*').split("\n")
# Parse each file in the filenames array
Deanswerify::Parser.parse_files files
#===============================================================#
./working.D/data.D/DeepConnect-0.4.06.007/lib/deep-connect/reference.rb
end
if Conf.DEBUG_REFERENCE
sprintf("",
@deep_space.to_s,
@csid,
@peer_id,
--
begin
@deep_space.session.send_to(self, :inspect)
rescue SessionServiceStopped
sprintf("",
@deep_space.to_s,
@csid,
@peer_id,
#===============================================================#
./working.D/data.D/dotty-0.0.3/spec/repository_spec.rb
end
it "should return the correct symlinks for regular files in dotfiles/" do
%x(touch #{@dotfile_dirs[:default]}/.a && touch #{@dotfile_dirs[:default]}/b)
@repo.symlinks_from_dotfiles_directories.should == { 'dotfiles/.a' => '.a', 'dotfiles/b' => 'b' }
end
--
it "should handle files and directories within in+XXX directories" do
FileUtils.mkdir_p(File.join @dotfile_dirs[:default], 'in+.other_dir/b')
%x(touch #{@dotfile_dirs[:default]}/in+.other_dir/.a)
@repo.symlinks_from_dotfiles_directories.should == { 'dotfiles/in+.other_dir/.a' => '.other_dir/.a', 'dotfiles/in+.other_dir/b' => '.other_dir/b' }
end
it "should handle nested in+XXX dirs" do
FileUtils.mkdir_p(File.join @dotfile_dirs[:default], 'in+first/in+second/a')
%x(touch #{@dotfile_dirs[:default]}/in+first/b)
%x(touch #{@dotfile_dirs[:default]}/in+first/in+second/c)
@repo.symlinks_from_dotfiles_directories.should == {
'dotfiles/in+first/in+second/a' => 'first/second/a',
'dotfiles/in+first/b' => 'first/b',
#===============================================================#
./working.D/data.D/dotty-0.0.3/spec/repository_actions_spec.rb
end
it "should try to run repository specific implode action if dotty-repository.thor exists" do
%x(touch #{@repo.local_path}/dotty-repository.thor)
@actions.stub!(:run)
@actions.should_receive(:run).once.with('thor dotty_repository:implode')
suppress_output do
--
end
it "should try to run repository specific bootstrap action if dotty-repository.thor exists" do
%x(touch #{@repo.local_path}/dotty-repository.thor)
@actions.stub!(:run)
@actions.should_receive(:run).once.with('thor dotty_repository:bootstrap')
suppress_output do
#===============================================================#
./working.D/data.D/dotty-0.0.3/spec/support/shared_contexts.rb
File.open File.join(@repo.local_path, 'dotty-symlinks.yml'), 'w' do |f|
f.write @symlinks.to_yaml
end
%x(git init #{@repo.local_path})
end
end
#===============================================================#
./working.D/data.D/dotty-0.0.3/spec/app_spec.rb
before do
Dotty::Repository.list.each do |repo|
%x(git init #{repo.local_path})
end
end
--
end
it "should display git changes" do
%x(cd #{Dotty::Repository.list.first.local_path} && touch newfile)
Dotty::Repository.list.first.stub!(:unpushed_changes?).and_return(true)
output = capture(:stdout) do
subject.list
#===============================================================#
./working.D/data.D/dcolthorp-bistro_car-0.2/lib/bistro_car.rb
file = Tempfile.new('script.coffee')
file.write(source)
file.close
%x(coffee -p #{file.path})
end
attr_accessor :mode, :minify
#===============================================================#
./working.D/data.D/depengine-0.0.18/etc/isolate/jruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/loggable.rb
# originates. It defaults to the name of class with the object_id
# appended.
def facility
@facility ||= self.class.name.gsub(/::/, ".").gsub(/([a-z])([A-Z])/, "\\1_\\2").downcase + "[%x]" % object_id
end
end
end; end
#===============================================================#
./working.D/data.D/depengine-0.0.18/etc/isolate/ruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/loggable.rb
# originates. It defaults to the name of class with the object_id
# appended.
def facility
@facility ||= self.class.name.gsub(/::/, ".").gsub(/([a-z])([A-Z])/, "\\1_\\2").downcase + "[%x]" % object_id
end
end
end; end
#===============================================================#
./working.D/data.D/duck_test-0.1.8/lib/duck_test/gem/helper.rb
##################################################################################
# ...
def build(gem_spec, output_gem_spec)
%x(gem build -V '#{gem_spec}.gemspec')
output_file_spec = self.output_gem_spec(output_gem_spec)
file_name = File.basename(output_file_spec)
FileUtils.mkdir_p(File.join(self.base_dir, 'pkg'))
--
self.build(gem_spec, output_gem_spec)
output_file_spec = self.output_gem_spec(output_gem_spec, "pkg")
puts "Installing gem: #{output_file_spec}"
%x(gem install '#{output_file_spec}')
puts " Install complete."
end
--
self.build(gem_spec, output_gem_spec)
output_file_spec = self.output_gem_spec(output_gem_spec, "pkg")
puts "Releasing gem: #{output_file_spec}"
%x(gem push '#{output_file_spec}')
puts " Release complete."
else
raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
--
FileUtils.mkdir_p(File.join(path, 'gems'))
FileUtils.cp(output_file_spec, File.join(path, 'gems'))
%x(gem generate_index --directory #{path})
puts " Local release complete."
else
#===============================================================#
./working.D/data.D/dartboard-0.1.1/rake_tasks/flog.rb
desc "Feel the pain of my code, and submit a refactoring patch"
task :flog do
puts %x(find lib | grep ".rb$" | xargs flog)
end
task :flog_to_disk => :create_doc_directory do
puts "Flogging..."
%x(find lib | grep ".rb$" | xargs flog > doc/flog.txt)
puts "Done Flogging...\n"
end
#===============================================================#
./working.L/data.L/laser-0.7.0.pre1/spec/spec_helper.rb
%x(rake build_parsers)
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
#===============================================================#
./working.L/data.L/laser-0.7.0.pre1/spec/analysis_specs/sexp_extension_specs/type_inference_spec.rb
# [:var_field, [:@ident, "a", [1, 0]]],
# [:xstring_literal, [[:@tstring_content, "find .", [1, 7]]]]]]]
it 'discovers the class for executed string literals' do
tree = Sexp.new(Ripper.sexp('a = %x(find .)'))
list = tree[1]
list[0][2].expr_type.should == Types::ClassType.new('String', :invariant)
end
#===============================================================#
./working.L/data.L/lurklien-0.0.1/lib/lurklien.rb
class Lurklien
def self.get_local_uptime
r = %x("uptime").strip().gsub(',','')
#r = exec("uptime")
uptime = r.split().slice(2,3).join(" ").gsub(',','').gsub('days ','')
p "uptime: %s" % uptime
--
end
def self.get_local_diskspace
d = %x(df -h).strip().gsub(',','')
#puts r
lines = d.split("\n")
lines.shift
#===============================================================#
./working.L/data.L/logging-1.8.1/lib/logging/appenders/email.rb
# Logger.appenders.email( 'email',
# :from => "server@example.com",
# :to => "developers@example.com",
# :subject => "Application Error [#{%x(uname -n).strip}]",
#
# :address => "smtp.google.com",
# :port => 443,
#===============================================================#
./working.L/data.L/lctl-0.0.3/lib/lctl/cli.rb
if files.length == 1
say("#{action.capitalize}ing #{files.first}")
%x(launchctl #{action} #{files.first})
else
say "Expected to find one file. Found #{files.length} files", :red
print_files(files, :red)
#===============================================================#
./working.C/data.C/crate-0.2.1/lib/crate/project.rb
@compile_params = {}
Dir.chdir( ::Crate.ruby.pkg_dir ) do
%w[ CC CFLAGS XCFLAGS LDFLAGS CPPFLAGS LIBS ].each do |p|
@compile_params[p] = %x( ./miniruby -I. -rrbconfig -e 'puts Config::CONFIG["#{p}"]' ).strip
end
end
end
#===============================================================#
./working.C/data.C/cucumber-chef-3.0.8/lib/cucumber/chef/utility/log_helper.rb
def log_details
{
"program" => $0.to_s.inspect,
"uname" => %x(uname -a).chomp.strip.inspect,
"chef_repo" => chef_repo.inspect,
"log_file" => log_file.inspect,
"config_rb" => config_rb.inspect,
#===============================================================#
./working.C/data.C/cucumber-chef-3.0.8/lib/cucumber/chef/utility.rb
################################################################################
def external_ip
%x(wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//').chomp.strip
end
################################################################################
#===============================================================#
./working.C/data.C/cucumber-chef-3.0.8/chef_repo/cookbooks/cucumber-chef/recipes/test_lab.rb
command "cat #{home_dir}/.ssh/id_rsa.pub | tee -a #{home_dir}/.ssh/authorized_keys"
not_if do
%x( cat #{home_dir}/.ssh/authorized_keys | grep "`cat #{home_dir}/.ssh/id_rsa.pub`" )
($? == 0)
end
end
--
notifies :restart, "service[chef-client]"
only_if do
%x( cat /etc/chef/client.rb | grep "log_level :info" )
($? == 0)
end
end
#===============================================================#
./working.C/data.C/cucumber-chef-3.0.8/chef_repo/cookbooks/cucumber-chef/recipes/lxc.rb
notifies :restart, "service[apparmor]"
not_if do
%x( cat /etc/apparmor.d/local/usr.sbin.dhcpd3 | grep "\/etc\/bind\/" )
($? == 0)
end
end
--
notifies :restart, "service[networking]"
only_if do
%x( cat /etc/dhcp/dhclient.conf | grep "#prepend domain-name-servers 127.0.0.1;" )
($? == 0)
end
end
--
notifies :restart, "service[networking]"
not_if do
%x( cat /etc/network/interfaces | grep "iface br0 inet static" )
($? == 0)
end
end
--
notifies :restart, "service[networking]"
not_if do
%x( sysctl net.ipv4.ip_forward | grep "net.ipv4.ip_forward = 1" )
($? == 0)
end
end
--
notifies :restart, "service[networking]"
not_if do
%x( iptables -t nat --list | grep "MASQUERADE" )
($? == 0)
end
end
--
notifies :restart, "service[bind9]"
not_if do
%x( cat /etc/bind/named.conf | grep "\/etc\/bind\/named\.conf\.test-lab" )
($? == 0)
end
end
--
notifies :restart, "service[isc-dhcp-server]"
not_if do
%x( cat /etc/dhcp/dhcpd.conf | grep "\/etc\/dhcp\/test-lab\.conf" )
($? == 0)
end
end
--
notifies :restart, "service[isc-dhcp-server]"
not_if do
%x( cat /etc/default/isc-dhcp-server | grep "INTERFACES=\\\"br0\\\"" )
($? == 0)
end
end
--
notifies :stop, "service[lxc-net]"
only_if do
%x( cat /etc/default/lxc | grep "LXC_AUTO=\\\"true\\\"" )
($? == 0)
end
end
--
notifies :stop, "service[lxc-net]"
only_if do
%x( cat /etc/default/lxc | grep "USE_LXC_BRIDGE=\\\"true\\\"" )
($? == 0)
end
end
#===============================================================#
./working.C/data.C/combat-0.9.9/lib/settings.rb
@ipa_file = "#{@filename}.ipa"
@plist_file_url = "#{@url}#{@plist_file}"
@template_file = options[:template] || "#{COMBAT_ROOT}/templates/template.erb"
@deployer = %x(whoami).strip
if (type == 'android')
@icon_source_path = "res/drawable-hdpi/icon.png"
#===============================================================#
./working.C/data.C/cpr-0.1.1-linux/lib/cpr/notify.rb
CPR::NOTIFIER = CPR::Mumbles_Notifier.new
end
when /darwin/
if %x(which growlnotify).match /^\// # gotta start with a / to indicate it found it in the path
require 'cpr/notify/growl-notifier'
CPR::NOTIFIER = CPR::Growl_Notifier.new
end
#===============================================================#
./working.C/data.C/cpr-0.1.1-linux/lib/cpr/notify/growl-notifier.rb
class Growl_Notifier
def notify(title, text)
%x(growlnotify -m #{text} #{title})
end
end
#===============================================================#
./working.C/data.C/cygnus-0.0.7/lib/cygnus.rb
$selected_files = Array.new
$bookmarks = {}
$mode = nil
$glines=%x(tput lines).to_i
$gcols=%x(tput cols).to_i
# grows depends on size of textpad @cols, not screen size, since this is no longer cli
$grows = $glines - 2
$pagesize = 60
--
#
def screen_settings
# TODO these need to become part of our new full_indexer class, not hang about separately.
$glines=%x(tput lines).to_i
$gcols=%x(tput cols).to_i
# this depends now on textpad size not screen size TODO FIXME
$grows = $glines - 1
$pagesize = 60
#===============================================================#
./working.C/data.C/classiccms-0.7.2/vendor/bundle/gems/encryptor-1.1.3/test/encryptor_test.rb
class EncryptorTest < Test::Unit::TestCase
algorithms = %x(openssl list-cipher-commands).split
key = Digest::SHA256.hexdigest(([Time.now.to_s] * rand(3)).join)
iv = Digest::SHA256.hexdigest(([Time.now.to_s] * rand(3)).join)
original_value = Digest::SHA256.hexdigest(([Time.now.to_s] * rand(3)).join)
#===============================================================#
./working.C/data.C/capistrano-demonz-0.0.26/lib/demonz/base.rb
desc "Push local changes to Git repository"
task :push do
# Check we are on the right branch, so we can't forget to merge before deploying
branch = %x(git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \\(.*\\)/\\1/').chomp
if branch != "#{branch}" && !ENV["IGNORE_BRANCH"]
raise Capistrano::Error, "Not on #{branch} branch (set IGNORE_BRANCH=1 to ignore)"
end
#===============================================================#
./working.C/data.C/cmd-0.7.2/lib/cmd.rb
# Executes a shell, perhaps should only be defined by subclasses.
def do_shell(line)
shell = ENV['SHELL']
line ? write(%x(#{line}).strip) : system(shell)
end
# Takes care of collecting the current command and its arguments if any and
#===============================================================#
./working.O/data.O/opal-0.4.4/spec/parser/xstr_spec.rb
it "can use '[', '(' or '{' matching pairs for string boundry" do
opal_parse('%x{foo}').should == [:xstr, "foo"]
opal_parse('%x[foo]').should == [:xstr, "foo"]
opal_parse('%x(foo)').should == [:xstr, "foo"]
end
it "can parse empty strings" do
opal_parse('%x{}').should == [:xstr, ""]
opal_parse('%x[]').should == [:xstr, ""]
opal_parse('%x()').should == [:xstr, ""]
end
it "should allow interpolation" do
opal_parse('%x{#{foo}}').should == [:dxstr, "", [:evstr, [:call, nil, :foo, [:arglist]]]]
opal_parse('%x[#{foo}]').should == [:dxstr, "", [:evstr, [:call, nil, :foo, [:arglist]]]]
opal_parse('%x(#{foo})').should == [:dxstr, "", [:evstr, [:call, nil, :foo, [:arglist]]]]
end
it "should allow ivar, gvar and cvar interpolation" do
--
end
it "should match '(' and ')' pairs used to start string before ending match" do
opal_parse('%x(())').should == [:xstr, "()"]
opal_parse('%x(foo(bar)baz)').should == [:xstr, "foo(bar)baz"]
opal_parse('%x((foo)bar)').should == [:xstr, "(foo)bar"]
opal_parse('%x(foo(bar))').should == [:xstr, "foo(bar)"]
opal_parse('%x(foo#{bar}baz)').should == [:dxstr, "foo", [:evstr, [:call, nil, :bar, [:arglist]]], [:str, "baz"]]
opal_parse('%x(a(b(c)d(e)f)g)').should == [:xstr, "a(b(c)d(e)f)g"]
opal_parse('%x(a(b(c)#{foo}d)e)').should == [:dxstr, "a(b(c)", [:evstr, [:call, nil, :foo, [:arglist]]], [:str, "d)e"]]
end
it "should match '[' and ']' pairs used to start string before ending match" do
#===============================================================#
./working.O/data.O/opal-0.4.4/spec/rubyspec/language/execution_spec.rb
describe "%x" do
it "is the same as ``" do
ip = 'world'
# %x(echo disc #{ip}).should == "disc world\n"
end
end
#===============================================================#
./working.K/data.K/kikubari-0.0.3/lib/deployer/deployer_git.rb
#
def do_deploy
branch = @config.config["branch"] || "master"
%x(git clone #{@config.config["origin"]} -b #{branch} #{@config.env_time_folder} )
end
end
#===============================================================#
./working.K/data.K/k-yamada-net-ssh-2.3.0/lib/net/ssh/loggable.rb
# originates. It defaults to the name of class with the object_id
# appended.
def facility
@facility ||= self.class.name.gsub(/::/, ".").gsub(/([a-z])([A-Z])/, "\\1_\\2").downcase + "[%x]" % object_id
end
end
end; end
#===============================================================#
./working.K/data.K/kstrano-1.1.6/lib/helpers/git_helper.rb
require 'cgi'
def self.fetch
%x(git fetch)
end
def self.merge_base(commit1, commit2 = "HEAD")
base = %x(git merge-base #{commit1} #{commit2})
base.strip
end
def self.commit_hash(commit = "HEAD")
hash = %x(git rev-parse #{commit})
hash.strip
end
def self.branch_name(commit = "HEAD")
name = %x(git name-rev --name-only #{commit})
name.strip
end
def self.origin_refspec
refspec = %x(git config remote.origin.fetch)
refspec.strip
end
def self.origin_url
url = %x(git config remote.origin.url)
url.strip
end
#===============================================================#
./working.K/data.K/kstrano-1.1.6/lib/kstrano.rb
before "deploy:update" do
KStrano.say "executing ssh-add"
%x(ssh-add)
kuma.changelog
if !KStrano.ask "Are you sure you want to continue deploying?", "y"
#===============================================================#
./working.K/data.K/kajam-1.0.3.rc2/vendor/rails/railties/lib/rails/gem_dependency.rb
unless installed?
cmd = "#{gem_command} #{install_command.join(' ')}"
puts cmd
puts %x(#{cmd})
end
end
#===============================================================#
./working.Z/data.Z/zsh_dots-0.6.5/spec/integration/command_spec.rb
describe Dots::Command do
before do
dot_file = File.expand_path("~/.dot_file")
%x(touch #{dot_file}) unless File.exists? dot_file
end
describe "persist PATH" do
subject { %x(./bin/dots persist ~/.dot_file) }
it "copies the file to the dots repo" do
subject.should_not be_blank
--
end
describe "forget PATH" do
subject { %x(./bin/dots forget ~/.dot_file) }
it "restores the file to its original location" do
subject.should_not be_blank
--
end
describe "bare invocation" do
subject { %x(./bin/dots) }
it "shows usage information" do
subject.should_not be_blank
#===============================================================#
./working.Z/data.Z/zsh_dots-0.6.5/spec/models/dot_file_spec.rb
describe Dots::DotFile do
before do
%x(echo "This is my config" >> ~/.dot_file)
@file = Dots::DotFile.new "~/.dot_file"
end
--
describe "Forgetting a file" do
before do
%x(touch ~/.dots/config/dot_file && ln -s ~/.dots/config/dot_file ~/.dot_file)
@file = Dots::DotFile.find "~/.dot_file"
end
#===============================================================#
./working.Z/data.Z/ztk-1.7.1/spec/ztk/ssh_spec.rb
config.host_name = "127.0.0.1"
end
data = %x(hostname).chomp
status = subject.exec("hostname")
status.exit_code.should == 0
--
config.host_name = "127.0.0.1"
config.timeout = WAIT_SMALL
end
hostname = %x(hostname).chomp
lambda { subject.exec("hostname ; sleep 10") }.should raise_error ZTK::SSHError
end
--
config.proxy_host_name = "127.0.0.1"
end
data = %x( hostname ).chomp
status = subject.exec("hostname")
status.exit_code.should == 0
--
config.proxy_host_name = "127.0.0.1"
config.timeout = WAIT_SMALL
end
hostname = %x(hostname).chomp
lambda { subject.exec("hostname ; sleep 10") }.should raise_error ZTK::SSHError
end
#===============================================================#
./working.Z/data.Z/ztk-1.7.1/spec/ztk/command_spec.rb
subject.config do |config|
config.ui = @ui
end
hostname = %x(hostname).chomp
status = subject.exec("hostname")
status.exit_code.should == 0
@ui.stdout.rewind
--
config.ui = @ui
config.timeout = WAIT_SMALL
end
hostname = %x(hostname).chomp
lambda { subject.exec("hostname ; sleep 10") }.should raise_error ZTK::CommandError
end
#===============================================================#
./working.Z/data.Z/ztk-1.7.1/spec/ztk/pty_spec.rb
describe "spawn" do
it "should be able to spawn the command \"hostname\"" do
data = %x(hostname).chomp
output = nil
subject.spawn("hostname") do |r, w, p|
#===============================================================#
./working.Z/data.Z/ztk-1.7.1/lib/ztk/parallel.rb
# Default Maximum Number of Forks
MAX_FORKS = case RUBY_PLATFORM
when /darwin/ then
%x( sysctl hw.ncpu ).strip.split(':').last.strip.to_i
when /linux/ then
%x( grep -c processor /proc/cpuinfo ).strip.strip.to_i
end
# Platforms memory capacity in bytes
MAX_MEMORY = case RUBY_PLATFORM
when /darwin/ then
%x( sysctl hw.memsize ).strip.split[1].to_i
when /linux/ then
(%x( grep MemTotal /proc/meminfo ).strip.split[1].to_i * 1024)
end
# Result Set
#===============================================================#
./working.Z/data.Z/zombie_passenger_killer-0.3.0/lib/zombie_passenger_killer/reaper.rb
# return array of pids reported from passenger-status command, nil if passenger-status doesn't run
def passenger_pids
pids = %x(#{'rvmsudo ' if @rvmsudo}passenger-status|grep PID).split("\n").map { |x| x.strip.match(/PID: \d*/).to_s.split[1].to_i }
if $?.exitstatus.zero?
pids
else
--
end
def process_status
%x(ps -eo pid,pcpu,args|grep -v grep|egrep '#{@pattern}').split("\n").map do |line|
values = line.strip.split[0..1]
{:pid => values.first.to_i, :cpu => values.last.to_f}
end
#===============================================================#
./working.G/data.G/ginst-2009.12.8/vendor/rails/railties/lib/rails/gem_dependency.rb
unless installed?
cmd = "#{gem_command} #{install_command.join(' ')}"
puts cmd
puts %x(#{cmd})
end
end
#===============================================================#
./working.G/data.G/gnubarcode-0.1.0/lib/gnubarcode.rb
end
def to_image
%x(barcode -b #{barcode} | convert -trim +repage ps:- jpg:-)
end
def inspect
#===============================================================#
./working.G/data.G/git-whistles-0.7.7/lib/git-whistles/app.rb
def run(command)
%x(#{command})
end
def run!(command)
result = %x(#{command})
return result if $? == 0
die "command '#{command}' failed"
end
#===============================================================#
./working.G/data.G/git-issue-0.9.0/lib/git_issue/base.rb
upstream = options[:upstream]
head = options[:head]
commits = %x(git cherry -v #{upstream} #{head}).split(/\n/).map{|s|
s.scan(/^([+-])\s(\w+)\s(.*)/).first
}.select{|_, _, msg| msg =~ /#[0-9]+/ }.map{|diff, sha1, msg|
msg.scan(/#([0-9]+)/).flatten.map{|ticket| [diff, sha1, msg, ticket]}
--
def current_branch
RUBY_PLATFORM.downcase =~ /mswin(?!ce)|mingw|bccwin|cygwin/ ?
%x(git branch -l 2> NUL | grep "*" | cut -d " " -f 2).strip :
%x(git branch -l 2> /dev/null | grep "*" | cut -d " " -f 2).strip
end
def guess_ticket
#===============================================================#
./working.G/data.G/git-issue-0.9.0/lib/git_issue/bitbucket.rb
system "git branch -D #{branch_name}" if options[:force]
system "git checkout -b #{branch_name}"
else
if %x(git branch -l | grep "#{branch_name}").strip.empty?
system "git checkout -b #{branch_name}"
else
system "git checkout #{branch_name}"
#===============================================================#
./working.G/data.G/git-issue-0.9.0/lib/git_issue/github.rb
system "git branch -D #{branch_name}" if options[:force]
system "git checkout -b #{branch_name}"
else
if %x(git branch -l | grep "#{branch_name}").strip.empty?
system "git checkout -b #{branch_name}"
else
system "git checkout #{branch_name}"
#===============================================================#
./working.G/data.G/git-issue-0.9.0/lib/git_issue/redmine.rb
system "git branch -D #{branch_name}" if options[:force]
system "git checkout -b #{branch_name}"
else
if %x(git branch -l | grep "#{branch_name}").strip.empty?
system "git checkout -b #{branch_name}"
else
system "git checkout #{branch_name}"
--
end
def local(option = {})
branches = %x(git branch).split(/\n/).select{|b| b.scan(/(\d+)_/).present?}.map{|b| b.gsub(/^(\s+|\*\s+)/, "")}
branches.each do |b|
puts b
issues = b.scan(/(\d+)_/).map{|ticket_id| fetch_issue(ticket_id) rescue nil}.compact
#===============================================================#
./working.G/data.G/glynn-1.0.11/lib/glynn/file.rb
class File
def self.is_bin?(f)
%x(file #{f}) !~ /text/
end
end
end
#===============================================================#
./working.G/data.G/git_wit-0.0.6/lib/git_wit/authorized_keys/file.rb
def modify(mode, &block)
return super if owned? || self.original_location
contents = %x(sudo -u "##{owner}" cat "#{location}") unless mode.include? "w"
original_owner = owner
self.original_location = location
tmp = Tempfile.new "git_wit_authorized_keys"
--
super
self.location = original_location
if mode != "r"
%x(cat "#{tmp.path}" | sudo -u "##{owner}" tee "#{location}" >/dev/null)
end
tmp.unlink
self.original_location = nil
#===============================================================#
./working.G/data.G/gitlab-pygments.rb-0.3.2/vendor/pygments-main/tests/examplefiles/pleac.in.rb
host_info = `host #{his_host}`
%x(ps #{$$})
banner = 'Costs only $4.95'.split(' ')
#===============================================================#
./working.G/data.G/git-check-ci-0.1.4/lib/git-check-ci/config.rb
def is_git_dir?
in_dir do
%x(git status 2>/dev/null)
($? == 0)
end
end
--
# puts "writing config (#{key} -> #{value})"
in_dir do
if value.nil?
%x(git config --unset #{key} || true)
success = ($? == 0)
else
success = system("git", "config", key, value)
--
def get
in_dir do
value = %x(git config #{key}).strip
# raise Error.new("reading git config failed (#{key})") unless ($? == 0)
value.empty? ? (@default || "") : value
end
#===============================================================#
./working.G/data.G/gemnasium-2.0.1/spec/gemnasium/dependency_files_spec.rb
end
def git_hash(path)
%x( git hash-object #{path} ).strip
end
#===============================================================#
./working.G/data.G/gitpusshuten-0.0.8/spec/git_spec.rb
let(:git) { GitPusshuTen::Git.new }
before do
%x(git remote rm rspec_staging) if %x(git remote) =~ /rspec_staging/
end
describe '#has_remote?' do
#===============================================================#
./working.G/data.G/gitpusshuten-0.0.8/lib/gitpusshuten/git.rb
##
# Wrapper for the git unix utility command
def git(command)
%x(git #{command})
end
##
#===============================================================#
./working.G/data.G/gitswitch-0.4.2/lib/gitswitch/git.rb
GIT_BIN = '/usr/bin/env git'
def self.version
%x(#{GIT_BIN} --version).to_s.gsub(/^git version\s*/, '')
end
def self.in_a_git_repo
%x(#{GIT_BIN} status 2>&1 | head -n 1).to_s =~ /^fatal/i ? false : true
end
def self.git_config(user, options = {})
git_args = 'config --replace-all'
git_args += ' --global' if options[:global]
%x(#{GIT_BIN} #{git_args} user.email #{user[:email].to_s.shellescape})
%x(#{GIT_BIN} #{git_args} user.name #{user[:name].to_s.shellescape}) if !user[:name].to_s.empty?
end
def self.get_git_user_info(options = {})
--
git_args += ' --global' if options[:global]
{
:name => %x(#{GIT_BIN} #{git_args} user.name).to_s.chomp,
:email => %x(#{GIT_BIN} #{git_args} user.email).to_s.chomp
}
end
#===============================================================#
./working.G/data.G/gistto-0.0.1/lib/gistto/modules/utils.rb
# get user from git global configuration
#
def get_user_from_global
%x(git config --global user.name).strip
end # get_user_from_global
#
#===============================================================#
./working.G/data.G/gemstreamer-1.2.0/spec/assets/testapp/vendor/rails/railties/lib/rails/gem_dependency.rb
unless installed?
cmd = "#{gem_command} #{install_command.join(' ')}"
puts cmd
puts %x(#{cmd})
end
end
#===============================================================#
./working.P/data.P/parsetree19-0.3/test/unit/test_parse_tree_for_str.rb
["5", [:scope, [:lit, 5]]],
["'5'", [:scope, [:str, '5']]],
['%x(5)', [:scope, [:xstr, '5']]],
['"#{5}"', [:scope, [:dstr, nil, [:evstr, [:lit, 5]]]]],
['`#{5}`', [:scope, [:dxstr, nil, [:evstr, [:lit, 5]]]]],
['/#{5}/', [:scope, [:dregx, '', [:evstr, [:lit, 5]]]]],
#===============================================================#
./working.P/data.P/pretty-diff-0.1.4/lib/pretty-diff.rb
@options = defaults.merge options
command = "diff -u #{one.to_s} #{two.to_s}"
@lines = %x(#{command})
end
# simply returns lines
#===============================================================#
./working.P/data.P/pygments.rb-0.5.2/vendor/pygments-main/tests/examplefiles/pleac.in.rb
host_info = `host #{his_host}`
%x(ps #{$$})
banner = 'Costs only $4.95'.split(' ')
#===============================================================#
./working.P/data.P/pothoven-attachment_fu-3.2.9/lib/technoweenie/attachment_fu/processors/core_image_processor.rb
properties = { OSX::NSImageCompressionFactor => quality / 100.0 } if quality
result.save(self.temp_path, OSX::NSJPEGFileType, properties)
#
# puts "#{self.temp_path} @ #{quality.inspect} -> #{%x(identify -format '%Q' "#{self.temp_path}")}"
#
self.size = File.size(self.temp_path)
end
#===============================================================#
./working.P/data.P/pangolin-0.4.3/spec/integration/javac_intg_spec.rb
end
it 'is runnable' do
output = %x(cd #{@output_dir} && java com.example.HelloWorld)
output.should == "Hello world\n"
end
end
#===============================================================#
./working.P/data.P/pangolin-0.4.3/spec/integration/jar_intg_spec.rb
context 'unpacked' do
before do
%x(cd #{@output_dir} && jar -xf #{@output_file})
end
it 'can be unpacked' do
--
context 'table of contents' do
it 'contains all files' do
file_listing = %x(jar -tf #{@output_file})
file_listing.should include('com/example/HelloWorld.class')
end
it 'contains a manifest' do
file_listing = %x(jar -tf #{@output_file})
file_listing.should include('META-INF/MANIFEST.MF')
end
end
#===============================================================#
./working.P/data.P/pangolin-0.4.3/lib/pangolin/exec/junit.rb
class_path_str = (@class_path + [JUNIT_JAR_PATH]).join(':')
test_classes = @class_names.join(' ')
output = %x(java -classpath #{class_path_str} org.junit.runner.JUnitCore #{test_classes} 2>&1)
print_result(io, output)
#===============================================================#
./working.P/data.P/pangolin-0.4.3/lib/pangolin/exec/javac.rb
include JavacCommon
def execute_compiler(io)
output = %x(javac #{command_args.join(' ')} 2>&1)
io.puts(format_output(output))
#===============================================================#
./working.P/data.P/puzzle_selector-1.0.2/lib/puzzle_selector/main_window.rb
# Launch the puzzle corresponding to the button that was clicked.
def launch
exec = PuzzleManager.instance.exec_for_name sender.text
Thread.new { %x(nohup #{exec} > /dev/null 2>&1&) }
end
end
end
#===============================================================#
./working.P/data.P/pdf-writer-1.1.8/demo/qr-language.rb
%Q(interpolation and backslashes)
%(interpolation and backslashes)
`echo command interpretation with interpolation and backslashes`
%x(echo command interpretation with interpolation and backslashes)
EOS
h3 "Backslashes"
#===============================================================#
./working.P/data.P/picolena-0.2.2/lib/picolena/templates/spec/models/plain_text_extractor_spec.rb
# File.should exist(doc.send(:thumbnail_path))
File.exist?(thumb_path).should be_true
# NOTE: It seems that ffmpegthumbnailer outputs a png file even with -o output.jpg
%x(file -ib #{thumb_path}).chomp.should =~ /image\/(jpeg|png)/
end
else
it should_extract_thumbnail
#===============================================================#
./working.P/data.P/pupu-0.2.1/lib/pupu/github.rb
module ShellExtensions
def run(command)
puts "[SHELL] #{command} # in #{Dir.pwd}"
%x(#{command})
$?.exitstatus == 0
end
end
--
protected
def save_metadata(pupu, url)
revision = %x(git log --pretty=format:'%H' -1)
dsl = DSL.new(pupu)
dependencies = dsl.get_dependencies.map { |dependency| dependency.name }
params = {revision: revision, repository: url, dependencies: dependencies}
#===============================================================#
./working.P/data.P/pullall-0.1.7/lib/pullall/actions.rb
paths = load_paths(group)
paths.each do |path|
puts "Pulling from #{colorize(path)}:"
%x((cd #{path} && git pull origin master))
puts "\n"
end
end
#===============================================================#
./working.S/data.S/sgf_parser-0.1.0/lib/sgf/parser.rb
def is_binary? file
# This does not work?!
# parts = %x(/usr/bin/file -i #{file}).split(':', 2)
# not parts[1].include?('text')
end
end
#===============================================================#
./working.S/data.S/snatch-1.1.0/lib/snatch.rb
arguments = args.join(' ')
redirect = ' > /dev/null' if options[:silent]
log "git #{command} #{arguments}#{redirect}"
%x(git #{command} #{arguments}#{redirect})
end
def remove_cms_files
#===============================================================#
./working.S/data.S/shelly-0.4.1/lib/shelly/structure_validator.rb
def tasks
return [] unless rakefile?
@loaded_tasks ||= %x(rake -P).split("\n")
end
def repo_paths
#===============================================================#
./working.S/data.S/sudothinker-eeepub-0.6.1/lib/eeepub/ocf.rb
container.save(File.join(meta_inf, 'container.xml'))
%x(zip -X9 \"#{output_path}\" mimetype)
%x(zip -Xr9D \"#{output_path}\" * -xi mimetype)
end
end
end
#===============================================================#
./working.S/data.S/style-scanner-0.0.7/spec/integrations/command_line_spec.rb
it "calls the scanner when cmd line called with an echoed sentence" do
# mispelling error should show
%x(echo '#{text}' | style-scanner -s).should match "dlog"
end
it "calls the scanner when cmd line called with a file" do
%x(style-scanner '#{file}').should match "cliché"
end
it "works with HTML input" do
# mispelling in html should not show if stripper properly
%x(echo '#{html}' | style-scanner -h -s).should_not match "dlog"
end
it "doesn't do adverbs by default" do
%x(echo '#{adverb_text}' | style-scanner).should_not match "quietly"
end
it "can turn on adverbs as needed using command line options" do
%x(echo '#{adverb_text}' | style-scanner -a).should match "quietly"
end
it "works with Textile input" do
# this test works because the software will visit the image link if the html is not stripped
%x(echo '#{textile}' | style-scanner -t -s).should_not match "dlog"
end
end
#===============================================================#
./working.S/data.S/sedna-0.6.0/ext/sedna/extconf.rb
# Fix multiple arch flags on Mac OS X.
if RUBY_PLATFORM.include?("darwin")
ldir.each do |libdir|
if File.exists?("#{libdir}/libsedna.a") and %x(which lipo && lipo -info #{libdir}/libsedna.a) =~ /architecture: (.+)$/
set_arch($1) unless $1 == "i386"
break
end
#===============================================================#
./working.S/data.S/skullet-0.0.1/spec/skullet_spec.rb
end
it "-v, shows the version" do
%x(#{executable} -v).should include(Skullet::VERSION)
end
context "basic project structure" do
#===============================================================#
./working.S/data.S/skullet-0.0.1/spec/skullet/generator_spec.rb
end
it "uses current ruby, a gemset named after the project and the option --create" do
version = %x(ruby -v).split(" ")[1]
if version.include? "p"
with_patch = version.split "p"
version = "#{with_patch[0]}-p#{with_patch[1]}"
#===============================================================#
./working.S/data.S/skullet-0.0.1/lib/skullet/generator.rb
end
def make_rvm
ruby_version = %x(ruby -v).split(" ")[1]
if ruby_version.include? "p"
with_patch = ruby_version.split "p"
ruby_version = "#{with_patch[0]}-p#{with_patch[1]}"
#===============================================================#
./working.S/data.S/sourcify-0.5.0/spec/spec_helper.rb
# http://tyenglog.heroku.com/2010/9/how-to-test-irb-specific-support-2-
sourcify_rb = File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'sourcify.rb')
irb_feedback = /^ => /
values = %x(echo "#{stdin_str}" | irb -r #{sourcify_rb}).split("\n").
grep(irb_feedback).map{|s| eval(s.sub(irb_feedback,'').strip) }
# IRB behaves slightly differently in 1.9.2 for appending newline
(values[-1].nil? && RUBY_VERSION.include?('1.9.2')) ? values[0 .. -2] : values
#===============================================================#
./working.S/data.S/sourcify-0.5.0/spec/proc/to_source_magic_line_var_spec.rb
end
should 'handle interpolation in (%x) command' do
lambda { %x(echo #{__LINE__}) }.should.be having_source(%Q(proc { %x(echo \#{#{__LINE__}}) }))
end
should 'handle interpolation in (`) command' do
#===============================================================#
./working.S/data.S/sourcify-0.5.0/spec/proc/to_source_magic_file_var_spec.rb
end
should 'handle interpolation in (%x) command' do
lambda { %x(echo #{__FILE__}) }.should.be having_source(%Q(proc { %x(echo #{__FILE__}) }))
end
should 'handle interpolation in (`) command' do
#===============================================================#
./working.S/data.S/shipping_materials-0.0.2/lib/shipping_materials/storage.rb
base = "#{save_path}/#{basename}"
html_file, pdf_file = base + '.html', base + '.pdf'
File.open(html_file, 'w') {|f| f.write(contents) }
%x( wkhtmltopdf #{html_file} #{pdf_file} )
File.unlink(html_file)
if Config.use_s3? && !Config.use_gzip?
@s3 ||= S3.new
#===============================================================#
./working.S/data.S/sprout-0.7.246/lib/sprout/archive_unpacker.rb
zip_name = File.basename(zip_file)
output = File.expand_path(dir)
# puts ">> zip_dir: #{zip_dir} zip_name: #{zip_name} output: #{output}"
%x(cd #{zip_dir};unzip #{zip_name} -d #{output})
else
retries = 0
begin
#===============================================================#
./working.S/data.S/smog-0.0.4/lib/smog/cli.rb
2.times do
command = build_curl
@last_response = %x(#{ command })
puts_response command, @last_response
end
end
#===============================================================#
./working.S/data.S/specjour-0.7.0/lib/specjour/cpu.rb
protected
def self.command(cmd)
%x(#{cmd})
end
def self.platform
#===============================================================#
./working.S/data.S/smushkid-0.0.3/lib/smushkid.rb
puts "no space savings acheived deleting #{@target_file}" unless @quiet
puts "tagging original file" unless @quiet
@quoted_filename = "\"#{file}\""
%x(/usr/local/bin/jhead -cl \"smushkid\" #{@quoted_filename}) if @exif_tag
File.delete(@target_file)
else
if @make_backup
puts "space savings! replacing with: #{simg} and making backup or original: #{@backup_file}" unless @quiet
puts "tagging target file" unless @quiet
%x(/usr/local/bin/jhead -cl \"smushkid\" #{@quoted_filename}) if @exif_tag
puts "move #{@target_file} to #{file}" unless @quiet
FileUtils.cp file, @backup_file
File.rename @target_file, file
--
else
puts "space savings! replacing with #{simg}" unless @quiet
puts "tagging target file" unless @quiet
%x(/usr/local/bin/jhead -cl \"smushkid\" #{@quoted_filename}) if @exif_tag
puts "move #{@target_file} to #{file}" unless @quiet
File.rename @target_file, file
File.open("images_processed.json", "a+") { |f| f << @image_results.to_json + ','}
#===============================================================#
./working.S/data.S/scout-5.7.1/lib/scout/server.rb
# captures a list of processes running at this moment
def take_snapshot
info "Taking a process snapshot"
ps=%x(ps aux).split("\n")[1..-1].join("\n") # get rid of the header line
@checkin[:snapshot]=ps
rescue Exception
error "unable to capture processes on this server. #{$!.message}"
#===============================================================#
./working.S/data.S/sml-twitter-0.7.3/examples/oauth.rb
rsecret = oauth.request_token.secret
puts "> redirecting you to twitter to authorize..."
%x(open #{oauth.request_token.authorize_url})
print "> what was the PIN twitter provided you with? "
pin = gets.chomp
#===============================================================#
./working.S/data.S/sml-twitter-0.7.3/examples/connect.rb
})
# authorize in browser
%x(open #{oauth.request_token.authorize_url})
end
#===============================================================#
./working.S/data.S/sakuric-2.1.3/lib/sonice-players/mpd.rb
end
def launched?
%x(mpc 2> /dev/null)
$? == 0
end
--
private
def mpc(command)
%x(mpc #{command}).split("\n").first
end
end
#===============================================================#
./working.S/data.S/sakuric-2.1.3/lib/sonice-players/rhythmbox.rb
end
def launched?
%x(rhythmbox-client --no-start --print-playing 2>/dev/null).rstrip != ""
end
private
def tell_to(command)
%x(rhythmbox-client --no-start --#{command}).rstrip
end
end
#===============================================================#
./working.S/data.S/sakuric-2.1.3/lib/sonice-players/itunes_mac.rb
end
def launched?
%x(osascript -e 'tell app "Itunes" to return name of current track' 2>/dev/null)
$? == 0
end
--
private
def tell_to(command)
%x(osascript -e 'tell app "iTunes" to #{command}').rstrip
end
end
#===============================================================#
./working.S/data.S/sakuric-2.1.3/bin/jason-xpath.rb
cmd_exec = "/usr/bin/python -c \"#{my_program}\" 2>/dev/null"
myin = $stdin.read
%x( #{cmd_exec} )
IO.popen(cmd_exec, mode='w') do |io|
io.write(myin)
end
#===============================================================#
./working.S/data.S/sakuric-2.1.3/bin/json-xpath.rb
cmd_exec = "/usr/bin/python -c \"#{my_program}\" 2>/dev/null"
myin = $stdin.read
%x( #{cmd_exec} )
IO.popen(cmd_exec, mode='w') do |io|
io.write(myin)
end
#===============================================================#
./working.S/data.S/secobarbital-twitter-0.9.2.2/examples/oauth.rb
rsecret = oauth.request_token.secret
puts "> redirecting you to twitter to authorize..."
%x(open #{oauth.request_token.authorize_url})
print "> what was the PIN twitter provided you with? "
pin = gets.chomp
#===============================================================#
./working.S/data.S/secobarbital-twitter-0.9.2.2/examples/connect.rb
})
# authorize in browser
%x(open #{oauth.request_token.authorize_url})
end
#===============================================================#
./working.S/data.S/sweety_backy-0.0.21/test/commander_test.rb
"#{@tmp_dir}/back.tar.gz"
)
result = %x(tar -tzvf #{@tmp_dir}/back.tar.gz)
assert_match( "./", result )
assert_match( "./file1.txt", result )
--
}
)
result = %x(tar -tzvf #{@tmp_dir}/back.sql.tar.gz)
assert_match( /\sback.sql$/, result )
end
#===============================================================#
./working.S/data.S/sweety_backy-0.0.21/lib/sweety_backy/utils.rb
def self.command( _command )
Utils.log "command: #{_command}"
result = %x( #{_command} )
raise "ERROR: on command: '#{_command}', result: '#{result}'" if $?.exitstatus != 0
#===============================================================#
./working.S/data.S/stagecoach-0.0.1/lib/ach/creator.rb
# rt_num_check_mod = mod_operation(structure[:bank_params][:receiving_dfi_routing_num])
@count_filelines = %x(wc -l #{"#{ach_filename}"}).split.first.to_i
@block_count = block_count(@count_filelines)
#((@trace_number_counter.last-1)+(@addenda_record_count.last-1)), #TODO: REPLACE THIS!!! @entry_details[:records].size
file_control = FileControlRecord.new(
#===============================================================#
./working.S/data.S/sonixlabs-net-ssh-2.3.0/lib/net/ssh/loggable.rb
# originates. It defaults to the name of class with the object_id
# appended.
def facility
@facility ||= self.class.name.gsub(/::/, ".").gsub(/([a-z])([A-Z])/, "\\1_\\2").downcase + "[%x]" % object_id
end
end
end; end
#===============================================================#
./working.I/data.I/inkscape_merge-0.1.3/lib/inkscape_merge/processor.rb
@options.csv_options = {:headers => true, :col_sep => ',', :encoding => 'utf-8'}
@options.limit = 0
@options.dpi = 300
@options.inkscape = %x(which inkscape).chomp
# If no Inkscape in PATH, try to guess from platform
if options.inkscape.empty?
options.inkscape = case RUBY_PLATFORM
#===============================================================#
./working.I/data.I/iccs-soap-0.1.14/lib/iccs-soap.rb
class CustomLogFormatter
require 'term/ansicolor'
TIME_FORMAT = "%Y-%m-%d %H:%M:%S."
HOST = %x(hostname).chomp
APP = File.basename(Dir.pwd)
String.send(:include, Term::ANSIColor)
#===============================================================#
./working.I/data.I/itgwiki_mirror-1.0.4/lib/itgwiki_mirror/backuper.rb
# XXX You CANNOT have a space between -p and the password
#
%x( mysqldump -u#{@db_user} -p#{@db_pass} #{@db_name} > #{@dumpfile} )
puts %( mysqldump -u#{@db_user} -p#{@db_pass} #{@db_name} > #{@dumpfile} ) if $DEBUG
end
--
puts %( rsync #{opts} #{src} #{dst} ) if $DEBUG
%x( rsync #{opts} #{src} #{dst} )
end
--
# just touch a file called "complete" in the mirror target
#
%x( ssh #{@user}@#{@host} #{port} touch #{@rsync}/complete )
end
end
end
#===============================================================#
./working.I/data.I/itgwiki_mirror-1.0.4/lib/itgwiki_mirror/deployer.rb
# XXX no space allowed between -p and password
#
%x( mysql -u#{@db_user} -p#{@db_pass} -e 'drop database #{@db_name}' )
end
--
# XXX no space allowed between -p and password
#
%x( mysql -u#{@db_user} -p#{@db_pass} -e 'create database #{@db_name}' )
end
--
# XXX no space allowed between -p and password
#
%x( mysql -u#{@db_user} -p#{@db_pass} #{@db_name} < #{@mirror}/itgwiki.mysqldump )
end
--
# comment the wgServer line
#
%x( sed -i '/wgServer/ s/^/#/' #{@mirror}/w/LocalSettings.php )
end
--
# comment lines with the word sphinx (case insensitive) in them that are
# not already commented
#
%x( sed -i '/^[^#].*sphinx/I s/^/#/' #{@mirror}/w/LocalSettings.php )
end
--
# append readonly message to config file
#
%x( echo '$wgReadOnly = "#{READ_ONLY_MSG}";' >> #{@mirror}/w/LocalSettings.php )
end
--
# sync the contents of the directory into the wiki directory. `man rsync`
# for more details.
#
%x( rsync -a #{@mirror}/w/ #{@wiki} )
end
end
end
#===============================================================#
./working.T/data.T/tbooster-0.2.3/lib/tbooster.rb
end
def self.listener_processes_exist?
listener_pids = (%x( cat #{pid} ) || "").split(" ").map{|pid| pid.to_i}.select{|pid| pid > 0}
return false if listener_pids.length != 2
processes_exist = true
--
end
def self.close_all_and_cleanup
%x( rm -f #{pipe} ) if File.exists?(pipe)
if File.exists?(pid)
kill_opened_processes
%x( rm -f #{pid} )
end
end
def self.kill_opened_processes
%x( kill -9 `cat #{pid}` )
end
def self.start_listeners
--
def self.send(args)
unless File.exist?(pipe)
%x( mkfifo #{pipe} )
end
if args.length > 0
#===============================================================#
./working.T/data.T/toggle-1.0.0/spec/cli_spec.rb
end
before :each do
%x(echo "#{content}" > #{default_key_file})
end
after :each do
--
describe "when key does not exist" do
it "copies the default key to the actual" do
%x(./bin/toggle --ensure-key #{test_dir})
FileUtils.identical?(key_file, default_key_file).should == true
end
end
--
let(:key_content) { 'existing_key' }
before do
%x(echo "#{key_content}" > #{key_file})
end
it "leaves the current key alone" do
%x(./bin/toggle --ensure-key #{test_dir})
File.read(key_file).chomp.should == key_content
end
end
--
end
before :each do
%x(echo "#{default_config_content}" > #{default_config_file})
end
after :each do
--
actual_key_file = File.join(test_dir, 'key.yml')
default_key_content = 'some_key'
%x(echo "#{default_key_content}" > #{default_key_file})
%x(./bin/toggle --copy-config-defaults #{test_dir})
File.exists?(actual_key_file).should == false
end
describe "no config exists" do
it "copies the default config to the actual" do
%x(./bin/toggle --copy-config-defaults #{test_dir})
FileUtils.identical?(actual_config_file, default_config_file).should == true
end
end
describe "config is identical to default" do
before do
%x(cp #{default_config_file} #{actual_config_file})
end
it "leaves current config unchanged" do
%x(./bin/toggle --copy-config-defaults #{test_dir})
FileUtils.identical?(actual_config_file, default_config_file).should == true
end
end
--
let(:different_content) { "#{default_config_content} BUT DIFFERENT" }
before do
%x(echo "#{different_content}" > #{actual_config_file})
end
it "leaves current config unchanged when user responds with anything but 'y' words" do
%x(echo 'n' | ./bin/toggle --copy-config-defaults #{test_dir})
FileUtils.identical?(actual_config_file, default_config_file).should == false
end
it "replaces current config with default when user responds with 'y' words" do
%x(echo 'y' | ./bin/toggle --copy-config-defaults #{test_dir})
FileUtils.identical?(actual_config_file, default_config_file).should == true
File.read(actual_config_file).chomp.should == default_config_content
end
--
end
before :each do
%x(echo "#{config_default_content}" > #{config_default_file})
%x(echo "#{key_default_content}" > #{key_default_file})
end
after :each do
--
describe "copies default config and key file" do
it "copies each default file over to its appropriate location" do
%x(./bin/toggle --copy-defaults #{test_dir})
FileUtils.identical?(config_default_file, config_actual_file).should == true
FileUtils.identical?(key_default_file, key_actual_file).should == true
end
--
describe "actual is identical to default" do
before do
%x(cp #{config_default_file} #{config_actual_file})
end
it "leaves current file unchanged" do
%x(./bin/toggle --copy-defaults #{test_dir})
FileUtils.identical?(config_default_file, config_actual_file).should == true
end
end
--
let(:different_content) { "#{config_default_content} BUT DIFFERENT" }
before do
%x(echo "#{different_content}" > #{config_actual_file})
end
it "leaves current file unchanged when user responds with anything but 'y' words" do
%x(echo 'n' | ./bin/toggle --copy-defaults #{test_dir})
FileUtils.identical?(config_default_file, config_actual_file).should == false
File.read(config_actual_file).chomp.should == different_content
end
it "replaces current file with default when user responds with 'y' words" do
%x(echo 'y' | ./bin/toggle --copy-defaults #{test_dir})
FileUtils.identical?(config_default_file, config_actual_file).should == true
File.read(config_actual_file).chomp.should == config_default_content
end
--
let(:config_file) { File.join(FIXTURES_PATH, 'config.yml') }
it "alerts the user if the file is not found" do
%x(./bin/toggle --keys /path/to/nothing).chomp.should == "toggle config file not found, please check specified path"
end
it "can be queried for the available keys from the commandline" do
%x(./bin/toggle --keys #{config_file}).chomp.should == "- local\n- remote"
end
end
--
let(:config_file) { File.join(FIXTURES_PATH, 'config.yml') }
it "alerts the user if the file is not found" do
%x(./bin/toggle --values /path/to/nothing).chomp.should == "toggle config file not found, please check specified path"
end
it "can be queried for the available keys from the commandline" do
%x(./bin/toggle --values #{config_file},local).should == <<-EOS.strip_heredoc
---
:plain_attribute: local_plain_attribute_value
:erb_attribute: local_erb_attribute_value
--
describe "file does not exist" do
it "adds .toggle.local with commons var placeholders" do
%x(./bin/toggle --init-local #{test_dir})
File.read(file).chomp.should == <<-EOS.strip_heredoc
# Add any variables that you'd like below.
#
--
describe "file already exists" do
before do
%x(echo "SOME CONTENT" > #{file})
end
it "leaves .toggle.local unchanged when user responds with anything but 'y' words" do
%x(echo 'n' | ./bin/toggle --init-local #{test_dir})
File.read(file).chomp.should == 'SOME CONTENT'
end
it "replaces .toggle.local with default when user responds with 'y' words" do
%x(echo 'y' | ./bin/toggle --init-local #{test_dir})
File.read(file).chomp.should == <<-EOS.strip_heredoc
# Add any variables that you'd like below.
#
--
describe "when user has not created any actual or .default files" do
it "creates a default key + config file in the passed path" do
%x(./bin/toggle --make-defaults #{test_dir})
File.read(default_key_file).should == <<-EOS.strip_heredoc
# Copy this file to ./key{.exts} or run the following command:
#
--
describe "when user has created an actual key file but the corresponding .default file does not exist" do
before do
%x(echo "SOME CONTENT" > #{actual_key_file})
end
it "copies the actual user created key file to the corresponding .default" do
%x(./bin/toggle --make-defaults #{test_dir})
File.read(default_key_file).should == "SOME CONTENT\n"
end
end
describe "when user has created an actual config file but the corresponding .default file does not exist" do
before do
%x(echo "SOME CONTENT" > #{actual_config_file})
end
it "copies the actual user created file to the corresponding .default" do
%x(./bin/toggle --make-defaults #{test_dir})
File.read(default_config_file).should == "SOME CONTENT\n"
end
end
describe "when user has created .default key file" do
before do
%x(echo "SOME CONTENT" > #{default_key_file})
end
it "leaves the .default file unchanged when user responds with anything but 'y' words" do
%x(echo 'n' | ./bin/toggle --make-defaults #{test_dir})
File.read(default_key_file).should == "SOME CONTENT\n"
end
it "replaces the .default file with default when user responds with 'y' words" do
%x(echo 'y' | ./bin/toggle --make-defaults #{test_dir})
File.read(default_key_file).should == <<-EOS.strip_heredoc
# Copy this file to ./key{.exts} or run the following command:
#
--
describe "when user has created .default config file" do
before do
%x(echo "SOME CONTENT" > #{default_config_file})
end
it "leaves current config file unchanged when user responds with anything but 'y' words" do
%x(echo 'n' | ./bin/toggle --make-defaults #{test_dir})
File.read(default_config_file).should == "SOME CONTENT\n"
end
it "replaces current config file with default when user responds with 'y' words" do
%x(echo 'y' | ./bin/toggle --make-defaults #{test_dir})
File.read(default_config_file).should == <<-EOS.strip_heredoc
# Copy this file to ./config.yml or run the following command:
#
#===============================================================#
./working.T/data.T/tmux-connector-1.0.8/lib/tmux-connector/tmux_handler.rb
end
def self.delete_all_tmux_sessions()
sessions_list = %x( tmux list-sessions 2> /dev/null)
sessions = sessions_list.scan(/^([^:]+): /).map(&:first)
sessions.each { |e| delete_tmux_session e }
end
#===============================================================#
./working.T/data.T/tb_release-0.0.9/lib/tb_release/command.rb
unless capture
system(com)
else
@output = %x(#{com}).chomp
end
end
#===============================================================#
./working.T/data.T/toadhopper-2.1/lib/toadhopper.rb
params = {}
params['api_key'] = @api_key
params['deploy[rails_env]'] = options[:framework_env] || 'development'
params['deploy[local_username]'] = options[:username] || %x(whoami).strip
params['deploy[scm_repository]'] = options[:scm_repository]
params['deploy[scm_revision]'] = options[:scm_revision]
response(@deploy_url, params)
#===============================================================#
./working.T/data.T/tagcrumbs-0.3.2/examples/request_authorization.rb
unless Tagcrumbs.valid_credentials?
puts "Please authorize the Gem to have access to your Tagcrumbs account on: #{Tagcrumbs.authorize_url}"
%x(open #{Tagcrumbs.authorize_url}) # open browser
print "Press Enter to continue..."
gets
#===============================================================#
./working.T/data.T/tagcrumbs-0.3.2/lib/tagcrumbs/cli.rb
@stdout.puts "Connecting to Tagcrumbs..."
authorize_url = Tagcrumbs.authorize_url
%x(open #{authorize_url})
@stdout.print "Please authorize the application in your browser: #{authorize_url}.\nPress Enter after you authorized the application to continue..."
@stdin.gets
#===============================================================#
./working.T/data.T/twitter-multi-0.9.8.3/examples/oauth.rb
rsecret = oauth.request_token.secret
puts "> redirecting you to twitter to authorize..."
%x(open #{oauth.request_token.authorize_url})
print "> what was the PIN twitter provided you with? "
pin = gets.chomp
#===============================================================#
./working.T/data.T/twitter-multi-0.9.8.3/examples/connect.rb
})
# authorize in browser
%x(open #{oauth.request_token.authorize_url})
end
#===============================================================#
./working.T/data.T/tdd-attachment_fu-0.9.9.b/test/test_helper.rb
File.open(result, 'wb') { |f| f.write(thumb.db_file.data) }
result
end
quality = %x(identify -format '%Q' "#{filename}" 2> /dev/null)
if $?.success?
assert_equal expected, quality.to_i, "Produced JPEG quality (thumbnail: #{thumbnail.inspect}) is incorrect."
else
#===============================================================#
./working.T/data.T/tdd-attachment_fu-0.9.9.b/lib/technoweenie/attachment_fu/processors/core_image_processor.rb
properties = { OSX::NSImageCompressionFactor => quality / 100.0 } if quality
result.save(self.temp_path, OSX::NSJPEGFileType, properties)
#
# puts "#{self.temp_path} @ #{quality.inspect} -> #{%x(identify -format '%Q' "#{self.temp_path}")}"
#
self.size = File.size(self.temp_path)
end
#===============================================================#
./working.T/data.T/twitter-jruby-0.9.7.2010061001/examples/oauth.rb
rsecret = oauth.request_token.secret
puts "> redirecting you to twitter to authorize..."
%x(open #{oauth.request_token.authorize_url})
print "> what was the PIN twitter provided you with? "
pin = gets.chomp
#===============================================================#
./working.T/data.T/twitter-jruby-0.9.7.2010061001/examples/connect.rb
})
# authorize in browser
%x(open #{oauth.request_token.authorize_url})
end
#===============================================================#
./working.T/data.T/thepub-0.0.2/lib/thepub/epub/ocf.rb
f << 'application/epub+zip'
end
# mimetype has to be first in the archive
%x(zip -X9 \"#{output_path}\" mimetype)
%x(zip -Xr9D \"#{output_path}\" * -xi mimetype)
end
end
#===============================================================#
./working.T/data.T/turnip-1.1.0/spec/integration_spec.rb
describe 'The CLI', :type => :integration do
before do
@result = %x(rspec -fs examples/*.feature)
end
it "shows the correct description" do
#===============================================================#
./working.T/data.T/todone-0.2.7/spec/helper.rb
ABS_CONFIG_FILE = File.join(CONFIG_DIR, Todone::Consts::CONFIG_FILE)
def clean_test_config!
%x(rm -rf #{CONFIG_DIR}) if File.exists? CONFIG_DIR
end
def dummy_config
--
def ensure_fresh_config!
clean_test_config!
%x(mkdir -p #{CONFIG_DIR}) unless File.exists? CONFIG_DIR
File.open(ABS_CONFIG_FILE, 'w') {|f| f.write(dummy_config.to_yaml) }
end
#===============================================================#
./working.T/data.T/teejayvanslyke-twitter-0.6.11/examples/connect.rb
})
# authorize in browser
%x(open #{oauth.request_token.authorize_url})
end
#===============================================================#
./working.T/data.T/testlab-1.6.1/lib/commands/network.rb
@testlab.ui.stdout.puts("Routes for TestLab network '#{network.id}':".green.bold)
case RUBY_PLATFORM
when /darwin/ then
@testlab.ui.stdout.puts %x(netstat -nrf inet | grep '#{osx_network(network)}/#{network.cidr}').strip
when /linux/ then
@testlab.ui.stdout.puts %x(netstat -nr | grep '#{network.network}').strip
end
end
end
#===============================================================#
./working.T/data.T/tnargav-1.2.3/vendor/bundle/ruby/1.9.1/gems/net-ssh-2.6.8/lib/net/ssh/loggable.rb
# originates. It defaults to the name of class with the object_id
# appended.
def facility
@facility ||= self.class.name.gsub(/::/, ".").gsub(/([a-z])([A-Z])/, "\\1_\\2").downcase + "[%x]" % object_id
end
end
end; end
#===============================================================#
./working.T/data.T/t2-web-0.2.0/bin/t2_webapp.rb
# Check what kind of file it is. for now use system 'file' -- note that it will only
# work with one image since flatten_list_results only deals with multi-line strings
# and single strings or single images (indirectly!)
mime_type = %x( file --mime-type #{display_file} )
# TODO: image types can go to array and regex auto-generated
# TODO: application/octet-stream is a temporary hack until we deal with 'typing' properly
--
if mime_type =~ /octet-stream/
unless File.file?("#{settings.public_folder}/#{WEB_APP_NAME}/tmp/outputs/#{run_uuid}/clean_#{t2_output}")
new_length = File.size?(display_file) - 3 - 5 # for and \n respectively
%x( dd if="#{display_file}" of="#{settings.public_folder}/#{WEB_APP_NAME}/tmp/outputs/#{run_uuid}/clean_#{t2_output}" bs=1 skip=3 count="#{new_length}" )
end
generate_image_result("/#{WEB_APP_NAME}/tmp/outputs/#{run_uuid}/clean_#{t2_output}")
else
#===============================================================#
./working.R/data.R/rutty-2.5.4/test/helper.rb
def call_init
unless File.exists? TEST_CONF_DIR
%x(#{RUTTY_BIN} init #{TEST_CONF_DIR})
end
end
def clean_test_config!
%x(rm -rf #{TMP_DIR}) if File.exists? TMP_DIR
end
def seed_nodes
out = %x(#{RUTTY_BIN} add_node localhost -c #{TEST_CONF_DIR} -k ~/.ssh/id_rsa -u #{ENV['USER']} -g localhost,test -p 22)
assert_match /Added localhost/, out
end
def seed_bad_node
out = %x(#{RUTTY_BIN} add_node example.com -c #{TEST_CONF_DIR} -g example,test,broken)
assert_match /Added example\.com/, out
end
#===============================================================#
./working.R/data.R/rutty-2.5.4/test/test_action_add_node.rb
should "properly create a new node entry when called" do
require 'yaml'
output = %x(#{RUTTY_BIN} add_node -c #{TEST_CONF_DIR} example.com -k /home/user/.ssh/id_rsa -u root -p 22333 -g example,testing)
assert_match /#{Colors::GREEN}Added example\.com#{Colors::CLEAR}/, output
#===============================================================#
./working.R/data.R/rutty-2.5.4/test/test_action_scp.rb
File.open(@test_file_src, 'w') { |f| f.write "Hello, this is a test." }
@out = %x(#{RUTTY_BIN} scp -c #{TEST_CONF_DIR} -a #{@test_file_src} #{@test_file_dest} 2>&1)
assert_file_exists "#{@test_file_dest}"
assert_equal "Hello, this is a test.", File.read("#{@test_file_dest}")
--
File.open(@test_file_src, 'w') { |f| f.write "Hello, this is a test." }
@out = %x(#{RUTTY_BIN} scp -c #{TEST_CONF_DIR} -a #{@test_file_src} #{@test_file_dest} 2>&1)
assert_match /^#{Colors::GREEN}localhost#{Colors::CLEAR}\n+/, @out
assert_match /\n+#{Colors::GREEN}1 host\(s\), 0 error\(s\), \d+(?:\.\d+)? seconds?#{Colors::CLEAR}/, @out
--
File.open(@test_file_src, 'w') { |f| f.write "Hello, this is a test." }
@out = %x(#{RUTTY_BIN} scp -c #{TEST_CONF_DIR} -a #{@test_file_src} #{@test_file_dest} 2>&1)
assert_match /^#{Colors::YELLOW}#{Colors::RED_BG}example\.com#{Colors::CLEAR}\s+#{Colors::RED}ERROR: Connection timeout#{Colors::CLEAR}\n+/, @out
assert_match /\n+#{Colors::RED}1 host\(s\), 1 error\(s\), \d+(?:\.\d+)? seconds?#{Colors::CLEAR}/, @out
#===============================================================#
./working.R/data.R/rutty-2.5.4/test/test_action_init.rb
teardown { clean_test_config! }
should "create the file structure if it doesn't exist" do
out = %x(#{RUTTY_BIN} init #{TEST_CONF_DIR})
assert_file_exists TEST_CONF_DIR
assert_file_exists TEST_GENERAL_CONF
--
should "report that the file structure already exists if it does" do
ensure_fresh_config!
out = %x(#{RUTTY_BIN} init #{TEST_CONF_DIR})
exists = "#{Colors::CYAN}exists#{Colors::CLEAR}"
--
end
should "report that it has created the file structure if it doesn't exist" do
out = %x(#{RUTTY_BIN} init #{TEST_CONF_DIR})
create = "#{Colors::GREEN}create#{Colors::CLEAR}"
#===============================================================#
./working.R/data.R/rutty-2.5.4/test/test_action_list_nodes.rb
teardown { clean_test_config! }
should "report no defined nodes when no nodes are defined" do
output = %x(#{RUTTY_BIN} list_nodes -c #{TEST_CONF_DIR} 2>&1)
assert_match /#{Colors::YELLOW}No nodes defined#{Colors::CLEAR}/, output
end
should "properly list defined nodes in ASCII table format" do
3.times { seed_nodes }
output = %x(#{RUTTY_BIN} list_nodes -c #{TEST_CONF_DIR} 2>&1)
output = output.split("\n")
separator = /^(?:\+{1}\-+)+\+$/
--
should "properly list defined nodes in JSON format" do
3.times { seed_nodes }
output = %x(#{RUTTY_BIN} list_nodes -o json -c #{TEST_CONF_DIR} 2>&1)
require 'json'
require 'yaml'
--
should "properly list defined nodes in XML format" do
3.times { seed_nodes }
output = %x(#{RUTTY_BIN} list_nodes -o xml -c #{TEST_CONF_DIR} 2>&1)
require 'xmlsimple'
#===============================================================#
./working.R/data.R/rutty-2.5.4/test/test_action_dsh.rb
teardown { clean_test_config! }
should "report no defined nodes when no nodes defined" do
output = %x(#{RUTTY_BIN} -c #{TEST_CONF_DIR} -a uptime)
assert_match /^#{Colors::YELLOW}No nodes defined#{Colors::CLEAR}$/, output.rstrip
end
--
should "display a critical error state when unable to connect" do
seed_bad_node
output = %x(#{RUTTY_BIN} -c #{TEST_CONF_DIR} -a uptime)
assert_match /^#{Colors::YELLOW}#{Colors::RED_BG}example\.com#{Colors::CLEAR}\s+#{Colors::RED}ERROR: Connection timeout#{Colors::CLEAR}$/, output.rstrip
end
--
should "display a general error state when an exit code > 0 is returned" do
seed_nodes
output = %x(#{RUTTY_BIN} -c #{TEST_CONF_DIR} -a foobar)
assert_match /^#{Colors::BOLD}#{Colors::RED}localhost#{Colors::CLEAR}\s+.*command not found.*$/, output.rstrip
end
--
should "display the proper output on success" do
seed_nodes
output = %x(#{RUTTY_BIN} -c #{TEST_CONF_DIR} -a whoami)
assert_match /^#{Colors::GREEN}localhost#{Colors::CLEAR}\s+#{ENV['USER']}$/, output.rstrip
end
--
should "display successful statistics output" do
seed_nodes
output = %x(#{RUTTY_BIN} -c #{TEST_CONF_DIR} -a whoami)
assert_match /\n+#{Colors::GREEN}1 host\(s\), 0 error\(s\), \d+(?:\.\d+)? seconds?#{Colors::CLEAR}/, output
end
--
should "display error-state statistics output" do
seed_bad_node
output = %x(#{RUTTY_BIN} -c #{TEST_CONF_DIR} -a whoami)
assert_match /\n+#{Colors::RED}1 host\(s\), 1 error\(s\), \d+(?:\.\d+)? seconds?#{Colors::CLEAR}/, output
end
#===============================================================#
./working.R/data.R/rubycom-0.3.0/test/rubycom/rubycom_test.rb
command = "test_command_mixed_options"
args = "testing_arg \"[test1, test2]\" -test_opt='testing_option' \"{a: 'test_hsh_arg'}\" -test_bool=true some other args"
expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_bool=true test_rest=["some", "other", "args"]'+"\n"
result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
assert_equal(expected, result)
end
--
command = "test_command_mixed_options"
args = "testing_arg [test1,test2] -test_opt='testing_option' \"{a: 'test_hsh_arg'}\" some other args"
expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_bool=some test_rest=["other", "args"]'+"\n"
result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
assert_equal(expected, result)
end
--
command = "test_command_mixed_options"
args = 'testing_arg "[test1,test2]" -test_opt="testing_option" "{a: "test_hsh_arg"}" -test_bool=false some other args'
expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_bool=false test_rest=["some", "other", "args"]'+"\n"
result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
assert_equal(expected, result)
end
--
command = "test_command_mixed_options"
args = 'testing_arg "[ test1 , test2 ]" -test_opt="testing_option" "{ a: "test_hsh_arg" }" -test_bool=false some other args'
expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_bool=false test_rest=["some", "other", "args"]'+"\n"
result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
assert_equal(expected, result)
end
--
command = "test_command_mixed_options"
args = 'testing_arg "[ test1 , test2 ]" -test_opt="testing_option" "{ :a => "test_hsh_arg" }" false some other args'
expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={ :a => test_hsh_arg } test_bool=false test_rest=["some", "other", "args"]'+"\n"
result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
assert_equal(expected, result)
end
--
command = "test_command_mixed_options"
args = "testing_arg \"[test1, test2]\" -test_opt='testing_option' \"{a: 'test_hsh_arg'}\""
expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_bool=true test_rest=[]'+"\n"
result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
assert_equal(expected, result)
end
#===============================================================#
./working.R/data.R/relex-specjour-0.2.7/lib/specjour/cpu.rb
protected
def self.command(cmd)
%x(#{cmd})
end
end
end
#===============================================================#
./working.R/data.R/rack-smusher-0.0.4/lib/rack/smusher.rb
puts "compressing #{source}"
mkdir_p File.dirname(target), { :verbose => false }
cp_r source, target, { :verbose => false }
%x(smusher #{target})
[200, File.read(target)]
end
#===============================================================#
./working.R/data.R/rugui-1.6.0/lib/rugui/gem_dependency.rb
unless installed?
cmd = "#{gem_command} #{install_command.join(' ')}"
puts cmd
puts %x(#{cmd})
end
end
#===============================================================#
./working.R/data.R/rspec-puppet-augeas-0.2.3/lib/rspec-puppet-augeas/test_utils.rb
eos
end
output = %x(augparse #{testaug} 2>&1)
raise RSpec::Puppet::Augeas::Error, "augparse failed:\n#{output}" unless $? == 0 && output.empty?
end
end
#===============================================================#
./working.R/data.R/recipiez-0.5.4/recipes/deployment_recipiez.rb
def grab_revision_log
case scm.to_sym
when :git
%x( git log --pretty=format:"* #{"[%h, %an] %s"}" #{previous_revision}..#{current_revision} )
when :subversion
format_svn_log current_revision, previous_revision
end
--
def format_svn_log(current_revision, previous_revision)
require 'rexml/document'
begin
xml = REXML::Document.new(%x( svn log --xml --revision #{current_revision}:#{previous_revision} ))
xml.elements.collect('//logentry') do |logentry|
"* [#{logentry.attributes['revision']}, #{logentry.elements['author'].text}] #{logentry.elements['msg'].text}"
end.join("\n")
rescue
%x( svn log --revision #{current_revision}:#{previous_revision} )
end
end
#===============================================================#
./working.R/data.R/recipiez-0.5.4/recipes/campfire.rb
announcement = "#{announced_deployer} has deployed #{application} to #{announced_stage}"
campfire_room.speak announcement
begin
rev_log = %x( git log --pretty=format:"* #{"[%h, %an] %s"}" #{previous_revision}..#{current_revision} )
campfire_room.paste rev_log
rescue Faraday::Error::ParsingError
# FIXME deal with crazy color output instead of rescuing
#===============================================================#
./working.R/data.R/r18n-desktop-1.1.6/lib/r18n-desktop/osx.rb
module R18n
class I18n
def self.system_locale
%x(defaults read .GlobalPreferences AppleLanguages | tr -d [:space:] | cut -c2-3).chop
end
end
end
#===============================================================#
./working.R/data.R/reflection-0.5.0/lib/reflection/command/stash.rb
private
def move_stash_repository_git_index_to_target(source, target)
%x(mv #{source} #{target})
end
def commit_and_push_files(repository_path, target)
--
end
def move_stash_repository_git_index_back(source, target)
%x(mv #{source} #{target})
end
end
#===============================================================#
./working.R/data.R/reflection-0.5.0/lib/reflection/repository.rb
def pull
Reflection.log.debug "Pulling in #{self.path}.."
Reflection.log.debug(%x((cd #{self.path} && git pull --rebase)))
end
end
#===============================================================#
./working.R/data.R/reflection-0.5.0/lib/reflection/directory/base.rb
def clean!
Reflection.log.debug "Cleaning #{self.path}/.."
%x(rm -r #{self.path}/*)
end
def parent
--
def copy_git_index_to(target_path)
Reflection.log.debug "Copying git-index '#{self.git_index}' to #{target_path}"
%x(cp -R #{self.git_index} #{target_path})
end
def get_git_index_from(target_path)
Reflection.log.debug "Getting git-index from #{target_path}"
%x(rm -rf #{self.git_index}) if File.exists?(self.git_index)
%x(mkdir -p #{self.path})
%x(mv -f #{File.join(target_path, '/.git')} #{File.join(self.path, "/")})
end
def move_content_to(target_path)
Reflection.log.debug "Moving content to '#{target_path}'.."
%x(mv #{File.join(self.path, '/*')} #{File.join(target_path, '/')})
# %x(cp -R #{File.join(self.path, '/.')} #{target_path})
# %x(rm -rf #{self.path})
end
end
#===============================================================#
./working.R/data.R/reflection-0.5.0/lib/reflection/rails/database.rb
def run(command)
# Reflection.log.debug "-- #{command}"
%x(#{command})
end
#===============================================================#
./working.R/data.R/ruby_ext-4.0.3/lib/rake_ext.rb
namespace :docs do
desc "Generate documentation"
task :generate do
%x(cd docs && rocco -o site *.rb)
end
desc "Publish documentation"
#===============================================================#
./working.R/data.R/ruby_ext-4.0.3/lib/rake_ext/project.rb
class GemHelper
class << self
def next_version gem_name
%x(gem list --remote #{gem_name}).scan /#{gem_name} \((\d+\.\d+\.\d+)\)/ do |s|
v = s.first.split('.').collect{|d| d.to_i}
v[-1] = v[-1] + 1
return v.join('.')
--
File.open(gemspec_file, 'w'){|f| f.write gemspec.to_ruby}
puts ' building'
%x(gem build #{gemspec_file})
puts ' pushing'
gem_file = Dir.glob("#{gemspec.name}*.gem").first
--
gems, fake_gems = GemHelper.parse_project_gemfile
gems.each do |name, version|
puts "Installing gem #{name} #{version}"
%x(gem install #{name}#{" -v #{version}" if version}) # --ignore-dependencies)
end
end
--
gems, fake_gems = GemHelper.parse_project_gemfile
(gems + fake_gems).each do |name, version|
puts "Installing gem #{name} #{version}"
%x(gem install #{name} #{"-v #{version}" if version})
end
end
end
#===============================================================#
./working.R/data.R/redcar-dev-0.12.0dev-java/plugins/project/vendor/net-ssh/lib/net/ssh/loggable.rb
# originates. It defaults to the name of class with the object_id
# appended.
def facility
@facility ||= self.class.name.gsub(/::/, ".").gsub(/([a-z])([A-Z])/, "\\1_\\2").downcase + "[%x]" % object_id
end
end
end; end
#===============================================================#
./working.R/data.R/repctl-0.0.72/lib/repctl/mysql_admin.rb
"--innodb_data_home_dir=#{server['innodb_data_home_dir']} " +
"--innodb_log_group_home_dir=#{server['innodb_log_group_home_dir']} " +
"--relay-log=#{Socket.gethostname}-relay-bin"
%x( cd #{MYSQL_HOME} && #{cmd} )
end
#
#===============================================================#
./working.R/data.R/rails_csi-2.3.5.p6/lib/rails/gem_dependency.rb
unless installed?
cmd = "#{gem_command} #{install_command.join(' ')}"
puts cmd
puts %x(#{cmd})
end
end
#===============================================================#
./working.R/data.R/rvc-1.7.0/lib/rvc/modules/vnc.rb
end
if File.basename(VNC) == 'vncviewer' # or other vnc clients that support the same -passwd
tightvnc = %x(#{VNC} --version 2>&1).lines.first['TightVNC'] != nil
file = Tempfile.new('rvcvncpass')
filename = file.path
begin
#===============================================================#
./working.R/data.R/rubypython-raspi-0.1.2/spec/spec_helper.rb
end
def run_python_command(cmd)
%x(python -c '#{cmd}').chomp
end
RSpec.configure do |config|
#===============================================================#
./working.R/data.R/rubypython-raspi-0.1.2/lib/rubypython/interpreter.rb
def runpy(command)
i = @python || @python_exe || 'python'
if FFI::Platform.windows?
o = %x(#{i} -c "#{command}" 2> NUL:)
else
o = %x(#{i} -c "#{command}" 2> /dev/null)
end
[ $?, o.chomp ]
#===============================================================#
./working.R/data.R/rpbertp13-twitter-0.9.1/examples/connect.rb
})
# authorize in browser
%x(open #{oauth.request_token.authorize_url})
end
#===============================================================#
./working.R/data.R/rutabaga-0.0.4/spec/feature_spec.rb
describe 'integration', :type => :integration do
before do
@result = %x(rspec -r rutabaga -fs examples/*_spec.rb)
end
it "shows the correct description" do
#===============================================================#
./working.R/data.R/railscasts_download-0.3.1/lib/railscasts_download/downloader.rb
def get( uri )
filename = uri.split( '/' ).last
unless File.exists? filename
p %x(wget #{uri} -O #{filename}.tmp )
p %x(mv #{filename}.tmp #{filename} )
end
end
end
#===============================================================#
./working.R/data.R/ripper2ruby-0.0.2/test/nodes/string_test.rb
end
define_method :"test a percent-x delimited string" do
src = "%x(foo)"
assert_build(src)
end
#===============================================================#
./working.R/data.R/reactive-core-0.2.0/lib/reactive-core/gem_dependency.rb
def install
cmd = "#{gem_command} #{install_command.join(' ')}"
[cmd, %x(#{cmd})]
end
def embed
--
"Successfully embedded #{name} #{installer.spec.version}"
else
cmd = "#{gem_command} #{install_command.join(' ')} -i #{Reactive.path_for('gems')} --ignore-dependencies"
[cmd, %x(#{cmd})]
end
end
#===============================================================#
./working.R/data.R/rhodes-3.5.1.12/spec/framework_spec/app/spec/language/execution_spec.rb
describe "%x" do
it "is the same as ``" do
ip = 'world'
%x(echo disc #{ip}).should == "disc world\n"
end
end
=end
#===============================================================#
./working.R/data.R/ruby_cop-1.0.5/spec/analyzer/node_builder_spec.rb
it { should parse('"#$0"') }
it { should parse("'a' 'b'") }
it { should parse('`foo`') }
it { should parse('%x(foo)') }
end
context "symbol" do
#===============================================================#
./working.R/data.R/rspec-absolutely_prepended_after_each-0.0.1/spec/spec_helper.rb
# this example require spec and return to set
shared_examples "returning rspec output" do
def rspec(file)
%x(bundle exec rspec -fd #{file})
end
def common_configuration
#===============================================================#
./working.R/data.R/repub-0.3.5/lib/repub/epub/ocf.rb
f << 'application/epub+zip'
end
# mimetype has to be first in the archive
%x(zip -X9 \"#{output_path}\" mimetype)
%x(zip -Xr9D \"#{output_path}\" * -xi mimetype)
end
end
#===============================================================#
./working.R/data.R/rubylexer-0.7.7/test/data/pleac.rb
host_info = `host #{his_host}`
%x(ps #{$$})
banner = 'Costs only $4.95'.split(' ')
#===============================================================#
./working.R/data.R/right_link-5.9.1/scripts/thunker.rb
@log.error("'tty' command failed") unless $?.success?
if File.exists?(tty)
%x(sudo chown #{Shellwords.escape(username)} #{Shellwords.escape(tty)})
raise RuntimeError, "Failed to change ownership of #{tty}" unless $?.success?
else
@log.error("'tty' command did not give a reasonable answer: #{tty}")
#===============================================================#
./working.R/data.R/right_link-5.9.1/lib/instance/login_user_manager.rb
cmd = "sudo #{cmd}" unless Process.euid == 0
RightScale::Log.info("LoginUserManager command: #{cmd}")
output = %x(#{cmd})
result = $?
RightScale::Log.info("LoginUserManager result: #{$?.exitstatus}; output: #{cmd}")
#===============================================================#
./working.R/data.R/rlsm-1.8.1/examples/presenting_monoids_in_tex.rb
def dfa2tex(opts = { :dot => true })
dfa = @monoid.to_dfa
if opts[:dot] and not %x(which dot).empty?
filename = tmp_filename
dfa2pic dfa, :filename => filename, :format => 'plain'
#===============================================================#
./working.R/data.R/radiantcms-couchrest_model-0.2.4/vendor/rails/railties/lib/rails/gem_dependency.rb
unless installed?
cmd = "#{gem_command} #{install_command.join(' ')}"
puts cmd
puts %x(#{cmd})
end
end
#===============================================================#
./working.R/data.R/rubypython-0.6.3/spec/spec_helper.rb
end
def run_python_command(cmd)
%x(python -c '#{cmd}').chomp
end
RSpec.configure do |config|
#===============================================================#
./working.R/data.R/rubypython-0.6.3/lib/rubypython/interpreter.rb
def runpy(command)
i = @python || @python_exe || 'python'
if ::FFI::Platform.windows?
o = %x(#{i} -c "#{command}" 2> NUL:)
else
o = %x(#{i} -c "#{command}" 2> /dev/null)
end
[ $?, o.chomp ]
#===============================================================#
./working.R/data.R/radiant-rc-0.9.0/vendor/rails/railties/lib/rails/gem_dependency.rb
unless installed?
cmd = "#{gem_command} #{install_command.join(' ')}"
puts cmd
puts %x(#{cmd})
end
end
#===============================================================#
./working.R/data.R/rprompt-0.0.6/lib/rprompt.rb
# executes prompt item command
# @return [String] command result
def commandResult
%x(#{@cmd} 2> /dev/null)
end
end
#===============================================================#
./working.R/data.R/rubyworks-ec2-0.1.4/lib/util/database_backup.rb
key = EzCrypto::Key.with_password ENV['SECRET_ACCESS_KEY'], 'saltoftheearth'
unencrypted_contents = key.decrypt encrypted_contents
File.open(TMP_BACKUP_FILE, 'w') { |f| f << unencrypted_contents }
%x(mysql < #{TMP_BACKUP_FILE})
end
rescue AWS::S3::NoSuchBucket
STDERR.puts "Nothing to restore"
#===============================================================#
./working.R/data.R/rack-cookie-monster-1.1.0/features/support/celerity_startup.rb
kill_test_server
end
%x(vendor/gems/bin/rackup --require lib/rack/cookie_monster --require vendor/gems/environment --daemon --pid #{SERVER_PID} --server webrick features/monster.ru)
raise "Couldn't start server" unless host_listening_on_port? "localhost", $port, 10
$server ||= Culerity::run_server
#===============================================================#
./working.R/data.R/ruwiki-0.9.3/lib/ruwiki/auth/gforge.rb
user_name = rows[0].strip
sql = %Q(SELECT unix_group_name FROM groups g, users u, user_group ug WHERE u.user_name = '#{user_name}' AND ug.user_id = u.user_id AND g.group_id = ug.group_id)
res = %x(psql -q -t -U #{options['user']} #{options['pass']} -c \"#{sql}\")
groups = []
res.split(/\n/).each {|row| groups << row.strip }
AuthenticationResult.new(user_name, groups)
#===============================================================#
./working.R/data.R/runpuppet-1.0.2/test/binary_test.rb
require 'test/helper'
describe "Runpuppet" do
it "has no syntax errors" do
a = %x(./bin/runpuppet -h 2>&1)
a.must_match 'Runpuppet for puppet_controller'
end
end
#===============================================================#
./working.R/data.R/runpuppet-1.0.2/lib/runpuppet/config.rb
end
def read_shell(cmd)
%x(#{cmd})
end
end
end
#===============================================================#
./working.R/data.R/rails_info-0.1.0/spec/support/deferred_garbage_collection.rb
end
def self.memory_threshold
@mem = %x(free 2>/dev/null).to_s.split(" ")
return nil if @mem.empty?
@mem[15].to_i / (@mem[7].to_i/100)
end
#===============================================================#
./working.R/data.R/rgithook-3.0.3/test/integration/test_pull_and_push.rb
rgithook1.install(false)
in_temp_dir do |dir|
%x(git clone #{rgithook1.path} sample_test)
Dir.chdir 'sample_test'
%x(touch asdf && git add . && git commit -m 'adf')
push_result = %x(git push)
assert_equal $?.to_i, 0, "Error:\n#{push_result}"
end
end
#===============================================================#
./working.R/data.R/rgithook-3.0.3/test/integration/test_install.rb
File.open(@rgithook.conf_file,'w') do |f|
hook_file =<<-EOF
on :post_receive do |old_commit,new_commit,ref|
%x(touch \#{old_commit})
%x(touch \#{new_commit})
%x(touch \#{ref})
end
on :pre_commit do
%x(rm a b c)
end
EOF
f.write(hook_file)
#===============================================================#
./working.R/data.R/rgithook-3.0.3/lib/rgithook/runner.rb
# #These will send test results of the master branch when the repo is updated
# on :post_receive do |old_rev,new_rev,ref|
# if ref =~ /master$/
# %x(rake test | mail -s 'Updated #{ref}' guillermo@cientifico.net)
# end
# end
#
--
# on :post_receive do |old_rev,new_rev,ref|
# if ref =~ /master$/
# emails = repo.commits_between(old_rev, new_rev).map{|c| c.author.email}.uniq
# test = %x(rake test)
# emails.each do |mail|
# IO.popen("mail -s 'Updated #{repo_name}' #{mail}",'w') {|mail| mail.write test}
# end
#===============================================================#
./working.R/data.R/rgithook-3.0.3/lib/rgithook/test/unit.rb
def in_sample_repo
in_temp_dir do |temp_file|
%x(unzip #{fixture_path('sample_repo.zip')})
yield ::Grit::Repo.new(temp_file)
end
end
#===============================================================#
./working.R/data.R/rgithook-3.0.3/lib/plugins/email.rb
class Email < RGitHook::Plugin
option :destination, "Destination of email functions", %x(who am i), [String]
module RunnerMethods
include TMail
#===============================================================#
./working.R/data.R/rgithook-3.0.3/lib/plugins/temp.rb
repo_dir = File.join(temp_dir,commit.to_s)
old_dir = Dir.pwd
%x(git clone #{repo.path} #{repo_dir})
Dir.chdir repo_dir
%x(git checkout #{commit.is_a?(::Grit::Commit) ? commit.sha : commit})
yield ::Grit::Repo.new(repo_dir)
Dir.chdir old_dir
end
#===============================================================#
./working.R/data.R/rgithook-3.0.3/lib/plugins/test.rb
end
def test_spec(repo)
[%x(spec spec/),$?]
end
def test_cucumber(repo)
[%x(cucumber features/),$?]
end
def test_unit(repo)
[%x(testrb `find test -name '*.rb'`),$?]
end
end
end
#===============================================================#
./working.R/data.R/rgithook-3.0.3/lib/plugins/rake.rb
module RunnerMethods
def rake(task,*options)
%x(rake #{task})
end
end
end
#===============================================================#
./working.R/data.R/rain-1.0.5/test/test_helper.rb
class ActiveSupport::TestCase
setup do
%x(mkdir -p config)
File.open File.expand_path('./config/versions.yml'), 'w' do |f|
f.puts <#===============================================================#
./working.R/data.R/rain-1.0.5/test/rain/deployer_test.rb
class Rain::DeployerTest < ActiveSupport::TestCase
describe "DeployerTest: bare invocation" do
before { @command ||= %x(./bin/rain) }
should "deploy to production" do
assert_match 'Got a handful of stacks better grab an umbrella', @command
--
describe "DeployerTest: specific environment invocation" do
context "on stage" do
before { @command ||= %x(./bin/rain on stage) }
should "deploy a new tag to stage" do
assert_match 'executing... git push origin rel_', @command
--
end
context "on production" do
before { @command ||= %x(./bin/rain on production) }
should "deploy the same tag that's on stage to production" do
assert_match 'Deploying existing tag', @command
--
end
describe "DeployerTest: help invocation for 'on'" do
before { @command ||= %x(./bin/rain help on) }
should "prompt for an environment" do
assert_match 'rain on ENVIRONMENT', @command
#===============================================================#
./working.R/data.R/rain-1.0.5/test/rain/git_tools_test.rb
describe "GitTools: on_master?" do
should "return true when we are on the master branch" do
assert %x(git checkout master > /dev/null), "master not checked out"
assert on_master?
end
should "return false when we are on any other branch" do
original_branch = %x(git branch | grep '*').gsub! /\*\s|\n/, ""
assert_equal 'master', original_branch
assert %x(git checkout -b some-branch > /dev/null), "some-branch not checked out"
refute on_master?
assert %x(git checkout #{original_branch} > /dev/null), "master not checked out"
assert %x(git branch -d some-branch > /dev/null), "some-branch was not deleted"
end
end
describe "GitTools: no_changes_pending?" do
should "return false when there are uncommitted changes" do
assert %x(echo "test" >> LICENSE.md), "LICENSE.md was not edited"
refute no_changes_pending?, "LICENSE.md is still clean"
assert %x(git checkout HEAD LICENSE.md), "LICENSE.md not reset to HEAD state"
assert no_changes_pending?, "LICENSE.md is still dirty. Make sure you commit everything else!"
end
end
describe "GitTools: last_release_tag" do
setup { %x(git tag rel_9.9.999) }
should "return the last release_tag entered into git" do
assert_equal ReleaseTag.latest, last_release_tag
end
teardown { %x(git tag -d rel_9.9.999) }
end
describe "GitTools: git_name" do
setup { @original_name = %x(git config user.name); %x(git config user.name "OJ Simpson") }
should "return the name set in ~/.gitconfig" do
assert_equal "OJ Simpson", git_name
end
teardown { %x(git config user.name "#{@original_name}") }
end
describe "GitTools: tagged_latest_version?" do
setup { %x(git tag rel_0.0.1) }
should "return true when the current tag and the latest-released tag are the same" do
refute_nil ReleaseTag.current
--
end
should "return false when the current tag has not been pushed" do
assert %x(git tag rel_0.0.2), "Couldn't create latest tag"
refute tagged_latest_version?, "Latest version tagged"
assert %x(git tag -d rel_0.0.2), "Couldn't delete tag"
end
teardown { %x(git tag -d rel_0.0.1) }
end
#describe "GitTools: push_tag" do
#===============================================================#
./working.R/data.R/rain-1.0.5/lib/rain/git_tools.rb
# Test whether we are currently using the master branch. All
# deployment activity should take place on the master branch.
def on_master?
out = %x(git symbolic-ref -q HEAD)
out.strip == "refs/heads/master"
end
# Test whether there are any uncommitted changes in the working
# directory.
def no_changes_pending?
%x(git status --porcelain).split("\n").length == 0
end
# Moved code to ReleaseTag. Basically returns a ReleaseTag with a version
--
# Display name as set in +~/.gitconfig+
def git_name
%x(git config --get user.name).split("\n")[0]
end
alias deployer git_name
--
# what is/what would have been executed onto stdout.
def run_cmd(cmd)
puts "executing... #{cmd}"
%x(#{cmd}) unless ENV['RAILS_ENV'] == "test"
end
# Full path of the versions.yml file in the Rails app.
#===============================================================#
./working.R/data.R/rain-1.0.5/lib/rain/git_tools/release_tag.rb
# Return the latest ReleaseTag as computed by looking at the most
# recent "rel_*" tag created on Git.
def self.latest
tags = %x(git tag).split("\n").select{|l| l =~ /^rel_/}.map{ |l| ReleaseTag.new(l) }.sort
tags.last || ReleaseTag.new('rel_0.0.0')
end
end
#===============================================================#
./working.R/data.R/rubycop-1.0.1/spec/analyzer/node_builder_spec.rb
it { should parse('"#$0"') }
it { should parse("'a' 'b'") }
it { should parse('`foo`') }
it { should parse('%x(foo)') }
end
context "symbol" do
#===============================================================#
./working.R/data.R/rorra-twitter-0.9.9/examples/oauth.rb
rsecret = oauth.request_token.secret
puts "> redirecting you to twitter to authorize..."
%x(open #{oauth.request_token.authorize_url})
print "> what was the PIN twitter provided you with? "
pin = gets.chomp
#===============================================================#
./working.R/data.R/rorra-twitter-0.9.9/examples/connect.rb
})
# authorize in browser
%x(open #{oauth.request_token.authorize_url})
end
#===============================================================#
./working.H/data.H/historian-0.0.1/spec/support/git_helpers.rb
module GitHelpers
def run_git(*args)
Dir.chdir repo_directory
%x(git #{args.collect { |a| Shellwords.escape a }.join " "})
end
def tags
#===============================================================#
./working.H/data.H/historian-0.0.1/lib/historian/git.rb
def git(*args)
Dir.chdir repo_directory
%x(git #{args.collect { |a| Shellwords.escape a }.join " "})
end
end
#===============================================================#
./working.H/data.H/hookers-0.3.1/lib/hookers/git/repository.rb
module Git
class Repository
def last_commit
revision = %x(git log -1 HEAD --format=%H%n%an%n%s).split("\n")
Git::Commit.new(revision[0], revision[1], revision[2])
end
def commit(message)
%x(git commit -m'#{message}')
end
end
end
#===============================================================#
./working.H/data.H/hyde-ftp-0.3.0/lib/hyde.rb
end
def exists()
@jekyll_version = %x( jekyll -version )
if @jekyll_version[1] = "j"
nil
else
%x( gem install jekyll )
end
end
def new_site(name)
exists()
%x( jekyll new #{name} )
puts "Site created."
end
--
when "help"
$jekyll.help
when "list"
%x( hyde help )
else
puts " You didn't give me a command.\n Run 'hyde help' to see a command list."
end
#===============================================================#
./working.H/data.H/holepicker-0.3.1/lib/holepicker/file_finder.rb
module HolePicker
module FileFinder
def self.find_files(path, options = "")
%x(find -L #{path} #{options}).lines.map(&:strip)
end
end
end
#===============================================================#
./working.H/data.H/hotspots-1.1.0/lib/hotspots/repository/driver/git.rb
def pretty_log(options)
command = log_with_tag("Input", :as => :green) { Command::Git::Log.new(:since_days => options[:since_days], :message_filter => options[:message_filter]).build }
log_with_tag("Output", :as => :red) { %x(#{command}) }
end
def show_one_line_names(options)
command = log_with_tag("Input", :as => :green) { Command::Git::Show.new(:commit_hash => options[:commit_hash]).build }
log_with_tag("Output", :as => :red) { %x(#{command}) }
end
def log_with_tag(tag, options, &block)
#===============================================================#
./working.H/data.H/hippoload-0.0.2/lib/hippoload/hippo.rb
raise "Httperf is not installed on your machine" unless httperf_installed?
set_connections if @connections.nil?
set_rate if @rate.nil?
%x(httperf --num-conns=#{@connections} --rate=#{@rate} --server=#{@server} --port=#{@port} --uri="#{@uri}")
end
def becomes_crazy
#===============================================================#
./working.H/data.H/heroic-sns-1.1.1/lib/heroic/lru_cache.rb
@lock.synchronize { @value = value }
end
def to_s
sprintf '', self.object_id, @key.inspect
end
end
#===============================================================#
./working.W/data.W/workon-0.1.2/lib/workon/command.rb
def capture
display_banner
_cmd = [ expanded_env, @command ].compact.join ';'
%x(#{_cmd}) unless Workon.config[:dry_run]
end
def display_banner(banner = BANNERS[:running])
#===============================================================#
./working.W/data.W/walterdavis-eeepub-0.6.3/lib/eeepub/ocf.rb
container.save(File.join(meta_inf, 'container.xml'))
%x(zip -X9 \"#{output_path}\" mimetype)
%x(zip -Xr9D \"#{output_path}\" * -xi mimetype)
end
end
end
#===============================================================#
./working.W/data.W/watobo-0.9.13/lib/watobo/core/ca.rb
module CA
@cadir = File.join(Watobo.working_directory, "CA")
@crl_dir= File.join(@cadir, "crl")
@hostname = %x('hostname').strip
@hostname = "watobo" if @hostname.empty?
@domain = "#{@hostname}.watobo.local"
def self.ca_ready?
#===============================================================#
./working.W/data.W/webbynode-1.0.5.3/lib/webbynode/notify.rb
def self.message(message)
if self.installed? and !$testing
message = message.gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/, "")
%x(growlnotify -t "#{TITLE}" -m "#{message}" --image "#{IMAGE_PATH}")
end
end
#===============================================================#
./working.U/data.U/unparser-0.0.17/spec/integration/unparser/spike_spec.rb
context 'execute string' do
assert_source '`foo`'
assert_source '`foo#{@bar}`'
assert_generates '%x(\))', '`)`'
#assert_generates '%x(`)', '`\``'
assert_source '`"`'
end
#===============================================================#
./working.U/data.U/unpack-0.2.1/lib/unpack.rb
end
def unrar(args)
%x(cd '#{args[:path]}' && '#{@options[:absolute_path_to_unrar]}' e -y -o- '#{args[:file]}')
end
def unzip(args)
%x(unzip -n '#{args[:file]}' -d '#{args[:path]}')
end
def find_file_type(file_type)
#===============================================================#
./working.A/data.A/almost-happy-1.0.0/lib/vendor/albino.rb
tmp.write @target
tmp.close
command = [command, tmp.path].join(" ")
%x(#{command}).strip
ensure
tmp.unlink if tmp
end
#===============================================================#
./working.A/data.A/abak-flow-0.3.2/lib/abak-flow/request.rb
base = Abak::Flow::PullRequest.branch_by_prefix branch.name.split('/').first
upstream_branch = %x(git branch -r --contain #{branch.commit.sha} | grep upstream/#{base} 2> /dev/null).strip
local_sha = %x(git show #{branch.name} --format=%H --no-notes 2> /dev/null | head -n 1).strip
statuses = {
unused: upstream_branch.empty?,
#===============================================================#
./working.A/data.A/assetbuild-0.1.0/lib/asset_build/coffee_bundler.rb
protected
def compile(path)
%x(coffee -p #{path})
end
def process_path(path)
#===============================================================#
./working.A/data.A/abiquo-installer-tests-20121026.1/vendor/net-ssh-2.5.2/lib/net/ssh/loggable.rb
# originates. It defaults to the name of class with the object_id
# appended.
def facility
@facility ||= self.class.name.gsub(/::/, ".").gsub(/([a-z])([A-Z])/, "\\1_\\2").downcase + "[%x]" % object_id
end
end
end; end
#===============================================================#
./working.A/data.A/alpha_omega-1.5.15/lib/alpha_omega/config/deploy_localhost.rb
task :localdomain do
if dna["env_pod"] == "localdomain"
set :releases, []
set :deploy_to, %x(pwd).chomp
set :use_sudo, false
set :user, %x(id -u -n).chomp
set :group, %x(id -g -n).chomp
set :root_user, %x(id -u -n).chomp
set :root_group, %x(id -g -n).chomp
set :dir_perms, "0755"
set :bundler_options, "--path vendor/bundle"
set :skip_scm, true
#===============================================================#
./working.A/data.A/alpha_omega-1.5.15/lib/alpha_omega/config/deploy_notify.rb
end
def map_sha_tag rev
tag = %x(git show-ref | grep '^#{rev} refs/tags/' | cut -d/ -f3).chomp
tag.empty? ? rev : tag
end
#===============================================================#
./working.A/data.A/alpha_omega-1.5.15/lib/alpha_omega/deploy.rb
_cset :success, false
_cset (:figlet) {
fig = [%x(which figlet).strip].reject {|f| !(File.executable? f)}.first
fig ? "#{fig} -w 200" : "echo"
}
#===============================================================#
./working.A/data.A/amp-pure-0.5.0/test/functional_tests/test_functional.rb
# for a commit command.
def run_amp_command(command, args = [], opts = {})
args = [args] unless args.kind_of?(Array)
%x(TESTING='true' && #{AMP_BINARY} #{command} #{options_hash_to_string(opts)} #{args.join(" ")})
end
alias_method :amp, :run_amp_command
--
# @see run_amp_command
def run_hg_command(command, args = [], opts = {})
args = [args] unless args.kind_of?(Array)
%x(hg #{command} #{options_hash_to_string(opts)} #{args.join(" ")})
end
alias_method :hg, :run_hg_command
#===============================================================#
./working.A/data.A/amp-pure-0.5.0/site/src/helpers.rb
def commit_count
path_to_amp = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "bin", "amp"))
hash = %x(#{path_to_amp} stats).split("\n").inject({}) do |hash, line|
result = line.split(/\s+/)
next unless result.size >= 2
hash[result[0][0..-2]] = result[1].to_i
#===============================================================#
./working.A/data.A/alphabetize-0.1.2/test/test_alphabetize.rb
require './alphabetize/lib/alphabetize'
%x(cp test_Gemfile Gemfile)
Alphabetize::alphabetize_file
#===============================================================#
./working.A/data.A/alphabetize-0.1.2/lib/alphabetize.rb
puts "Chunks: #{file_chunks.inspect}"
backupFilename = "old_#{filename}"
%x( mv #{filename} #{backupFilename})
file = File.open(filename, 'w')
# file.truncate(0) # clear the file
#===============================================================#
./working.A/data.A/amp-git-0.2.0/lib/amp-git/repo_format/changeset.rb
##
# Converts a semi-reliable revision # into a git changeset node.
def convert_rev_to_node(rev)
%x(git rev-list --reverse HEAD).split("\n")[rev - 1]
end
##
# Converts a git changeset node into a semi-reliable revision #
def convert_node_to_rev(node)
%x(git rev-list --reverse HEAD | grep -n #{node} | cut -d: -f1).to_i
end
#===============================================================#
./working.A/data.A/auto_test-1.0/lib/tasks/auto_test.rb
require 'auto_test'
path = %x(gem which auto_test)
path = path[0..path.size-15]
namespace :auto_test do
#===============================================================#
./working.A/data.A/atlassian-stash-0.1.6/lib/atlassian/stash/git.rb
module Stash
module Git
def get_current_branch
%x(git symbolic-ref HEAD)[/refs\/heads\/(.*)/, 1]
end
def is_in_git_repository?
--
end
def get_remotes
%x(git remote -v)
end
def get_remote_url
--
end
def create_git_alias
%x(git config --global alias.create-pull-request "\!sh -c 'stash pull-request \\$0'")
end
end
end
#===============================================================#
./working.A/data.A/atlassian-stash-0.1.6/lib/atlassian/stash/pullrequest.rb
end
def generate_pull_request_title(source, target)
output = %x(git log --reverse --format=%s #{target}..#{source}).split(/\n/).first
output || 'Merge \'%s\' into \'%s\'' % [source, target]
end
#===============================================================#
./working.A/data.A/alicorn-0.4.2/lib/alicorn/scaler.rb
end
def grep_process_list
%x(ps ax)
end
def send_signal(master_pid, sig)
#===============================================================#
./working.A/data.A/antfarm-0.4.0/rails/vendor/rails/railties/lib/rails/gem_dependency.rb
def install
cmd = "#{gem_command} #{install_command.join(' ')}"
puts cmd
puts %x(#{cmd})
end
def unpack_to(directory)
#===============================================================#
./working.A/data.A/airport_events-0.1.0/lib/airport_events/airport.rb
end
def self.run_info_command
%x(#{INFO_COMMAND})
end
def self.parse_ssid result
#===============================================================#
./working.A/data.A/anyplayer-1.0.0/lib/anyplayer/players/mpd.rb
end
def launched?
%x(mpc 2> /dev/null)
$? == 0
end
--
private
def mpc(command)
%x(mpc #{command}).split("\n").first
end
end
#===============================================================#
./working.A/data.A/anyplayer-1.0.0/lib/anyplayer/players/amarok.rb
end
def launched?
not %x(qdbus org.kde.amarok 2>&1).match(/does not exist|command not found/)
end
private
def amarok(command)
%x(qdbus org.kde.amarok /Player org.freedesktop.MediaPlayer.#{command}).rstrip
end
def amarok_get_meta(name)
#===============================================================#
./working.A/data.A/anyplayer-1.0.0/lib/anyplayer/players/xmms2.rb
def launched?
# xmms2 autolaunches the daemon, so this should always be true
%x(xmms2 status 2> /dev/null)
$? == 0
end
--
private
def xmms2(command)
%x(xmms2 #{command}).split("\n").first.strip
end
end
#===============================================================#
./working.A/data.A/anyplayer-1.0.0/lib/anyplayer/players/rhythmbox.rb
end
def launched?
%x(rhythmbox-client --no-start --print-playing 2>/dev/null).rstrip != ""
end
private
def rhythmbox(command)
%x(rhythmbox-client --no-start --#{command}).rstrip
end
end
#===============================================================#
./working.A/data.A/anyplayer-1.0.0/lib/anyplayer/players/itunes_mac.rb
end
def launched?
nb = %x(osascript -e 'tell app "System Events" to count (every process whose name is "iTunes")' 2>/dev/null).rstrip
nb.match(/^\d+/) and nb.to_i > 0 ? true : false
end
--
private
def itunes(command)
%x(osascript -e 'tell app "iTunes" to #{command}').rstrip
end
end
#===============================================================#
./working.A/data.A/anyplayer-1.0.0/lib/anyplayer/players/spotify_mac.rb
end
def launched?
nb = %x(osascript -e 'tell app "System Events" to count (every process whose name is "Spotify")' 2>/dev/null).rstrip
nb.match(/^\d+/) and nb.to_i > 0 ? true : false
end
--
private
def spotify(command)
%x(osascript -e 'tell app "spotify" to #{command}').rstrip
end
end
#===============================================================#
./working.A/data.A/acouchi-0.0.14/lib/acouchi/rake/tasks.rb
desc "farm"
task :farm do
port_range = (7004...10000).to_a
%x(adb devices).scan(/.*\tdevice/).map{|device|device.gsub! " device",""}.each do |device|
system "ACOUCHI_DEVICE=#{device} ACOUCHI_PORT=#{port_range.sample} rake features &"
end
end
#===============================================================#
./working.A/data.A/amp-0.5.3/test/functional_tests/test_functional.rb
# @see run_amp_command
def run_hg_command(command, args = [], opts = {})
args = [args] unless args.kind_of?(Array)
%x(hg #{command} #{options_hash_to_string(opts)} #{args.join(" ")})
end
alias_method :hg, :run_hg_command
#===============================================================#
./working.A/data.A/amp-0.5.3/site/src/helpers.rb
def commit_count
path_to_amp = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "bin", "amp"))
hash = %x(#{path_to_amp} stats).split("\n").inject({}) do |hash, line|
result = line.split(/\s+/)
next unless result.size >= 2
hash[result[0][0..-2]] = result[1].to_i
#===============================================================#
./working.A/data.A/abnf-0.0.1/lib/abnf/parser.rb
es << Term.new(NatSet.new(v.to_i))
}
yield :val, Seq.new(*es)
when /\A%x([0-9A-Fa-f]+)-([0-9A-Fa-f]+)/
t = $&
yield :val, Term.new(NatSet.new($1.hex..$2.hex))
when /\A%x[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]+)*/
#===============================================================#
./working.F/data.F/features-0.3.0/lib/suite.rb
html = parse_results(results).html
%x(touch '/tmp/out.html' && echo '#{html}' > /tmp/out.html && open '/tmp/out.html' )
end
def parse_results_and_open_in_safari(results)
--
end
def open_in_safari(html)
%x(touch '/tmp/out.html' && echo '#{html}' > /tmp/out.html && open '/tmp/out.html' )
end
def parse_results(results="")
#===============================================================#
./working.F/data.F/fuey_client-0.4.4/lib/fuey_client/fuey/inspections/support/shell_command.rb
end
def execute
%x(#{@command})
end
end
end
#===============================================================#
./working.F/data.F/fixture_replacement-3.0.1/rake_tasks/code_quality.rb
desc "Feel the pain of my code, and submit a refactoring patch"
task :flog do
puts %x(find lib | grep ".rb$" | xargs flog)
end
task :flog_to_disk => :create_doc_directory do
puts "Flogging..."
%x(find lib | grep ".rb$" | xargs flog > doc/flog.txt)
puts "Done Flogging...\n"
end
#===============================================================#
./working.F/data.F/fluby-0.7.4/test/test_fluby.rb
def test_compilation
in_folder(PROJECT) do
%x(fluby build)
assert File.exist?("deploy/#{PROJECT}.swf"), "Compilation failed. Have you installed mtasc and swfmill?"
end
end
--
def test_package
in_folder(PROJECT) do
%x(rake package)
now = Time.now.strftime("%Y%m%d")
assert File.exist?("pkg/#{now}-#{PROJECT}.zip")
end
#===============================================================#
./working.F/data.F/fluby-0.7.4/test/helper.rb
end
def global_teardown
%x(rm -Rf #{PROJECT})
# Go unquiet
unless ENV['QUIET'] == 'false'
$stdout = $stdout_real
#===============================================================#
./working.F/data.F/fluby-0.7.4/lib/fluby.rb
}
def self.version
%x(cat #{gem_path}/VERSION)
end
def self.gem_path
File.dirname(__FILE__) + "/../"
--
EOF
end unless File.exist?(debug_cfg_file)
%x(touch "$HOME/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt")
end
def self.available_templates
--
@nodebug = false
end
def self.notify
%x(growlnotify --name Rake -m 'Finished building #{project_name} in #{@end - @start} seconds')
end
def self.assets
Dir.glob(['assets/*.js','assets/*.xml']).each do |file|
#===============================================================#
./working.F/data.F/fpm-cookery-0.15.0/lib/fpm/cookery/packager.rb
private
def git_config(key)
%x(git config --get #{key}).strip
rescue
Log.warn "Git config command for key '#{key}' failed."
nil
#===============================================================#
./working.F/data.F/flexutils-1.0.0/lib/flexutils/flex_utils.rb
puts cmd_str if operative_options[:verbose]
%x(#{cmd_str} 2>&1)
end
def standard_options
#===============================================================#
./working.F/data.F/friend_collection-0.1.0/examples/connect.rb
})
# authorize in browser
%x(open #{oauth.request_token.authorize_url})
end
end
#===============================================================#
./working.F/data.F/foolio-0.0.3/ext/foolio/make_table.rb
# -*- mode:ruby; coding:utf-8 -*-
%x(grep foolio_ foolio_ext.c | grep '^VALUE' | grep -v '__').each_line do|func|
if func =~ /VALUE ([^(]+)\((.*)\)/ then
name = $1
args = $2.split(",").map{|s|
#===============================================================#
./working.F/data.F/flashcards-0.0.2/lib/flashcards/base.rb
class GrowlNotification
FULL_IMAGE_PATH = File.join(File.dirname(__FILE__), '/speak.gif')
def initialize(title, body)
%x(growlnotify --image #{FULL_IMAGE_PATH} -t "#{title}" -m "#{body}")
end
end
class Base
#===============================================================#
./working.N/data.N/net-ssh-2.6.8/lib/net/ssh/loggable.rb
# originates. It defaults to the name of class with the object_id
# appended.
def facility
@facility ||= self.class.name.gsub(/::/, ".").gsub(/([a-z])([A-Z])/, "\\1_\\2").downcase + "[%x]" % object_id
end
end
end; end
#===============================================================#
./working.N/data.N/newrelic_rpm-3.6.6.147/test/performance/lib/performance/runner.rb
build_file_contents = File.read(build_file_path)
return $1.strip if build_file_contents =~ /GITSHA: (.*)/
else
%x((cd '#{path}' && git log --pretty='%h' -n 1)).strip
end
end
#===============================================================#
./working.N/data.N/nezu-0.7.1/spec/functional/generators_spec.rb
end
after do
%x(rm -rf #{configatron.destination_root})
end
end
#===============================================================#
./working.N/data.N/nezu-0.7.1/lib/nezu.rb
# if you don`t like them just override its #call method
class CustomLogFormatter
TIME_FORMAT = "%Y-%m-%d %H:%M:%S."
HOST = %x(hostname).chomp
APP = File.basename(Dir.pwd)
String.send(:include, Term::ANSIColor)
#===============================================================#
./working.N/data.N/negroku-1.1.4/lib/negroku/helpers.rb
# Find or create config folder
unless File.directory?(config_path)
puts "[Negroku] => Could not find the \"config\" folder. Creating it now!"
%x(mkdir #{config_path})
end
# Find or create deploy folder
unless File.directory?(deploy_path)
puts "[Negroku] => Could not find the \"deploy\" folder. Creating it now!"
%x(mkdir #{deploy_path})
end
# replace and rename older deploy.rb
--
puts "[Negroku] => Backing up deploy.rb"
old_versions = Dir.entries(config_path).map {|entree| entree if entree =~ /deploy\.old\.(\d+)\.rb$/}.compact!
if old_versions.empty?
%x(mv #{deployfile} #{File.join(config_path, 'deploy.old.1.rb')})
else
version = old_versions.last.match('^deploy\.old\.(\d+)\.rb$')[1].to_i + 1
%x(mv #{deployfile} #{File.join(config_path, "deploy.old.#{version}.rb")})
end
end
#===============================================================#
./working.N/data.N/negroku-1.1.4/lib/negroku/cli.rb
menu.select_by = :index
# find local remote from git repo
%x(git remote -v 2> /dev/null | awk '{print $2}' | uniq).split("\n").each do |url|
menu.choice(url) do |server|
say("Using #{server}")
data[:repo] = server;
--
desc "show", "Show the current remote variables"
def show
%x(cap #{options[:stage]} rbenv:vars:show)
end
desc "add", "Adds or updates env variables to the remote server"
--
end
end
%x(cap #{options[:stage]} rbenv:vars:add -s key=#{key} -s value=#{value})
end
end
#===============================================================#
./working.N/data.N/negroku-1.1.4/lib/negroku/config.rb
# create an empty .negroku file
unless File.exist?(config_file)
%x(touch #{config_file})
end
# base config
#===============================================================#
./working.N/data.N/ninjs-0.16.8/spec/cli_spec.rb
it 'should create a new application' do
suppress_output do
%x(cd #{SPEC_DIR}; #{@bin} create myapp)
end
"#{SPEC_DIR}/ninjs.conf".should be_same_file_as "#{SPEC_DIR}/fixtures/ninjs.conf"
--
end
it 'should create a new application in a subdirectory' do
suppress_output { %x(cd #{SPEC_DIR} && #{@bin} create myapp js) }
"#{SPEC_DIR}/js/ninjs.conf".should be_same_file_as "#{SPEC_DIR}/fixtures/ninjs.conf"
--
end
it 'should compile the application' do
suppress_output { %x(cd #{SPEC_DIR} && #{@bin} create myapp) }
FileUtils.cp "#{SPEC_DIR}/fixtures/hello.module.js", "#{SPEC_DIR}/modules"
FileUtils.cp "#{SPEC_DIR}/fixtures/hello.elements.js", "#{SPEC_DIR}/elements"
--
FileUtils.cp "#{SPEC_DIR}/fixtures/foo.elements.js", "#{SPEC_DIR}/elements"
FileUtils.cp "#{SPEC_DIR}/fixtures/foo.model.js", "#{SPEC_DIR}/models"
suppress_output { %x(cd #{SPEC_DIR} && #{@bin} compile) }
File.exists?("#{SPEC_DIR}/application/hello.js").should be_true
File.exists?("#{SPEC_DIR}/application/foo.js").should be_true
end
it 'should update the application' do
suppress_output { %x(cd #{SPEC_DIR} && #{@bin} create myapp) }
File.open("#{SPEC_DIR}/lib/nin.js", 'w+') do |file|
file << 'changed'
end
suppress_output { %x(cd #{SPEC_DIR} && #{@bin} update) }
"#{SPEC_DIR}/lib/nin.js".should be_same_file_as "#{SPEC_DIR}/fixtures/nin.js"
end
it 'should generate a module file' do
suppress_output do
%x(cd #{SPEC_DIR} && #{@bin} create myapp)
%x(cd #{SPEC_DIR} && #{@bin} generate module mymodule)
end
"#{SPEC_DIR}/modules/mymodule.module.js".should be_same_file_as "#{SPEC_DIR}/fixtures/mymodule.module.js"
--
it 'should generate a module file with an alias' do
suppress_output do
%x(cd #{SPEC_DIR} && #{@bin} create myapp)
%x(cd #{SPEC_DIR} && #{@bin} generate module mymodule -a)
end
"#{SPEC_DIR}/modules/mymodule.module.js".should be_same_file_as "#{SPEC_DIR}/fixtures/mymodule.alias.module.js"
--
it 'should generate an elements file' do
suppress_output do
%x(cd #{SPEC_DIR} && #{@bin} create myapp)
%x(cd #{SPEC_DIR} && #{@bin} generate elements mymodule)
end
"#{SPEC_DIR}/elements/mymodule.elements.js".should be_same_file_as "#{SPEC_DIR}/fixtures/mymodule.elements.js"
--
it 'should generate a model file' do
suppress_output do
%x(cd #{SPEC_DIR} && #{@bin} create myapp)
%x(cd #{SPEC_DIR} && #{@bin} generate model mymodule)
end
"#{SPEC_DIR}/models/mymodule.model.js".should be_same_file_as "#{SPEC_DIR}/fixtures/mymodule.model.js"
--
it 'should generate a module file with dependencies' do
suppress_output do
%x(cd #{SPEC_DIR} && #{@bin} create myapp)
%x(cd #{SPEC_DIR} && #{@bin} generate module mymodule -em)
end
"#{SPEC_DIR}/modules/mymodule.module.js".should be_same_file_as "#{SPEC_DIR}/fixtures/mymodule.dependencies.module.js"
#===============================================================#
./working.M/data.M/mistilteinn-0.1.2/lib/mistilteinn/git.rb
private
def cmd(str)
str = %x(#{str} 2>/dev/null || echo "").strip
str.empty? ? nil : str
end
end
#===============================================================#
./working.M/data.M/monkey_master-1.0.0/lib/monkey_master/monkey_commander.rb
@device_list = devices
else
# No devices specified, detect them
device_list = %x(adb devices | grep -v "List" | grep "device" | awk '{print $1}')
device_list = device_list.split("\n")
@device_list = device_list
end
--
if(@device_list)
@device_list.each{|device|
@logger.info("[CLEANUP] KILLING the monkey on device #{device}.")
%x(adb -s #{device} shell ps | awk '/com\.android\.commands\.monkey/ { system("adb -s #{device} shell kill " $2) }')
}
else
@logger.warn("[CLEANUP] No devices specified yet.")
--
@logger.info("\t[MASTER #{device}] Monkey " + i.to_s + " is doing its thing...")
# Start the monkey
%x(adb -s #{device} shell monkey -p #{@app_id} -v 80000 --throttle 100 --ignore-timeouts --pct-majornav 10 --pct-appswitch 0 --kill-process-after-error)
if($? != 0)
@logger.info("\t\t[MASTER #{device}] Monkey encountered an error!")
end
--
# Clean the current log
File.truncate(current_log, 0)
@logger.info("\t\t[MASTER #{device}] Monkey " + i.to_s + " is killing the app now in preparation for the next monkey.")
%x(adb -s #{device} shell am force-stop #{@app_id})
end
@logger.info("[MASTER #{device}] All monkeys are done.")
}
--
begin
Timeout::timeout(5) {
@logger.info("[SETUP] Creating the following log file: #{current_log}")
%x(adb -s #{device} logcat -c #{current_log} &)
%x(adb -s #{device} logcat *:W > #{current_log} &)
}
rescue Timeout::Error
end_logging
--
def end_logging
@device_list.each{|device|
@logger.info("[CLEANUP] KILLING the logcat process on device #{device}.")
%x(adb -s #{device} shell ps | grep -m1 logcat | awk '{print $2}' | xargs adb -s #{device} shell kill)
@logger.info("[CLEANUP] KILLING the logcat process for the device #{device} on the machine.")
%x(ps ax | grep -m1 "adb -s #{device} logcat" | awk '{print $1}' | xargs kill)
}
end
end
#===============================================================#
./working.M/data.M/moneypools-rake_helpers-0.1.0/lib/rake_helpers/config.rb
def add_extra_params
add(:flex_sdk_path, :name => 'flex_sdk',
:default => Proc.new do
if mxmlc_bin_path = %x(which mxmlc)
# /.../sdk_root/bin/mxmlc => /.../sdk_root
File.expand_path(File.join(File.dirname(mxmlc_bin_path), '..'))
else
#===============================================================#
./working.M/data.M/monitoring-client-0.3.0/spec/config_spec.rb
describe Config do
it "should load the hostname" do
Config.global.hostname.should == %x(hostname).strip
end
end
end
#===============================================================#
./working.M/data.M/monitoring-client-0.3.0/lib/monitoring/client/config.rb
end
def get_hostname
%x(hostname).strip
end
end
#===============================================================#
./working.M/data.M/maid-0.3.0/lib/maid/maid.rb
# Delegates to `Kernel.\``. Made primarily for testing other commands and some error handling.
def cmd(command) #:nodoc:
if supported_command?(command)
%x(#{ command })
else
raise ArgumentError, "Unsupported system command: #{ command.inspect }"
end
--
# TODO: Instead of using `which`, use an alternative listed at:
#
# http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
@@supported_commands[command_name] = supported ? supported : !%x(which #{ command_name }).empty?
end
def default_trash_path
#===============================================================#
./working.M/data.M/manifest-rails-0.2.8/app/models/page.rb
# Creates the template file after the Page is created.
def create_template
%x(touch #{self.template_path})
end
# Renames the template file after the Page is updated.
def rename_template
old_template_path = template_path_from_slug(slug_was)
%x(mv #{old_template_path} #{template_path})
end
# Removes the template file after the Page is destroyed.
def remove_template
%x(rm #{template_path})
end
# Generates a Page template path given a slug.
#===============================================================#
./working.M/data.M/magic_recipes-0.0.29/lib/magic_recipes/git.rb
if git_usr && git_usr != "gitusr" && git_pwd && git_pwd != "gitpwd"
run system( "../../../bin/git_cap #{git_usr} #{git_pwd}" )
end
# %x()
end
end
#===============================================================#
./working.M/data.M/media-path-0.1.4/lib/media-path.rb
# @since 0.0.1
def run(command)
Dir.chdir(self) do
return %x(#{command})
end
end
#===============================================================#
./working.M/data.M/minmb-net-ssh-2.5.1/lib/net/ssh/loggable.rb
# originates. It defaults to the name of class with the object_id
# appended.
def facility
@facility ||= self.class.name.gsub(/::/, ".").gsub(/([a-z])([A-Z])/, "\\1_\\2").downcase + "[%x]" % object_id
end
end
end; end
#===============================================================#
./working.M/data.M/migration_collapser-0.1.1/rake_tasks/flog.rb
desc "Feel the pain of my code, and submit a refactoring patch"
task :flog do
puts %x(find lib | grep ".rb$" | xargs flog)
end
task :flog_to_disk => :create_doc_directory do
puts "Flogging..."
%x(find lib | grep ".rb$" | xargs flog > doc/flog.txt)
puts "Done Flogging...\n"
end
#===============================================================#
./working.M/data.M/myfdb_utilities-0.0.4/spec/myfdb/batch/images_spec.rb
describe '#upload' do
context 'error' do
before do
%x(touch #{directory}/test.jpg)
Net::HTTP.
expects(:start).
at_least_once.
--
def create_images
%w(jpeg JPEG jpg JPG tiff).each_with_index do |ext, i|
%x(touch #{directory}/#{i}_test.#{ext})
end
end
--
def delete_images
Dir.glob directory + '/*' do |f|
%x(rm #{f})
end
end
#===============================================================#
./working.M/data.M/myfdb_utilities-0.0.4/lib/command/helpers.rb
end
def process_running?(command)
! %x(ps ux | awk '/#{command}/ && !/#{Process.ppid}/ && !/#{Process.pid}/ && !/awk/ {print $2}').empty?
end
end
end
#===============================================================#
./working.M/data.M/multi_formal_i18n_tenancy-0.0.5/spec/support/deferred_garbage_collection.rb
end
def self.memory_threshold
@mem = %x(free 2>/dev/null).to_s.split(" ")
return nil if @mem.empty?
@mem[15].to_i / (@mem[7].to_i/100)
end
#===============================================================#
./working.M/data.M/miloops-attachment_fu-3.2.7/test/test_helper.rb
File.open(result, 'wb') { |f| f.write(thumb.db_file.data) }
result
end
quality = %x(identify -format '%Q' "#{filename}" 2> /dev/null)
if $?.success?
assert_equal expected, quality.to_i, "Produced JPEG quality (thumbnail: #{thumbnail.inspect}) is incorrect."
else
#===============================================================#
./working.M/data.M/miloops-attachment_fu-3.2.7/lib/technoweenie/attachment_fu/processors/core_image_processor.rb
properties = { OSX::NSImageCompressionFactor => quality / 100.0 } if quality
result.save(self.temp_path, OSX::NSJPEGFileType, properties)
#
# puts "#{self.temp_path} @ #{quality.inspect} -> #{%x(identify -format '%Q' "#{self.temp_path}")}"
#
self.size = File.size(self.temp_path)
end
#===============================================================#
./working.V/data.V/vimpack-0.0.4/features/step_definitions/vimpack_git_steps.rb
end
FileUtils.rmtree(@full_path).should be_true if File::directory?(@full_path)
FileUtils.mkdir(@full_path).should be_true
res = %x( git init --bare #{@full_path} )
$?.should eq(0)
end
#===============================================================#
./working.V/data.V/ver-2010.08/config/syntax/Ruby.rb
[{include: "#interpolated_ruby"},
{include: "#escaped_char"},
{include: "#nest_parens_i"}]},
{begin: /%x(?<_1>[^\w])/,
beginCaptures: {0 => {name: "punctuation.definition.string.begin.ruby"}},
comment: "execute string (allow for interpolation)",
end: "\\1",
#===============================================================#
./working.V/data.V/vibes-bj-1.2.2/spec/rails_root/vendor/rails/railties/lib/rails/gem_dependency.rb
def install
cmd = "#{gem_command} #{install_command.join(' ')}"
puts cmd
puts %x(#{cmd})
end
def unpack_to(directory)
#===============================================================#
./working.V/data.V/vagrant-actionio-0.0.9/vendor/bundle/gems/net-ssh-2.2.2/lib/net/ssh/loggable.rb
# originates. It defaults to the name of class with the object_id
# appended.
def facility
@facility ||= self.class.name.gsub(/::/, ".").gsub(/([a-z])([A-Z])/, "\\1_\\2").downcase + "[%x]" % object_id
end
end
end; end
#===============================================================#
./working.Y/data.Y/yac-1.4.6/lib/yac.rb
def search_content(args)
# If use @ as prefix , only search private repository
result = args.sub!(/^@/,'') ? [] : %x(
find "#{@main_path}" -not -iwholename '*\/.git\/*' | xargs grep -HniP '#{args}' --binary-files=without-match | sed 's/^/@/g'
).split("\n")
result.concat %x(
find "#{@pri_path}" -not -iwholename '*\/.git\/*' | xargs grep -HniP '#{args}' --binary-files=without-match
).split("\n")
#===============================================================#