Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pearkes committed May 8, 2013
0 parents commit f39a5e8
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,3 @@
## 0.0.1 (unreleased)

Initial release.
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,28 @@
# Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


## Development Environment

To add a feature, fix a bug, or to run a development build of `get`
on your machine, you'll need to have [go](http://golang.org/) installed.

You can then build a binary:

$ go build

And run it:

$ ./get

To install the development binary on your system:

$ chmod +x ./get
$ [sudo] cp get /usr/bin/

If you need help with your environment, feel free to open an issue.
22 changes: 22 additions & 0 deletions LICENSE.md
@@ -0,0 +1,22 @@
Copyright (c) 2013 Jack Pearkes

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
66 changes: 66 additions & 0 deletions README.md
@@ -0,0 +1,66 @@
# get

![Demo Gif]()

## Overview

`get` helps you keep all of your git repositories that have GitHub
remotes up to date.

It's opinionated about how you organize your repositories. When
you run `get` the first time, it will build you something like this:

├── pearkes
│   ├── get
│   ├── tugboat
│   └── jack.ly
├── mitchellh
│   └── vagrant
├── amadeus
│   └── html7
├── someorg
│   └── bigproject
└── someotherorg
└── biggerproject

Basically, your repositories will be name-spaced according
to who the owner is on GitHub.

It's really useful if you have a lot of repos and an inconsistent network
connection. Before hopping on a plane, train or automobile, run: `get`.

## The Command

get

1. Checks to see if the necessary requirements for `get` exist
2. If it needs to, asks for your credentials to talk to GitHub
3. Clones any missing repositories
4. Runs `git fetch` in repostories that exist

This is done in parallel as much as possible to speed things up.

## Configuration

Configuration is stored in a `.getconfig` file in your home directory.
(`~/.getconfig`)

### Ignored Repositories or Organizations

Sometimes you don't want to retrieve that gigantic project that
someone committed `.mov` files to.

repo-ignore: icloud, facebook
owner-ignore: adobe

### Binary Paths

`get` uses `curl` and `git`. It'll use whatever is in your `PATH`, but
that can be overidden.

curl-path: /usr/local/bin/curl
git-path: /usr/local/bin/git

## Contributing

Check out the [contributing guide]().
138 changes: 138 additions & 0 deletions main.go
@@ -0,0 +1,138 @@
package main

import (
"flag"
"fmt"
"os"
)

// We pass around the environment and attach various useful things to
// it, like arguments to `get` and the configuration.
type Env struct {
Config Configuration
ProvidedPath string
Path string
}

// type Configuration is built from the file ~/.getconfig.
type Configuration struct {
Token string
Path string
IgnoredOwners []string
IgnoredRepos []string
}

// type Locals represents the list of local owners (1st level) and
// local repos (2nd level). It is read from the file system, from the
// path specified by either an argument or the configuration.
type Locals struct {
Owners []string
Repos []string
}

// type Remotes represents the list of remote owners and repos for
// each of those retrieved from the GitHub API.
type Remotes struct {
Owners []string
Repos []string
}

// Creates configuration at ~/.getconfig.
func createConfiguration() {

}

// Injects the configuration into the environment.
func injectConfiguration() {
// conf := Configiration{}
}

// Checks the configuration on the filesystem for syntax errors or
// non-exsistance.
func checkConfiguration(conf Configuration) {

}

// Asks the user for credentials, and then makes a request to the
// GitHub API to get an authorization token to store in ~/.getconfig
func askForCredentials() {

}

// Checks a path to see if it is get compatible. If not, it raises an
// error.
func checkPath(env Env) {
var path string

if env.ProvidedPath != "" {
path = env.ProvidedPath

} else if env.Config.Path != "" {
path = env.Config.Path
}

_, err := os.Stat(path)
if err != nil {
// They haven't set-up a path, let's take them through it.
sequence_authorize(env)
}
}

// Retrieves a list of all available repostories and builds them up into
// something we can handle locally. After this occurs, we begin our
// clone / fetch sequence.
func listRepostories() {

}

// The authorization sequence, required for someone without a ~/.getconfig
func sequence_authorize(env Env) Env {
return env
}

// The update sequence, which retrieves the repos and fetches or clones
// each of them.
func sequence_update() {

}

// The check sequence, which goes through the basic health checks for
// `get` to succesfully function.
func sequence_checks(env Env) Env {
checkConfiguration(env.Config)
checkPath(env)
return env
}

// Parses options sent to `get` and kicks off the main event.
func main() {
flag.Parse()

// conf := injectConfiguration()

env := Env{ProvidedPath: flag.Arg(0)}

// Run checks
env = sequence_checks(env)
//
{

}
}

func usage() {
fmt.Println(`Usage: get [<path>] [-v] [-h] [-d]
-v, --version Prints the version and exits.
-h, --help Prints the usage information.
-d, --debug Logs debugging information to STDOUT.
Arguments:
path The path to place or update the
repostories. Defaults to the path
in ~/.get.
To learn more or to contribute, please see github.com/pearkes/get`)
os.Exit(1)
}
14 changes: 14 additions & 0 deletions version.go
@@ -0,0 +1,14 @@
package main

import (
"fmt"
)

func Version() []int {
return []int{0, 0, 1}
}

func VersionString() string {
v := Version()
return fmt.Sprintf("%d.%02d.%02d", v[0], v[1], v[2])
}

0 comments on commit f39a5e8

Please sign in to comment.