diff --git a/src/components/Git.php b/src/components/Git.php index 7e8bb9a..6c73008 100644 --- a/src/components/Git.php +++ b/src/components/Git.php @@ -32,19 +32,14 @@ class Git if (strpos($endpoint, 'github.com')) { return self::getGitHubComUrl($endpoint, $file); } - if (strpos($endpoint, 'bitbucket.org')) { - return self::getBitBucketOrgUrl($endpoint, $file); - } - if (strpos($endpoint, 'notabug.org')) { - return self::getBitBucketOrgUrl($endpoint, $file); - } - if (strpos($endpoint, 'gitlab.com')) { - return self::getBitBucketOrgUrl($endpoint, $file); - } if (strpos($endpoint, 'repo.or.cz')) { return self::getRepoOrCzUrl($endpoint, $file); } - return false; + return strtr($endpoint, [ + 'http://' => 'https://', + 'git://' => 'https://', + '.git' => $file ? '/raw/master/' . $file : '/', + ]); } /** @@ -62,20 +57,6 @@ class Git ]); } - /** - * @param $endpoint - * @param $file - * @return string - */ - private static function getBitBucketOrgUrl($endpoint, $file) - { - return strtr($endpoint, [ - 'http://' => 'https://', - 'git://' => 'https://', - '.git' => $file ? '/raw/master/' . $file : '/', - ]); - } - /** * @param $endpoint * @param $file diff --git a/src/config/main.php b/src/config/main.php index 45d67de..93292e9 100644 --- a/src/config/main.php +++ b/src/config/main.php @@ -30,6 +30,7 @@ $web = [ 'packages/' => 'package/view', 'packages' => 'package/index', // mods + 'submit' => 'mod/create', 'mods/update/' => 'mod/update', 'mods/' => 'mod/view', 'mods' => 'mod/index', diff --git a/src/controllers/DocsController.php b/src/controllers/DocsController.php index 05f4576..730453a 100644 --- a/src/controllers/DocsController.php +++ b/src/controllers/DocsController.php @@ -13,9 +13,9 @@ class DocsController extends Controller return $this->render('index'); } - public function actionBowerJsonFormat() + public function actionBowerFormat() { - return $this->render('bower-json-format'); + return $this->render('bower-format'); } } diff --git a/src/views/docs/bower-json-format.php b/src/views/docs/bower-format.php similarity index 84% rename from src/views/docs/bower-json-format.php rename to src/views/docs/bower-format.php index 0019255..befdff5 100644 --- a/src/views/docs/bower-json-format.php +++ b/src/views/docs/bower-format.php @@ -2,10 +2,15 @@ /* @var $this yii\web\View */ -$this->title = 'Minetest bower.json specification'; -?> -
+use yii\helpers\Html; +$this->title = 'bower.json Format'; +$this->params['breadcrumbs'][] = ['label' => 'Docs', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

Example bower.json

@@ -138,9 +143,15 @@ $this->title = 'Minetest bower.json specification';
  • Key must be a valid name.
  • -
  • Value must be a valid semver range, a Git URL, or a URL (inc. tarball and zipball).
  • -
  • Git URLs can be restricted to a reference (revision SHA, branch, or tag) by appending it after a hash, e.g. https://github.com/owner/package.git#branch.
  • -
  • Value can be an owner/package shorthand, i.e. owner/package. By default, the shorthand resolves to GitHub -> git://github.com/{{owner}}/{{package}}.git. This may be changed in .bowerrc shorthand_resolver.
  • +
  • Value must be a valid + semver range, a Git URL, or a URL (inc. tarball and zipball). +
  • +
  • Git URLs can be restricted to a reference (revision SHA, branch, or tag) by appending it after a hash, e.g. + https://github.com/owner/package.git#branch. +
  • +
  • Value can be an owner/package shorthand, i.e. owner/package. By default, the shorthand resolves to GitHub -> git://github.com/{{owner}}/{{package}}.git. This may be changed in + .bowerrc shorthand_resolver. +
  • Local paths may be used as values for local development, but they will be disallowed when registering.
diff --git a/src/views/docs/index.php b/src/views/docs/index.php new file mode 100644 index 0000000..755c808 --- /dev/null +++ b/src/views/docs/index.php @@ -0,0 +1,23 @@ +title = 'Documentation'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + [ + ['label' => 'bower.json Format', 'url' => ['/docs/bower-format']], + ], + ]); + ?> + +
diff --git a/src/views/layouts/main.php b/src/views/layouts/main.php index 97900fb..32f3a4b 100644 --- a/src/views/layouts/main.php +++ b/src/views/layouts/main.php @@ -39,6 +39,7 @@ echo Nav::widget([ //['label' => 'Home', 'url' => ['/site/index']], ['label' => 'Browse', 'url' => ['/mod/index']], ['label' => 'Submit', 'url' => ['/mod/create']], + ['label' => 'Docs', 'url' => ['/docs/index']], ], ]); echo Nav::widget([ diff --git a/src/views/mod/create.php b/src/views/mod/create.php index d14b7aa..616f162 100644 --- a/src/views/mod/create.php +++ b/src/views/mod/create.php @@ -6,7 +6,7 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model app\models\Package */ -$this->title = 'Create Package'; +$this->title = 'Submit Mod'; $this->params['breadcrumbs'][] = ['label' => 'Mods', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> diff --git a/src/views/mod/update.php b/src/views/mod/update.php deleted file mode 100644 index 9a9d0c7..0000000 --- a/src/views/mod/update.php +++ /dev/null @@ -1,21 +0,0 @@ -title = 'Update Package: ' . ' ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Packages', 'url' => ['index']]; -$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update'; -?> -
- -

title) ?>

- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/src/views/site/index.php b/src/views/site/index.php index 74c5227..c1a3c06 100644 --- a/src/views/site/index.php +++ b/src/views/site/index.php @@ -32,25 +32,25 @@ $this->params['jumbotron'] = '/site/_index-jumbotron'; }
-

Install Packages

+

Install Mods

-

Install packages with bower install.

-
$ bower install <package>
+

Install mods with bower install.

+
$ bower install <mod>
-

Create Packages

+

Create Mods

-

Create packages with +

Create mods with bower register or .

$ bower register <my_mod_name> <git_endpoint>
 
 # for example
 $ bower register example https://github.com/user/example.git
-

Package Information

+

Mod Information

-

Package information is collected from a bower.json file in the repository

+

Mod information is collected from a bower.json file in the repository

-

'btn btn-sm btn-default']); ?>

+

'btn btn-sm btn-default']); ?>