Upgraded to laravel 4.1 and working on app engine support

This commit is contained in:
Hillel Coren 2014-01-04 23:31:37 +02:00
parent df95dc213d
commit ac50e86eef
23 changed files with 226 additions and 41 deletions

2
.gitignore vendored
View File

@ -9,3 +9,5 @@ composer.phar
composer.lock composer.lock
.DS_Store .DS_Store
Thumbs.db Thumbs.db
app.yaml
database.sql

View File

@ -1,19 +1,18 @@
# Invoice Ninja # Invoice Ninja
## Simple, Intuitive Invoicing ## Simple, Intuitive Invoicing
### Live demo: [http://sketch-out.com/ninja/public/](http://sketch-out.com/ninja/public/) ### Live demo: [http://invoice-ninja.appspot.com](http://invoice-ninja.appspot.com/)
### Introduction ### Introduction
Most online invoicing sites are expensive. They shouldn't be. The aim of this project is to provide a free, open-source alternative. Additionally, the hope is this codebase will serve as a sample site for Laravel as well as other JavaScript technologies. Most online invoicing sites are expensive. They shouldn't be. The aim of this project is to provide a free, open-source alternative. Additionally, the hope is this codebase will serve as a sample site for Laravel as well as other JavaScript technologies.
### Features ### Features
* Core application built using Laravel 4 * Core application built using Laravel 4.1
* Invoice PDF generation directly in the browser * Invoice PDF generation directly in the browser
* Integrates with many payment providers * Integrates with many payment providers
* Recurring invoices
### Remaining Work ### Remaining Work
* Recurring invoices
* Internationalization
* Home dashboard * Home dashboard
* Reports * Reports

View File

@ -113,6 +113,7 @@ return array(
'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider', 'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider', 'Illuminate\Workbench\WorkbenchServiceProvider',
'Illuminate\Remote\RemoteServiceProvider',
'Basset\BassetServiceProvider', 'Basset\BassetServiceProvider',
'Bootstrapper\BootstrapperServiceProvider', 'Bootstrapper\BootstrapperServiceProvider',
'Zizaco\Confide\ConfideServiceProvider', 'Zizaco\Confide\ConfideServiceProvider',
@ -134,7 +135,7 @@ return array(
| |
*/ */
'manifest' => storage_path().'/meta', 'manifest' => storage_path() . '/meta',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -156,7 +157,7 @@ return array(
'Cache' => 'Illuminate\Support\Facades\Cache', 'Cache' => 'Illuminate\Support\Facades\Cache',
'ClassLoader' => 'Illuminate\Support\ClassLoader', 'ClassLoader' => 'Illuminate\Support\ClassLoader',
'Config' => 'Illuminate\Support\Facades\Config', 'Config' => 'Illuminate\Support\Facades\Config',
'Controller' => 'Illuminate\Routing\Controllers\Controller', 'Controller' => 'Illuminate\Routing\Controller',
'Cookie' => 'Illuminate\Support\Facades\Cookie', 'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt', 'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB', 'DB' => 'Illuminate\Support\Facades\DB',
@ -185,6 +186,7 @@ return array(
'URL' => 'Illuminate\Support\Facades\URL', 'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator', 'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View', 'View' => 'Illuminate\Support\Facades\View',
'SSH' => 'Illuminate\Support\Facades\SSH',
'Basset' => 'Basset\Facade', 'Basset' => 'Basset\Facade',
'Alert' => 'Bootstrapper\Alert', 'Alert' => 'Bootstrapper\Alert',
'Badge' => 'Bootstrapper\Badge', 'Badge' => 'Bootstrapper\Badge',

View File

@ -62,7 +62,7 @@ return array(
'collation' => 'utf8_unicode_ci', 'collation' => 'utf8_unicode_ci',
'prefix' => '', 'prefix' => '',
), ),
'pgsql' => array( 'pgsql' => array(
'driver' => 'pgsql', 'driver' => 'pgsql',
'host' => 'localhost', 'host' => 'localhost',
@ -111,7 +111,7 @@ return array(
'redis' => array( 'redis' => array(
'cluster' => true, 'cluster' => false,
'default' => array( 'default' => array(
'host' => '127.0.0.1', 'host' => '127.0.0.1',

View File

@ -0,0 +1,18 @@
<?php
return array(
'connections' => array(
'mysql' => array(
'driver' => 'mysql',
'host' => getenv('DEVELOPMENT_DB_HOST'),
'database' => getenv('DEVELOPMENT_DB_NAME'),
'username' => getenv('DEVELOPMENT_DB_USERNAME'),
'password' => getenv('DEVELOPMENT_DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
),
);

View File

@ -0,0 +1,9 @@
<?php
return array(
'debug' => true,
'manifest' => 'gs://invoice-ninja/meta',
);

View File

@ -0,0 +1,7 @@
<?php
return array(
'driver' => 'memcached',
);

View File

@ -0,0 +1,19 @@
<?php
return array(
'connections' => array(
'mysql' => array(
'driver' => 'mysql',
'unix_socket' => getenv('PRODUCTION_CLOUD_SQL_INSTANCE'),
'host' => '',
'database' => getenv('PRODUCTION_DB_NAME'),
'username' => getenv('PRODUCTION_DB_USERNAME'),
'password' => getenv('PRODUCTION_DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
),
);

View File

@ -0,0 +1,7 @@
<?php
return array(
'driver' => 'memcached',
);

View File

@ -57,4 +57,22 @@ return array(
), ),
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => array(
'database' => 'mysql', 'table' => 'failed_jobs',
),
); );

59
app/config/remote.php Executable file
View File

@ -0,0 +1,59 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Default Remote Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify the default connection that will be used for SSH
| operations. This name should correspond to a connection name below
| in the server list. Each connection will be manually accessible.
|
*/
'default' => 'production',
/*
|--------------------------------------------------------------------------
| Remote Server Connections
|--------------------------------------------------------------------------
|
| These are the servers that will be accessible via the SSH task runner
| facilities of Laravel. This feature radically simplifies executing
| tasks on your servers, such as deploying out these applications.
|
*/
'connections' => array(
'production' => array(
'host' => '',
'username' => '',
'password' => '',
'key' => '',
'keyphrase' => '',
'root' => '/var/www',
),
),
/*
|--------------------------------------------------------------------------
| Remote Server Groups
|--------------------------------------------------------------------------
|
| Here you may list connections under a single group name, which allows
| you to easily access all of the servers at once using a short name
| that is extremely easy to remember, such as "web" or "database".
|
*/
'groups' => array(
'web' => array('production')
),
);

View File

@ -31,6 +31,8 @@ return array(
'lifetime' => 120, 'lifetime' => 120,
'expire_on_close' => false,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Session File Location | Session File Location
@ -122,4 +124,18 @@ return array(
'domain' => null, 'domain' => null,
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => false,
); );

View File

@ -26,6 +26,6 @@ return array(
| |
*/ */
'pagination' => 'pagination::slider', 'pagination' => 'pagination::bootstrap3',
); );

View File

@ -498,7 +498,7 @@ class ConfideSetupUsersTable extends Migration {
$t->decimal('adjustment', 13, 4); $t->decimal('adjustment', 13, 4);
$t->decimal('balance', 13, 4); $t->decimal('balance', 13, 4);
$t->foreign('account_id')->references('id')->on('accounts'); $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade'); $t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
$t->foreign('currency_id')->references('id')->on('currencies'); $t->foreign('currency_id')->references('id')->on('currencies');
}); });

View File

@ -13,10 +13,12 @@ return array(
| |
*/ */
"password" => "Passwords must be six characters and match the confirmation.", "password" => "Passwords must be at least six characters and match the confirmation.",
"user" => "We can't find a user with that e-mail address.", "user" => "We can't find a user with that e-mail address.",
"token" => "This password reset token is invalid.", "token" => "This password reset token is invalid.",
"sent" => "Password reminder sent!",
); );

View File

@ -16,11 +16,9 @@
//dd(new DateTime()); //dd(new DateTime());
//Event::fire('user.signup'); //Event::fire('user.signup');
//dd(App::environment()); //dd(App::environment());
//dd(gethostname());
include_once(app_path().'/libraries/utils.php'); // TODO_FIX
include_once(app_path().'/handlers/UserEventHandler.php'); // TODO_FIX
// TODO_FIX replace with cron // TODO_FIX replace with cron
Route::get('/send_emails', function() { Route::get('/send_emails', function() {
Artisan::call('ninja:send-invoices'); Artisan::call('ninja:send-invoices');

View File

@ -33,9 +33,12 @@ ClassLoader::addDirectories(array(
| |
*/ */
$logFile = 'log-'.php_sapi_name().'.txt'; //$logFile = 'log-'.php_sapi_name().'.txt';
//Log::useDailyFiles(storage_path().'/logs/'.$logFile);
Log::useDailyFiles(storage_path().'/logs/'.$logFile); use Monolog\Logger;
$monolog = Log::getMonolog();
$monolog->pushHandler(new Monolog\Handler\SyslogHandler('intranet', 'user', Logger::DEBUG, false, LOG_PID));
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -29,8 +29,6 @@ require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/start.php'; $app = require_once __DIR__.'/bootstrap/start.php';
$app->boot();
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Load The Artisan Console Application | Load The Artisan Console Application
@ -43,6 +41,8 @@ $app->boot();
| |
*/ */
$app->setRequestForConsoleEnvironment();
$artisan = Illuminate\Console\Application::start($app); $artisan = Illuminate\Console\Application::start($app);
/* /*

View File

@ -52,6 +52,6 @@ return array(
| |
*/ */
'storage' => __DIR__.'/../app/storage', 'storage' => (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false) ? "gs://invoice-ninja/storage" : __DIR__.'/../app/storage',
); );

View File

@ -1,5 +1,39 @@
<?php <?php
/*
require_once 'google/appengine/api/app_identity/AppIdentityService.php';
use \google\appengine\api\app_identity\AppIdentityService;
// Define the gethostname function if it does not exist
if (!function_exists('gethostname')) {
function gethostname() {
return AppIdentityService::getApplicationId();
}
}
*/
/*
$app->instance('path.storage','gs://invoice-ninja');
$app->instance('path.manifest', 'gs://invoice-ninja/meta');
if(strlen(ini_get('google_app_engine.allow_include_gs_buckets'))) {
$primary_bucket_name = explode(', ', ini_get('google_app_engine.allow_include_gs_buckets'))[0];
dd($primary_bucket_name);
$app->instance('path.storage','gs://'.$primary_bucket_name);
$app->instance('path.manifest', storage_path().'/meta');
}
*/
if (!function_exists('gethostname')) {
function gethostname() {
return php_uname('n');
}
}
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Create The Application | Create The Application
@ -13,7 +47,7 @@
$app = new Illuminate\Foundation\Application; $app = new Illuminate\Foundation\Application;
$app->redirectIfTrailingSlash(); //$app->redirectIfTrailingSlash();
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -28,8 +62,9 @@ $app->redirectIfTrailingSlash();
$env = $app->detectEnvironment(array( $env = $app->detectEnvironment(array(
'development' => array('precise64', 'ubuntu-server-12042-x64-vbox4210'), 'development' => ['precise64', 'ubuntu-server-12042-x64-vbox4210'],
'staging' => array('host107.hostmonster.com') 'gae-development' => ['HILLEL-PC','hillel-PC'],
'gae-production' => ['GNU/Linux']
)); ));
/* /*

View File

@ -4,10 +4,10 @@
"keywords": ["framework", "laravel"], "keywords": ["framework", "laravel"],
"license": "MIT", "license": "MIT",
"require": { "require": {
"laravel/framework": "4.0.*", "laravel/framework": "4.1.*",
"jasonlewis/basset": "dev-master", "jasonlewis/basset": "dev-master",
"patricktalmadge/bootstrapper": "dev-develop", "patricktalmadge/bootstrapper": "dev-develop",
"zizaco/confide": "2.0.x", "zizaco/confide": "3.1.x",
"anahkiasen/former": "dev-master", "anahkiasen/former": "dev-master",
"barryvdh/laravel-debugbar": "dev-master", "barryvdh/laravel-debugbar": "dev-master",
"chumper/datatable": "dev-master", "chumper/datatable": "dev-master",

4
php.ini Executable file
View File

@ -0,0 +1,4 @@
; enable function that are disabled by default in the App Engine PHP runtime
google_app_engine.enable_functions = "php_sapi_name, php_uname, getmypid"
google_app_engine.allow_include_gs_buckets = "invoice-ninja"
allow_url_include=1

View File

@ -42,21 +42,8 @@ $app = require_once __DIR__.'/../bootstrap/start.php';
| Once we have the application, we can simply call the run method, | Once we have the application, we can simply call the run method,
| which will execute the request and send the response back to | which will execute the request and send the response back to
| the client's browser allowing them to enjoy the creative | the client's browser allowing them to enjoy the creative
| and wonderful applications we have created for them. | and wonderful application we have whipped up for them.
| |
*/ */
$app->run(); $app->run();
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once the app has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$app->shutdown();