dsimard / grunt-angular-phonegap

Combine yeoman/generator-angular and phonegap
MIT License
156 stars 23 forks source link

gitignore has www and some other folders which meants after pulling project from git it would not build properly #22

Closed reviyou closed 10 years ago

reviyou commented 10 years ago

Hello @dsimard , happy new year, just wanted to share another thing that might be an issue

If I create a new project - all works fine and I can build it, however gitignore of this project strangely has: node_modules dist .tmp .sass-cache app/bower_components

platforms www !www/config.xml !www/res

So after somebody pulls the project from repo, I don't think there is a way to recreate those folders easily. and without www or npm packages most of the commands would not work. So I am just not sure what should be done by person who pulls the project the first time(or continues integration job for that matter).

dsimard commented 10 years ago

A node project should never include node_modules/. First thing to do after pulling out a project is npm install.

The source of the code should be in app/. grunt build will recreate dist/ and grunt phonegap:build will recreate www/.

platforms/ is created after we call cordova platform add android or any other platforms.

All these directories are dependent on your current setup and should not be forced.

reviyou commented 10 years ago

yes, npm install recreates node_modules/ however {grunt build} would throw an error "no bower components found" (since this folder ignored in app folder I assume) and {grunt phonegap build} would throw the same error as well. {cordova platform add android} would throw "no such file or directory ....www\config.xml" since we didn't run grunt phonegap:build yet, obviously.

dsimard commented 10 years ago

I updated this : https://github.com/dsimard/grunt-angular-phonegap-example#getting-started

First, it's npm install, then bower install.

You'll probably have another problem if you don't have a platforms directory in your project. Just create it and it will be ok. Then, in your .gitignore, change platforms for platforms/**/.

I'll be deploying soon the fixes for issues #24 and #25.

Let me know if it works ok.

reviyou commented 10 years ago

thanks, yes bower install adds bower components and {grunt build} creates dist and grunt {phonegap:build} creates www, but www still has no config.xml and some other files(index.html scripts seems to be different for example) - so cordova platform add android still fails complaining about missing config.xml

dsimard commented 10 years ago

Normally, !www/config.xml in .gitignore keeps that file. Do you still have the www/ directory? If not, create a new phonegap project and copy www/config.xml and www/res from it.

It should probably work.

reviyou commented 10 years ago

It seems that instead of www it should be www/* in order to opit all files but res and config, Another thing is that index.html seems to be pointing to the uncompressed css and styles even though www\scripts and www\styles have a compressed version of it.

However I still have an exception during cordova platform add:

Creating Cordova project for the Android platform:

C:\Users\ALEXANDR\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:1 26 throw e; ^ Error: An error occured during creation of android sub-project. Creating Cordova project for the Android platform:

at C:\Users\ALEXANDR\AppData\Roaming\npm\node_modules\cordova\src\platform.j

s:244:30 at ChildProcess.exithandler (child_process.js:641:7) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:735:16) at Socket. (child_process.js:948:11) at Socket.EventEmitter.emit (events.js:95:17) at Pipe.close (net.js:466:12)

I'll play with it trying to find other differences and let you know if I get to the bottom of it

Thanks,

dsimard commented 10 years ago

Did you find something?

reviyou commented 10 years ago

It's an interesting problem, I am still looking into it, I can only reproduce it after I commit and pull code from git, I am trying to compare files to find the differences but so far no luck. Need to spend a little bit more timeю

I create project that has a bare minimum required for cordova platform add android to work:

01/07/2014 01:53 AM

.cordova 01/07/2014 01:56 AM platforms 01/07/2014 01:53 AM plugins 01/07/2014 01:56 AM www where ww has only config.xml

so now I'll try to see which one of the files gets corrupted somehow and why

reviyou commented 10 years ago

ok issue is resolved! Turns out even though you told me(and I forgot) platforms folder was missing and it was causing this error. And I was forgettting that it's removed in once place and exist but empty in another.

Also my previous comment about platform/*/ was not accurate. Git doesn't allow to commit empty folders so the best way to do it is to create an empty "platform" folder with .gitignore file inside witht he following content:

!.gitignore

after that I add platform folder to the version control and it works just fine.

Thanks @dsimard bad cordova exception handling, took a while to realize where the problem is..

dsimard commented 10 years ago

@reviyou I'm sorry, in this comment, I forgot to mention to add a '.gitkeep' file to platforms/.

A .gitkeep file is a convention to avoid git to get rid of an empty directory.

You can see how I did in the example project.

If you execute npm update grunt-angular-phonegap, it should update to v0.1.5 and it will take care of that (npm view grunt-angular-phonegap version to know which version is installed).