A Community-led Hyper-Hackable Text Editor
Go to file
Michael Bolin e04f17fe5f Set up the atom.repository-provider service and implement GitRepositoryProvider.
I tested this by creating a dummy implementation of an `HgRepositoryProvider`
(with the optional `createRepositorySync()` method implemented) and an `HgRepository`
in an Atom package with the following stanza in the `package.json`:

```
  "providedServices": {
    "atom.repository-provider": {
      "versions": {
        "0.1.0": "createHgRepositoryProvider"
      }
    }
  },
```

I opened a path with an Hg repository from the command line using Atom.
I verified that `atom.project.repositoryProviders` contains both a
`GitRepositoryProvider` and an `HgRepositoryProvider`.

I also verified that running the following printed out an `HgRepository`:

```
var Directory = require('pathwatcher').Directory;
atom.project.repositoryForDirectory(
    new Directory(atom.project.getPath(), /* symlink */ false)).then(
        function(repo) { console.log('repo: %o', repo); });
```

One thing that stands out to me about the current API for the
atom.repository-provider service is that the function used to create
a `RepositoryProvider` does not receive any arguments. If the creation
of the `GitRepositoryProvider` were done via the service, this would
be a problem because it needs a reference to `atom.project`, which is
not defined when it is created. (We work around this because it is
created in `Project`'s constructor, so it can pass `this` to
`new GitRepositoryProvider()`.)

We would have to create a `RepositoryProviderFactory` or something if
we wanted to specify arguments when creating a `RepositoryProvider`,
in general. Maybe that's too crazy / not an issue, in practice.

Though note that `GitRepository` cannot access `atom.project` lazily
because it uses it in its constructor to do the following:

```
if @project?
  @subscriptions.add @project.eachBuffer (buffer) => @subscribeToBuffer(buffer)
```

So long as we can guarantee that `atom.project` is defined before the
other providers are initialized, I think we should be OK.

Follow-up work:
* Replace the use of `RepositoryProvider.createRepositorySync()` with
`RepositoryProvider.repositoryForDirectory()` in `Project.setPaths()`.
* Replace all uses of `Project.getRepositories()` with
`Project.repositoryForDirectory()` in packages that are bundled with Atom
by default.
* Implement `Directory.exists()` and/or `Directory.existsSync()` and update
`git-repositor-provider.coffee`, as appropriate.
* Eliminate `GitRepositoryProvider.repositoryForDirectory()`'s use of
synchronous methods.
* Somewhat orthogonal to this diff, but the following fields need to be
removed from `Project` because they enforce the idea of a single root:
`path`, `rootDirectory`, and `repo`. This has implications around the
existing use of `@rootDirectory?.off()` and `@destroyRepo()`.
2015-02-10 21:46:02 -08:00
apm ⬆️ apm@0.135 2015-02-04 10:35:57 -08:00
benchmark Convert require ‘atom’ to require '../src/space-pen-extensions' 2014-11-26 14:55:38 -08:00
build Add executable value to desktop file template 2015-02-05 10:12:30 -08:00
docs Fix atom engine semver in upgrading docs 2015-02-05 15:07:16 +01:00
dot-atom Update default style sheet with ::shadow selector 2015-01-13 10:07:03 -07:00
exports Upgrade deprecations asking for space-pen to use atom-space-pen-views 2015-01-07 14:02:57 -08:00
keymaps Replaces usages of .mini selector with [mini] 2014-11-13 16:04:57 -08:00
menus Fix context menu when shadow DOM is enabled 2014-12-16 15:16:12 -08:00
resources Let Linux packages fully determine executable path 2015-02-04 11:06:20 -07:00
script Automated rpm package builds to '/usr' 2015-02-04 01:42:52 -07:00
spec Prompt split editors to save on close 2015-02-04 17:14:46 -08:00
src Set up the atom.repository-provider service and implement GitRepositoryProvider. 2015-02-10 21:46:02 -08:00
static rename esnext to 6to5 2015-01-29 17:29:02 -08:00
vendor Don’t require a specific jQuery instance for jasmine jQuery matchers 2014-11-06 15:27:45 -07:00
.gitattributes Add paths that work on Git 1.7 2014-06-11 13:24:54 -07:00
.gitignore Write control/desktop files to temp folder 2014-07-21 16:45:59 -07:00
.node-version use nodejs v0.10.33 and python 2.7.6 2014-12-08 21:40:31 +02:00
.npmrc Remove empty ca setting 2014-05-29 09:26:18 -07:00
.pairs Add Daniel to pairs file 2014-06-26 14:25:40 -07:00
.python-version use nodejs v0.10.33 and python 2.7.6 2014-12-08 21:40:31 +02:00
atom.sh Use ATOM_HOME for nohup.out location 2015-02-04 10:35:57 -08:00
coffeelint.json Treat debugger statements as lint errors 2014-09-30 13:25:55 -07:00
CONTRIBUTING.md Change HTTP to HTTPS. 2015-01-31 17:59:45 +08:00
Dockerfile 📝 Tweak image description 2014-10-23 09:11:13 -07:00
LICENSE.md Add .md extension 2014-04-23 15:36:57 -07:00
package.json ⬆️ timecop@0.29 2015-02-05 10:55:06 -08:00
README.md Tweak chocolatey instructions 2015-02-04 13:35:47 -08:00

Atom

Atom is a hackable text editor for the 21st century, built on atom-shell, and based on everything we love about our favorite editors. We designed it to be deeply customizable, but still approachable using the default configuration.

Visit atom.io to learn more or visit the Atom forum.

Visit issue #3684 to learn more about the Atom 1.0 roadmap.

Installing

OS X

Download the latest Atom release.

Atom will automatically update when a new release is available.

Windows

Download the latest AtomSetup.exe installer.

Atom will automatically update when a new release is available.

You can also download an atom-windows.zip file from the releases page. The .zip version will not automatically update.

Using chocolatey? Run cinst Atom to install the latest version of Atom.

Debian Linux (Ubuntu)

Currently only a 64-bit version is available.

  1. Download atom-amd64.deb from the Atom releases page.
  2. Run sudo dpkg --install atom-amd64.deb on the downloaded package.
  3. Launch Atom using the installed atom command.

The Linux version does not currently automatically update so you will need to repeat these steps to upgrade to future releases.

Red Hat Linux (Fedora, CentOS, Red Hat)

Currently only a 64-bit version is available.

  1. Download atom.x86_64.rpm from the Atom releases page.
  2. Run sudo yum localinstall atom.x86_64.rpm on the downloaded package.
  3. Launch Atom using the installed atom command.

The Linux version does not currently automatically update so you will need to repeat these steps to upgrade to future releases.

Building

Developing

Check out the guides and the API reference.