aboutsummaryrefslogtreecommitdiff
path: root/ruby/repository.cc
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2008-01-22 09:33:59 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2008-01-22 09:33:59 +0000
commit3acdbde6298e2f5fb9be182fbe1882d8fa5ae1a6 (patch)
tree02de1286e03353475b136e01deb0b18b8c6202cf /ruby/repository.cc
parent1463d109f49cc0a9c7e3a3aaf2217c5e525956ba (diff)
downloadpaludis-3acdbde6298e2f5fb9be182fbe1882d8fa5ae1a6.tar.gz
paludis-3acdbde6298e2f5fb9be182fbe1882d8fa5ae1a6.tar.xz
(ruby) Add Repository.get_environment_variable.
Diffstat (limited to 'ruby/repository.cc')
-rw-r--r--ruby/repository.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/ruby/repository.cc b/ruby/repository.cc
index f4f7e4187..83f5a1384 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2006, 2007 Ciaran McCreesh
- * Copyright (c) 2006, 2007 Richard Brown
+ * Copyright (c) 2006, 2007, 2008 Richard Brown
* Copyright (c) 2007 David Leverton
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -884,6 +884,24 @@ namespace
}
};
+ /*
+ * call-seq:
+ * get_environment_variable(package_id, environment_variable) -> String
+ *
+ * Query an environment variable.
+ */
+ VALUE
+ repository_get_environment_variable(VALUE self, VALUE pid, VALUE ev)
+ {
+ tr1::shared_ptr<Repository> * self_ptr;
+ Data_Get_Struct(self, tr1::shared_ptr<Repository>, self_ptr);
+ if ((*self_ptr)->environment_variable_interface)
+ return rb_str_new2((*self_ptr)->environment_variable_interface->get_environment_variable(value_to_package_id(pid),StringValuePtr(ev)).c_str());
+
+ return Qnil;
+
+ }
+
void do_register_repository()
{
/*
@@ -948,6 +966,7 @@ namespace
RUBY_FUNC_CAST((&RepositoryKey<MetadataStringKey, &Repository::format_key>::fetch)), 0);
rb_define_method(c_repository, "installed_root_key",
RUBY_FUNC_CAST((&RepositoryKey<MetadataFSEntryKey, &Repository::installed_root_key>::fetch)), 0);
+ rb_define_method(c_repository, "get_environment_variable", RUBY_FUNC_CAST(&repository_get_environment_variable),2);
/*
* Document-class: Paludis::ProfilesDescLine