Hot answers tagged

28

I always lay my add-ons out to match the directory structure of a default ExpressionEngine install. For example, check out Freemember on github. I think this makes it most obvious for customers downloading the add-on (believe it or not we used to get questions about where to copy the files to). In Store, my git directory structure looks like this: /system/...


21

The first place to start is to get a GitHub or a Bitbucket account. For new users, I'd recommend Bitbucket for their excellent tutorial: https://confluence.atlassian.com/display/BITBUCKET/Bitbucket+101 Follow the tutorial above to setup SSH through Git Bash on your local machine (or setup GitHub's easy-to-pick-up GitHub for Windows if you prefer GitHub) ...


20

Since you're already familiar with EE, I think step 1 should be to take some time to learn the basics of version control. There are more good tutorials out there than you can shake a stick at: Git Simple Guide Ryan Masuga EECI Talk from 2010 Version Control Tutorial for Designers Git Immersion Git Book Online Free course on Code School And some paid ...


18

If you want the directories to still get created, you need to have something in them, so I make sure there is an index.html file in each of the EE image directories that says "Directory Access not allowed" (or similar). Then, for each of the directories you can add rules like the following (your paths may vary): /assets/images/captchas/* !/assets/images/...


16

I'll add to this as needed. Since you have ssh access to the server, start there. 1) Connect via ssh to the production server via Terminal (or iTerm app). cd to the root of your site (or the directory where you want to track changes). 2) Type the following: git config --global user.name "SITE NAME Prod Server" git config --global user.email johndoe@...


10

One of the key things to remember with ExpressionEngine and GIT is that not all directories should be version controlled. The core files, third party plugins and your design of course should be - but version controlling the /images/ and /cache/ directory for example is over the top and is a burden on resources (and frankly a waste of time!). In the past I ...


10

Since Git can currently only stage files and not empty directories, the only purely Git based solution is to do as you are now. An alternative approach is to include a bash script in your repo that creates any required cache directories if the do not exist and (importantly) sets permissions on these directories (which often needs to be 755/777). The ...


9

The other answers are going about this a slightly convoluted way. You don't need a special .gitignore in each folder, and that makes it hard for other developers to figure out what's going on (or you in a few months). Just ignore the whole cache folder in your root .gitignore: $ cd /path/to/root $ echo "system/expressionengine/cache/" >> .gitignore ...


8

A possibly cleaner way would be to have it in your .gitignore at the root level of your repo... system/expressionengine/cache/* !system/expressionengine/cache/.gitignore ... that way everything's centralized in that one .gitignore. However it's my preferred method to have multiple .gitignore files (like your example above), one in each "empty" directory ...


8

I do this exact thing on my local machine and I have over 30 sites setup with it - so dont worry it is perfectly doable! I have a MAMP Pro setup using Git & Beanstalk to handle VCS, code hosting and deployment. In order to have the system folder above root, here is an example project folder structure that would work with the system folder moved above ...


5

This series of posts is quite helpful, whether you're PC or Mac: http://www.johnfaulds.com.au/journal/developing-expressionengine-sites-with-mamp-git-tower-and-beanstalk-part-1/ http://www.johnfaulds.com.au/journal/developing-expressionengine-sites-with-mamp-git-tower-and-beanstalk-part-2/ It would be EXTREMELY nice to have a definitive EE/Git 'guide.' ...


5

The github/gitignore repo is usually a good starting place for gitignore defaults, and I think it is in this case as well: .DS_Store # Images images/avatars/ images/captchas/ images/smileys/ images/member_photos/ images/signature_attachments/ images/pm_attachments/ # Caches sized/ thumbs/ _thumbs/ */expressionengine/cache/*


5

So I'm inferring from the forum post you linked that you're bootstrapping your config with something like NSM bootstrap or similar in order to reduce the pain of moving EE between multiple environments (local/staging/production etc.). That's a great idea, and how I roll with EE myself (though take a look at FocusLabs Master Config for another, more in depth ...


5

Version 1.1.1 of the Master Config added two global variables by default. Here's a sample of use: {if global:env == 'dev'} {if logged_out} {redirect='tmp/login'} {/if} {/if} An alternate approach without nesting conditionals: {if global:env == 'dev' && logged_out} {redirect='tmp/login'} {/if} If you are using a version before ...


5

I don't think it's left that many short to be honest. Most developers I'm aware of save their templates as files. Whilst I'd always recommend having version control in place, you don't need it, you can still save templates as files without Git. As for tutorials, the Ellislab docs are pretty explicit about how it's done. The learning curve for Git isn't ...


4

We use a single .gitignore file in the root directory, and we specifically list all subfolders. This way, the cache folder can contain the default index.html file, and will be indexed by git. system/expressionengine/cache/ee_version/ system/expressionengine/cache/ee_version/current_version system/expressionengine/cache/tag_cache system/expressionengine/...


4

I set this up by creating a "themes" directory inside my main repo. For instance with ProForm, my directory structure in development actually looks like this: ~/public_html/ee/third_party/proform/ __notes/ __static/ config/ docs/ language/ libraries/ models/ plugins/ templates/ tests/ themes/ views/ config.php ext.proform.php index.html mcp.proform.php mod....


4

I personally store the addons in a central "code" folder and then symlink the addons' third_party and themes folder to my sandbox folder. This way the git folder contains both system and themes addon folder.


4

*.DS_Store .gitignore .htaccess .ftpquota /expressionengine/cache/* /assets/cache/* /uploads/avatars/* /uploads/member_photos/* /uploads/pm_attachments/* /uploads/signature_attachments/* The path to some of your folders will obviously be different.


4

Having just gotten at least my development site up and running with Git I was looking into how to manage all the different parts of an EE project as sub projects (repositories). I was trying to avoid git submodules like the plague because of my past experience with them (Drupal). If you're new to git you're likely to mess something up there down the line. ...


3

+1 for Bitbucket & SourceTree


3

Your paths may vary: # Global Files !.gitignore .htaccess .sass-cache # .svn .DS_Store config.local.php config.dev.php [Tt]humbs.db # Images src/www/public_html/assets/ee_images/* # src/www/public_html/assets/ee_images/avatars/ # src/www/public_html/assets/ee_images/captchas/ # src/www/public_html/assets/ee_images/smileys/ # src/www/public_html/assets/...


3

Jason Siffring at Surprise Highway posted an article on how to do this with .htaccess. Unfortunately it requires a .htpasswd file, which it looks like you're trying to avoid. Here's the link in case it's useful: http://surprisehighway.com/article/how-to-password-protect-development-and-staging-sites-with-htaccess


3

Here's how I'm deploying the majority of sites http://digitalevangelist.net/blog/git-deployments I do have a paid DeployHQ account as well but that's generally for larger projects deploying to multiple environments with emails going to stakeholders when there's been a deployment.


3

Can you define what you mean by "a modern CMS"? Any database driven system will face similar problems when using Git source control. This isn't specifically an ExpressionEngine problem. The only systems that wouldn't suffer this difficulty are those using flat file architecture. I often use Git with ExpressionEngine. The only possible sticking point being, ...


2

The main Master Config file has global variables configured that you can use: From line 253: $master_global = array( 'global:env' => ENV, 'global:env_full' => ENV_FULL ); The variables for each environment are set in the config.env.php file. {global:env} will get you "prod, stage, dev or local" and {global:env_full} will get you "Production,...


2

You probably got errors because EE couldn't find the cache folder. I'm new to git, and I have all my ignore rules in one file in the root and there I have this # Cache /ee-admin/expressionengine/cache/* /public_html/cache/*


2

Lately I have been using this as the default gitignore for non-EE projects and I was thinking of adapting it for EE. i'm open for suggestions. #ignore everything apart from php, css, xml, htaccess, sql, js * !*/ !*.php !*.css !*.xml !*.htaccess !*.sql !*.js !*.shtml


2

This is more for once you have Git set up and going, but this article really helped me build out a workable development and deployment workflow using branching. http://nvie.com/posts/a-successful-git-branching-model/ Here are some other resources that helped me get GIT set up that I don't think have been mentioned yet Resources Devot:ee: Version Control for ...


2

Besides all the other answers, I like to add a git "hook" that would do a database dump into a directory inside my repo, then perform a "git add", every time I do a commit. You can achieve this by creating a file named "pre-commit" inside .git/hooks/ and making executable (not sure how to do that on windows machines). In my mac (using MAMP) I have the ...


Only top voted, non community-wiki answers of a minimum length are eligible