列出 Merb::Slices 依赖项的最佳方法?

发布于 2024-07-09 10:21:23 字数 179 浏览 9 评论 0原文

我正在 Merb 应用程序中创建切片列表,如下所示:

Merb::Slices.each_slice |slice|

我想获取每个切片的依赖项列表,知道如何访问它吗?

我仍在阅读 merb 代码,解决方案可能很快就会出现;)

I'm creating a list of the Slices in my Merb app, like this:

Merb::Slices.each_slice do |slice|

I'd like to get the list of dependencies for each of this slice, any idea how to access it?

I'm still reading merb code, solution might come soon ;)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

迷爱 2024-07-16 10:21:23

似乎不可能获取特定切片的依赖项列表。

下一个解决方案是解析切片 init.rb

在任务中发现的一些有趣的东西,全局依赖列表:

Merb::BootLoader::Dependency.dependencies

Seems impossible to get list of dependencies for a particular slice.

The next solution is to parse the slice init.rb

Something interesting found in the quest, the global list of dependencies:

Merb::BootLoader::Dependencies.dependencies

明天过后 2024-07-16 10:21:23

我还没有使用过切片,但根据我的理解,它们本身就像一个迷你 merb 应用程序,因此每个切片不是都有一个 /config/dependency.rb 吗? 也许这会被解析到程序中并在某个地方可用。

可能有一些东西这里文档

另外,以下是 Merb 常量(您可以从中获取环境等信息)上可用的方法。 有一个称为依赖项的函数,它返回一个数组(当我在应用程序中使用 merb -i 运行时,该数组为空)。

>> Merb.methods.sort
=> ["<", "<=", "<=>", "==", "===", "=~", ">", ">=", "JSON", "__caller_info__", "__caller_lines__", "__id__", "__profile__", "__send__", "abstract_method", "adapter", "adapter=", "add_generators", "add_mime_type", "add_rakefiles", "ancestors", "args_and_options", "assigns", "at_exit", "at_exit_procs", "autoload", "autoload?", "available_accepts", "available_mime_types", "b64encode", "blank?", "bundled?", "class", "class_eval", "class_variable_defined?", "class_variables", "clone", "config", "const_defined?", "const_get", "const_missing", "const_set", "constants", "context", "debugger", "decode64", "decode_b", "deep_clone", "deferred_actions", "dependencies", "dependency", "describe", "dir_for", "disable", "disabled?", "disabled_components", "disabled_components=", "display", "dup", "encode64", "encoded_hash", "enforce!", "enum_for", "env", "env?", "environment", "environment=", "environment_info", "environment_info=", "eql?", "equal?", "exception", "exiting", "exiting=", "extend", "extract_options_from_args!", "fatal!", "find_const", "forking_environment?", "framework_root", "freeze", "frozen?", "full_const_get", "full_const_set", "generators", "given", "glob_for", "hash", "id", "in?", "include?", "included_modules", "inline", "inspect", "instance_eval", "instance_method", "instance_methods", "instance_of?", "instance_variable_defined?", "instance_variable_get", "instance_variable_set", "instance_variables", "is_a?", "is_haml?", "j", "jj", "kind_of?", "klass_hashes", "klass_hashes=", "load_config", "load_dependencies", "load_dependency", "load_paths", "load_paths=", "log_path", "log_stream", "logger", "make_module", "merb", "merge_env", "meta_class", "method", "method_defined?", "methods", "mime_transform_method", "module_eval", "modules", "name", "nil?", "object_id", "on_jruby?", "on_windows?", "options", "orm", "orm=", "orm_generator_scope", "present?", "print_colorized_backtrace", "private_class_method", "private_instance_methods", "private_method_defined?", "private_methods", "protected_instance_methods", "protected_method_defined?", "protected_methods", "public_class_method", "public_instance_methods", "public_method_defined?", "public_methods", "push_path", "quacks_like?", "rakefiles", "reload", "remove_mime_type", "remove_paths", "rescue_require", "reset_logger!", "respond_to?", "restart_environment", "root", "root=", "root_path", "send", "share_as", "share_examples_for", "shared_examples_for", "should", "should_not", "singleton_methods", "start", "start_environment", "started", "started=", "started?", "taguri", "taguri=", "taint", "tainted?", "template_engine", "template_engine=", "test_framework", "test_framework=", "test_framework_generator_scope", "testing?", "to_a", "to_enum", "to_json", "to_s", "to_yaml", "to_yaml_properties", "to_yaml_style", "track_dependency", "trap", "try_dup", "type", "untaint", "use_orm", "use_template_engine", "use_test", "use_testing_framework", "yaml_as", "yaml_tag_class_name", "yaml_tag_read_class"]

I haven't used slices yet, but from my understanding they are like a mini merb app in themself, therefore wouldn't each slice have a /config/dependencies.rb? Maybe this gets parsed into the program and is available somewhere.

There may be something here in the docs.

Also, here are the methods available on the Merb constant (which you get things like the environment from). There's one called dependencies which returns an array (which is empty when I'm running with merb -i in an app).

>> Merb.methods.sort
=> ["<", "<=", "<=>", "==", "===", "=~", ">", ">=", "JSON", "__caller_info__", "__caller_lines__", "__id__", "__profile__", "__send__", "abstract_method", "adapter", "adapter=", "add_generators", "add_mime_type", "add_rakefiles", "ancestors", "args_and_options", "assigns", "at_exit", "at_exit_procs", "autoload", "autoload?", "available_accepts", "available_mime_types", "b64encode", "blank?", "bundled?", "class", "class_eval", "class_variable_defined?", "class_variables", "clone", "config", "const_defined?", "const_get", "const_missing", "const_set", "constants", "context", "debugger", "decode64", "decode_b", "deep_clone", "deferred_actions", "dependencies", "dependency", "describe", "dir_for", "disable", "disabled?", "disabled_components", "disabled_components=", "display", "dup", "encode64", "encoded_hash", "enforce!", "enum_for", "env", "env?", "environment", "environment=", "environment_info", "environment_info=", "eql?", "equal?", "exception", "exiting", "exiting=", "extend", "extract_options_from_args!", "fatal!", "find_const", "forking_environment?", "framework_root", "freeze", "frozen?", "full_const_get", "full_const_set", "generators", "given", "glob_for", "hash", "id", "in?", "include?", "included_modules", "inline", "inspect", "instance_eval", "instance_method", "instance_methods", "instance_of?", "instance_variable_defined?", "instance_variable_get", "instance_variable_set", "instance_variables", "is_a?", "is_haml?", "j", "jj", "kind_of?", "klass_hashes", "klass_hashes=", "load_config", "load_dependencies", "load_dependency", "load_paths", "load_paths=", "log_path", "log_stream", "logger", "make_module", "merb", "merge_env", "meta_class", "method", "method_defined?", "methods", "mime_transform_method", "module_eval", "modules", "name", "nil?", "object_id", "on_jruby?", "on_windows?", "options", "orm", "orm=", "orm_generator_scope", "present?", "print_colorized_backtrace", "private_class_method", "private_instance_methods", "private_method_defined?", "private_methods", "protected_instance_methods", "protected_method_defined?", "protected_methods", "public_class_method", "public_instance_methods", "public_method_defined?", "public_methods", "push_path", "quacks_like?", "rakefiles", "reload", "remove_mime_type", "remove_paths", "rescue_require", "reset_logger!", "respond_to?", "restart_environment", "root", "root=", "root_path", "send", "share_as", "share_examples_for", "shared_examples_for", "should", "should_not", "singleton_methods", "start", "start_environment", "started", "started=", "started?", "taguri", "taguri=", "taint", "tainted?", "template_engine", "template_engine=", "test_framework", "test_framework=", "test_framework_generator_scope", "testing?", "to_a", "to_enum", "to_json", "to_s", "to_yaml", "to_yaml_properties", "to_yaml_style", "track_dependency", "trap", "try_dup", "type", "untaint", "use_orm", "use_template_engine", "use_test", "use_testing_framework", "yaml_as", "yaml_tag_class_name", "yaml_tag_read_class"]
扮仙女 2024-07-16 10:21:23

理论上,你的切片应该像宝石一样捆绑在一起。 因此,您可以直接从 gem 本身中提取依赖项

In theory your slice should be bundled up as a gem. As such, you can pull the dependencies out of the directly from the gem itself

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文