Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'pathname'
require 'lib/database_utils'
DatabaseUtils.establish_connection
# call-seq
# get_owner_from_svn_log(Pathname("path/to/source.java")) => owner_name
#
# if 'pathname' doesn't exist or there is no commit history then returns nil
def self.get_owner_from_svn_log(pathname)
log = `svn log #{pathname}`
first_commit_time = nil
committers = Hash.new(0)
log.reverse_each do |line|
if line =~ /^\w+? \| (\w+?) \| (.+?) \(.+?\) \| /
# call-seq
# get_owner_from_svn_log(Pathname("path/to/source.java")) => owner_name
#
# if 'pathname' doesn't exist or there is no commit history then returns nil
def self.get_owner_from_svn_log(pathname)
log = `svn log #{pathname}`
first_commit_time = nil
commits = []
log.each do |line|
commits << [$1, first_commit_time = Time.parse($2)] if line =~ /^\w+? \| (\w+?) \| (.+?) \(.+?\) \| /
class Source < ActiveRecord::Base
belongs_to :owner
def self.create_from_pathname(pathname)
source = Source.new({:path => "", :tracename => ""})
end
private
package com.usps.webservice.msg;
public class ResponseWrapper<E> {
private Object response = null;
public ResponseWrapper(E response) {
this.response = response;
}
.svn/prop-base/ZipCodeLookUp.java.svn-base:
K 13
svn:eol-style
V 6
native
END
danlynn:ZIPCodeLookupClient danlynn$ svn proplist --verbose ZipCodeLookUp.java
Properties on 'ZipCodeLookUp.java':
svn:eol-style
native
Failures = Struct.new(:log, :last_success)
class Failures
def to_s
"log=#{log.size}, last_success=#{last_success}"
end
end
Failure = Struct.new(:time, :message)
Feature: Manage Users
In order to manage user details
As a security enthusiast
I want to edit user profiles only when authorized
Scenario Outline: Show or hide edit profile link
Given the following user records
| username | password | admin |
| bob | secret | false |
| admin | secret | true |
# XmlObjectParser by Dan Lynn
xml_str = <<XMLEND
<inventory title="OmniCorp Store #45x10^3">
<section name="health">
<item upc="123456789" stock="12">
<name>Invisibility Cream</name>
<price>14.50</price>
<description>Makes you invisible</description>
</item>