Skip to content

Commit 4d3dfb2

Browse files
committed
Prepare for public release.
1 parent 0b8444f commit 4d3dfb2

File tree

16 files changed

+680
-0
lines changed

16 files changed

+680
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*~
2+
debian/files
3+
debian/tmp
4+
debian/golang-phoenix-dev*

AUTHORS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Names should be added to this file like so:
2+
# Name <email address>
3+
#
4+
# Please keep the list sorted.
5+
6+
Lance Cooper <lance@struktur.de>

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Copyright (c) 2014, struktur AG
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are
6+
met:
7+
8+
1. Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright
12+
notice, this list of conditions and the following disclaimer in the
13+
documentation and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

debian/changelog

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
phoenix (0.1.0) precise; urgency=low
2+
3+
* Initial public release.
4+
5+
-- Simon Eisenmann <simon@struktur.de> Thu, 13 Feb 2014 14:43:07 +0100
6+
7+
phoenix (0.0.6) precise; urgency=low
8+
9+
* Fix handling of panics during server startup.
10+
* Add support for setting configuration defaults prior to
11+
server startup.
12+
13+
-- Lance Cooper <lance@struktur.de> Thu, 02 Jan 2014 17:06:25 -0600
14+
15+
phoenix (0.0.5) precise; urgency=low
16+
17+
* Fix exception on startup when no configfile was specified.
18+
19+
-- Lance Cooper <lance@struktur.de> Mon, 21 Oct 2013 14:58:05 -0500
20+
21+
phoenix (0.0.4) precise; urgency=low
22+
23+
* Fix build and installed dependencies.
24+
25+
-- Lance Cooper <lance@struktur.de> Wed, 16 Oct 2013 11:28:11 -0500
26+
27+
phoenix (0.0.3) precise; urgency=low
28+
29+
* Add ability to fetch app name and version strings.
30+
31+
-- Lance Cooper <lance@struktur.de> Wed, 02 Oct 2013 11:34:43 +0200
32+
33+
phoenix (0.0.2) precise; urgency=low
34+
35+
* Breaking change: fix blocking portion of api.
36+
37+
-- Lance Cooper <lance@struktur.de> Fri, 27 Sep 2013 15:23:40 +0200
38+
39+
phoenix (0.0.1) precise; urgency=low
40+
41+
* Initial release.
42+
43+
-- Lance Cooper <lance@struktur.de> Fri, 27 Sep 2013 13:27:17 +0200

debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8

debian/control

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Source: phoenix
2+
Section: golang
3+
Priority: extra
4+
Maintainer: Lance Cooper <lance@struktur.de>
5+
Build-Depends: debhelper (>= 8),
6+
dh-golang,
7+
golang-go (>= 1.1),
8+
golang-goconf-dev,
9+
golang-httputils-dev
10+
Standards-Version: 3.9.3
11+
12+
Package: golang-phoenix-dev
13+
Pre-Depends: dpkg (>= 1.15.6~)
14+
Architecture: all
15+
Depends: ${shlibs:Depends},
16+
${misc:Depends},
17+
golang-goconf-dev,
18+
golang-httputils-dev
19+
Description: phoenix
20+
is a Golang library providing support functionality for application startup,
21+
configuration, logging, and profiling.

debian/copyright

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: phoenix
3+
Source: http://github.com/strukturag/phoenix
4+
5+
Files: *
6+
Copyright: Copyright (c) 2014, struktur AG
7+
License: BSD-3-clause
8+
All rights reserved.
9+
10+
Redistribution and use in source and binary forms, with or without
11+
modification, are permitted provided that the following conditions are
12+
met:
13+
14+
1. Redistributions of source code must retain the above copyright
15+
notice, this list of conditions and the following disclaimer.
16+
17+
2. Redistributions in binary form must reproduce the above copyright
18+
notice, this list of conditions and the following disclaimer in the
19+
documentation and/or other materials provided with the distribution.
20+
21+
3. Neither the name of the copyright holder nor the names of its
22+
contributors may be used to endorse or promote products derived from
23+
this software without specific prior written permission.
24+
25+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

debian/install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
usr/share/gocode/src

debian/lintian-overrides

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Lintian doesn't know aboug section golang yet,
2+
# but this is fine since it's in debian and ubuntu next.
3+
golang-phoenix-dev: unknown-section golang

debian/rules

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/make -f
2+
3+
#export DH_VERBOSE=1
4+
5+
export DH_OPTIONS
6+
7+
export DH_GOPKG := golang.struktur.de/phoenix
8+
TMPGOPATH = $(CURDIR)/debian/tmp/usr/share/gocode
9+
10+
override_dh_auto_install:
11+
mkdir -p ${TMPGOPATH}/src/${DH_GOPKG}
12+
# Copy all .go files to /usr/share/gocode (we compile and ship).
13+
find . -path ./debian -prune -o -type f -name "*.go" -exec tar cf - {} + | (cd "${TMPGOPATH}/src/${DH_GOPKG}" && tar xvf -)
14+
15+
%:
16+
dh $@ --with=golang

debian/source/format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (native)

doc.go

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

logging.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright 2014 struktur AG. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package phoenix
6+
7+
import (
8+
"io"
9+
"os"
10+
"path"
11+
"sync"
12+
)
13+
14+
func openLogWriter(logfile string) (wc io.WriteCloser, err error) {
15+
// NOTE(lcooper): Closing stderr is generally considered a "bad thing".
16+
wc = nopWriteCloser(os.Stderr)
17+
if logfile != "" {
18+
wc, err = os.OpenFile(path.Clean(logfile), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0640)
19+
}
20+
wc = newLockingWriteCloser(wc)
21+
return
22+
}
23+
24+
type lockingWriteCloser struct {
25+
sync.Mutex
26+
io.WriteCloser
27+
}
28+
29+
// NOTE(lcooper): this shouldn't be a bottleneck in the general case,
30+
// as the logger implementation already locks. However it does
31+
// make the writer safe for access from multiple loggers at once.
32+
// We don't lock on Close() since we're the only ones who call it.
33+
func newLockingWriteCloser(wc io.WriteCloser) io.WriteCloser {
34+
return &lockingWriteCloser{WriteCloser: wc}
35+
}
36+
37+
func (wc *lockingWriteCloser) Write(bytes []byte) (int, error) {
38+
wc.Lock()
39+
defer wc.Unlock()
40+
return wc.WriteCloser.Write(bytes)
41+
}
42+
43+
type nopCloser struct {
44+
io.Writer
45+
}
46+
47+
func nopWriteCloser(w io.Writer) io.WriteCloser {
48+
return &nopCloser{w}
49+
}
50+
51+
func (closer *nopCloser) Close() error {
52+
return nil
53+
}

0 commit comments

Comments
 (0)