yii2 vendor and some files are missing from github - github

I have set up a new repo on github and pushed yii2 advanced template. Now i realized that some folders/files are missing from github like vendor and backend/web/index.php.
Anyone have idea why this is happening, i also checked my local git setup there files are present.

Check out the installation guide.
Running composer install is what creates the vendor folder, while running init creates those index.php files.

I have found that its happening because of .gitignore file. i removed it and its working fine for me.

It's quite simple idea behind missing these files, they are called ...-local.php, because their content can vary for different developers or production conditions. All you have to do before upload yii2 to the github, check the /environments directory, it includes templates for the local files, so after yii2 project is copied from the github, they will be generated by ./yii init.
Step-by-step, what should be done:
Configure files in /environments/dev and /environments/prod (for production). Most likely, if you don't change the yii2 project file structure or touch any of the /config files, you don't need to adapt them.
Update /environments/index.php, if you have updated /environments files
Upload the project to GitHub
Clone the project and run composer install to install dependencies
And finally run ./yii init from the root folder. You will see that ...-local.php files are now generated in certain directories the same way as they are configured in the environments.
More detailed information about this topic: https://www.yiiframework.com/extension/yiisoft/yii2-app-advanced/doc/guide/2.0/en/structure-environments

Related

Github - Download Not Fully Included All Folders/Files

I am new to Github. I downloaded the PHPWord (link below) on Github, but some how the folders: samples, tests, docs are missing. It only has the folder "src/PhpWord".
https://github.com/PHPOffice/PHPWord
I also use composer require phpoffice/phpword and the result is the same (missing folders)
Am I doing something wrong or there is another way to download which will include the other folders: samples, tests, docs.
Thanks in advance,
The reason the other folders are missing may be due to you downloaded the Zip file and not a clone to your PC which downloads everything including the source code.
The Zip download only contains one file folder to the program. I suspect this is the finished product rather than the development product your seeing in the GitHub repository. Although, usually the author of the program includes this in the instructions which I didn't see when reading them.
You may also want to re-read the instructions on the REAME.md document in the repository. There are some requirements that need to be preformed before using composer to install the dependencies. It may account for the "missing folders" message

Keeping essential config/configure files hidden on public Github forks

I wish to fork a Github project that has config/configure files within it.
How can I run it alongside my desktop and live website project. But ensure that my config/configure files used on my desktop and live website (with all my db usernames etc) never get accidently copied/pushed over?
this is about envoronment setting. what i saw before is one can have different settings of config in the same location and the program can use an environment variable to determine what configs to be loaded. In addition, confidential settings should be saved in env variable instead of github. hope this helps.
Consider using .gitignore file.
If you create a file in your repository named .gitignore, Git uses it to determine which files and directories to ignore, before you make a commit.
Read more here.

openshift nodejs copy written file to repo

I have a nodejs app on openshift an one of the things the app does is write a text file.
Problem is, whenever I update code in the app and deploy it, the text file is gone because the live repo address has changed.
Is there a way using build hooks to get any files saved in a particular folder, add them to my git repo and then deploy the app? I'm not completely clear what I would write in a hook or what to save the hook as so any help would be awesome!
Thank you!
You need to store the file inside of your OPENSHIFT_DATA_DIR so that it will not get over-written each time. You can not copy the file into your git repo on the gear. You might want to try something like the WordPress cartridge does, which is create a symlink (using the deploy action hook) to create a folder in your repo dir that is linked to your OPENSHIFT_DATA_DIR (https://github.com/openshift/wordpress-example/blob/master/.openshift/action_hooks/deploy)

Files from Yeoman web-app that needs to be committed in SCM/GIT

When we do "yo webapp" (assuming webapp generator is installed), it scaffold projects which contains file relevant to bower, grunt and then there is app folder, which we all know what's it about.
My question is, out of this structure what are the files that needs to be maintained in SCM, Should it be only app directory or should it whole structure ?(assuming there are no additional grunt task or any build file changes from earlier scaffolding)
Yeoman webapp generator will produce a .gitignore file which includes files that should not be committed to a SCM. This file includes the following directories:
node_modules
dist
.tmp
.sass-cache
bower_components
test/bower_components
It is clear that .tmp and .sass-cache have no reason to be in the repo as they both are only temporary.
There is however a discussion whether bower (and rarely node) dependencies should be checked in. For most projects I recommend not to.
Please note that in either case one should never change the packages directly in the bower_components or node_modules folder as any change will be lost at next bower install or npm install. A fork of the original project (either as a independent repo or to folder in the project - e.g. lib) is a better idea - a follow up pull request would then add a lot of karma :)
The dist folder with the build of the application may be committed depending on your deployment method. There is a very good guide on deployment on Yeoman site.
As a start, you should put everything into SCM with the exception of app/bower_components, test/bower_components and node_modules. All files under these directories come from public repo, either node or bower repo.
In this setup, whenever another developer checkout from SCM, he needs to run 2 commands: npm install and bower install. What I typically do is I create a file called install.sh (install.bat on Windows) and have these 2 commands inside this script file. In this way, when you find that you need to run more commands for initialization, you can easily add to this script file and new developers can just checkout and run install.sh.
In some cases, I found that I need to perform small modification to a public library. In this case, I will check this library inside bower_components into SCM as well. This is not common, but it happens.

Which files/directories to ignore in a Laravel 4 project when using version control?

I have a Laravel 4 project, and I would like to know which files should be ignored when using a version control software such as Git, Mercury or SVN?
The structure of my project looks like the following screen capture.
I'm pretty new to Composer so I'm not very clear about what goes to a repo what not. If someone can post their .gitignore file or their SVN ignore property, it could be handy.
For reference, that .gitignore file can be found here:
/bootstrap/compiled.php
/vendor
composer.phar
composer.lock # Remove this one after you create a project
.env.*.php
.env.php
.DS_Store
Thumbs.db
As noted in the below comment, you probably want to commit composer.lock in your project. Laravel ignores it by default so the authors of the laravel/laravel package don't accidently impose packages on you.
Your project should include the composer.lock file so you can install packages of stable versions (via composer install instead of composer update) properly in your production environments.
Note that the config file:
app/config/app.php
Has a cryptographic key in it that wouldn't be great to commit to a repository. Or, at least, the file needs to be overwritten in production.
You might also want to see the Laravel docs here and here. This discusses how to setup different Laravel configurations for different environments and protect sensitive information. All your .env.local.php type files should not be included in version control. Note that the .env.*.php and .env.php is added in the default Laravel .gitignore file. You can see it here
Laravel has posted their .gitignore on GitHub, which can be found here.
As of today, it looks like this:
/bootstrap/compiled.php
/vendor
composer.phar
composer.lock
.env.*.php
.env.php
.DS_Store
Thumbs.db
GitHub has a repository of suggested .gitignore files for almost all kinds of projects at: http://github.com/github/gitignore
Alternatively, you can search it for your project using this handy and extremely useful online tool: http://www.gitignore.io