Questions about Grunt

SFTP for straight up file transfers. It’s file transfer, but through SSH which encrypts everything, including your username and password. FTP sends everything via plain text.

Other than that, if you saw the screencast about Composer, and you have your theme and extra plugins in Git repositories, basically everything but the database and uploads folder can be set up automatically, no FTP/SFTP required.

If you haven’t signed up yet: https://twitter.com/digitalocean/status/378221194282934273

They had a $10 code earlier. I still haven’t paid them anything

Sorry dude, too late! I didn’t notice they had a referral program until I’d already signed up, otherwise I would have asked you or kalenjohnson for sure.

(if there’s a way of doing it retroactively let me know)

It’s no referral, it’s just a sign up code for $5 credit to use with them.

Oh yeah, my bad.

In that case: thanks for the code enollo. Looks like I could open a ticket to get a credit even though I missed the chance, but it feels kind of petty for $5. (I will do it anyway)

FTP is reckless and dangerous; sending files and passwords in plain text can compromise your site.

SFTP removes the security issue but you have to manually manage which files to upload or re-upload everything again. This can be slow, but will also make it difficult to revert any changes or even keep track of the version currently deployed.

Deploying via Git fixes these issues and Capistrano simplifies and enhances the process.

Oh, i totally forgot I have a referral link!

I was just sending you a $5 credit they posted a few days ago. Open up a ticket and they will apply it to your account :slight_smile:

I’m not even sure if I’m allowed to post a referral link on this forum. If I am, I’ll gladly post it. I wish it offered a 50:50 split credit that way both parties win.

This seems very interesting, but I’m totally new to this and don’t get how to do. Could you give some more infos, or a link for newbie.

Do you use this for all your sites? It seems to be a system more for big web app oriented than for small sites. Or not?
Using git the code will be public and visible to all?

So I feel like I have all the pieces in place now (digitalocean is great by the way), but I’m still not sure if I’m doing things the right way. Is it something like this? (maybe this will help popsy too)

I followed the method in: http://toroid.org/ams/git-website-howto

  1. Local: in the /themes directory of a WP install

    git clone git://github.com/roots/roots.git

  2. Local: make changes, then

    git add .
    git commit

  3. Remote: create a bare repository somewhere not in /www (I used /home/me/git)

    git init --bare

  4. Remote: add a ‘post-receive’ file to /hooks with this in:

    #!/bin/sh
    GIT_WORK_TREE=/path/to/www/wp-content/themes/roots git checkout -f

then make it executable:

chmod +x hooks/post-receive
  1. Local: add the new remote repository

    git remote add mywebsite ssh://user@server/path/to/git/

  2. Local: push to remote

    git push mywebsite +master:refs/heads/master

(not sure why the last bit is necessary)

  1. Later updates are just:

    git push mywebsite

Am I on the right track?

@fuf: Definitely on the right track, although I would recommend extending the hook to force the correct file permissions.
You should also look into Capistrano as you have your own Digital Ocean machine.

@popsy: Bitbucket offers free private hosting for teams of 5 or less, which will prevent the code being public. Version control is professional, but small sites can and should be executed professionally too. Even if you only have SFTP set up, you should still be using some form of VCS.

Or, run grunt, then Ctrl or Cmd + Z will pause Grunt, and type “bg” to put it in the background. Then you can run grunt watch and git from the same terminal.

Thanks for that, i was wondering how to use the terminal when grunt watch was running.

Could you post that script for Win?

Do you know how to create a batch file? If so, create separate batch files to run grunt watch and npm install. If not…

Here’s the Windows way. In Windows Explorer, in your local branch, create a new text file. (Right-mouse, New, Text Document). Rename the file grunt-watch.bat. Edit the file. You’ll need to explicitly edit it because double-click runs .bat files by default. In the file, type “grunt watch” without quotes. Save the file.

Do the same thing for npm install, but call the file npm-install.bat and type “npm install” without quotes instead.

Or you can find them at https://github.com/jmjf/roots in the jmjf-master branch.

1 Like

Actually, i must have misread that command, as it does nothing for me when i try to apply it.

Just want to chime in that a screencast about how folks use Git with Roots including deployment would be much appreciated. I can understand the value of version control, but am confused about how to set this up and work with it in a web dev environment.

Hmmm, I really don’t do much in Terminal and am feeling a bit out of my depth in there. I’ve watched the awesome screencast and seem to have everything configured right. Grunt is working and watching.

Do I need to turn Grunt off at some point (like when I’m ready to log out of my computer)? Do I need to tell Grunt to stop watching? If so, how do I do that?

You can press Ctrl or Cmd + C to stop whatever program is running in the terminal.

Starting to use the terminal or command line takes some getting used to, but the more you use it, the more comfortable you’ll get, and the more you’ll probably actually like it. It is surprisingly powerful, once you get over the fact it’s not a GUI and you type everything :smile:

And about version control, just imagine the last time you wanted to update a site that’s already live, or wanted to test something… you probably made a backup of the file you’re editing, copy index.php to index-oct23-2013.php. After doing that on a project a bunch of times, your site gets pretty messy. And a little ridiculous. Version control helps solve that issue. Every time you commit, you are taking a snapshot of the project.

1 Like

Yep you’re on the right track. But you should also look into hosting the Git repo on another host like Bitbucket (that Foxaii mentioned). It will just add another redundant backup source (git repos can have multiple remotes).

Finally, I think your first step is wrong. If you just want the base Roots theme that you’ll be making modifications to, you don’t want to clone it. You could just download the zip from GitHub and unzip it in your themes dir. You’d probably only want to clone Roots if you were using it as a parent theme and not touching it.

I still have some doubts:

1- I like Bitbucket but I don’t understand what does with upload a site on an hosting! if I understand correctly, it serves just to syncronize a project between multiple developers

2- the requirment to use git to upload the site in place of ftp is to use an hosting that features a git server? The hosting i’m using doesn’t have it

3- I really appreciate the contribute of fuf, but all that terminal lines can be done from an ide like aptana with a git plugin?