Skip to content

Commit

Permalink
Prepare for public release.
Browse files Browse the repository at this point in the history
  • Loading branch information
longsleep committed Feb 13, 2014
1 parent 0b8444f commit 4d3dfb2
Show file tree
Hide file tree
Showing 16 changed files with 680 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*~
debian/files
debian/tmp
debian/golang-phoenix-dev*
6 changes: 6 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Names should be added to this file like so:
# Name <email address>
#
# Please keep the list sorted.

Lance Cooper <lance@struktur.de>
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Copyright (c) 2014, struktur AG
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 changes: 43 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
phoenix (0.1.0) precise; urgency=low

* Initial public release.

-- Simon Eisenmann <simon@struktur.de> Thu, 13 Feb 2014 14:43:07 +0100

phoenix (0.0.6) precise; urgency=low

* Fix handling of panics during server startup.
* Add support for setting configuration defaults prior to
server startup.

-- Lance Cooper <lance@struktur.de> Thu, 02 Jan 2014 17:06:25 -0600

phoenix (0.0.5) precise; urgency=low

* Fix exception on startup when no configfile was specified.

-- Lance Cooper <lance@struktur.de> Mon, 21 Oct 2013 14:58:05 -0500

phoenix (0.0.4) precise; urgency=low

* Fix build and installed dependencies.

-- Lance Cooper <lance@struktur.de> Wed, 16 Oct 2013 11:28:11 -0500

phoenix (0.0.3) precise; urgency=low

* Add ability to fetch app name and version strings.

-- Lance Cooper <lance@struktur.de> Wed, 02 Oct 2013 11:34:43 +0200

phoenix (0.0.2) precise; urgency=low

* Breaking change: fix blocking portion of api.

-- Lance Cooper <lance@struktur.de> Fri, 27 Sep 2013 15:23:40 +0200

phoenix (0.0.1) precise; urgency=low

* Initial release.

-- Lance Cooper <lance@struktur.de> Fri, 27 Sep 2013 13:27:17 +0200
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8
21 changes: 21 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Source: phoenix
Section: golang
Priority: extra
Maintainer: Lance Cooper <lance@struktur.de>
Build-Depends: debhelper (>= 8),
dh-golang,
golang-go (>= 1.1),
golang-goconf-dev,
golang-httputils-dev
Standards-Version: 3.9.3

Package: golang-phoenix-dev
Pre-Depends: dpkg (>= 1.15.6~)
Architecture: all
Depends: ${shlibs:Depends},
${misc:Depends},
golang-goconf-dev,
golang-httputils-dev
Description: phoenix
is a Golang library providing support functionality for application startup,
configuration, logging, and profiling.
35 changes: 35 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: phoenix
Source: http://github.com/strukturag/phoenix

Files: *
Copyright: Copyright (c) 2014, struktur AG
License: BSD-3-clause
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/share/gocode/src
3 changes: 3 additions & 0 deletions debian/lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Lintian doesn't know aboug section golang yet,
# but this is fine since it's in debian and ubuntu next.
golang-phoenix-dev: unknown-section golang
16 changes: 16 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/make -f

#export DH_VERBOSE=1

export DH_OPTIONS

export DH_GOPKG := golang.struktur.de/phoenix
TMPGOPATH = $(CURDIR)/debian/tmp/usr/share/gocode

override_dh_auto_install:
mkdir -p ${TMPGOPATH}/src/${DH_GOPKG}
# Copy all .go files to /usr/share/gocode (we compile and ship).
find . -path ./debian -prune -o -type f -name "*.go" -exec tar cf - {} + | (cd "${TMPGOPATH}/src/${DH_GOPKG}" && tar xvf -)

%:
dh $@ --with=golang
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
9 changes: 9 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2014 struktur AG. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package phoenix provides runtime support for long running server processes.
//
// In particular, it provides standardized mechanisms for handling logging,
// configuration, and HTTP server startup, as well as profiling support.
package phoenix
53 changes: 53 additions & 0 deletions logging.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2014 struktur AG. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package phoenix

import (
"io"
"os"
"path"
"sync"
)

func openLogWriter(logfile string) (wc io.WriteCloser, err error) {
// NOTE(lcooper): Closing stderr is generally considered a "bad thing".
wc = nopWriteCloser(os.Stderr)
if logfile != "" {
wc, err = os.OpenFile(path.Clean(logfile), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0640)
}
wc = newLockingWriteCloser(wc)
return
}

type lockingWriteCloser struct {
sync.Mutex
io.WriteCloser
}

// NOTE(lcooper): this shouldn't be a bottleneck in the general case,
// as the logger implementation already locks. However it does
// make the writer safe for access from multiple loggers at once.
// We don't lock on Close() since we're the only ones who call it.
func newLockingWriteCloser(wc io.WriteCloser) io.WriteCloser {
return &lockingWriteCloser{WriteCloser: wc}
}

func (wc *lockingWriteCloser) Write(bytes []byte) (int, error) {
wc.Lock()
defer wc.Unlock()
return wc.WriteCloser.Write(bytes)
}

type nopCloser struct {
io.Writer
}

func nopWriteCloser(w io.Writer) io.WriteCloser {
return &nopCloser{w}
}

func (closer *nopCloser) Close() error {
return nil
}
Loading

0 comments on commit 4d3dfb2

Please sign in to comment.