Code Monkey home page Code Monkey logo

app-template's Issues

cake.bat vs. cake.php behave differently about Plugins

cake.bat and cake.php behave differently.

I setup the app-template, connect to the DB, add CakeDC's Search plugin and execute its shell through
a) cake.bat
b) cake.php

As you can see below adding --working . fixes the issue.
cake.bat and the *nix shell script cake both set the working path when calling cake.php:

php -q "%lib%cake.php" -working "%CD% " %*

exec php -q "$CONSOLE"/cake.php -working "$APP" "$@"

D:\dev\xampp\htdocs>composer -sdev create-project friendsofcake/app-template app
-template
Installing friendsofcake/app-template (dev-master 69f700e7a2154510b08201e9a50a72
a095d9b223)
  - Installing friendsofcake/app-template (dev-master master)
    Cloning master

Created project in app-template
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing composer/installers (dev-master 89d77bf)
    Loading from cache

  - Installing josegonzalez/dotenv (0.3.0)
    Downloading: 100%

  - Installing cakephp/cakephp (2.5.6)
    Loading from cache

  - Installing friendsofcake/crud (3.0.9)
    Downloading: 100%

  - Installing ad7six/dsn (0.3.1)
    Downloading: 100%

  - Installing cakephp/debug_kit (dev-master c911030)
    Loading from cache

friendsofcake/crud suggests installing cakedc/search (If you want to use the Sea
rch Listener)
Writing lock file
Generating autoload files
Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? y

D:\dev\xampp\htdocs>cd app-template

D:\dev\xampp\htdocs\app-template>composer require cakedc/migrations:*
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing cakedc/migrations (dev-master 0d62dda)
    Cloning 0d62dda64f4386fb29e68e3ba4d022aa90252aee

Writing lock file
Generating autoload files

D:\dev\xampp\htdocs\app-template>cd app

D:\dev\xampp\htdocs\app-template\app>console\cake.bat Migrations.migration statu
s

Cake Migration Shell
---------------------------------------------------------------
Migrations Plugin

Current version:
  #003 003_increase_class_name_length
Latest version:
  #003 003_increase_class_name_length
---------------------------------------------------------------


D:\dev\xampp\htdocs\app-template\app>php console\cake.php Migrations.migration s
tatus
Error: Plugin Migrations could not be found.
#0 D:\dev\xampp\htdocs\app-template\vendor\cakephp\cakephp\lib\Cake\Core\App.php
(227): CakePlugin::path('Migrations')
#1 D:\dev\xampp\htdocs\app-template\vendor\cakephp\cakephp\lib\Cake\Core\App.php
(549): App::path('Console/Command', 'Migrations')
#2 [internal function]: App::load('MigrationShell')
#3 [internal function]: spl_autoload_call('MigrationShell')
#4 D:\dev\xampp\htdocs\app-template\vendor\cakephp\cakephp\lib\Cake\Console\Shel
lDispatcher.php(249): class_exists('MigrationShell')
#5 D:\dev\xampp\htdocs\app-template\vendor\cakephp\cakephp\lib\Cake\Console\Shel
lDispatcher.php(200): ShellDispatcher->_getShell('Migrations.migr...')
#6 D:\dev\xampp\htdocs\app-template\vendor\cakephp\cakephp\lib\Cake\Console\Shel
lDispatcher.php(66): ShellDispatcher->dispatch()
#7 D:\dev\xampp\htdocs\app-template\app\Console\cake.php(40): ShellDispatcher::r
un(Array)
#8 {main}

D:\dev\xampp\htdocs\app-template\app>php console\cake.php Migrations.migration s
tatus --working .
Cake Migration Shell
---------------------------------------------------------------
Migrations Plugin

Current version:
  #003 003_increase_class_name_length
Latest version:
  #003 003_increase_class_name_length
---------------------------------------------------------------

D:\dev\xampp\htdocs\app-template\app>

This is unexpected because when using a vanilla CakePHP setup this is not needed:

C:\Users\marc.wuerth\Desktop\cakephp-master\app>console\cake.bat Migrations.migr
ation status

Cake Migration Shell
---------------------------------------------------------------
Migrations Plugin

Current version:
  #003 003_increase_class_name_length
Latest version:
  #003 003_increase_class_name_length
---------------------------------------------------------------


C:\Users\marc.wuerth\Desktop\cakephp-master\app>php console\cake.php Migrations.
migration status
Cake Migration Shell
---------------------------------------------------------------
Migrations Plugin

Current version:
  #003 003_increase_class_name_length
Latest version:
  #003 003_increase_class_name_length
---------------------------------------------------------------

C:\Users\marc.wuerth\Desktop\cakephp-master\app>console\cake.bat Migrations.migr
ation status --working .

Cake Migration Shell
---------------------------------------------------------------
Migrations Plugin

Current version:
  #003 003_increase_class_name_length
Latest version:
  #003 003_increase_class_name_length
---------------------------------------------------------------


C:\Users\marc.wuerth\Desktop\cakephp-master\app>php console\cake.php Migrations.
migration status --working .
Cake Migration Shell
---------------------------------------------------------------
Migrations Plugin

Current version:
  #003 003_increase_class_name_length
Latest version:
  #003 003_increase_class_name_length
---------------------------------------------------------------

WWW_ROOT points to wrong directory

WWW_ROOT should point to the correct webroot directory.

Using this template it returns:
/vagrant/app/app/webroot/

instead of

/vagrant/app/webroot/

Not using .env leads to errors in bootstrap

I just tried to setup the app-template without an Config/.env file, which leads to errors in Config/bootstrap.php

https://github.com/FriendsOfCake/app-template/blob/master/app/Config/bootstrap.php#L38

Argument 1 passed to Hash::get() must be of the type array, boolean given, called in /.../app/Config/bootstrap.php on line 38 and defined [CORE/Cake/Utility/Hash.php, line 43]

Errors happens for lines: 38, 42, 43, 44, 45, 46

Errors is due to return value from parseUrlFromEnv https://github.com/FriendsOfCake/app-template/blob/master/app/Config/core.php#L52

CakePHP 3.0 Version

We definitely want to keep the same features the app-template has - maybe even expand it if necessary - so filing this bug such that we don't forget.

We should also pull in whatever changes are necessary from the cakephp/app repo.

Incorrect path to bootstrap.php (cake3)?

Just generated a new cake3 app using app-template and the nginx error produces the following error:

2014/11/03 19:06:53 [error] 2792#0: *5 FastCGI sent in stderr: "PHP message: PHP Warning:  require(/home/vagrant/Apps/cake3/vendor/cakephp/cakephp/src/bootstrap.php): failed to open stream: No such file or directory in /home/vagrant/Apps/cake3/App/Config/bootstrap.php on line 50

I am no expert but it might be looking in the wrong directory:

  • /home/vagrant/Apps/cake3/vendor/cakephp/cakephp/src /bootstrap.php does not exist
  • /home/vagrant/Apps/cake3/vendor/cakephp/cakephp/config/bootstrap.php does

Plugin not in app?

Just tested out the install, and it's put a /Plugin folder in the root, rather than under /app. Is this correct?

To me, I've always installed plugins into app/Plugin.

Script

Error clarification

The error on the home page: "URL rewriting is not properly configured on your server" shows up always after you change your CSS... should have some sort of note on home.ctp saying "If you've updated your css and your styles are applied, ignore this error"

Including composer's class autoloader causes fatal error

Since e5ad977 the default app will fail to load, the added autoloader causes the CRUD plugin to not load properly. Adding this was discussed in #18.

Fatal error: Call to a member function addListener() on a non-object in app\Config\bootstrap.php on line 99

Call Stack
#   Time    Memory  Function    Location
1   0.0002  135088  {main}( )   ..\index.php:0
2   0.0131  991240  Dispatcher->dispatch( ) ..\index.php:110
3   0.0166  1172504 Dispatcher->_invoke( )  ..\Dispatcher.php:160
4   0.0170  1191144 Controller->startupProcess( )   ..\Dispatcher.php:182
5   0.0172  1198712 CakeEventManager->dispatch( )   ..\Controller.php:674
6   0.0172  1198712 CakeEventManager->dispatch( )   ..\CakeEventManager.php:233
7   0.0172  1198912 call_user_func ( )  ..\CakeEventManager.php:247
8   0.0172  1198928 Configure::{closure:C:\xampp\htdocs\CakePoser2\app\Config\bootstrap.php:89-100}( )  ..\CakeEventManager.php:247
9   0.0294  1473760 App::shutdown( )    ..\App.php:0
10  0.0306  1465752 App::_checkFatalError( )    ..\App.php:902
11  0.0306  1466616 call_user_func ( )  ..\App.php:929
12  0.0306  1466648 ErrorHandler::handleError( )    ..\App.php:929
13  0.0306  1467112 ErrorHandler::handleFatalError( )   ..\ErrorHandler.php:203
14  0.0312  1467992 call_user_func ( )  ..\ErrorHandler.php:252
15  0.0312  1468008 ErrorHandler::handleException( )    ..\ErrorHandler.php:252
16  0.0319  1473784 ExceptionRenderer->__construct( )   ..\ErrorHandler.php:119
17  0.0319  1473904 ExceptionRenderer->_getController( )    ..\ExceptionRenderer.php:92
18  0.0325  1517824 Controller->startupProcess( )   ..\ExceptionRenderer.php:154
19  0.0327  1525392 CakeEventManager->dispatch( )   ..\Controller.php:674
20  0.0327  1525392 CakeEventManager->dispatch( )   ..\CakeEventManager.php:233
21  0.0327  1525592 call_user_func ( )  ..\CakeEventManager.php:247
22  0.0327  1525608 Configure::{closure:app\Config\bootstrap.php:89-100}( ) ..\CakeEventManager.php:247

Unfortunately I don't have a fix for this right now, maybe some of the FoC developers has a better idea of what's going on. @ADmad ?

BTW, I also tried using CakePHP v2.4.3 by changing the composer.json and issuing a composer update (still using PEAR), but this will give the same error. So the CakePHP 2.4.3 -> 2.4.4 update shouldn't be the problem.

cake binary not executable

:(

vagrant@precise64:/vagrant/app/app$ Console/cake test app Controller/AppController
-bash: Console/cake: Permission denied
vagrant@precise64:/vagrant/app/app$ ll Console/
total 12
drwxrwxrwx 1 vagrant vagrant  204 Feb 24 07:15 ./
drwxrwxrwx 1 vagrant vagrant  272 Feb 24 07:33 ../
-rw-rw-rw- 1 vagrant vagrant 1391 Feb 24 07:15 cake
-rw-rw-rw- 1 vagrant vagrant 1028 Feb 24 07:15 cake.bat
-rw-rw-rw- 1 vagrant vagrant 1348 Feb 24 07:15 cake.php
drwxrwxrwx 1 vagrant vagrant  102 Feb 24 07:15 Command/

Don't ignore `Plugin` or `vendors`

I'd like to not use composer on my server - instead vendorizing the plugins and cake core - so ignoring those two directories seems like a pretty poor decision.

composer update needed

Would be nice if Readme file is more detailed. I had to do a composer update, after the create-project inorder for debugkit to get installed.

Crud plugin?

Just curious why this has been included. If this is more an app skeleton shouldn't it be the choice of the developer to include plugins?

App Template does not allow scaling on Heroku

I've followed the bible on how to create a new app using composer. I enable redistogo and set environment variables as proposed.

The app gets up and running nicely on heroku when I'm running a single dyno. But when I try to scale the app (heroku ps:scale web=2) I get a lot of Internal Server Errors. Enabling debug mode and I found out that the error message is:

Fatal error: Uncaught exception 'CacheException' with message 'Cache engine default is not properly configured.' in /app/vendor/cakephp/cakephp/lib/Cake/Cache/Cache.php:181 Stack trace: #0 /app/vendor/cakephp/cakephp/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('default') #1 /app/app/Config/core.php(283): Cache::config('default', Array) #2 /app/vendor/cakephp/cakephp/lib/Cake/Core/Configure.php(72): include('/app/app/Config...') #3 /app/vendor/cakephp/cakephp/lib/Cake/bootstrap.php(175): Configure::bootstrap(true) #4 /app/webroot/index.php(101): include('/app/vendor/cak...') #5 {main} thrown in /app/vendor/cakephp/cakephp/lib/Cake/Cache/Cache.php on line 181

Scaling down to 1 dyno and the problem is gone. Any ideas on how to solve this?

UPDATE:
I ran a
debug(env('CACHE_URL'));
just before the call to Cache::config
I get the same result both when it works and when it fails. The connection string looks like this:

redis://redistogo:[email protected]:10290//?prefix=APP_NAME_&duration=DURATION

I don't know how to debug Cake core when running in Heroku production environment.

Update 2:
I've got the error in 2 different projects on 2 different Heroku deployments. I think @josegonzalez can reproduce it on http://pastebin.herokuapp.com/ since I've followed that tutorial.

Update 3:
I added

debug($_SERVER['DYNO']);
to see which dyno the app is running on.
Running with 2 Dynos, web.1 has 100% succes rate. web.2 mostly fails, but sometimes manage to return the page.
Running with 3 Dynos, web.1 still has 100% succes rate. web.2 fails more than before, web.3 has 100% fail rate.

Autoload composer vendor file

This doesn't seem setup? If it is, please point it out to me, and if not, should we?

For reference, I am attempting to setup Opauth via composer and it's not being autoloaded :(

Consider adding an `app/cake` php binary

So I have a small issue. When running the command Console/cake from within a vagrant installation will cause issues because the cake binary is not executable[1].

As such, I'd like to include a cake file in app with the following contents:

#!/usr/bin/php -q
<?php
chdir(dirname(__FILE__));

include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Console' . DIRECTORY_SEPARATOR . 'cake.php';

This will allow us to do:

php cake

From within the app dir and have everything work[2]. Thoughts?

[1] See #36 for details.
[2] It will also prepend all output with #!/usr/bin/php -q because we are including the existing cake.php file. No real good way to avoid this without removing that from cake.php, or extracting it somehow. Thoughts?

Investigate usage of official heroku-php-buildpack

I got it working by setting the following in a Procfile:

web: vendor/bin/heroku-php-apache2 webroot

Nginx didn't work, though there is no reason it shouldn't. Haven't had time to investigate thoroughly, so filing an issue to make sure this doesn't get lost.

Set preferred-install to `dist` instead of `source`

I frequently have timeout issues when running composer install within the vm for the cakephp repo - among others - as it's about 60mb at this point.

Calling composer install --prefer-dist appears to work fine, though having this work OOB would be great. Thoughts?

Missing /tmp

Looks like the /tmp folders are missing from the repo. Is this correct?

One of my biggest bug-bears is always having to create these folders in every project I bake.

Creation of app/tmp

I see from the composer.json that the template is using 2.4.0-beta which means the /tmp should be created automatically?

This doesn't seem to be happening for me. Or was this feature introduced in 2.4.1?

Would it be worth updating the template to use the latest stable? 2.4.2

RFC: include vagrant

I was thinking of having vagrant included somehow in app-template.
Would be nice to be able to do:

vagrant up --provision-with chef
or
vagrant up --provision-with ansible

Not sure if this is a smart thing to do, or in what way this could best be handled. Having the vagrant repos as separete is cleaner then including it in app-template.
Currently vagrant-x repos are installed with composer create, and will end up with /vagrant/app/app/webroot as docroot, which is also somewhat awkward. Ofcourse could move around the folders, but a simple 2 step setup would be nice to get started:

composer -sdev create-project friendsofcake/app-template ProjectName
cd ProjectName
vagrant up --provision-with ansible

I'd like to hear your thoughts about this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.