Permalink
Browse files

Packaging.

  • Loading branch information...
1 parent 822aa33 commit ac54da99903cf4e627f90c59ae736e3261937118 @ralphbean ralphbean committed Nov 5, 2012
Showing with 147 additions and 21 deletions.
  1. +2 −0 .gitignore
  2. +19 −0 LICENSE
  3. +55 −0 apps-fp-o.spec
  4. +36 −0 bin/yaml2html.py
  5. +18 −2 {data → bin}/yaml2json.py
  6. +0 −19 data/yaml2html.py
  7. +17 −0 make-release.sh
View
@@ -1,2 +1,4 @@
*.swp
*.pyc
+build
+dist
View
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Red Hat Inc. - Author: Ralph Bean <rbean@redhat.com>
+
+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.
View
@@ -0,0 +1,55 @@
+%global prefix /srv/web
+
+Name: apps-fp-o
+Version: 0.1
+Release: 1%{?dist}
+Summary: A landing page for apps.fedoraproject.org
+
+License: MIT
+URL: http://github.com/ralphbean/apps.fp.o
+# Use "./make-release.sh" from a git snapshot
+# Please update the version number liberally.
+Source0: %{name}-%{version}.tar.gz
+
+# Used for the yaml2{json,html}.py scripts.
+Requires: PyYAML
+
+%description
+This is static HTML, CSS, and javascript for a landing page for
+http://apps.fedoraproject.org/packages.
+
+Change the /usr/share/apps.fp.o/apps.yaml file and re-run
+apps-fp-o-yaml2json.py and apps-fp-o-yaml2html.py to update the
+diagram.
+
+%prep
+%setup -q
+
+%build
+# Nada
+
+%install
+mkdir -p %{buildroot}/%{_bindir}
+install -m 0755 bin/yaml2html.py %{buildroot}/%{_bindir}/%{name}-yaml2html.py
+install -m 0755 bin/yaml2json.py %{buildroot}/%{_bindir}/%{name}-yaml2json.py
+
+mkdir -p %{buildroot}/%{_datadir}/%{name}
+install -m 0644 data/* %{buildroot}/%{_datadir}/%{name}
+
+mkdir -p %{buildroot}/%{prefix}/%{name}
+cp -r {index.html,apps-yaml.html,bootstrap,css,img,js} %{buildroot}/%{prefix}/%{name}/.
+
+%files
+%doc README.rst LICENSE CONTRIBUTING.rst
+
+%{_bindir}/%{name}-yaml2json.py
+%{_bindir}/%{name}-yaml2html.py
+
+%{_datadir}/%{name}/apps.yaml
+
+# The rest of the content goes here
+%{prefix}/%{name}/
+
+%changelog
+* Mon Nov 05 2012 Ralph Bean <rbean@redhat.com> - 0.1-1
+- Initial packaging for Fedora Infrastructure
View
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+""" Convert our apps.yaml file to raw HTMl, to stdout. """
+
+
+import os
+import yaml
+
+
+def find_data_file():
+ name = "apps.yaml"
+ locations = [
+ os.path.abspath('./data'),
+ '/usr/share/apps-fp-o',
+ ]
+ for location in locations:
+ filename = location + '/' + name
+ if os.path.exists(filename):
+ return filename
+
+ raise IOError("No config file found %r %r" % (locations, name))
+
+if __name__ == '__main__':
+ filename = find_data_file()
+ with open(filename, "r") as f:
+ raw = f.read()
+ print """<html><body>
+
+<!--
+Don't edit this html file, edit data/apps.yaml
+instead and regenerate this file with yaml2html.py
+-->
+
+<pre>
+%s
+</pre>
+</body></html>""" % raw
View
@@ -1,12 +1,27 @@
#!/usr/bin/env python
""" Convert our apps.yaml file to JSON, to stdout. """
+import os
import yaml
import json
next_id = 0
+def find_data_file():
+ name = "apps.yaml"
+ locations = [
+ os.path.abspath('./data'),
+ '/usr/share/apps-fp-o',
+ ]
+ for location in locations:
+ filename = location + '/' + name
+ if os.path.exists(filename):
+ return filename
+
+ raise IOError("No config file found %r %r" % (locations, name))
+
+
def mangle(d):
global next_id
d['id'] = next_id
@@ -24,13 +39,14 @@ def mangle(d):
js_file_header = """
/*
* Warning.
- * Do not edit this file. It is generated from data/apps.yaml
+ * Do not edit this file. It is generated from dataapps.yaml
* ...edit that file instead.
*/
"""
if __name__ == '__main__':
- with open("apps.yaml", "r") as f:
+ filename = find_data_file()
+ with open(filename, "r") as f:
d = yaml.load(f.read())
d = mangle(d)
print js_file_header
View
@@ -1,19 +0,0 @@
-#!/usr/bin/env python
-""" Convert our apps.yaml file to raw HTMl, to stdout. """
-
-import yaml
-
-if __name__ == '__main__':
- with open("apps.yaml", "r") as f:
- raw = f.read()
- print """<html><body>
-
-<!--
-Don't edit this html file, edit data/apps.yaml
-instead and regenerate this file with yaml2html.py
--->
-
-<pre>
-%s
-</pre>
-</body></html>""" % raw
View
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# Enable negative glob
+shopt -s extglob
+
+VERSION=0.1
+
+rm -rf build
+mkdir -p build/apps-fp-o-$VERSION
+mkdir -p dist
+cp -r !(build|dist) build/apps-fp-o-$VERSION/.
+rm -rf build/apps-fp-o-$VERSION/{build,dist}
+pushd build
+tar -czvf ../dist/apps-fp-o-$VERSION.tar.gz apps-fp-o-$VERSION
+popd
+
+echo Wrote dist/apps-fp-o-$VERSION.tar.gz

0 comments on commit ac54da9

Please sign in to comment.