• Meteor

Working with Different Meteor Versions

From the class:  Setting Up Meteor Projects

I'd like to show you a couple of different ways to use various Meteor versions in your project. You might just want to upgrade to the latest version of Meteor. Or if you're following along on the mailing list, you might see an email about a release candidate and want to try out some of its new features. If you're on the bleeding edge, you might even be following along on a particular topic branch or on the develop branch of Meteor.

The first thing we'll do while we're on GitHub is to copy the SSH clone URL for the Meteor project itself. This will let us clone the project into our local folder. Next up, we'll clone this into a code folder on our machine. I typically put most of my code into a folder called Source in my home directory, but you can call this whatever you want. Next, I'll clone the Meteor project into this folder, and then we can change into the project and switch to various branches.

By default, I'll be on the development branch, and the develop branch is where the development of the project happens. And so this is not a stable branch. It's one where active development is happening.

We can take a look at different release tags for the project by typing get tag, and there's quite a few of them. So if you wanted to see releases, for example, we could use get tag and then pipe that output to grep and take a look at releases, and we could even do that to take a look at a release for a particular version. You can check out a particular branch or even a tag by using get checkout and then the name of the tag or the branch.

Over in our actual application directory, I'd like to show you how to run our project from a get checkout of Meteor. This is most useful when we want to try out something that hasn't been released yet, or if we're debugging the Meteor core itself. You shouldn't need to do this, but if you're following along with Meteor development or you're playing around with advanced bleeding edge features, this technique will be useful.

In order to use the Meteor get checkout version, we just have to use the Meteor tool that is associated with the get checkout. And so instead of typing Meteor to start up our application, we'll give the full path to the meteor checkout. So in this case, it's source, meteor, and then the tool is called meteor.

So this will use the development version of Meteor, the get checkout, and run our app with that. And you might get this message saying it's the first time you've run meteor from a get checkout, and it will automatically download a kit with all of the dependencies. Once that process completes, our app will have started up using the get checkout version of Meteor.

One of the cool things about this approach is I can go back to my meteor source directory and change to a different branch, and that will automatically cause my project to restart and use the new media version. For example, I can go over here and say get checkout devel. And now I've switched to the develop branch, and notice on the left that my app is automatically restarting. And now it's using the develop branch of my Meteor get checkout.

Now, having to type source meteor meteor each time that I want to use a get checkout of meteor is pretty annoying. So instead, what we can do is create a bash alias to this, and that bash alias I normally will call dev meteor or curmeteor for our current meteor. So what we want to be able to do is to type current meteor, and that will automatically use a checkout version of meteor.

To do that, we can edit our bashrc file and create an alias there. That way, it will be available on all future shell sessions. And in this case, I actually created it as a shell function, and that way we can call this function. And what this will do is execute this command at this path here and then pass along any arguments that we have after we type curmeteor.

Now that we've seen how to follow along on the bleeding edge using a get checkout of Meteor, let me show you the more established way to update your Meteor version. Inside of our application directory, first let's see what version of Meteor we're currently using. To do that, I can type Meteor and then the --version flag. This will be the version of Meteor that was used when we created our application.

Meteor will never automatically update our Meteor version, but if we want to update to the latest one, we can type Meteor update. This process might take a couple of seconds while Meteor refreshes package metadata. I can update the release of Meteor to any version that I want by using a special flag called release, and I can pass to it any version of Meteor, including one that is a previous release.

For example, let's say I want to go back to version 0.8.3. Once this process completes, if I type meteor --version, it should say that I'm on Meteor version 0.8.3. To go back to the latest version, I can type meteor update again. And now I'm back at the latest version of Meteor.

Before Meteor releases official versions, they'll often release something called a release candidate. And a release candidate gives the community a chance to try things out before it becomes an official release. So if you'd like to follow along and try out some release candidates, I'm going to show you how to do that next.

So here's an example of an email to the core list where the release candidate is 0.9.2 and rc0, and that means it's the first release candidate. So what we're going to do is go over to our application and update our version to this particular release candidate. So I'll type Meteor update and use the release flag, and this time it'll be 0.9.2 and then a dash, the rc for release candidate, and then the number of the release candidate.

So Meteor might download a couple of extra things here to get us up to date for this version of Meteor. When that process completes, we should now be using the new Meteor version of 0.9.2 release candidate 0. Then we can start up our app as normal just using the Meteor command, and it will automatically use that version of Meteor.

In this video, we started off by looking at how to run our application from a get checkout of Meteor using Meteor source code. Then I showed you how to update to the latest version of Meteor using the update command. And finally, we looked at how to set Meteor to a particular release by using the release flag to the update command. This way, we can go back to previous releases, or we can try out even new release candidates as Meteor develops.