UNPKG

9.06 kBMarkdownView Raw
1# Meteorite
2
3Meteorite is a Meteor version manager and package manager. It provides an easy way to run different versions of meteor, use non-core packages, and to install packages from the [Atmosphere package repository](https://atmosphere.meteor.com/).
4
5Meteorite provides the command `mrt`, which can be used to add and install smart packages from atmosphere.
6
7``` sh
8$ mrt create my-app
9$ cd my-app
10# Install an Atmosphere package, recursively fetching dependencies.
11$ mrt add router
12# Check for and install any updates, and run the app.
13$ mrt
14```
15
16## Installing Meteorite
17
18Meteorite can be installed via [npm](https://npmjs.org/).
19
20``` sh
21$ npm install -g meteorite
22```
23
24### NOTE:
25If your system requires root access to install global npm packages, make sure you use the `-H` flag:
26
27``` sh
28$ sudo -H npm install -g meteorite
29```
30
31## Updating from pre-0.6.0 Meteorite
32
33Meteorite now symlinks packages into the `packages/` directory of your app, so it's no longer necessary to run `mrt` when you want to start a server. Just make sure you `mrt install` in your app, and delete the `"meteor"` section from your `smart.json`.
34
35Subsequently, you can simply use `meteor` to run your development server, and just `mrt install` to ensure all packages are installed from atmosphere.
36
37### NOTES
38
39- Meteor is not officially supported on windows; you can run it thanks to [Tom Wijman's excellent work](http://win.meteor.com). However, meteorite's git based approach runs counter to the MSI installation that's required to get it working. So meteorite *does not* work under windows right now. Pull Requests which change this would be gladly accepted! Also, see [this blog post](http://www.discovermeteor.com/2013/03/20/using-meteor-and-atmopshere-on-windows/) for some information about how to use it.
40
41- You'll also need to ensure you have [git](http://git-scm.com) installed and available in your path. Also, you'll need to make sure that `mrt`'s install location (usually `/usr/local/bin/`) is on your path.
42
43
44## Usage
45
46### `mrt add <package>`
47
48Works like `meteor add`, but if the package isn't one of Meteor's included packages, it installs it from [Atmosphere](https://atmosphere.meteor.com).
49
50Unlike `meteor add`, only one package can be added at a time with `mrt add`.
51
52``` sh
53# Add the latest version of the moment package on Atmosphere.
54$ mrt add moment
55# Add a specific version of a package.
56$ mrt add router --pkg-version 0.3.4
57# Meteorite will install page.js too, because router depends on it.
58```
59
60### `mrt remove <package>`
61
62Similarly, removes a package from `smart.json`, and unlinks it from your project (as well as telling Meteor not to use it).
63
64### `mrt install`
65
66Install all packages listed in `smart.json` that aren't already installed on your machine. Use this command if you are working collaboratively and your colleagues install new packages.
67
68### `mrt update`
69
70Installs any available updates to the app's desired Meteor version and packages.
71
72### `mrt create <name>`
73
74Works like `meteor create`, but you can specify the desired branch, tag or reference of [Meteor's git repository](https://github.com/meteor/meteor) that the app should be based on.
75
76``` sh
77# By default, apps are based on Meteor's master branch.
78$ mrt create cool-app
79# You can create apps based on a branch of Meteor's repo.
80$ mrt create risky-app --branch devel
81# Or, on a tag (such as version numbers).
82$ mrt create safe-app --tag v0.5.4
83# Or, or on a commit.
84$ mrt create choosy-app --ref a9a717
85```
86
87### `mrt create-package [path/to/]foo`
88
89Puts the basic building blocks down for creating a package named `foo`, (potentially in a sub directory, usually `packages/`).
90
91### `mrt link-package path/to/foo`
92
93Links `packages/foo` to `path/to/foo` so that you can use a local version without changing `smart.json`. Useful for quick changes to a package you maintain when developing an application.
94
95Note that `mrt install` or `mrt` will _overwrite_ this link if you also have `foo` in your `smart.json` (which you probably will). This may change in the future.
96
97## Options
98
99Options can be passed at the very end of the command.
100
101### `--verbose`
102
103Log debug information to the console.
104
105Example: `mrt add crypto-sha1 --verbose`
106
107## Deprecated commands
108
109As Meteorite now installs packages into the `packages/` directory, you can simply run `meteor` to start your app. You may need to run `mrt install` first.
110You can run any meteor executable you like (e.g. from a checkout somewhere on your machine).
111
112### `mrt`
113
114Works like `meteor`, but checks and installs the app's desired Meteor version and package dependencies before running the app. You may still want to use this, but it's no longer the official way to use Meteorite.
115
116If however you want to use a forked version of Meteor in your project, you can still list it in your `smart.json`, and Meteorite will run it via `mrt`. (Of course you could just run it directly from a checkout too, which may be simpler).
117
118### Other commands
119
120When Meteorite is executed for an app, it checks or installs the app's desired Meteor version, packages and dependencies, then does the required book-keeping (described below), and finally passes the command onto `meteor`.
121
122## Permission woes?
123
124It is *not* required that you run `sudo mrt`. If you do so, your home directory will pick up some root-owned files and you'll struggle to run `mrt` without `sudo` from then on. This isn't good.
125
126To fix the problem, try cleaning up potentially "sudo-ed" files:
127
128```bash
129sudo mrt uninstall
130sudo mrt uninstall --system
131sudo chown -R `whoami` ~/.npm
132```
133
134If possible, try not to install Meteorite as root either. If you have permissions problems, make sure you install with `sudo -H npm install -g meteorite`. If you've installed without `-H`, your `~/.npm` directory will be owned by root and you should run the `chown` command above to fix it.
135
136
137
138## How Meteorite works
139
140Apps tell Meteorite the Meteor version and packages they want with a file called `smart.json` in their root directory. Meteorite will install those dependencies the next time it is executed within that app.
141
142Meteorite writes to a `smart.lock` file in the app's root directory to track the exact versions of its dependencies, even when it's set up in a fresh environment. You should check the `smart.lock` file into your app's version control, to ensure that other developers are running the same versions of the dependencies. Any changes in `smart.json` take precendency over `smart.lock`. The `smart.lock` file is reset with the `mrt update` command.
143
144### Example `smart.json`
145
146The `meteor` property is not required: apps will depend on Meteor's master branch by default. You can specify `meteor.branch`, `meteor.tag` or `meteor.git` to use alternate branches, tags and forks respectively. Note that `meteor.git` expects an actual URL, use `ssh://git@github.com/meteor/meteor.git` instead of `git@github.com:meteor/meteor.git`.
147
148``` json
149{
150 "packages": {
151 "moment": {},
152 "router": "0.3.4",
153 "roles": {
154 "version": "1.0.1"
155 },
156 "accounts-persona": {
157 "git": "https://github.com/vladikoff/meteor-accounts-persona"
158 },
159 "normalize.css": {
160 "git": "https://github.com/rithis/meteor-normalize.css",
161 "tag": "v2.0.1"
162 },
163 "branch-of-package": {
164 "git": "https://github.com/EventedMind/iron-router.git",
165 "branch": "dev"
166 },
167 "my-experiment": {
168 "path": "/path/to/local/package"
169 }
170 }
171}
172```
173
174## Writing Meteorite packages
175
176Meteorite packages include a `smart.json` file in their root directory to provide information about the package, and to list their dependencies. For an example, see [Meteor Router's `smart.json`](https://github.com/tmeasday/meteor-router/blob/master/smart.json).
177
178Meteorite packages also include a `package.js` file in their root directory to tell Meteorite how it should be installed. For an example, see [Meteor Roles' `package.js`](https://github.com/alanning/meteor-roles/blob/master/roles/package.js).
179
180See [Atmosphere's documentation on writing packages](https://atmosphere.meteor.com/wtf/package) for more information.
181
182## Bash Completion
183
184Use Meteorite's bash completion by sourcing it in your .bashrc or .bash_profile.
185
186Depending on where you installed Meteorite:
187
188```bash
189if [ -f /path/to/meteorite/completions/mrt.bash ]; then
190 . /path/to/meteorite/completions/mrt.bash
191fi
192```
193
194Alternatively, you can create a symbolic link under bash_completion.d:
195
196```bash
197ln -s /path/to/meteorite/completions/mrt.bash /path/to/bash_completion.d/mrt
198```
199
200## Running Meteorite In a Git Hook Script
201
202If you encounter checkout errors while running `mrt install` or `mrt update` within a Git hook script, it is because `GIT_DIR` is set to an unexpected value when running within a hook. The solution is to temporarily unset it just before running the `mrt` command.
203
204```bash
205(unset GIT_DIR; mrt update)
206```
207
208## Contributing
209
210Contributions to meteorite are very welcome! Please see the [Contribution Guide](https://github.com/oortcloud/meteorite/blob/master/CONTRIBUTING.md) for details.