On 09/25/2012 12:48 AM, Russell Jackson wrote:
Is there any reason why we can't look up the base path from gitorious.yml like so?

require 'pathname'
require 'yaml'

incpath = File.dirname(__FILE__)

hooks_realpath = Pathname.new(incpath).realpath
yaml_path = File.join(hooks_realpath, "..", "..", "config", "gitorious.yml")
gitorious_yaml = YAML.load_file(yaml_path)
base_path = gitorious_yaml[ENV["RAILS_ENV"]]["repository_base_path"]

gitdir = File.expand_path(File.join(incpath, ".."))
hashed_dir = gitdir.sub(/^#{base_path}\//, "")

puts hashed_dir


Sure, looks viable enough...

--
best regards,
Thomas Kjeldahl Nilsson
http://gitorious.com

--
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com

Reply via email to