Branch: refs/heads/master
Author: Matthew Brush <mbrush(a)codebrainz.ca>
Committer: Matthew Brush <mbrush(a)codebrainz.ca>
Date: Tue, 18 Jun 2013 10:31:17 UTC
Commit: 157abb992ce10d77f51fb99cce36154ca2384e2a
https://github.com/geany/geany-themes/commit/157abb992ce10d77f51fb99cce3615…
Log Message:
-----------
Add `make help` to Makefile with a little bit of info
Modified Paths:
--------------
Makefile
Modified: Makefile
29 files changed, 27 insertions(+), 2 deletions(-)
===================================================================
@@ -12,7 +12,7 @@ ARCHIVE_TEMP_DIR = geany-themes-$(THEMES_VERSION)
# dummy rule to handle default case, doesn't do anything useful
all:
- @echo "Nothing to do, use \`make install' instead."
+ @echo "Nothing to do, use \`make help' for info."
install:
mkdir -p $(COLORSCHEME_DIR)
@@ -45,4 +45,29 @@ dist: $(THEMES) README.md Makefile ChangeLog AUTHORS COPYING
tar -cjf $(ARCHIVE_NAME) $(ARCHIVE_TEMP_DIR)/
rm -rf $(ARCHIVE_TEMP_DIR) ChangeLog
-.PHONY: all install uninstall dist ChangeLog index clean
+help:
+ @echo "Geany-Themes Makefile Help"
+ @echo "=========================="
+ @echo ""
+ @echo " This is a little helper Makefile for managing the Geany-Themes "
+ @echo " source tree. Most users will at most want to use the "
+ @echo " \`make install' command or simply copy the files into the "
+ @echo " \`$(HOME)/.config/geany/colorschemes' directory."
+ @echo ""
+ @echo "Makefile Commands:"
+ @echo "------------------"
+ @echo " make install - Installs all color scheme .conf files"
+ @echo " make uninstall - Uninstall tracked color scheme files"
+ @echo " make index - Regenerate the index/index.json file"
+ @echo " make dist - Create a .tar.bz2 package for release"
+ @echo " make ChangeLog - Update the ChangeLog file from Git log"
+ @echo ""
+ @echo "Experimental commands:"
+ @echo "----------------------"
+ @echo " make colorsnormal - Normalize colour notation in schemes"
+ @echo " make defaultify - Add default values in the schemes"
+ @echo ""
+ @echo "For more up to date information, visit:"
+ @echo " https://github.com/geany/geany-themes"
+
+.PHONY: all install uninstall dist ChangeLog index clean help
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Matthew Brush <mbrush(a)codebrainz.ca>
Committer: Matthew Brush <mbrush(a)codebrainz.ca>
Date: Tue, 18 Jun 2013 10:31:17 UTC
Commit: fdbfeaf20609b045a6387796f6824cc42846da1a
https://github.com/geany/geany-themes/commit/fdbfeaf20609b045a6387796f6824c…
Log Message:
-----------
Improve machine API to the themes
* Improve index/index.json
* Add MD5 sum of that file into index/index.json.md5
* Remove experimental index.conf and index.xml files from the build
* Remove genindex script and related template files
* Add screenshot-missing.png icon to screenshots dir
- From elementary-xfce icon theme (status/64/image-missing.png)
* Update index/README.md detailing the format/fields of the JSON file.
Modified Paths:
--------------
Makefile
index/Makefile
index/README.md
index/index.conf
index/index.json
index/index.json.md5
index/index.xml
screenshots/screenshot-missing.png
scripts/Makefile
scripts/genindex
scripts/index.conf.in
scripts/index.json.in
scripts/index.xml.in
scripts/mkindex.py
Modified: Makefile
10 files changed, 5 insertions(+), 5 deletions(-)
===================================================================
@@ -27,8 +27,11 @@ uninstall:
# safety in case there's other stuff in there.
rm -f $(UNINSTALL_THEMES)
-indices:
- make -C scripts indices
+index:
+ make -C index
+
+clean:
+ make -C index clean
colorsnormal:
python scripts/colornorm.py $(THEMES)
@@ -36,9 +39,6 @@ colorsnormal:
usedefaults:
python scripts/defaultify.py $(THEMES)
-clean:
- make -C scripts clean
-
ChangeLog:
git --no-pager log --format="%ai %aN %n%n%x09* %s%n" > ChangeLog
Modified: index/Makefile
15 files changed, 15 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,15 @@
+scheme_files = $(wildcard ../colorschemes/*.conf)
+screen_files = $(wildcard ../screenshots/*.png)
+
+all: index.json index.json.md5
+
+index.json: $(scheme_files) $(screen_files)
+ python ../scripts/mkindex.py > $@
+
+index.json.md5: index.json
+ md5sum $< > $@
+
+clean:
+ rm -f index.json*
+
+.PHONY: all clean
Modified: index/README.md
101 files changed, 71 insertions(+), 30 deletions(-)
===================================================================
@@ -1,39 +1,80 @@
-Geany Themes Index Files README
-===============================
+Geany Themes Index File README
+==============================
-The files here are auto-generated using the `indices` rule to the main
-`Makefile`. Like `make indices` should result in these index files being
-regenerated (if needed).
+The `index.json` file is auto-generated using the `make index` command.
+The `index` rule of the Makefile runs the `scripts/mkindex.py` script
+which reads the colour schemes' info, generates screenshot and download
+URLs, base64 encoded 64x64 thumbnails and stores it all into a JSON
+formatted text file.
-Whenever a color scheme changes it's supposed to increment its `version`
-key in the `theme_info` group. This changing version number, output into
-the destination index files, will allow clients to detect newer versions
-of the color schemes.
+File Format
+-----------
-There are 3 output formats: [GKeyFile][gkf], [XML][xml] and [JSON][json].
-Looking at the generated files should make it obvious how to parse them. The
-canonical source if these files is:
+The JSON file consists of a top-level dictionary where the keys are
+the theme "identifiers" (ie. name used in filenames and code). The
+identifiers are not necessarily useful to humans.
-* [index.conf][gkfidx]
-* [index.xml][xmlidx]
-* [index.json][jsonidx]
+### Theme Info Fields
-Barring some Github outtage or them banning these links, they point to where
-clients can find the index files.
+#### author
-If you have updated one or more color scheme `.conf` files, change into the
-root Geany-Themes directory and run:
+The author field contains a name and usually an email address, although
+the value may be an empty string as well (ie. unknown author). This
+string is meant to be human-readable.
- $ make indices
+#### colorscheme
-The generated index files are checked into the Geany-Themes Git repository
-so there will be a bit of noise whenever updating color scheme files. It
-might be beneficial to make one commit for the real changes and one for
-updating the generated files.
+This is the download URL of the color scheme `.conf` file. If the file
+this URL points to is downloaded into the user's colour scheme directory,
+the colour scheme will be available in Geany for user once it's restarted.
+This field will never be empty.
-[gkf]: http://developer.gnome.org/glib/stable/glib-Key-value-file-parser.html
-[xml]: http://www.w3.org/XML
-[json]: http://www.json.org
-[gkfidx]: https://raw.github.com/codebrainz/geany-themes/master/index/index.conf
-[xmlidx]: https://raw.github.com/codebrainz/geany-themes/master/index/index.xml
-[jsonidx]: https://raw.github.com/codebrainz/geany-themes/master/index/index.json
+#### description
+
+A short description of the theme or an empty string. The string is meant
+to be displayed to human beings.
+
+#### md5hash
+
+An MD5 hash of the colour scheme `.conf` file from the last time it was
+changed. This value can be used to check if a local scheme needs updating
+and/or to verify the integrity of the file that could be downloaded using
+the `colorscheme` URL field. This field will never be empty.
+
+#### name
+
+A human-readable name of the colour scheme meant to be display for example
+in a GUI label/widget. This field will never be empty.
+
+#### screenshot
+
+This is the download URL for a preview image of the colour scheme. The
+image will always be in PNG format and the resolution, although not
+guaranteed, will be large enough to give an idea of what the colour
+scheme looks like. This may be an empty string if the color scheme
+doesn't have a screenshot or it may be a generic "screenshot missing"
+image.
+
+#### thumbnail
+
+This is a thumbnail image, 64 pixels wide and 64 pixels high, in PNG
+format, base64 encoded (for storing in text file). This is a small icon
+of the preview screenshot suitable for displaying for example in a GUI
+list of schemes. This maybe be an empty string if the colour scheme
+doesn't have a screenshot or it maybe be a generic "screenshit missing"
+icon that is 64 pixels wide and tall.
+
+#### version
+
+This field contains a whole number that is incremented each time the
+theme is changed. You can compare this against installed color scheme
+versions to see if an update is available.
+
+<s>The version number is a sequence of one or more digits, optionally
+separated by periods/decimal points. The string will always contain
+only 0-9 and optional decimal points in between any of the numbers,
+for example "1.2.3", "123", "12.3", but never "..2", ".2.", "....", etc.
+The result of splitting the string on the decimal point and converting
+each component into an integer will always succeed and the string will
+never be empty. One or more of the numbers in the string will move in
+the upward direction when the colour scheme is modified.</s>
Modified: index/index.conf
157 files changed, 0 insertions(+), 157 deletions(-)
===================================================================
@@ -1,157 +0,0 @@
-# This file is auto-generated from `index.conf.in`, do not edit!
-#
-# The special repositories group, for color schemes `repo_name` for
-# screenshots `repo_name_screens`. Both point to a URI that when having the
-# color schemes name and extension will resolve to a file. The basename is
-# each color scheme's group name here, ex. [bespin] is bespin.conf and
-# bespin.png for color schemes and screenshots, respectively.
-[repositories]
-default=https://raw.github.com/codebrainz/geany-themes/master/colorschemes
-default_screens=https://github.com/codebrainz/geany-themes/raw/master/screenshots
-
-# Each theme follows the pattern:
-# [theme_name]
-# name=The Theme Name
-# desc=The description of the theme.
-# repos=repo_name
-# vers=42
-[bespin]
-name=Bespin
-desc=A port of the Bespin theme.
-repos=default
-version=1.22.0
-
-[black]
-name=Black Scheme
-desc=Black background, other colours
-repos=default
-version=1.22.0
-
-[dark-fruit-salad]
-name=Dark Fruit Salad
-desc=Low contrast theme ported from the set_geany_colors utility
-repos=default
-version=1.22.0
-
-[dark]
-name=Dark
-desc=Dark syntax colouring theme
-repos=default
-version=1.22.0
-
-[fluffy]
-name=Fluffy
-desc=A soft and downy color scheme.
-repos=default
-version=1.22.0
-
-[gedit]
-name=Gedit
-desc=A port of Gedit's default theme.
-repos=default
-version=1.22.0
-
-[github]
-name=GitHub
-desc=Similar to GitHub.com's highlighting colors.
-repos=default
-version=1.22.0
-
-[inkpot]
-name=InkPot
-desc=Based on the vim theme of the same name.
-repos=default
-version=1.22.0
-
-[kugel]
-name=Kugel
-desc=A dark, but not too dark with focus to be comfortable to the eyes.
-repos=default
-version=1.22.0
-
-[mc]
-name=Ralesk's MC
-desc=Midnight Commander-like scheme
-repos=default
-version=1.22.1
-
-[monokai]
-name=Monokai
-desc=It's warm, colorful and pleasing to the eyes
-repos=default
-version=1.0
-
-[oblivion2]
-name=Oblivion 2
-desc=Based on the Gedit color scheme Oblivion and the Dark Color Scheme with rearranged colors.
-repos=default
-version=1.22.0
-
-[pygments]
-name=Pygments
-desc=Default Pygments theme for Geany
-repos=default
-version=1.22.0
-
-[railcasts2]
-name=Railcasts 2
-desc=A port of railscasts2 from gedit-themes.
-repos=default
-version=1.22.0
-
-[retro]
-name=Retro
-desc=Inspired by old green screen terminals.
-repos=default
-version=0.01
-
-[slushpoppies]
-name=Slush and Poppies
-desc=A port of Slush and Poppies from gedit-themes.
-repos=default
-version=1.22.0
-
-[solarized-dark]
-name=Solarized (dark)
-desc=Dark Solarized theme for Geany
-repos=default
-version=1.22.0
-
-[solarized-light]
-name=Solarized (light)
-desc=Light Solarized theme for Geany
-repos=default
-version=1.22.0
-
-[tango-dark]
-name=Tango
-desc=Loosely based on the Dark theme, but Tangofied.
-repos=default
-version=1.22.0
-
-[tango-light]
-name=Tango Light
-desc=A light theme using Tango colors.
-repos=default
-version=1.22.0
-
-[tinge]
-name=Tinge
-desc=A tinge more tanginess
-repos=default
-version=1.22.0
-
-[vibrant-ink]
-name=Vibrant
-desc=Vibrant Ink Theme for Geany
-repos=default
-version=1.22.0
-
-[zenburn]
-name=Zenburn
-desc=A port of Zenburn from gedit-themes.
-repos=default
-version=1.22.0
-
-
-
Modified: index/index.json
375 files changed, 229 insertions(+), 146 deletions(-)
===================================================================
No diff available, check online
Modified: index/index.json.md5
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1 @@
+909a1c759ba0bc8ea2181dc856c4c269 index.json
Modified: index/index.xml
196 files changed, 0 insertions(+), 196 deletions(-)
===================================================================
@@ -1,196 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This file is auto-generated, do not edit! -->
-<index>
- <repos>
- <repo name="default"
- href="https://raw.github.com/codebrainz/geany-themes/master/colorschemes"
- screens="https://github.com/codebrainz/geany-themes/raw/master/screenshots"/>
- </repos>
- <themes>
- <theme id="bespin">
- <name>Bespin</name>
- <desc>A port of the Bespin theme.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="black">
- <name>Black Scheme</name>
- <desc>Black background, other colours</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="dark-fruit-salad">
- <name>Dark Fruit Salad</name>
- <desc>Low contrast theme ported from the set_geany_colors utility</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="dark">
- <name>Dark</name>
- <desc>Dark syntax colouring theme</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="fluffy">
- <name>Fluffy</name>
- <desc>A soft and downy color scheme.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="gedit">
- <name>Gedit</name>
- <desc>A port of Gedit's default theme.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="github">
- <name>GitHub</name>
- <desc>Similar to GitHub.com's highlighting colors.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="inkpot">
- <name>InkPot</name>
- <desc>Based on the vim theme of the same name.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="kugel">
- <name>Kugel</name>
- <desc>A dark, but not too dark with focus to be comfortable to the eyes.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="mc">
- <name>Ralesk's MC</name>
- <desc>Midnight Commander-like scheme</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.1</version>
- </theme>
- <theme id="monokai">
- <name>Monokai</name>
- <desc>It's warm, colorful and pleasing to the eyes</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.0</version>
- </theme>
- <theme id="oblivion2">
- <name>Oblivion 2</name>
- <desc>Based on the Gedit color scheme Oblivion and the Dark Color Scheme with rearranged colors.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="pygments">
- <name>Pygments</name>
- <desc>Default Pygments theme for Geany</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="railcasts2">
- <name>Railcasts 2</name>
- <desc>A port of railscasts2 from gedit-themes.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="retro">
- <name>Retro</name>
- <desc>Inspired by old green screen terminals.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>0.01</version>
- </theme>
- <theme id="slushpoppies">
- <name>Slush and Poppies</name>
- <desc>A port of Slush and Poppies from gedit-themes.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="solarized-dark">
- <name>Solarized (dark)</name>
- <desc>Dark Solarized theme for Geany</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="solarized-light">
- <name>Solarized (light)</name>
- <desc>Light Solarized theme for Geany</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="tango-dark">
- <name>Tango</name>
- <desc>Loosely based on the Dark theme, but Tangofied.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="tango-light">
- <name>Tango Light</name>
- <desc>A light theme using Tango colors.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="tinge">
- <name>Tinge</name>
- <desc>A tinge more tanginess</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="vibrant-ink">
- <name>Vibrant</name>
- <desc>Vibrant Ink Theme for Geany</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- <theme id="zenburn">
- <name>Zenburn</name>
- <desc>A port of Zenburn from gedit-themes.</desc>
- <repos>
- <repo>default</repo>
- </repos>
- <version>1.22.0</version>
- </theme>
- </themes>
-</index>
-
Modified: screenshots/screenshot-missing.png
0 files changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online
Modified: scripts/Makefile
16 files changed, 0 insertions(+), 16 deletions(-)
===================================================================
@@ -1,16 +0,0 @@
-
-indices: ../index/index.conf ../index/index.xml ../index/index.json
-
-../index/index.conf: index.conf.in
- python genindex $< ../colorschemes/*.conf > $@
-
-../index/index.xml: index.xml.in
- python genindex $< ../colorschemes/*.conf > $@
-
-../index/index.json: index.json.in
- python genindex $< ../colorschemes/*.conf > $@
-
-clean:
- rm -f ../index/index.conf ../index/index.xml ../index/index.json
-
-.PHONY: indices clean
Modified: scripts/genindex
109 files changed, 0 insertions(+), 109 deletions(-)
===================================================================
@@ -1,109 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Generates the index files in the `index` directory. Determines format based
-on the input file's extension:
- 'conf.in' -> ../index/index.conf
- 'xml.in' -> ../index/index.xml
- 'json.in' -> ../index/index.json
-
-Usage: genindex index.ext.in COLORSCHEME_FILES...
-"""
-
-import os
-import sys
-try:
- from configparser import SafeConfigParser
-except ImportError:
- from ConfigParser import SafeConfigParser
-
-def usage(f):
- f.write("Usage: %s TEMPLATE COLOR_SCHEMES...\n" % os.path.basename(__file__))
-
-def gen_conf_code(title, name, desc, repos, vers):
- code = '[%s]\n' % title
- code += 'name=%s\n' % name
- code += 'desc=%s\n' % desc
- code += 'repos=%s\n' % ';'.join(repos)
- code += 'version=%s\n\n' % vers
- return code
-
-def gen_xml_code(title, name, desc, repos, vers):
- code = '\n <theme id="%s">\n' % title
- code += ' <name>%s</name>\n' % name
- code += ' <desc>%s</desc>\n' % desc
- code += ' <repos>\n'
- for repo in repos:
- code += ' <repo>%s</repo>\n' % repo
- code += ' </repos>\n'
- code += ' <version>%s</version>\n' % vers
- code += ' </theme>'
- return code
-
-def gen_json_code(title, name, desc, repos, vers):
- code = ' "%s": {\n' % title
- code += ' "name": "%s",\n' % name
- code += ' "desc": "%s",\n' % desc
- code += ' "repos": [%s],\n' % ','.join(['"%s"'%r for r in repos])
- code += ' "version": "%s"\n' % vers
- code += ' },\n'
- return code
-
-CODE_MAP = {
- "conf": gen_conf_code,
- "xml": gen_xml_code,
- "json": gen_json_code,
-}
-
-def main(args):
- if len(args) < 2:
- sys.stderr.write("error: no template file specified\n")
- usage(sys.stderr)
- return 1
- mode = ''
- tmpl_file = args[1]
- if tmpl_file.endswith('.conf.in'):
- mode = 'conf'
- elif tmpl_file.endswith('.xml.in'):
- mode = 'xml'
- elif tmpl_file.endswith('.json.in'):
- mode = 'json'
- else:
- sys.stderr.write('error: unknown template format for "%s"' % tmpl_file)
- return 2
- if len(args) < 3:
- sys.stderr.write("error: no color scheme(s) specified\n")
- usage(sys.stderr)
- return 3
- code = ''
- cs_files = args[2:]
- for cs_file in cs_files:
- conf = SafeConfigParser()
- conf.read(cs_file)
- if conf.has_section('theme_info'):
- fn = os.path.basename(cs_file)
- title = fn
- if fn.endswith(".conf"):
- title = fn[:-5]
- if conf.has_option('theme_info', 'name'):
- name = conf.get('theme_info', 'name')
- else:
- name = title
- if conf.has_option('theme_info', 'description'):
- desc = conf.get('theme_info', 'description')
- else:
- desc = ''
- repos = ['default']
- if conf.has_option('theme_info', 'version'):
- vers = conf.get('theme_info', 'version')
- else:
- vers = str(int(os.stat(cs_file).st_mtime))
- code += CODE_MAP[mode](title, name, desc, repos, vers)
- if mode == 'json' and code.endswith(',\n'):
- code = code[:-2] + '\n'
- tmpl_text = open(tmpl_file).read()
- tmpl_text = tmpl_text.replace("##themes##", code)
- print(tmpl_text)
- return 0
-
-if __name__ == "__main__": sys.exit(main(sys.argv))
Modified: scripts/index.conf.in
18 files changed, 0 insertions(+), 18 deletions(-)
===================================================================
@@ -1,18 +0,0 @@
-# This file is auto-generated from `index.conf.in`, do not edit!
-#
-# The special repositories group, for color schemes `repo_name` for
-# screenshots `repo_name_screens`. Both point to a URI that when having the
-# color schemes name and extension will resolve to a file. The basename is
-# each color scheme's group name here, ex. [bespin] is bespin.conf and
-# bespin.png for color schemes and screenshots, respectively.
-[repositories]
-default=https://raw.github.com/codebrainz/geany-themes/master/colorschemes
-default_screens=https://github.com/codebrainz/geany-themes/raw/master/screenshots
-
-# Each theme follows the pattern:
-# [theme_name]
-# name=The Theme Name
-# desc=The description of the theme.
-# repos=repo_name
-# vers=42
-##themes##
Modified: scripts/index.json.in
10 files changed, 0 insertions(+), 10 deletions(-)
===================================================================
@@ -1,10 +0,0 @@
-{
- "repos": {
- "default": {
- "src": "https://raw.github.com/codebrainz/geany-themes/master/colorschemes",
- "screens": "https://github.com/codebrainz/geany-themes/raw/master/screenshots"
- }
- },
- "themes": {
-##themes## }
-}
Modified: scripts/index.xml.in
11 files changed, 0 insertions(+), 11 deletions(-)
===================================================================
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This file is auto-generated, do not edit! -->
-<index>
- <repos>
- <repo name="default"
- href="https://raw.github.com/codebrainz/geany-themes/master/colorschemes"
- screens="https://github.com/codebrainz/geany-themes/raw/master/screenshots"/>
- </repos>
- <themes>##themes##
- </themes>
-</index>
Modified: scripts/mkindex.py
102 files changed, 102 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+
+'''
+Creates a JSON index file listing information about all of the color schemes.
+Note: requires Python Imaging Library (PIL), ex. 'python-imaging' Debian package.
+'''
+
+import os
+import sys
+import json
+import ConfigParser
+import hashlib
+import base64
+import StringIO
+import Image, ImageDraw, ImageOps, ImageFilter
+
+SCREENSHOT_BASE = 'https://raw.github.com/geany/geany-themes/master/screenshots/'
+SCHEMES_BASE = 'https://raw.github.com/geany/geany-themes/master/colorschemes/'
+
+def get_option(cp, group, key, default=None):
+ try: return cp.get(group, key)
+ except ConfigParser.Error: return default
+
+def generate_thumbnail(conf_fn, screenshot_dir='screenshots'):
+ base = os.path.splitext(os.path.basename(conf_fn))[0]
+ png_file = os.path.join(screenshot_dir, '%s.png' % base)
+
+ if not os.path.exists(png_file):
+ png_file = os.path.join(screenshot_dir, 'screenshot-missing.png')
+ img = Image.open(png_file)
+ output = StringIO.StringIO()
+ img.save(output, "PNG", optimize=True)
+ data = base64.b64encode(output.getvalue())
+ output.close()
+ return data
+ else:
+ img = Image.open(png_file)
+ img = img.crop((2,2,img.size[1]-2,img.size[1]-2))
+ img.thumbnail((64,64), Image.ANTIALIAS)
+#-- set to True to save thumbs into screenshots/.thumbs
+ do_thumbs = False
+ if do_thumbs:
+ thumb_dir = os.path.join(screenshot_dir, '.thumbs')
+ try:
+ os.makedirs(thumb_dir)
+ except OSError as e:
+ if e.errno != 17: raise
+ thumb_fn = os.path.join(thumb_dir, base + '.png')
+ img.save(thumb_fn, "PNG", optimize=True)
+#--
+ output = StringIO.StringIO()
+ img.save(output, "PNG", optimize=True)
+ data = base64.b64encode(output.getvalue())
+ output.close()
+
+ return data
+
+def create_index(themes_dir, screenshot_dir='screenshots'):
+ data = {}
+
+ for conf_file in os.listdir(themes_dir):
+
+ if not conf_file.endswith('.conf'):
+ continue
+
+ conf_file = os.path.join(themes_dir, conf_file)
+ cp = ConfigParser.ConfigParser()
+ cp.read(conf_file)
+
+ if not cp.has_section('theme_info'):
+ continue
+
+ scheme_name = '.'.join(os.path.basename(conf_file).split('.')[:-1])
+
+ try:
+ version = get_option(cp, 'theme_info', 'version', '0.0.0').split('.')
+ version = list(version + (['0']*3))[0:3]
+ except IndexError, TypeError:
+ version = ['0']*3
+
+ data[scheme_name] = {
+ 'name': get_option(cp, 'theme_info', 'name', 'Untitled'),
+ 'description': get_option(cp, 'theme_info', 'description', ''),
+ 'version': '.'.join(version),
+ 'author': get_option(cp, 'theme_info', 'author', 'Unknown Author'),
+ 'screenshot': '%s%s.png' % (SCREENSHOT_BASE, scheme_name),
+ 'colorscheme': '%s%s.conf' % (SCHEMES_BASE, scheme_name),
+ 'md5hash': hashlib.md5(open(conf_file).read()).hexdigest(),
+ 'thumbnail': generate_thumbnail(conf_file, screenshot_dir),
+ }
+
+ # json.dumps() leaves trailing whitespace on some lines, strip it off
+ data = json.dumps(data, indent=2, sort_keys=True).rstrip()
+ return '\n'.join([l.rstrip() for l in data.split('\n')]) + '\n'
+
+if __name__ == "__main__":
+ cur_dir = os.path.abspath(os.path.dirname(__file__))
+ root_dir = os.path.abspath(os.path.dirname(cur_dir))
+ screen_dir = os.path.join(root_dir, 'screenshots')
+ scheme_dir = os.path.join(root_dir, 'colorschemes')
+ index = create_index(scheme_dir, screen_dir)
+ sys.stdout.write(index)
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Matthew Brush <mbrush(a)codebrainz.ca>
Committer: Matthew Brush <mbrush(a)codebrainz.ca>
Date: Tue, 18 Jun 2013 10:31:17 UTC
Commit: dc03ceaa7432743176a1a19ff5636aaf91285d2b
https://github.com/geany/geany-themes/commit/dc03ceaa7432743176a1a19ff5636a…
Log Message:
-----------
Add simple `install.sh` script
In case someone is too lazy to copy manually and also to lazy to
install and use GNU Make.
Modified Paths:
--------------
install.sh
Modified: install.sh
10 files changed, 10 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,10 @@
+#!/bin/sh
+CSDIR="$HOME/.config/geany/colorschemes/"
+echo "Installing themes into \`$CSDIR'..."
+mkdir -p "$CSDIR"
+for SCHEME in `ls colorschemes/*.conf`
+do
+ BNAME=`basename "$SCHEME"`
+ echo " => $BNAME"
+ cp "$SCHEME" "$CSDIR"
+done
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Matthew Brush <mbrush(a)codebrainz.ca>
Committer: Matthew Brush <mbrush(a)codebrainz.ca>
Date: Tue, 18 Jun 2013 10:31:17 UTC
Commit: 8cc75499a53e46c3bdbdb7f4eba43d91ddc487bf
https://github.com/geany/geany-themes/commit/8cc75499a53e46c3bdbdb7f4eba43d…
Log Message:
-----------
Add automatic version bumping script
Makefile default rule now calls `autobump` and `index` targets. To
use this, call `make` after changing any of the colour schemes.
The way it works is versions.log contains the md5 sums of the
color scheme files. The autobump script checks the old sum from
versions.log against the current color scheme file and if any of
them changed, it opens the color scheme and increments the version
number in it and then stores the newly computed sum (after the bump)
back into versions.log. When the `index` rule is run in the Makefile,
it updates the `index.json` and `index.json.md5` files based on the
changes.
Modified Paths:
--------------
Makefile
scripts/autobump.py
scripts/versions.log
Modified: Makefile
12 files changed, 7 insertions(+), 5 deletions(-)
===================================================================
@@ -10,9 +10,7 @@ MISMATCH_MESSAGE = Warning: Possible wrong version of Geany installed
ARCHIVE_NAME = geany-themes-$(THEMES_VERSION).tar.bz2
ARCHIVE_TEMP_DIR = geany-themes-$(THEMES_VERSION)
-# dummy rule to handle default case, doesn't do anything useful
-all:
- @echo "Nothing to do, use \`make help' for info."
+all: autobump index
install:
mkdir -p $(COLORSCHEME_DIR)
@@ -23,9 +21,12 @@ uninstall:
# safety in case there's other stuff in there.
rm -f $(UNINSTALL_THEMES)
-index:
+index: scripts/versions.log
make -C index
+autobump: $(THEMES)
+ python scripts/autobump.py
+
clean:
make -C index clean
@@ -59,6 +60,7 @@ help:
@echo " make install - Installs all color scheme .conf files"
@echo " make uninstall - Uninstall tracked color scheme files"
@echo " make index - Regenerate the index/index.json file"
+ @echo " make autobump - Update scheme versions on change"
@echo " make dist - Create a .tar.bz2 package for release"
@echo " make ChangeLog - Update the ChangeLog file from Git log"
@echo ""
@@ -70,4 +72,4 @@ help:
@echo "For more up to date information, visit:"
@echo " https://github.com/geany/geany-themes"
-.PHONY: all install uninstall dist ChangeLog index clean help
+.PHONY: all install uninstall dist ChangeLog index autobump clean help
Modified: scripts/autobump.py
74 files changed, 74 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+
+"""
+Automatically updates a color scheme's version number when the file
+is modified. Run this before committing the change(s) to the repo.
+"""
+
+import os
+import sys
+import hashlib
+
+def gen_sum(fn):
+ return hashlib.md5(open(fn).read()).hexdigest()
+
+def read_log(log_file):
+ entries = []
+ try:
+ contents = open(log_file, 'r').read()
+ except IOError:
+ contents = ''
+ for line in [l.strip() for l in contents.split('\n') if l.strip()]:
+ m,n = line.split('\t')
+ entries.append((n,m))
+ return entries
+
+def write_log(log_file, entries):
+ new_lines = []
+ for ent in entries:
+ new_lines.append('\t'.join((ent[1], ent[0])))
+ open(log_file, 'w').write('\n'.join(new_lines) + '\n')
+
+def bump_version(fn):
+ contents = open(fn).read()
+ lines = contents.split('\n')
+ new_lines = []
+ for line in lines:
+ line = line.rstrip()
+ if line.strip().startswith('version'):
+ k,v = line.split('=')
+ v = int(v.strip())
+ v += 1
+ new_lines.append('version=%d' % v)
+ print("Bumped version of '%s' from %d to %d" % (os.path.basename(fn), v-1, v))
+ else:
+ new_lines.append(line)
+ open(fn, 'w').write('\n'.join(new_lines))
+
+def check_scheme(entries, scheme_fn):
+ for i, ent in enumerate(entries):
+ n,m = ent
+ if n == os.path.basename(scheme_fn):
+ msum = gen_sum(scheme_fn)
+ if m != msum:
+ bump_version(scheme_fn)
+ entries[i] = (n, gen_sum(scheme_fn))
+ break
+ else:
+ entries.append((os.path.basename(scheme_fn), gen_sum(scheme_fn)))
+ return entries
+
+def main(args):
+ cur_dir = os.path.abspath(os.path.dirname(__file__))
+ root_dir = os.path.abspath(os.path.dirname(cur_dir))
+ scheme_dir = os.path.join(root_dir, 'colorschemes')
+ log_file = os.path.join(cur_dir, 'versions.log')
+ entries = read_log(log_file)
+ for fname in os.listdir(scheme_dir):
+ if not fname.endswith(".conf"): continue
+ path = os.path.join(scheme_dir, fname)
+ entries = check_scheme(entries, path)
+ write_log(log_file, entries)
+ return 0
+
+if __name__ == "__main__": sys.exit(main(sys.argv))
Modified: scripts/versions.log
23 files changed, 23 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,23 @@
+e65f709e475ba5480ae32d2be5ae3826 zenburn.conf
+c5af64e0f2627ba8b3e1ec8f519f88d2 mc.conf
+c61ead84fb2fba8bf1d27fb787a8f059 fluffy.conf
+a7511319de69a819e7edd6c60d90a686 oblivion2.conf
+2196d395b7669d6aa81dfbba95f08701 black.conf
+66ff10140d6c99c7ad38ddf6dd7f07a4 tango-light.conf
+6f55f721882b7c08e71b197c57a1c3dc solarized-dark.conf
+aab9502b99ac01bc4f90f3d5b5a5b8d8 slushpoppies.conf
+f35499a8cd643bd4159138adf5c35add tango-dark.conf
+303ab2befb4568b1e677e7615d601e81 dark.conf
+f0d3b817ee91646c1c9ecfe978d51cf6 retro.conf
+99b7663c11177e55dac5d232855a99b5 inkpot.conf
+f8968e4bd09c5f5c52f7de5577154582 bespin.conf
+e7a55e5c551e1dc1ca8f08cc121f44ce gedit.conf
+29dff713647db9f288d87423f32f0990 solarized-light.conf
+67188ade2cf5f81345c9cee2843d5512 vibrant-ink.conf
+8bbdfe4b1f7e5187d95d760cde19321c pygments.conf
+8af93bd5bec0a89acbd77ee468b30cf3 github.conf
+e766a25ea4c4417d840d9680586a3b6f monokai.conf
+40fa84812b22c97989d241d63bc84ead railcasts2.conf
+d7a2916b9d773c9e65a9cc60f10c4bfc tinge.conf
+f26daf0e6d9ae56a583d33fed60068b7 kugel.conf
+942a5d5197b98dc656dd91944f4f71a0 dark-fruit-salad.conf
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).