aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-18 08:39:49 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-18 08:39:49 +0000
commit281f2f4c33dd7edf4709220fbf7f7d7e96516310 (patch)
treebc31ce0c9e12676bc4e553511d69277d5867f694
parent22ccd48fab0d3230ace9e842acbb379580c12f40 (diff)
downloadpaludis-281f2f4c33dd7edf4709220fbf7f7d7e96516310.tar.gz
paludis-281f2f4c33dd7edf4709220fbf7f7d7e96516310.tar.xz
(ruby) Add missing PackageID keys
-rw-r--r--ruby/package_id.cc69
-rw-r--r--ruby/package_id_TEST.rb16
2 files changed, 81 insertions, 4 deletions
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index 2359cf2..c07c388 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -264,6 +264,62 @@ namespace
*
* Our binary origin repository
*/
+ /*
+ * Document-method: virtual_for_key
+ *
+ * call-seq:
+ * virtual_for_key -> MetadataPackageIDKey
+ *
+ * What we are a virtual for
+ */
+ /*
+ * Document-method: build_dependencies_key
+ *
+ * call-seq:
+ * build_dependencies_key -> MetadataDependencySpecTreeKey
+ *
+ * Our build dependencies
+ */
+ /*
+ * Document-method: run_dependencies_key
+ *
+ * call-seq:
+ * run_dependencies_key -> MetadataDependencySpecTreeKey
+ *
+ * Our run dependencies
+ */
+ /*
+ * Document-method: post_dependencies_key
+ *
+ * call-seq:
+ * post_dependencies_key -> MetadataDependencySpecTreeKey
+ *
+ * Our post dependencies
+ */
+ /*
+ * Document-method: suggested_dependencies_key
+ *
+ * call-seq:
+ * suggested_dependencies_key -> MetadataDependencySpecTreeKey
+ *
+ * Our suggested dependencies
+ */
+ /*
+ * Document-method: homepage_key
+ *
+ * call-seq:
+ * homepage_key -> MetadataSimpleURISpecTreeKey
+ *
+ * Our homepage
+ */
+ /*
+ * Document-method: fetches_key
+ *
+ * call-seq:
+ * fetches_key -> MetadataFetchableURISpecTreeKey
+ *
+ * Things we fetch
+ */
template <typename T_, const tr1::shared_ptr<const T_> (PackageID::* m_) () const>
struct KeyValue
{
@@ -318,6 +374,19 @@ namespace
rb_define_method(c_package_id, "installed_time_key", RUBY_FUNC_CAST((&KeyValue<MetadataTimeKey,&PackageID::installed_time_key>::fetch)), 0);
rb_define_method(c_package_id, "source_origin_key", RUBY_FUNC_CAST((&KeyValue<MetadataStringKey,&PackageID::source_origin_key>::fetch)), 0);
rb_define_method(c_package_id, "binary_origin_key", RUBY_FUNC_CAST((&KeyValue<MetadataStringKey,&PackageID::binary_origin_key>::fetch)), 0);
+ rb_define_method(c_package_id, "virtual_for_key", RUBY_FUNC_CAST((&KeyValue<MetadataPackageIDKey, &PackageID::virtual_for_key>::fetch)), 0);
+ rb_define_method(c_package_id, "build_dependencies_key", RUBY_FUNC_CAST((
+ &KeyValue<MetadataSpecTreeKey<DependencySpecTree>, &PackageID::build_dependencies_key>::fetch)), 0);
+ rb_define_method(c_package_id, "run_dependencies_key", RUBY_FUNC_CAST((
+ &KeyValue<MetadataSpecTreeKey<DependencySpecTree>, &PackageID::run_dependencies_key>::fetch)), 0);
+ rb_define_method(c_package_id, "post_dependencies_key", RUBY_FUNC_CAST((
+ &KeyValue<MetadataSpecTreeKey<DependencySpecTree>, &PackageID::post_dependencies_key>::fetch)), 0);
+ rb_define_method(c_package_id, "suggested_dependencies_key", RUBY_FUNC_CAST((
+ &KeyValue<MetadataSpecTreeKey<DependencySpecTree>, &PackageID::suggested_dependencies_key>::fetch)), 0);
+ rb_define_method(c_package_id, "fetches_key", RUBY_FUNC_CAST((
+ &KeyValue<MetadataSpecTreeKey<FetchableURISpecTree>, &PackageID::fetches_key>::fetch)), 0);
+ rb_define_method(c_package_id, "homepage_key", RUBY_FUNC_CAST((
+ &KeyValue<MetadataSpecTreeKey<SimpleURISpecTree>, &PackageID::homepage_key>::fetch)), 0);
/*
* Document-module: Paludis::PackageIDCanonicalForm
diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb
index f3ba8e4..a8e5e88 100644
--- a/ruby/package_id_TEST.rb
+++ b/ruby/package_id_TEST.rb
@@ -105,12 +105,20 @@ module Paludis
end
def test_members
- [:name, :version, :slot, :repository_name, :==, :keywords_key,
- :iuse_key, :short_description_key,
- :long_description_key, :contents_key, :installed_time_key,
- :source_origin_key, :binary_origin_key].each do |method|
+ { :name => String, :version => VersionSpec, :slot => String, :repository_name => String,
+ :keywords_key => MetadataKeywordNameSetKey, :iuse_key => MetadataIUseFlagSetKey,
+ :short_description_key => MetadataStringKey, :long_description_key => MetadataStringKey,
+ :contents_key => MetadataContentsKey, :installed_time_key => MetadataTimeKey,
+ :source_origin_key => MetadataStringKey, :binary_origin_key => MetadataStringKey
+ }.each_pair do | method, type |
assert_respond_to pid_testrepo, method
+ x = pid_testrepo.send(method)
+ if x
+ assert_kind_of type, x
+ else
+ assert_nil x
+ end
end
end