axyr/silverstripe-modulefolder

在'modules'文件夹中安装模块而不是在根目录下

安装: 53

依赖者: 0

建议者: 0

安全: 0

星标: 3

关注者: 3

分支: 2

公开问题: 4

类型:silverstripe-module

dev-master 2014-10-25 23:16 UTC

This package is not auto-updated.

Last update: 2024-09-24 01:00:25 UTC


README

在'modules'文件夹中安装模块而不是在根目录下。

这实际上不是一个模块,而是一个概念证明。

它可能会破坏某些东西,但初次尝试似乎工作得很好。

我使用一些模块测试了silverstripe安装程序,并成功通过了构建

https://travis-ci.org/axyr/silverstripe-installer

https://github.com/axyr/silverstripe-installer

  • axyr/silverstripe-adminlogin
  • ajshort/silverstripe-gridfieldextensions
  • unclecheese/display-logic

请帮助我用您自己的模块测试这个功能! :)

据我所知,唯一需要改变的是在Requirements::path_for_file中添加一个额外路径的检查。为了在不接触核心代码的情况下测试,有一个ModuleRequirements_Backend也会在MODULES_DIR中搜索需求。

if(!Director::fileExists($fileOrUrl)) {
  $fileOrUrl = MODULES_DIR . '/' . $fileOrUrl;
}

##Composer

使用Composer,您可以设置自定义的silverstripe-module类型安装路径。为了将cms和框架文件夹留在根目录下,您也可以强制这样做。

示例

{
	"name": "silverstripe/installer",
	"description": "The SilverStripe Framework Installer",
	"require": {
		"php": ">=5.3.2",
		"silverstripe/cms": "3.1.2",
		"silverstripe/framework": "3.1.2",
		"silverstripe-themes/simple": "*",
		"axyr/silverstripe-modulefolder": "*",
		"axyr/silverstripe-adminlogin": "*"
	},
	"config": {
		"process-timeout": 600	
	},
	"minimum-stability": "dev",
	"extra": {
		 "installer-paths": {
			"cms/": ["silverstripe/cms"],
			"framework/": ["silverstripe/framework"],
			"modules/": ["axyr/silverstripe-modulefolder"],
			"modules/{$name}/": ["type:silverstripe-module"]
		}
	}
}

这仍然会导致在模块文件夹中靠近其他模块的地方有一个代码文件夹,但我们现在无法避免这一点。

##背景

我喜欢让第三方模块存在于它们自己的文件夹中,并将我的自定义应用程序代码保存在mysite或甚至是一个包含自定义代码的第二个文件夹中。

现在我们有了Composer,我安装了更多模块,有时这些模块提供的功能很少,但非常有用。我不想让所有这些小的'插件'都放在我的根目录下。

我不想再次引发关于我们是否需要这个或当前'所有代码都在根目录下'的方法是否有问题的讨论

在Silverstripe 2.x时代,Google开发者组有一个长期的辩论

https://groups.google.com/forum/#!msg/silverstripe-dev/6qdRkCDliEg/A3mH9kFhG6MJ

https://groups.google.com/forum/#!topic/silverstripe-dev/on1_ABPDNTc

现在,我只是想知道这个功能是否真的能工作!