https://github.com/eightygrit/deploy-laravel/blob/master/deploy-laravel.z.sh
https://github.com/onigoetz/deployer
https://gist.github.com/purwandi/4110547
https://gist.github.com/chipotle/5506641
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
export PATH=/Applications/MAMP/bin/php/php5.3.6/bin/:$PATH
curl -ksS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer create-project laravel/laravel appname
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"require": {
"laravel/framework": "4.0.*",
"way/generators": "dev-master",
"zurb/foundation": "dev-master",
"zurb/foundation": "dev-master",
"conarwelsh/mustache-l4": "dev-master",
},
"require-dev":{
"phpunit/phpunit": "3.7.*",
"mockery/mockery": "0.7.*"
},
"autoload": {
"classmap": [
https://github.com/conarwelsh/mustache-l4
composer update
...
'Way\Generators\GeneratorsServiceProvider',
'Conarwelsh\MustacheL4\MustacheL4ServiceProvider',
...
hostname
$env = $app->detectEnvironment(array(
'local' => array('your-machine-name'),
));
chmod -R 777 app/storage/
Use 127.0.0.1 for locahost if possible
'paths' => array(__DIR__.'/../../public/views'),
{
"name": "laravel4-and-foundation",
"version": "0.0.1",
"private": true,
"dependencies": {
"foundation": "*",
"mustache": "*"
}
}
cd public
npm install
cd ..
mkdir public/views public/views/layouts public/js public/css
https://github.com/zurb/foundation/tree/scss-standalone
sudo chmod -R 755 vendor/way/generators/src/Way/
php artisan generate:resource webpage --fields="url:string"
//create a group of routes that will belong to APIv1
Route::group(array('prefix' => 'v1'), function()
{
//... insert API routes here...
Route::resource('webpages', 'V1\WebpagesController'); //notice the namespace
});
mkdir app/controllers/V1
mv app/controllers/WebpagesController.php app/controllers/V1/
<?php
//use our new namespace
namespace V1;
//import classes that are not in this new namespace
use BaseController;
class WebpagesController extends BaseController {
mkdir app/repositories
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php",
"app/repositories"
]
},
<?php
class WebpagesTableSeeder extends Seeder {
public function run()
{
// Uncomment the below to wipe the table clean before populating
DB::table('webpages')->truncate();
$webpages = array(
array(
'url' => 'http://wayne.edu/',
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
),
array(
'url' => 'http://wayne.edu/about/',
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
),
);
// Uncomment the below to run the seeder
DB::table('webpages')->insert($webpages);
}
}
composer dump-autoload
php artisan migrate --seed
vendor/phpunit/phpunit/phpunit.php
rm app/tests/ExampleTest.php
mkdir app/tests/controllers app/tests/repositories
Note: in TDD, the objective is to do no more work than is required to make your tests pass. So we want to do the absolute bare minimum here.
touch app/errors.php
cp -R vendor/zurb/foundation/scss public/
cp -R vendor/zurb/foundation/js/ public/js/
mv app/views/webpages public/views/
sudo gem install capistrano
capify .
cap deploy:setup
cap deploy:check
cap deploy
# This makes a few assumptions:
#
# - You are using a similar .gitignore to Laravel's default, so your
# vendor directory and composer(.phar) are not under version control
# - Composer is installed as an executable at /usr/local/bin/composer
#
# If you don't have Composer installed globally, you can modify the
# appropriate task (:composer_install). Or make your life simpler and
# install Composer globally.
# Fill in application-specific configuration options below
set :application, "Laravel 4 Testing Roll"
set :repository, "git@github.com:nickdenardis/laravel-test.git"
set :scm, :git
set :scm_username, "nickdenardis"
set :user, "user"
role :web, "server"
role :app, "server"
role :db, "server", :primary => true
set :deploy_to, "/usr/local/www/sites/base/"
set :deploy_via, :remote_cache
set :use_sudo, false # I don't need sudo, but you might
set :ssh_options, {:forward_agent => true}
set :copy_exclude, [".git", ".gitignore", ".tags", ".tags_sorted_by_file"]
set :keep_releases, 5
# Laravel deployment
namespace :deploy do
task :update do
transaction do
update_code
copy_config
composer_install
link_shared
laravel_migrate
symlink
end
end
task :finalize_update do
transaction do
# No need to change ownership
#run "chmod -R g+w #{releases_path}/#{release_name}"
end
end
task :symlink do
transaction do
run "ln -nfs #{current_release} #{deploy_to}/#{current_dir}"
end
end
task :link_shared do
transaction do
run "ln -nfs #{shared_path}/system #{current_release}/public/system"
end
end
task :laravel_migrate do
transaction do
run "php #{current_release}/artisan migrate"
end
end
task :laravel_rollback do
run "php #{deploy_to}/#{current_dir}/artisan migrate:rollback"
end
task :restart do
transaction do
# set writable storage dir
run "mydir=\"#{deploy_to}/#{current_dir}/app/storage\";if [ -d $mydir/cache ]; then chmod -R 777 $mydir/cache; rm -f $mydir/cache/*; fi"
run "mydir=\"#{deploy_to}/#{current_dir}/app/storage\";if [ -d $mydir/database ]; then chmod -R 777 $mydir/database; fi"
run "mydir=\"#{deploy_to}/#{current_dir}/app/storage\";if [ -d $mydir/meta ]; then chmod -R 777 $mydir/meta; fi"
run "mydir=\"#{deploy_to}/#{current_dir}/app/storage\";if [ -d $mydir/logs ]; then chmod -R 777 $mydir/logs; fi"
run "mydir=\"#{deploy_to}/#{current_dir}/app/storage\";if [ -d $mydir/sessions ]; then chmod -R 777 $mydir/sessions; fi"
run "mydir=\"#{deploy_to}/#{current_dir}/app/storage\";if [ -d $mydir/views ]; then chmod -R 777 $mydir/views; rm -f $mydir/views/*; fi"
run "mydir=\"#{deploy_to}/#{current_dir}/app/storage\";if [ -d $mydir/work ]; then chmod -R 777 $mydir/work; fi"
end
end
task :composer_install do
transaction do
run "cd #{current_release};/usr/local/bin/composer install"
end
end
# This task lets you keep server-specific configuration files in "shared/config/".
# Any file there will just be copied to your app/config directory.
task :copy_config do
transaction do
#run "cp #{shared_path}/config/* #{current_release}/app/config/"
end
end
end
after "deploy:rollback", "deploy:laravel_rollback"
https://help.github.com/articles/deploying-with-capistrano https://github.com/capistrano/capistrano/wiki/2.x-from-the-beginning http://guides.beanstalkapp.com/deployments/deploy-with-capistrano.html https://github.com/stefanooldeman/capistrano-handbook/wiki/Anatomy-of-a-capistrano-installation http://ryanflorence.com/deploying-with-capistrano-without-rails/