class Paludis::UninstallAction

An UninstallAction is used by UninstallTask to uninstall a PackageID.

Public Class Methods

new(uninstall_action_options) → UninstallAction click to toggle source

Create a new UninstallAction.

VALUE
    uninstall_action_new(VALUE self, VALUE opts)
    {
        auto options = BoxedOptions<UninstallActionOptions>::unbox(opts);
        std::shared_ptr<Action> * a(new std::shared_ptr<Action>(std::make_shared<UninstallAction>(options)));
        VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<Action> >::free, a));
        rb_obj_call_init(tdata, 1, &self);
        return tdata;
    }

    /*
     * Document-method: config_protect
     *
     * call-seq:
     *     config_protect -> String
     *
     * Our config_protect value
     */
    VALUE
    uninstall_action_options_config_protect(VALUE self)
    {
        UninstallActionOptions * p;
        Data_Get_Struct(self, UninstallActionOptions, p);
        return rb_str_new2((*p).config_protect().c_str());
    }

    /*
     * call-seq:
     *     failed? -> true or false
     *
     * Did our pretend phase fail?
     */
    VALUE
    pretend_action_failed(VALUE self)
    {
        std::shared_ptr<Action> * p;
        Data_Get_Struct(self, std::shared_ptr<Action>, p);
        return bool_to_value(std::static_pointer_cast<PretendAction>(*p)->failed());
    }

    /*
     * call-seq:
     *     set_failed -> Qnil
     *
     * Mark the action as failed.
     */
    VALUE
    pretend_action_set_failed(VALUE self)
    {
        std::shared_ptr<Action> * p;
        Data_Get_Struct(self, std::shared_ptr<Action>, p);
        std::static_pointer_cast<PretendAction>(*p)->set_failed();
        return Qnil;
    }

    void do_register_action()
    {
        /*
         * Document-class: Paludis::SupportsActionTest
         *
         * Tests whether a Paludis::PackageID supports a particular action.
         */
        c_supports_action_test = rb_define_class_under(c_paludis_module, "SupportsActionTest", rb_cObject);
        rb_define_singleton_method(c_supports_action_test, "new", supports_action_test_new, 1);

        /*
         * Document-class: Paludis::Action
         *
         * Base class for actions, used by Paludis::PackageID#perform_action.
         */
        c_action = rb_define_class_under(c_paludis_module, "Action", rb_cObject);
        rb_funcall(c_action, rb_intern("private_class_method"), 1, rb_str_new2("new"));

        /*
         * Document-class: Paludis::FetchAction
         *
         * An action for fetching.
         */
        c_fetch_action = rb_define_class_under(c_paludis_module, "FetchAction", c_action);
        rb_define_singleton_method(c_fetch_action, "new", fetch_action_new, 1);
        rb_define_method(c_fetch_action, "initialize", empty_init, -1);
        rb_define_method(c_fetch_action, "options", template_methods, 0);

        /*
         * Document-class: Paludis::FetchActionOptions
         *
         * Options for Paludis::FetchAction.
         */
        c_fetch_action_options = rb_define_class_under(c_paludis_module, "FetchActionOptions", rb_cObject);
        rb_define_singleton_method(c_fetch_action_options, "new", fetch_action_options_new, -1);
        rb_define_method(c_fetch_action_options, "initialize", empty_init, -1);
        rb_define_method(c_fetch_action_options, "safe_resume?",
                RUBY_FUNC_CAST((&NVFetch<FetchActionOptions, n::safe_resume, bool,                        &FetchActionOptions::safe_resume>::fetch)), 0);
        rb_define_method(c_fetch_action_options, "exclude_unmirrorable?",
                RUBY_FUNC_CAST((&NVFetch<FetchActionOptions, n::exclude_unmirrorable, bool,                        &FetchActionOptions::exclude_unmirrorable>::fetch)), 0);

        /*
         * Document-class: Paludis::FetchActionFailure
         *
         * A failed fetch action part.
         */
        c_fetch_action_failure = rb_define_class_under(c_paludis_module, "FetchActionFailure", rb_cObject);
        rb_define_singleton_method(c_fetch_action_failure, "new", fetch_action_failure_new, -1);
        rb_define_method(c_fetch_action_failure, "initialize", empty_init, -1);
        rb_define_method(c_fetch_action_failure, "target_file",
                RUBY_FUNC_CAST((&NVFetch<FetchActionFailure, n::target_file, std::string,                        &FetchActionFailure::target_file>::fetch)), 0);
        rb_define_method(c_fetch_action_failure, "requires_manual_fetching?",
                RUBY_FUNC_CAST((&NVFetch<FetchActionFailure, n::requires_manual_fetching, bool,                        &FetchActionFailure::requires_manual_fetching>::fetch)), 0);
        rb_define_method(c_fetch_action_failure, "failed_automatic_fetching?",
                RUBY_FUNC_CAST((&NVFetch<FetchActionFailure, n::failed_automatic_fetching, bool,                        &FetchActionFailure::failed_automatic_fetching>::fetch)), 0);
        rb_define_method(c_fetch_action_failure, "failed_integrity_checks",
                RUBY_FUNC_CAST((&NVFetch<FetchActionFailure, n::failed_integrity_checks, std::string,                        &FetchActionFailure::failed_integrity_checks>::fetch)), 0);

        /*
         * Document-class: Paludis::InfoActionOptions
         *
         * Options for Paludis::InfoAction
         */
        c_info_action_options = rb_define_class_under(c_paludis_module, "InfoActionOptions", rb_cObject);
        rb_define_singleton_method(c_info_action_options, "new", info_action_options_new, -1);
        rb_define_method(c_info_action_options, "initialize", empty_init, -1);

        /*
         * Document-class: Paludis::InfoAction
         *
         * An action for fetching.
         */
        c_info_action = rb_define_class_under(c_paludis_module, "InfoAction", c_action);
        rb_define_singleton_method(c_info_action, "new", info_action_new, 1);
        rb_define_method(c_info_action, "initialize", empty_init, -1);
        rb_define_method(c_info_action, "options", template_methods, 0);

        /*
         * Document-class: Paludis::ConfigActionOptions
         *
         * Options for Paludis::ConfigAction
         */
        c_config_action_options = rb_define_class_under(c_paludis_module, "ConfigActionOptions", rb_cObject);
        rb_define_singleton_method(c_config_action_options, "new", config_action_options_new, -1);
        rb_define_method(c_config_action_options, "initialize", empty_init, -1);

        /*
         * Document-class: Paludis::ConfigAction
         *
         * An action for fetching.
         */
        c_config_action = rb_define_class_under(c_paludis_module, "ConfigAction", c_action);
        rb_define_singleton_method(c_config_action, "new", config_action_new, 1);
        rb_define_method(c_config_action, "initialize", empty_init, -1);
        rb_define_method(c_config_action, "options", template_methods, 0);

        /*
         * Document-class: Paludis::InstallActionOptions
         *
         * Options for Paludis::InstallAction.
         */
        c_install_action_options = rb_define_class_under(c_paludis_module, "InstallActionOptions", rb_cObject);
        rb_define_singleton_method(c_install_action_options, "new", install_action_options_new, -1);
        rb_define_method(c_install_action_options, "initialize", empty_init, -1);
        rb_define_method(c_install_action_options, "destination", template_methods, 0);

        /*
         * Document-class: Paludis::InstallAction
         *
         * An InstallAction is used by InstallTask to install a PackageID.
         */
        c_install_action = rb_define_class_under(c_paludis_module, "InstallAction", c_action);
        rb_define_singleton_method(c_install_action, "new", install_action_new, 1);
        rb_define_method(c_install_action, "initialize", empty_init, -1);
        rb_define_method(c_install_action, "options", template_methods, 0);

        /*
         * Document-class: Paludis::UninstallActionOptions
         *
         * Options for Paludis::UninstallAction.
         */
        c_uninstall_action_options = rb_define_class_under(c_paludis_module, "UninstallActionOptions", rb_cObject);
        rb_define_singleton_method(c_uninstall_action_options, "new", uninstall_action_options_new, -1);
        rb_define_method(c_uninstall_action_options, "initialize", empty_init, -1);
        rb_define_method(c_uninstall_action_options, "config_protect", uninstall_action_options_config_protect, 0);

        /*
         * Document-class: Paludis::UninstallAction
         *
         * An UninstallAction is used by UninstallTask to uninstall a PackageID.
         */
        c_uninstall_action = rb_define_class_under(c_paludis_module, "UninstallAction", c_action);
        rb_define_singleton_method(c_uninstall_action, "new", uninstall_action_new, 1);
        rb_define_method(c_uninstall_action, "initialize", empty_init, -1);
        rb_define_method(c_uninstall_action, "options", template_methods, 0);

        /*
         * Document-class: Paludis::PretendActionOptions
         *
         * Options for Paludis::PretendAction.
         */
        c_pretend_action_options = rb_define_class_under(c_paludis_module, "PretendActionOptions", rb_cObject);
        rb_define_singleton_method(c_pretend_action_options, "new", pretend_action_options_new, -1);
        rb_define_method(c_pretend_action_options, "initialize", empty_init, -1);
        rb_define_method(c_pretend_action_options, "destination", template_methods, 0);

        /*
         * Document-class: Paludis::PretendAction
         *
         * A PretendAction is used by InstallTask to handle install-pretend-phase checks on a PackageID.
         */
        c_pretend_action = rb_define_class_under(c_paludis_module, "PretendAction", c_action);
        rb_define_singleton_method(c_pretend_action, "new", pretend_action_new, 1);
        rb_define_method(c_pretend_action, "initialize", empty_init, -1);
        rb_define_method(c_pretend_action, "failed?", pretend_action_failed, 0);
        rb_define_method(c_pretend_action, "set_failed", pretend_action_set_failed, 0);
        rb_define_method(c_pretend_action, "options", template_methods, 0);

        c_pretend_fetch_action = rb_define_class_under(c_paludis_module, "PretendFetchAction", c_action);
        rb_funcall(c_pretend_fetch_action, rb_intern("private_class_method"), 1, rb_str_new2("new"));
    }
}