forked from studioespresso/craft3-seeder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c061938
commit 9198d9a
Showing
20 changed files
with
785 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"pluginName":"Seeder","pluginDescription":"Easy entries seeder for Craft CMS","pluginVersion":"1.0.0","pluginAuthorName":"Studio Espresso","pluginVendorName":"","pluginAuthorUrl":"https://www.studioepsresso.co","pluginAuthorGithub":"studioespresso","codeComments":"yes","pluginComponents":"","consolecommandName":"","controllerName":"","cpsectionName":"","elementName":"","fieldName":"","modelName":"","purchasableName":"","recordName":"","serviceName":"","taskName":"","utilityName":"","widgetName":"","apiVersion":"api_version_3_0"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Seeder Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## 1.0.0 - 2018-03-21 | ||
### Added | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 Studio Espresso | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Seeder plugin for Craft CMS 3.x | ||
|
||
Easy entries seeder for Craft CMS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "studioespresso/craft-seeder", | ||
"description": "Easy entries seeder for Craft CMS", | ||
"type": "craft-plugin", | ||
"version": "1.0.0", | ||
"keywords": [ | ||
"craft", | ||
"cms", | ||
"craftcms", | ||
"craft-plugin", | ||
"seeder" | ||
], | ||
"support": { | ||
"docs": "https://github.com/studioespresso/seeder/blob/master/README.md", | ||
"issues": "https://github.com/studioespresso/seeder/issues" | ||
}, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Studio Espresso", | ||
"homepage": "https://www.studioepsresso.co" | ||
} | ||
], | ||
"require": { | ||
"craftcms/cms": "^3.0.0-RC1", | ||
"fzaninotto/faker": "^1.7.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"studioespresso\\seeder\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"name": "Seeder", | ||
"handle": "seeder", | ||
"hasCpSettings": false, | ||
"hasCpSection": false, | ||
"components": { | ||
"entries": "studioespresso\\seeder\\services\\Entries", | ||
"fields": "studioespresso\\seeder\\services\\Fields" | ||
}, | ||
"changelogUrl": "https://raw.githubusercontent.com/studioespresso/seeder/master/CHANGELOG.md", | ||
"class": "studioespresso\\seeder\\Seeder" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?php | ||
/** | ||
* Seeder plugin for Craft CMS 3.x | ||
* | ||
* Entries seeder for Craft CMS | ||
* | ||
* @link https://studioespresso.co | ||
* @copyright Copyright (c) 2018 Studio Espresso | ||
*/ | ||
|
||
namespace studioespresso\seeder; | ||
|
||
use studioespresso\seeder\models\Settings; | ||
use studioespresso\seeder\services\Entries as EntriesService; | ||
use studioespresso\seeder\services\Fields as FieldsService; | ||
|
||
use Craft; | ||
use craft\base\Plugin; | ||
use craft\services\Plugins; | ||
use craft\events\PluginEvent; | ||
use craft\console\Application as ConsoleApplication; | ||
use craft\web\UrlManager; | ||
use craft\events\RegisterUrlRulesEvent; | ||
|
||
use yii\base\Event; | ||
|
||
/** | ||
* Craft plugins are very much like little applications in and of themselves. We’ve made | ||
* it as simple as we can, but the training wheels are off. A little prior knowledge is | ||
* going to be required to write a plugin. | ||
* | ||
* For the purposes of the plugin docs, we’re going to assume that you know PHP and SQL, | ||
* as well as some semi-advanced concepts like object-oriented programming and PHP namespaces. | ||
* | ||
* https://craftcms.com/docs/plugins/introduction | ||
* | ||
* @author Studio Espresso | ||
* @package Seeder | ||
* @since 1.0.0 | ||
* @property EntriesService entries | ||
* @property FieldsService fields | ||
* @property Settings $settings | ||
* @method Settings getSettings() | ||
*/ | ||
class Seeder extends Plugin | ||
{ | ||
// Static Properties | ||
// ========================================================================= | ||
|
||
/** | ||
* Static property that is an instance of this plugin class so that it can be accessed via | ||
* Seeder::$plugin | ||
* | ||
* @var Seeder | ||
*/ | ||
public static $plugin; | ||
|
||
// Public Properties | ||
// ========================================================================= | ||
|
||
/** | ||
* To execute your plugin’s migrations, you’ll need to increase its schema version. | ||
* | ||
* @var string | ||
*/ | ||
public $schemaVersion = '1.0.0'; | ||
|
||
// Public Methods | ||
// ========================================================================= | ||
|
||
public function init() { | ||
parent::init(); | ||
self::$plugin = $this; | ||
|
||
// Add in our console commands | ||
if ( Craft::$app instanceof ConsoleApplication ) { | ||
$this->controllerNamespace = 'studioespresso\seeder\console\controllers'; | ||
} | ||
} | ||
|
||
// Protected Methods | ||
// ========================================================================= | ||
|
||
/** | ||
* Creates and returns the model used to store the plugin’s settings. | ||
* | ||
* @return \craft\base\Model|null | ||
*/ | ||
protected function createSettingsModel() | ||
{ | ||
return new Settings(); | ||
} | ||
|
||
/** | ||
* Returns the rendered settings HTML, which will be inserted into the content | ||
* block on the settings page. | ||
* | ||
* @return string The rendered settings HTML | ||
*/ | ||
protected function settingsHtml(): string | ||
{ | ||
return Craft::$app->view->renderTemplate( | ||
'seeder/settings', | ||
[ | ||
'settings' => $this->getSettings() | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
/** | ||
* Seeder plugin for Craft CMS 3.x | ||
* | ||
* Entries seeder for Craft CMS | ||
* | ||
* @link https://studioespresso.co | ||
* @copyright Copyright (c) 2018 Studio Espresso | ||
*/ | ||
|
||
namespace studioespresso\seeder\assetbundles\Seeder; | ||
|
||
use Craft; | ||
use craft\web\AssetBundle; | ||
use craft\web\assets\cp\CpAsset; | ||
|
||
/** | ||
* SeederAsset AssetBundle | ||
* | ||
* AssetBundle represents a collection of asset files, such as CSS, JS, images. | ||
* | ||
* Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application. | ||
* The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php) | ||
* of the class representing it. | ||
* | ||
* An asset bundle can depend on other asset bundles. When registering an asset bundle | ||
* with a view, all its dependent asset bundles will be automatically registered. | ||
* | ||
* http://www.yiiframework.com/doc-2.0/guide-structure-assets.html | ||
* | ||
* @author Studio Espresso | ||
* @package Seeder | ||
* @since 1.0.0 | ||
*/ | ||
class SeederAsset extends AssetBundle | ||
{ | ||
// Public Methods | ||
// ========================================================================= | ||
|
||
/** | ||
* Initializes the bundle. | ||
*/ | ||
public function init() | ||
{ | ||
// define the path that your publishable resources live | ||
$this->sourcePath = "@studioespresso/seeder/assetbundles/seeder/dist"; | ||
|
||
// define the dependencies | ||
$this->depends = [ | ||
CpAsset::class, | ||
]; | ||
|
||
// define the relative path to CSS/JS files that should be registered with the page | ||
// when this asset bundle is registered | ||
$this->js = [ | ||
'js/Seeder.js', | ||
]; | ||
|
||
$this->css = [ | ||
'css/Seeder.css', | ||
]; | ||
|
||
parent::init(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Seeder plugin for Craft CMS | ||
* | ||
* Seeder CSS | ||
* | ||
* @author Studio Espresso | ||
* @copyright Copyright (c) 2018 Studio Espresso | ||
* @link https://studioespresso.co | ||
* @package Seeder | ||
* @since 1.0.0 | ||
*/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Seeder plugin for Craft CMS | ||
* | ||
* Seeder JS | ||
* | ||
* @author Studio Espresso | ||
* @copyright Copyright (c) 2018 Studio Espresso | ||
* @link https://studioespresso.co | ||
* @package Seeder | ||
* @since 1.0.0 | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* Seeder plugin for Craft CMS 3.x | ||
* | ||
* Entries seeder for Craft CMS | ||
* | ||
* @link https://studioespresso.co | ||
* @copyright Copyright (c) 2018 Studio Espresso | ||
*/ | ||
|
||
/** | ||
* Seeder config.php | ||
* | ||
* This file exists only as a template for the Seeder settings. | ||
* It does nothing on its own. | ||
* | ||
* Don't edit this file, instead copy it to 'craft/config' as 'seeder.php' | ||
* and make your changes there to override default settings. | ||
* | ||
* Once copied to 'craft/config', this file will be multi-environment aware as | ||
* well, so you can have different settings groups for each environment, just as | ||
* you do for 'general.php' | ||
*/ | ||
|
||
return [ | ||
|
||
// This controls blah blah blah | ||
"someAttribute" => true, | ||
|
||
]; |
Oops, something went wrong.