UNPKG

7.97 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 `mrt` that can be used to add and install smart packages from atmosphere.
6
7``` sh
8# Create an app based on Meteor's devel branch.
9$ mrt create my-app --branch devel
10$ cd my-app
11# Install an Atmosphere package, recursively fetching dependencies.
12$ mrt add router
13# Check for and install any updates, and run the app.
14$ mrt
15```
16
17## Installing Meteorite
18
19Meteorite can be installed via [npm](https://npmjs.org/).
20
21``` sh
22$ npm install -g meteorite
23```
24
25### NOTE:
26If your system requires root access to install global npm packages, make sure you use the `-H` flag:
27
28``` sh
29$ sudo -H npm install -g meteorite
30```
31
32## Updating from pre-0.6.0 Meteorite
33
34Meteorite 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`.
35
36Subsequently, you can simply use `meteor` to run your development server, and just `mrt install` to ensure all packages are installed from atmosphere.
37
38### NOTES
39
40- 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.
41
42- 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.
43
44
45## Usage
46
47### `mrt add <package>`
48
49Works like `meteor add`, but if the package isn't one of Meteor's included packages, it installs it from [Atmosphere](https://atmosphere.meteor.com).
50
51Unlike `meteor add`, only one package can be added at a time with `mrt add`.
52
53``` sh
54# Add the latest version of the moment package on Atmosphere.
55$ mrt add moment
56# Add a specific version of a package.
57$ mrt add router --version 0.3.4
58# Meteorite will install page.js too, because router depends on it.
59```
60
61### `mrt install`
62
63Install 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.
64
65### `mrt update`
66
67Installs any available updates to the app's desired Meteor version and packages.
68
69### `mrt create-package [path/to/]foo`
70
71Puts the basic building blocks down for creating a package named `foo`, (potentially in a sub directory, usually `packages/`).
72
73## Deprecated commands
74
75As 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.
76You can run any meteor executable you like (e.g. from a checkout somewhere on your machine).
77
78### `mrt`
79
80Works 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.
81
82If 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).
83
84### `mrt create <name>`
85
86Works 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.
87
88``` sh
89# By default, apps are based on Meteor's master branch.
90$ mrt create cool-app
91# You can create apps based on a branch of Meteor's repo.
92$ mrt create risky-app --branch devel
93# Or, on a tag (such as version numbers).
94$ mrt create safe-app --tag v0.5.4
95# Or, or on a commit.
96$ mrt create choosy-app --ref a9a717
97```
98### Other commands
99
100When 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`.
101
102## Permission woes?
103
104It 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.
105
106To fix the problem, try cleaning up potentially "sudo-ed" files:
107
108```bash
109sudo mrt uninstall
110sudo mrt uninstall --system
111sudo chown -R `whoami` ~/.npm
112```
113
114If 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.
115
116
117
118## How Meteorite works
119
120Apps 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.
121
122Meteorite 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.
123
124### Example `smart.json`
125
126The `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`.
127
128``` json
129{
130 "meteor": {
131 "tag": "v0.5.4"
132 },
133 "packages": {
134 "moment": {},
135 "router": "0.3.4",
136 "roles": {
137 "version": "1.0.1"
138 },
139 "accounts-persona": {
140 "git": "https://github.com/vladikoff/meteor-accounts-persona"
141 },
142 "normalize.css": {
143 "git": "https://github.com/rithis/meteor-normalize.css",
144 "tag": "v2.0.1"
145 },
146 "my-experiment": {
147 "path": "/path/to/local/package"
148 }
149 }
150}
151```
152
153## Writing Meteorite packages
154
155Meteorite 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).
156
157Meteorite 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).
158
159See [Atmosphere's documentation on writing packages](https://atmosphere.meteor.com/wtf/package) for more information.
160
161## Bash Completion
162
163Use Meteorite's bash completion by sourcing it in your .bashrc or .bash_profile.
164
165Depending on where you installed Meteorite:
166
167```bash
168if [ -f /path/to/meteorite/completions/mrt.bash ]; then
169 . /path/to/meteorite/completions/mrt.bash
170fi
171```
172
173Alternatively, you can create a symbolic link under bash_completion.d:
174
175```bash
176ln -s /path/to/meteorite/completions/mrt.bash /path/to/bash_completion.d/mrt
177```
178
179## Contributing
180
181Contributions to meteorite are very welcome! Please see the [Contribution Guide](https://github.com/oortcloud/meteorite/blob/master/CONTRIBUTING.md) for details.