aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-10-18 15:50:49 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-10-18 15:50:49 +0000
commit4fd1de5afc268cb789f9a6954f1c9ef80296471d (patch)
treec3095f2e112ee9f62c1573ea2556224f34db8293
parentb20ca4de67b94bdbdcff90a73142993fc56511bb (diff)
downloadpaludis-4fd1de5afc268cb789f9a6954f1c9ef80296471d.tar.gz
paludis-4fd1de5afc268cb789f9a6954f1c9ef80296471d.tar.xz
Add basic VersionMetadata support to Ruby
-rw-r--r--ruby/Makefile.am13
-rw-r--r--ruby/dep_atom.cc32
-rw-r--r--ruby/environment.cc4
-rw-r--r--ruby/mask_reasons.cc2
-rw-r--r--ruby/package_database.cc8
-rw-r--r--ruby/package_database_entry.cc2
-rw-r--r--ruby/paludis_ruby.hh18
-rw-r--r--ruby/repository.cc23
-rw-r--r--ruby/version_metadata.cc160
-rw-r--r--ruby/version_metadata_TEST.rb74
-rwxr-xr-xruby/version_metadata_TEST_cleanup.sh14
-rwxr-xr-xruby/version_metadata_TEST_setup.sh33
-rw-r--r--ruby/version_spec.cc2
13 files changed, 356 insertions, 29 deletions
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 1091293..7a9133a 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -23,7 +23,8 @@ IF_RUBY_TESTS = \
mask_reasons_TEST.rb \
dep_atom_TEST.rb \
package_database_TEST.rb \
- repository_TEST.rb
+ repository_TEST.rb \
+ version_metadata_TEST.rb
IF_RUBY_SOURCES = \
paludis_ruby.cc paludis_ruby.hh \
@@ -34,12 +35,14 @@ IF_RUBY_SOURCES = \
dep_atom.cc \
log.cc \
package_database.cc \
- repository.cc
+ repository.cc \
+ version_metadata.cc
EXTRA_DIST = $(IF_RUBY_TESTS) $(IF_RUBY_SOURCES) \
environment_TEST_setup.sh environment_TEST_cleanup.sh \
package_database_TEST_setup.sh package_database_TEST_cleanup.sh \
- repository_TEST_setup.sh repository_TEST_cleanup.sh
+ repository_TEST_setup.sh repository_TEST_cleanup.sh \
+ version_metadata_TEST_setup.sh version_metadata_TEST_cleanup.sh
TESTS_ENVIRONMENT = env \
PALUDIS_NO_GLOBAL_HOOKS="yes" \
@@ -66,6 +69,7 @@ OUR_OBJECTS = \
package_database_entry.o \
version_spec.o \
repository.o \
+ version_metadata.o \
paludis_ruby.o
TESTS = $(IF_RUBY_TESTS)
@@ -96,6 +100,9 @@ package_database.o : package_database.cc paludis_ruby.hh
version_spec.o : version_spec.cc paludis_ruby.hh
$(OUR_CXXCOMPILE) -o $@ $(srcdir)/version_spec.cc
+version_metadata.o : version_metadata.cc paludis_ruby.hh
+ $(OUR_CXXCOMPILE) -o $@ $(srcdir)/version_metadata.cc
+
mask_reasons.o : mask_reasons.cc paludis_ruby.hh
$(OUR_CXXCOMPILE) -o $@ $(srcdir)/mask_reasons.cc
diff --git a/ruby/dep_atom.cc b/ruby/dep_atom.cc
index 3759c42..3affd33 100644
--- a/ruby/dep_atom.cc
+++ b/ruby/dep_atom.cc
@@ -46,11 +46,11 @@ namespace
VALUE
package_dep_atom_new(VALUE self, VALUE s)
{
- PackageDepAtom::Pointer * ptr(0);
+ PackageDepAtom::ConstPointer * ptr(0);
try
{
- ptr = new PackageDepAtom::Pointer(new PackageDepAtom(STR2CSTR(s)));
- VALUE tdata(Data_Wrap_Struct(self, 0, &Common<PackageDepAtom::Pointer>::free, ptr));
+ ptr = new PackageDepAtom::ConstPointer(new PackageDepAtom(STR2CSTR(s)));
+ VALUE tdata(Data_Wrap_Struct(self, 0, &Common<PackageDepAtom::ConstPointer>::free, ptr));
rb_obj_call_init(tdata, 1, &s);
return tdata;
}
@@ -69,23 +69,39 @@ namespace
c_package_dep_atom = rb_define_class_under(master_class(), "PackageDepAtom", c_dep_atom);
rb_define_singleton_method(c_package_dep_atom, "new", RUBY_FUNC_CAST(&package_dep_atom_new), 1);
rb_define_method(c_package_dep_atom, "initialize", RUBY_FUNC_CAST(&package_dep_atom_init), 1);
- rb_define_method(c_package_dep_atom, "to_s", RUBY_FUNC_CAST(&Common<PackageDepAtom::Pointer>::to_s_via_ptr), 0);
+ rb_define_method(c_package_dep_atom, "to_s", RUBY_FUNC_CAST(&Common<PackageDepAtom::ConstPointer>::to_s_via_ptr), 0);
}
}
-PackageDepAtom::Pointer
+PackageDepAtom::ConstPointer
paludis::ruby::value_to_package_dep_atom(VALUE v)
{
if (T_STRING == TYPE(v))
- return PackageDepAtom::Pointer(new PackageDepAtom(STR2CSTR(v)));
+ return PackageDepAtom::ConstPointer(new PackageDepAtom(STR2CSTR(v)));
else
{
- PackageDepAtom::Pointer * v_ptr;
- Data_Get_Struct(v, PackageDepAtom::Pointer, v_ptr);
+ PackageDepAtom::ConstPointer * v_ptr;
+ Data_Get_Struct(v, PackageDepAtom::ConstPointer, v_ptr);
return *v_ptr;
}
}
+VALUE
+paludis::ruby::dep_atom_to_value(DepAtom::ConstPointer m)
+{
+ DepAtom::ConstPointer * m_ptr(0);
+ try
+ {
+ m_ptr = new DepAtom::ConstPointer(m);
+ return Data_Wrap_Struct(c_dep_atom, 0, &Common<DepAtom::ConstPointer>::free, m_ptr);
+ }
+ catch (const std::exception & e)
+ {
+ delete m_ptr;
+ exception_to_ruby_exception(e);
+ }
+}
+
RegisterRubyClass::Register paludis_ruby_register_dep_atom PALUDIS_ATTRIBUTE((used))
(&do_register_dep_atom);
diff --git a/ruby/environment.cc b/ruby/environment.cc
index 69af47e..c54b93d 100644
--- a/ruby/environment.cc
+++ b/ruby/environment.cc
@@ -143,7 +143,7 @@ namespace
try
{
MaskReasons r(env_data->env_ptr->mask_reasons(*pde_ptr));
- return create_mask_reasons(r);
+ return mask_reasons_to_value(r);
}
catch (const std::exception & e)
{
@@ -159,7 +159,7 @@ namespace
try
{
- return create_package_database(env_data->env_ptr->package_database());
+ return package_database_to_value(env_data->env_ptr->package_database());
}
catch (const std::exception & e)
{
diff --git a/ruby/mask_reasons.cc b/ruby/mask_reasons.cc
index 85f77e0..993538b 100644
--- a/ruby/mask_reasons.cc
+++ b/ruby/mask_reasons.cc
@@ -88,7 +88,7 @@ namespace
}
VALUE
-paludis::ruby::create_mask_reasons(const MaskReasons & m)
+paludis::ruby::mask_reasons_to_value(const MaskReasons & m)
{
return Data_Wrap_Struct(c_mask_reasons, 0, &Common<MaskReasons>::free, new MaskReasons(m));
}
diff --git a/ruby/package_database.cc b/ruby/package_database.cc
index 4d79316..429b51c 100644
--- a/ruby/package_database.cc
+++ b/ruby/package_database.cc
@@ -78,7 +78,7 @@ namespace
VALUE result(rb_ary_new());
for (PackageDatabaseEntryCollection::Iterator i(items->begin()),
i_end(items->end()) ; i != i_end ; ++i)
- rb_ary_push(result, create_package_database_entry(*i));
+ rb_ary_push(result, package_database_entry_to_value(*i));
return result;
}
catch (const std::exception & e)
@@ -98,7 +98,7 @@ namespace
VALUE result(rb_ary_new());
for (PackageDatabase::RepositoryIterator r((*self_ptr)->begin_repositories()),
r_end((*self_ptr)->end_repositories()) ; r != r_end ; ++r)
- rb_ary_push(result, create_repository(*r));
+ rb_ary_push(result, repository_to_value(*r));
return result;
}
@@ -116,7 +116,7 @@ namespace
PackageDatabase::Pointer * self_ptr;
Data_Get_Struct(self, PackageDatabase::Pointer, self_ptr);
- return create_repository((*self_ptr)->fetch_repository(RepositoryName(STR2CSTR(name))));
+ return repository_to_value((*self_ptr)->fetch_repository(RepositoryName(STR2CSTR(name))));
}
catch (const std::exception & e)
{
@@ -147,7 +147,7 @@ namespace
}
VALUE
-paludis::ruby::create_package_database(PackageDatabase::Pointer m)
+paludis::ruby::package_database_to_value(PackageDatabase::Pointer m)
{
PackageDatabase::Pointer * m_ptr(0);
try
diff --git a/ruby/package_database_entry.cc b/ruby/package_database_entry.cc
index 9a1eaf1..9a9ef6b 100644
--- a/ruby/package_database_entry.cc
+++ b/ruby/package_database_entry.cc
@@ -71,7 +71,7 @@ namespace
}
VALUE
-paludis::ruby::create_package_database_entry(const PackageDatabaseEntry & d)
+paludis::ruby::package_database_entry_to_value(const PackageDatabaseEntry & d)
{
PackageDatabaseEntry * m_ptr(0);
try
diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh
index 7e48a8c..829d7f5 100644
--- a/ruby/paludis_ruby.hh
+++ b/ruby/paludis_ruby.hh
@@ -39,17 +39,21 @@ namespace paludis
std::string value_case_to_RubyCase(const std::string & s);
+ VALUE master_class();
+
/* constructors */
- VALUE master_class();
- VALUE create_mask_reasons(const MaskReasons &);
- VALUE create_package_database(PackageDatabase::Pointer);
- VALUE create_package_database_entry(const PackageDatabaseEntry &);
- VALUE create_repository(Repository::ConstPointer);
- VALUE create_version_spec(const VersionSpec &);
+ VALUE mask_reasons_to_value(const MaskReasons &);
+ VALUE package_database_to_value(PackageDatabase::Pointer);
+ VALUE package_database_entry_to_value(const PackageDatabaseEntry &);
+ VALUE repository_to_value(Repository::ConstPointer);
+ VALUE version_spec_to_value(const VersionSpec &);
+ VALUE version_metadata_to_value(VersionMetadata::ConstPointer);
+ VALUE dep_atom_to_value(DepAtom::ConstPointer);
VersionSpec value_to_version_spec(VALUE v);
- PackageDepAtom::Pointer value_to_package_dep_atom(VALUE v);
+ VersionMetadata::ConstPointer value_to_version_metadata(VALUE);
+ PackageDepAtom::ConstPointer value_to_package_dep_atom(VALUE v);
/* registration */
diff --git a/ruby/repository.cc b/ruby/repository.cc
index 6d46e7a..2f74606 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -144,7 +144,7 @@ namespace
VALUE result(rb_ary_new());
VersionSpecCollection::ConstPointer c((*self_ptr)->version_specs(q));
for (VersionSpecCollection::Iterator i(c->begin()), i_end(c->end()) ; i != i_end ; ++i)
- rb_ary_push(result, create_version_spec(*i));
+ rb_ary_push(result, version_spec_to_value(*i));
return result;
}
catch (const std::exception & e)
@@ -153,6 +153,23 @@ namespace
}
}
+ VALUE
+ repository_version_metadata(VALUE self, VALUE name, VALUE version)
+ {
+ try
+ {
+ Repository::ConstPointer * self_ptr;
+ Data_Get_Struct(self, Repository::ConstPointer, self_ptr);
+ return version_metadata_to_value((*self_ptr)->version_metadata(QualifiedPackageName(STR2CSTR(name)),
+ value_to_version_spec(version)));
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+
void do_register_repository()
{
c_repository = rb_define_class_under(master_class(), "Repository", rb_cObject);
@@ -166,11 +183,13 @@ namespace
rb_define_method(c_repository, "category_names", RUBY_FUNC_CAST(&repository_category_names), 0);
rb_define_method(c_repository, "package_names", RUBY_FUNC_CAST(&repository_package_names), 1);
rb_define_method(c_repository, "version_specs", RUBY_FUNC_CAST(&repository_version_specs), 1);
+
+ rb_define_method(c_repository, "version_metadata", RUBY_FUNC_CAST(&repository_version_metadata), 2);
}
}
VALUE
-paludis::ruby::create_repository(Repository::ConstPointer m)
+paludis::ruby::repository_to_value(Repository::ConstPointer m)
{
Repository::ConstPointer * m_ptr(0);
try
diff --git a/ruby/version_metadata.cc b/ruby/version_metadata.cc
new file mode 100644
index 0000000..0674aae
--- /dev/null
+++ b/ruby/version_metadata.cc
@@ -0,0 +1,160 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis_ruby.hh>
+#include <paludis/version_metadata.hh>
+#include <paludis/util/stringify.hh>
+#include <ruby.h>
+
+using namespace paludis;
+using namespace paludis::ruby;
+
+#define RUBY_FUNC_CAST(x) reinterpret_cast<VALUE (*)(...)>(x)
+
+namespace
+{
+ static VALUE c_version_metadata;
+
+ template <typename T_>
+ VALUE version_metadata_get_interface(VALUE self, const T_ * (VersionMetadata::* m) () const)
+ {
+ VersionMetadata::ConstPointer * self_ptr;
+ Data_Get_Struct(self, VersionMetadata::ConstPointer, self_ptr);
+ return ((**self_ptr).*m)() ? self : Qnil;
+ }
+
+ VALUE version_metadata_get_ebuild_interface(VALUE self)
+ {
+ return version_metadata_get_interface(self, &VersionMetadata::get_ebuild_interface);
+ }
+
+ VALUE version_metadata_get_ebin_interface(VALUE self)
+ {
+ return version_metadata_get_interface(self, &VersionMetadata::get_ebin_interface);
+ }
+
+ VALUE version_metadata_get_cran_interface(VALUE self)
+ {
+ return version_metadata_get_interface(self, &VersionMetadata::get_cran_interface);
+ }
+
+ VALUE version_metadata_get_virtual_interface(VALUE self)
+ {
+ return version_metadata_get_interface(self, &VersionMetadata::get_virtual_interface);
+ }
+
+ VALUE
+ version_metadata_license(VALUE self)
+ {
+ VersionMetadata::ConstPointer * self_ptr;
+ Data_Get_Struct(self, VersionMetadata::ConstPointer, self_ptr);
+ return dep_atom_to_value((*self_ptr)->license());
+ }
+
+ template <typename T_, T_ VersionMetadataBase::* m_>
+ struct BaseValue
+ {
+ static VALUE
+ fetch(VALUE self)
+ {
+ VersionMetadata::ConstPointer * self_ptr;
+ Data_Get_Struct(self, VersionMetadata::ConstPointer, self_ptr);
+ return rb_str_new2(stringify((**self_ptr).*m_).c_str());
+ }
+ };
+
+ template <typename T_, T_ EbuildVersionMetadata::* m_>
+ struct EbuildValue
+ {
+ static VALUE
+ fetch(VALUE self)
+ {
+ VersionMetadata::ConstPointer * self_ptr;
+ Data_Get_Struct(self, VersionMetadata::ConstPointer, self_ptr);
+ if ((*self_ptr)->get_ebuild_interface())
+ return rb_str_new2(stringify((*self_ptr)->get_ebuild_interface()->*m_).c_str());
+ else
+ return Qnil;
+ }
+ };
+
+ void do_register_version_metadata()
+ {
+ c_version_metadata = rb_define_class_under(master_class(), "VersionMetadata", rb_cObject);
+ rb_funcall(c_version_metadata, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_define_method(c_version_metadata, "get_ebuild_interface", RUBY_FUNC_CAST(&version_metadata_get_ebuild_interface), 0);
+ rb_define_method(c_version_metadata, "get_virtual_interface", RUBY_FUNC_CAST(&version_metadata_get_virtual_interface), 0);
+ rb_define_method(c_version_metadata, "get_ebin_interface", RUBY_FUNC_CAST(&version_metadata_get_ebin_interface), 0);
+ rb_define_method(c_version_metadata, "get_cran_interface", RUBY_FUNC_CAST(&version_metadata_get_cran_interface), 0);
+
+ rb_define_method(c_version_metadata, "license", RUBY_FUNC_CAST(&version_metadata_license), 0);
+
+ rb_define_method(c_version_metadata, "slot", RUBY_FUNC_CAST((&BaseValue<SlotName, &VersionMetadataBase::slot>::fetch)), 0);
+ rb_define_method(c_version_metadata, "license_string", RUBY_FUNC_CAST((&BaseValue<std::string,
+ &VersionMetadataBase::license_string>::fetch)), 0);
+ rb_define_method(c_version_metadata, "eapi", RUBY_FUNC_CAST((&BaseValue<std::string, &VersionMetadataBase::eapi>::fetch)), 0);
+ rb_define_method(c_version_metadata, "homepage", RUBY_FUNC_CAST((&BaseValue<std::string, &VersionMetadataBase::homepage>::fetch)), 0);
+ rb_define_method(c_version_metadata, "description", RUBY_FUNC_CAST((&BaseValue<std::string,
+ &VersionMetadataBase::description>::fetch)), 0);
+
+ rb_define_method(c_version_metadata, "provide_string", RUBY_FUNC_CAST((&EbuildValue<std::string,
+ &EbuildVersionMetadata::provide_string>::fetch)), 0);
+ rb_define_method(c_version_metadata, "src_uri", RUBY_FUNC_CAST((&EbuildValue<std::string,
+ &EbuildVersionMetadata::src_uri>::fetch)), 0);
+ rb_define_method(c_version_metadata, "restrict_string", RUBY_FUNC_CAST((&EbuildValue<std::string,
+ &EbuildVersionMetadata::restrict_string>::fetch)), 0);
+ rb_define_method(c_version_metadata, "keywords", RUBY_FUNC_CAST((&EbuildValue<std::string,
+ &EbuildVersionMetadata::keywords>::fetch)), 0);
+ rb_define_method(c_version_metadata, "eclass_keywords", RUBY_FUNC_CAST((&EbuildValue<std::string,
+ &EbuildVersionMetadata::eclass_keywords>::fetch)), 0);
+ rb_define_method(c_version_metadata, "iuse", RUBY_FUNC_CAST((&EbuildValue<std::string,
+ &EbuildVersionMetadata::iuse>::fetch)), 0);
+ rb_define_method(c_version_metadata, "inherited", RUBY_FUNC_CAST((&EbuildValue<std::string,
+ &EbuildVersionMetadata::inherited>::fetch)), 0);
+ }
+}
+
+VALUE
+paludis::ruby::version_metadata_to_value(VersionMetadata::ConstPointer m)
+{
+ VersionMetadata::ConstPointer * m_ptr(0);
+ try
+ {
+ m_ptr = new VersionMetadata::ConstPointer(m);
+ return Data_Wrap_Struct(c_version_metadata, 0, &Common<VersionMetadata::ConstPointer>::free, m_ptr);
+ }
+ catch (const std::exception & e)
+ {
+ delete m_ptr;
+ exception_to_ruby_exception(e);
+ }
+}
+
+VersionMetadata::ConstPointer
+paludis::ruby::value_to_version_metadata(VALUE v)
+{
+ VersionMetadata::ConstPointer * v_ptr;
+ Data_Get_Struct(v, VersionMetadata::ConstPointer, v_ptr);
+ return *v_ptr;
+}
+
+RegisterRubyClass::Register paludis_ruby_register_version_metadata PALUDIS_ATTRIBUTE((used))
+ (&do_register_version_metadata);
+
+
diff --git a/ruby/version_metadata_TEST.rb b/ruby/version_metadata_TEST.rb
new file mode 100644
index 0000000..e6ef5fe
--- /dev/null
+++ b/ruby/version_metadata_TEST.rb
@@ -0,0 +1,74 @@
+#!/usr/bin/ruby
+# vim: set sw=4 sts=4 et tw=80 :
+
+#
+# Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+#
+# This file is part of the Paludis package manager. Paludis is free software;
+# you can redistribute it and/or modify it under the terms of the GNU General
+# Public License version 2, as published by the Free Software Foundation.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+require 'test/unit'
+require 'Paludis'
+
+Paludis::Log.instance.log_level = Paludis::LogLevel::Warning
+
+class Paludis
+ class TestCase_VersionMetadata < Test::Unit::TestCase
+ def test_no_create
+ assert_raise NoMethodError do
+ p = VersionMetadata.new
+ end
+ end
+
+ def env
+ unless @env
+ @env = NoConfigEnvironment.new("version_metadata_TEST_dir/testrepo/")
+ end
+ @env
+ end
+
+ def vmd version
+ env.package_database.fetch_repository("testrepo").version_metadata("foo/bar", version)
+ end
+
+ def test_license
+ assert_kind_of DepAtom, vmd("1.0").license
+ end
+
+ def test_interfaces
+ assert vmd("1.0").get_ebuild_interface
+ assert ! vmd("1.0").get_ebin_interface
+ assert ! vmd("1.0").get_cran_interface
+ assert ! vmd("1.0").get_virtual_interface
+ end
+
+ def test_members
+ assert_equal "Test package", vmd("1.0").description
+ assert_equal "http://paludis.berlios.de/", vmd("1.0").homepage
+ assert_equal "0", vmd("1.0").slot
+ assert_equal "0", vmd("1.0").eapi
+ assert_equal "GPL-2", vmd("1.0").license_string
+ end
+
+ def test_ebuild_members
+ assert_equal "", vmd("1.0").provide_string
+ assert_equal "", vmd("1.0").src_uri
+ assert_equal "", vmd("1.0").restrict_string
+ assert_equal "test", vmd("1.0").keywords.gsub(%r/\s/, "")
+ assert_equal "", vmd("1.0").iuse.gsub(%r/\s/, "")
+ end
+ end
+end
+
+
diff --git a/ruby/version_metadata_TEST_cleanup.sh b/ruby/version_metadata_TEST_cleanup.sh
new file mode 100755
index 0000000..b300424
--- /dev/null
+++ b/ruby/version_metadata_TEST_cleanup.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d version_metadata_TEST_dir ] ; then
+ rm -fr version_metadata_TEST_dir
+else
+ true
+fi
+
+
+
+
+
+
diff --git a/ruby/version_metadata_TEST_setup.sh b/ruby/version_metadata_TEST_setup.sh
new file mode 100755
index 0000000..a87aac4
--- /dev/null
+++ b/ruby/version_metadata_TEST_setup.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir version_metadata_TEST_dir || exit 1
+cd version_metadata_TEST_dir || exit 1
+
+mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files} || exit 1
+cd testrepo || exit 1
+echo "testrepo" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+foo
+END
+cat <<END > profiles/profiles.desc
+test testprofile stable
+END
+cat <<END > profiles/testprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+END
+
+cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
+DESCRIPTION="Test package"
+HOMEPAGE="http://paludis.berlios.de/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+END
+
+cd ..
+
diff --git a/ruby/version_spec.cc b/ruby/version_spec.cc
index 96f400d..8938072 100644
--- a/ruby/version_spec.cc
+++ b/ruby/version_spec.cc
@@ -79,7 +79,7 @@ paludis::ruby::value_to_version_spec(VALUE v)
}
VALUE
-paludis::ruby::create_version_spec(const VersionSpec & v)
+paludis::ruby::version_spec_to_value(const VersionSpec & v)
{
VersionSpec * vv(new VersionSpec(v));
return Data_Wrap_Struct(c_version_spec, 0, &Common<VersionSpec>::free, vv);