Skip to content

Commit

Permalink
LICENCE, build script, and README stub
Browse files Browse the repository at this point in the history
  • Loading branch information
cortesi committed Dec 5, 2015
1 parent bb4d6db commit 26b4588
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Aldo Cortesi <[email protected]>

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.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[![Build Status](https://drone.io/github.com/cortesi/modd/status.png)](https://drone.io/github.com/cortesi/modd/latest)

# modd: trigger commands when files change



# Install

Go to the [releases page](https://github.com/cortesi/modd/releases/latest),
download the package for your OS, and copy the binary to somewhere on your
PATH.

If you have a working Go installation, you can also say

go get github.com/cortesi/modd/cmd/modd


# Quick start

TODO


# Features


### Cross-platform and self-contained

Modd is a single statically compiled binary with no external dependencies, and
is released for OSX, Linux and Windows.


### Designed for the terminal

This means no config file, no daemonization, and logs that are designed to be
read in the terminal by a developer.


### Does file change detection right



### Restart daemons tenderly and correctly



### Separate daemons and prep commands



## Excluding files

The **-x** flag supports the following terms:

Term | Meaning
------------- | -------
`*` | matches any sequence of non-path-separators
`**` | matches any sequence of characters, including path separators
`?` | matches any single non-path-separator character
`[class]` | matches any single non-path-separator character against a class of characters
`{alt1,...}` | matches a sequence of characters if one of the comma-separated alternatives matches

Any character with a special meaning can be escaped with a backslash (`\`). Character classes support the following:

Class | Meaning
---------- | -------
`[abc]` | matches any single character within the set
`[a-z]` | matches any single character in the range
`[^class]` | matches any single character which does *not* match the class
86 changes: 86 additions & 0 deletions build
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/usr/bin/env python

import contextlib
import fnmatch
import glob
import os
import shutil
import subprocess


DSTDIR = "./tmp"
ARCHS = [
("darwin", "amd64", "osx64", "tgz"),
("windows", "amd64", "windows64", "zip"),
("linux", "amd64", "linux64", "tgz"),
("linux", "arm", "linuxARM", "tgz"),
("netbsd", "amd64", "netbsd64", "tgz"),
("netbsd", "arm", "netbsdARM", "tgz"),
("openbsd", "amd64", "openbsd64", "tgz"),
]


@contextlib.contextmanager
def chdir(newdir):
curdir = os.getcwd()
try:
os.chdir(newdir)
yield
finally:
os.chdir(curdir)


def version():
print "Installing locally"
subprocess.call(["go", "install", "./cmd/modd"])
p = subprocess.Popen(["modd", "--version"], stderr=subprocess.PIPE)
return p.communicate()[1].strip()


def build(vers, goos, goarch, name, archive):
dst = os.path.join(DSTDIR, "modd-%s-%s"%(vers, name))
print "building to ", dst
for f in glob.glob(dst + "*"):
if os.path.isdir(f):
shutil.rmtree(f)
else:
os.unlink(f)
os.makedirs(dst)
env = os.environ.copy()
env["GOOS"] = goos
env["GOARCH"] = goarch
subprocess.call(
[
"go", "build",
"-o", os.path.join(dst, "modd"),
"./cmd/modd"
],
env = env
)
if archive == "tgz":
print "\tmaking .tgz"
subprocess.Popen(
["tar", "-czvf", dst + ".tgz", dst],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
).communicate()
elif archive == "zip":
print "\tmaking .zip"
subprocess.Popen(
["zip", "-r", dst + ".zip", dst],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
).communicate()


def main():
v = version()
print "Version is: ", v

for i in ARCHS:
build(v, *i)

print "Cleaning static inclusions..."


main()

0 comments on commit 26b4588

Please sign in to comment.