Skip to content

Commit ae193d8

Browse files
committed
Initial release
0 parents  commit ae193d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+3300
-0
lines changed

.bowerrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory" : "vendor/bower-asset"
3+
}

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# phpstorm project files
2+
.idea
3+
4+
# netbeans project files
5+
nbproject
6+
7+
# zend studio for eclipse project files
8+
.buildpath
9+
.project
10+
.settings
11+
12+
# windows thumbnail cache
13+
Thumbs.db
14+
15+
# composer vendor dir
16+
/vendor
17+
18+
# composer itself is not needed
19+
composer.phar
20+
21+
# Mac DS_Store Files
22+
.DS_Store
23+
24+
# phpunit itself is not needed
25+
phpunit.phar
26+
# local phpunit config
27+
/phpunit.xml
28+
29+
tests/_output/*
30+
tests/_support/_generated
31+
32+
#vagrant folder
33+
/.vagrant

LICENSE.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
The Yii framework is free software. It is released under the terms of
2+
the following BSD License.
3+
4+
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions
9+
are met:
10+
11+
* Redistributions of source code must retain the above copyright
12+
notice, this list of conditions and the following disclaimer.
13+
* Redistributions in binary form must reproduce the above copyright
14+
notice, this list of conditions and the following disclaimer in
15+
the documentation and/or other materials provided with the
16+
distribution.
17+
* Neither the name of Yii Software LLC nor the names of its
18+
contributors may be used to endorse or promote products derived
19+
from this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
POSSIBILITY OF SUCH DAMAGE.

Vagrantfile

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
require 'yaml'
2+
require 'fileutils'
3+
4+
required_plugins = %w( vagrant-hostmanager vagrant-vbguest )
5+
required_plugins.each do |plugin|
6+
exec "vagrant plugin install #{plugin}" unless Vagrant.has_plugin? plugin
7+
end
8+
9+
domains = {
10+
app: 'yii2basic.dev'
11+
}
12+
13+
vagrantfile_dir_path = File.dirname(__FILE__)
14+
15+
config = {
16+
local: vagrantfile_dir_path + '/vagrant/config/vagrant-local.yml',
17+
example: vagrantfile_dir_path + '/vagrant/config/vagrant-local.example.yml'
18+
}
19+
20+
# copy config from example if local config not exists
21+
FileUtils.cp config[:example], config[:local] unless File.exist?(config[:local])
22+
# read config
23+
options = YAML.load_file config[:local]
24+
25+
# check github token
26+
if options['github_token'].nil? || options['github_token'].to_s.length != 40
27+
puts "You must place REAL GitHub token into configuration:\n/yii2-app-basic/vagrant/config/vagrant-local.yml"
28+
exit
29+
end
30+
31+
# vagrant configurate
32+
Vagrant.configure(2) do |config|
33+
# select the box
34+
config.vm.box = 'bento/ubuntu-16.04'
35+
36+
# should we ask about box updates?
37+
config.vm.box_check_update = options['box_check_update']
38+
39+
config.vm.provider 'virtualbox' do |vb|
40+
# machine cpus count
41+
vb.cpus = options['cpus']
42+
# machine memory size
43+
vb.memory = options['memory']
44+
# machine name (for VirtualBox UI)
45+
vb.name = options['machine_name']
46+
end
47+
48+
# machine name (for vagrant console)
49+
config.vm.define options['machine_name']
50+
51+
# machine name (for guest machine console)
52+
config.vm.hostname = options['machine_name']
53+
54+
# network settings
55+
config.vm.network 'private_network', ip: options['ip']
56+
57+
# sync: folder 'yii2-app-advanced' (host machine) -> folder '/app' (guest machine)
58+
config.vm.synced_folder './', '/app', owner: 'vagrant', group: 'vagrant'
59+
60+
# disable folder '/vagrant' (guest machine)
61+
config.vm.synced_folder '.', '/vagrant', disabled: true
62+
63+
# hosts settings (host machine)
64+
config.vm.provision :hostmanager
65+
config.hostmanager.enabled = true
66+
config.hostmanager.manage_host = true
67+
config.hostmanager.ignore_private_ip = false
68+
config.hostmanager.include_offline = true
69+
config.hostmanager.aliases = domains.values
70+
71+
# quick fix for failed guest additions installations
72+
# config.vbguest.auto_update = false
73+
74+
# provisioners
75+
config.vm.provision 'shell', path: './vagrant/provision/once-as-root.sh', args: [options['timezone']]
76+
config.vm.provision 'shell', path: './vagrant/provision/once-as-vagrant.sh', args: [options['github_token']], privileged: false
77+
config.vm.provision 'shell', path: './vagrant/provision/always-as-root.sh', run: 'always'
78+
79+
# post-install message (vagrant console)
80+
config.vm.post_up_message = "App URL: http://#{domains[:app]}"
81+
end

assets/AppAsset.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* @link http://www.yiiframework.com/
4+
* @copyright Copyright (c) 2008 Yii Software LLC
5+
* @license http://www.yiiframework.com/license/
6+
*/
7+
8+
namespace app\assets;
9+
10+
use yii\web\AssetBundle;
11+
12+
/**
13+
* Main application asset bundle.
14+
*
15+
* @author Qiang Xue <[email protected]>
16+
* @since 2.0
17+
*/
18+
class AppAsset extends AssetBundle
19+
{
20+
public $basePath = '@webroot';
21+
public $baseUrl = '@web';
22+
public $css = [
23+
'css/site.css',
24+
];
25+
public $js = [
26+
];
27+
public $depends = [
28+
'yii\web\YiiAsset',
29+
'yii\bootstrap\BootstrapAsset',
30+
];
31+
}

codeception.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
actor: Tester
2+
paths:
3+
tests: tests
4+
log: tests/_output
5+
data: tests/_data
6+
helpers: tests/_support
7+
settings:
8+
bootstrap: _bootstrap.php
9+
memory_limit: 1024M
10+
colors: true
11+
modules:
12+
config:
13+
Yii2:
14+
configFile: 'config/test.php'
15+
cleanup: false
16+
17+
# To enable code coverage:
18+
#coverage:
19+
# #c3_url: http://localhost:8080/index-test.php/
20+
# enabled: true
21+
# #remote: true
22+
# #remote_config: '../codeception.yml'
23+
# whitelist:
24+
# include:
25+
# - models/*
26+
# - controllers/*
27+
# - commands/*
28+
# - mail/*
29+
# blacklist:
30+
# include:
31+
# - assets/*
32+
# - config/*
33+
# - runtime/*
34+
# - vendor/*
35+
# - views/*
36+
# - web/*
37+
# - tests/*

commands/HelloController.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* @link http://www.yiiframework.com/
4+
* @copyright Copyright (c) 2008 Yii Software LLC
5+
* @license http://www.yiiframework.com/license/
6+
*/
7+
8+
namespace app\commands;
9+
10+
use yii\console\Controller;
11+
use yii\console\ExitCode;
12+
13+
/**
14+
* This command echoes the first argument that you have entered.
15+
*
16+
* This command is provided as an example for you to learn how to create console commands.
17+
*
18+
* @author Qiang Xue <[email protected]>
19+
* @since 2.0
20+
*/
21+
class HelloController extends Controller
22+
{
23+
/**
24+
* This command echoes what you have entered as the message.
25+
* @param string $message the message to be echoed.
26+
* @return int Exit code
27+
*/
28+
public function actionIndex($message = 'hello world')
29+
{
30+
echo $message . "\n";
31+
32+
return ExitCode::OK;
33+
}
34+
}

composer.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"name": "yiisoft/yii2-app-basic",
3+
"description": "Yii 2 Basic Project Template",
4+
"keywords": ["yii2", "framework", "basic", "project template"],
5+
"homepage": "http://www.yiiframework.com/",
6+
"type": "project",
7+
"license": "BSD-3-Clause",
8+
"support": {
9+
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
10+
"forum": "http://www.yiiframework.com/forum/",
11+
"wiki": "http://www.yiiframework.com/wiki/",
12+
"irc": "irc://irc.freenode.net/yii",
13+
"source": "https://github.com/yiisoft/yii2"
14+
},
15+
"minimum-stability": "stable",
16+
"require": {
17+
"php": ">=7.0",
18+
"yiisoft/yii2": "~2.0.14",
19+
"yiisoft/yii2-bootstrap": "~2.0.0",
20+
"yiisoft/yii2-swiftmailer": "~2.0.0",
21+
"yiisoft/yii2-jui": "^2.0"
22+
},
23+
"require-dev": {
24+
"yiisoft/yii2-debug": "~2.0.0",
25+
"yiisoft/yii2-gii": "~2.0.0",
26+
"yiisoft/yii2-faker": "~2.0.0",
27+
28+
"codeception/base": "^2.2.3",
29+
"codeception/verify": "~0.3.1",
30+
"codeception/specify": "~0.4.3"
31+
},
32+
"config": {
33+
"process-timeout": 1800,
34+
"fxp-asset": {
35+
"enabled": false
36+
}
37+
},
38+
"scripts": {
39+
"post-install-cmd": [
40+
"yii\\composer\\Installer::postInstall"
41+
],
42+
"post-create-project-cmd": [
43+
"yii\\composer\\Installer::postCreateProject",
44+
"yii\\composer\\Installer::postInstall"
45+
]
46+
},
47+
"extra": {
48+
"yii\\composer\\Installer::postCreateProject": {
49+
"setPermission": [
50+
{
51+
"runtime": "0777",
52+
"web/assets": "0777",
53+
"yii": "0755"
54+
}
55+
]
56+
},
57+
"yii\\composer\\Installer::postInstall": {
58+
"generateCookieValidationKey": [
59+
"config/web.php"
60+
]
61+
}
62+
},
63+
"repositories": [
64+
{
65+
"type": "composer",
66+
"url": "https://asset-packagist.org"
67+
}
68+
]
69+
}

config/console.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
$params = require __DIR__ . '/params.php';
4+
$db = require __DIR__ . '/db.php';
5+
6+
$config = [
7+
'id' => 'basic-console',
8+
'basePath' => dirname(__DIR__),
9+
'bootstrap' => ['log'],
10+
'controllerNamespace' => 'app\commands',
11+
'aliases' => [
12+
'@bower' => '@vendor/bower-asset',
13+
'@npm' => '@vendor/npm-asset',
14+
],
15+
'components' => [
16+
'cache' => [
17+
'class' => 'yii\caching\FileCache',
18+
],
19+
'log' => [
20+
'targets' => [
21+
[
22+
'class' => 'yii\log\FileTarget',
23+
'levels' => ['error', 'warning'],
24+
],
25+
],
26+
],
27+
'db' => $db,
28+
],
29+
'params' => $params,
30+
/*
31+
'controllerMap' => [
32+
'fixture' => [ // Fixture generation command line.
33+
'class' => 'yii\faker\FixtureController',
34+
],
35+
],
36+
*/
37+
];
38+
39+
if (YII_ENV_DEV) {
40+
// configuration adjustments for 'dev' environment
41+
$config['bootstrap'][] = 'gii';
42+
$config['modules']['gii'] = [
43+
'class' => 'yii\gii\Module',
44+
];
45+
}
46+
47+
return $config;

config/db.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
return [
4+
'class' => 'yii\db\Connection',
5+
'dsn' => 'mysql:host=localhost;dbname=rutas',
6+
'username' => 'root',
7+
'password' => 'Mauc',
8+
'charset' => 'utf8',
9+
10+
// Schema cache options (for production environment)
11+
//'enableSchemaCache' => true,
12+
//'schemaCacheDuration' => 60,
13+
//'schemaCache' => 'cache',
14+
];

config/params.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
return [
4+
'adminEmail' => '[email protected]',
5+
];

0 commit comments

Comments
 (0)