aboutsummaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'ruby')
-rw-r--r--ruby/dep_spec.cc55
-rw-r--r--ruby/dep_spec_TEST.rb16
-rw-r--r--ruby/package_dep_spec_constraint.cc7
3 files changed, 7 insertions, 71 deletions
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 6e6e2a696..7952976a8 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -22,7 +22,6 @@
#include <paludis/dep_spec.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/version_requirements.hh>
#include <paludis/version_operator.hh>
#include <paludis/package_dep_spec_constraint.hh>
@@ -65,8 +64,6 @@ namespace
static VALUE c_exactly_one_dep_spec;
static VALUE c_conditional_dep_spec;
- static VALUE c_version_requirements_mode;
-
struct WrappedSpecBase;
template <typename> struct WrappedSpec;
@@ -719,35 +716,6 @@ namespace
std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_repository_constraint());
}
- /*
- * call-seq:
- * version_requirements -> Array
- *
- * Fetch the version requirements. E.g. [ {:operator => '=', :spec => VersionSpec.new('0.1') } ]
- */
- VALUE
- package_dep_spec_version_requirements_ptr(VALUE self)
- {
- std::shared_ptr<WrappedSpecBase> * ptr;
- Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- VALUE result(rb_ary_new());
- VALUE result_hash;
- if (std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->version_requirements_ptr())
- for (VersionRequirements::ConstIterator i(std::static_pointer_cast<const PackageDepSpec>((*ptr)->base_spec())->
- version_requirements_ptr()->begin()),
- i_end(std::static_pointer_cast<const PackageDepSpec>((*ptr)->base_spec())->version_requirements_ptr()->end()) ;
- i != i_end; ++i)
- {
- result_hash = rb_hash_new();
- rb_hash_aset(result_hash, ID2SYM(rb_intern("operator")),
- rb_str_new2(stringify(i->version_operator()).c_str()));
- rb_hash_aset(result_hash, ID2SYM(rb_intern("spec")),
- version_spec_to_value(i->version_spec()));
- rb_ary_push(result, result_hash);
- }
- return result;
- }
-
#ifdef CIARANM_REMOVED_THIS
/*
* call-seq:
@@ -780,14 +748,6 @@ namespace
}
#endif
- VALUE
- package_dep_spec_version_requirements_mode(VALUE self)
- {
- std::shared_ptr<WrappedSpecBase> * ptr;
- Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- return INT2FIX(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->version_requirements_mode());
- }
-
/*
* Document-method: original_url
* call-seq: original_url -> String
@@ -1068,8 +1028,6 @@ namespace
rb_define_method(c_package_dep_spec, "installable_to_path_constraint", RUBY_FUNC_CAST(&package_dep_spec_installable_to_path_constraint), 0);
rb_define_method(c_package_dep_spec, "any_slot_constraint", RUBY_FUNC_CAST(&package_dep_spec_any_slot_constraint), 0);
rb_define_method(c_package_dep_spec, "exact_slot_constraint", RUBY_FUNC_CAST(&package_dep_spec_exact_slot_constraint), 0);
- rb_define_method(c_package_dep_spec, "version_requirements", RUBY_FUNC_CAST(&package_dep_spec_version_requirements_ptr), 0);
- rb_define_method(c_package_dep_spec, "version_requirements_mode", RUBY_FUNC_CAST(&package_dep_spec_version_requirements_mode), 0);
#ifdef CIARANM_REMOVED_THIS
rb_define_method(c_package_dep_spec, "use_requirements", RUBY_FUNC_CAST(&package_dep_spec_use_requirements), 0);
#endif
@@ -1135,19 +1093,6 @@ namespace
VALUE (* block_dep_spec_to_s) (VALUE) = &dep_spec_to_s<BlockDepSpec>;
rb_define_method(c_block_dep_spec, "to_s", RUBY_FUNC_CAST(block_dep_spec_to_s), 0);
- /*
- * Document-module: Paludis::VersionRequirementsMode
- *
- * What sort of VersionRequirements to we have.
- *
- */
- c_version_requirements_mode = rb_define_module_under(paludis_module(), "VersionRequirementsMode");
- for (VersionRequirementsMode l(static_cast<VersionRequirementsMode>(0)), l_end(last_vr) ; l != l_end ;
- l = static_cast<VersionRequirementsMode>(static_cast<int>(l) + 1))
- rb_define_const(c_version_requirements_mode, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/version_requirements.hh, VersionRequirementsMode, c_version_requirements_mode>
-
rb_define_module_function(paludis_module(), "parse_user_package_dep_spec", RUBY_FUNC_CAST(&paludis_parse_user_dep_spec), -1);
}
}
diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb
index d0d63e3f1..d8bb8929e 100644
--- a/ruby/dep_spec_TEST.rb
+++ b/ruby/dep_spec_TEST.rb
@@ -203,22 +203,6 @@ module Paludis
assert_nil pde.category_name_part_constraint
end
- def test_version_requirements
- assert_kind_of Array, pda.version_requirements
- assert_equal 1, pda.version_requirements.size
- assert_equal VersionSpec.new('1'), pda.version_requirements.first[:spec]
- assert_equal ">=", pda.version_requirements.first[:operator]
- assert_equal 0, pdb.version_requirements.size
- assert_equal 0, pdc.version_requirements.size
- assert_equal 0, pdd.version_requirements.size
- assert_equal 0, pde.version_requirements.size
- end
-
- def test_version_requirements_mode
- assert_kind_of Fixnum, pda.version_requirements_mode
- assert_equal VersionRequirementsMode::And, pda.version_requirements_mode
- end
-
### def test_use_requirements
### assert_kind_of Array, pda.use_requirements
### assert_equal 2, pda.use_requirements.size
diff --git a/ruby/package_dep_spec_constraint.cc b/ruby/package_dep_spec_constraint.cc
index 52109a544..4184b4f4d 100644
--- a/ruby/package_dep_spec_constraint.cc
+++ b/ruby/package_dep_spec_constraint.cc
@@ -34,6 +34,7 @@ namespace
static VALUE c_name_constraint;
static VALUE c_package_name_part_constraint;
static VALUE c_category_name_part_constraint;
+ static VALUE c_version_constraint;
static VALUE c_in_repository_constraint;
static VALUE c_from_repository_constraint;
static VALUE c_installed_at_path_constraint;
@@ -73,6 +74,12 @@ namespace
new std::shared_ptr<const PackageDepSpecConstraint>(mm));
}
+ void visit(const VersionConstraint &)
+ {
+ value = Data_Wrap_Struct(c_version_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free,
+ new std::shared_ptr<const PackageDepSpecConstraint>(mm));
+ }
+
void visit(const InRepositoryConstraint &)
{
value = Data_Wrap_Struct(c_in_repository_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free,