[Checkins] SVN: hurry.jquery/trunk/ import the trunk for the hurry.jquery project

Jan-Wijbrand Kolman janwijbrand at gmail.com
Wed May 27 11:26:36 EDT 2009


Log message for revision 100462:
  import the trunk for the hurry.jquery project

Changed:
  A   hurry.jquery/trunk/
  A   hurry.jquery/trunk/CHANGES.txt
  A   hurry.jquery/trunk/CREDITS.txt
  A   hurry.jquery/trunk/MANIFEST.in
  A   hurry.jquery/trunk/README.txt
  A   hurry.jquery/trunk/buildout.cfg
  A   hurry.jquery/trunk/setup.py
  A   hurry.jquery/trunk/src/
  A   hurry.jquery/trunk/src/hurry/
  A   hurry.jquery/trunk/src/hurry/__init__.py
  A   hurry.jquery/trunk/src/hurry/jquery/
  A   hurry.jquery/trunk/src/hurry/jquery/__init__.py
  A   hurry.jquery/trunk/src/hurry/jquery/configure.zcml
  A   hurry.jquery/trunk/src/hurry/jquery/jquery-build/
  A   hurry.jquery/trunk/src/hurry/jquery/jquery.txt
  A   hurry.jquery/trunk/src/hurry/jquery/prepare.py
  A   hurry.jquery/trunk/src/hurry/jquery/tests.py

-=-
Added: hurry.jquery/trunk/CHANGES.txt
===================================================================
--- hurry.jquery/trunk/CHANGES.txt	                        (rev 0)
+++ hurry.jquery/trunk/CHANGES.txt	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,7 @@
+CHANGES
+*******
+
+1.3.2.1 (unreleased)
+====================
+
+* Initial public release, using jQuery-1.3.2.

Added: hurry.jquery/trunk/CREDITS.txt
===================================================================
--- hurry.jquery/trunk/CREDITS.txt	                        (rev 0)
+++ hurry.jquery/trunk/CREDITS.txt	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,6 @@
+Credit due where credit is due
+******************************
+
+Much of this package is inspired by the hurry.yui package that in turn could
+not exist without the very cool hurry.resource package. Both mainly written
+by Martijn Faasen. Thanks!

Added: hurry.jquery/trunk/MANIFEST.in
===================================================================
--- hurry.jquery/trunk/MANIFEST.in	                        (rev 0)
+++ hurry.jquery/trunk/MANIFEST.in	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,2 @@
+recursive-include src/hurry/jquery/jquery-build *
+include src/hurry/jquery/_lib.py

Added: hurry.jquery/trunk/README.txt
===================================================================
--- hurry.jquery/trunk/README.txt	                        (rev 0)
+++ hurry.jquery/trunk/README.txt	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,50 @@
+hurry.jquery
+************
+
+Introduction
+============
+
+This library packages jQuery_ for `hurry.resource`_. It is aware of jQuery's
+structure and different modes (normal, minified).
+
+.. _`hurry.resource`: http://pypi.python.org/pypi/hurry.resource
+.. _jQuery: http://jquery.com/
+
+How to use?
+===========
+
+You can import various bits of jQuery from ``hurry.jquery`` and ``.need``
+them where you want these resources to be included on a page::
+
+  from hurry import jquery
+
+  .. in your page or widget rendering code, somewhere ..
+
+  jquery.need()
+
+This requires integration between your web framework and ``hurry.resource``,
+and making sure that the original resources (shipped in the ``jquery-build``
+directory in ``hurry.jquery``) are published to some URL.
+
+The package has already been integrated for Grok_ and Zope 3. If you depend
+on the `hurry.zoperesource`_ package in your ``setup.py``, the above example
+should work out of the box. Make sure to depend on the `hurry.zoperesource`_
+package in your ``setup.py``.
+
+.. _`hurry.zoperesource`: http://pypi.python.org/pypi/hurry.zoperesource
+
+.. _Grok: http://grok.zope.org
+
+Preparing hurry.jquery before release
+=====================================
+
+This section is only relevant to release managers of ``hurry.jquery``.
+
+When releasing ``hurry.jquery``, an extra step should be taken. Follow the
+regular package `release instructions`_, but before egg generation (``python
+setup.py register sdist upload``) first execute ``bin/jqueryprepare <version
+number>``, where version number is the version of the YUI release, such as
+``1.3.2``. This will download the jQuery library of that version and place it
+in the egg.
+
+.. _`release instructions`: http://grok.zope.org/documentation/how-to/releasing-software

Added: hurry.jquery/trunk/buildout.cfg
===================================================================
--- hurry.jquery/trunk/buildout.cfg	                        (rev 0)
+++ hurry.jquery/trunk/buildout.cfg	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,15 @@
+[buildout]
+develop = .
+parts = scripts test
+versions = versions
+
+[versions]
+
+[scripts]
+recipe = zc.recipe.egg
+eggs = hurry.jquery
+
+[test]
+recipe = zc.recipe.testrunner
+defaults = ['--tests-pattern', '^f?tests$', '-v']
+eggs = hurry.jquery

Added: hurry.jquery/trunk/setup.py
===================================================================
--- hurry.jquery/trunk/setup.py	                        (rev 0)
+++ hurry.jquery/trunk/setup.py	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,46 @@
+from setuptools import setup, find_packages
+
+JQUERY_VERSION = '1.3.2'
+
+import sys, os
+
+def read(*rnames):
+    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+long_description = (
+    read('README.txt')
+    + '\n' +
+    read('CHANGES.txt')
+    + '\n' +
+    'Download\n'
+    '********\n'
+    )
+
+setup(
+    name='hurry.jquery',
+    version=JQUERY_VERSION + '.1' + 'dev',
+    description="hurry.resource style resources for jQuery.",
+    long_description = long_description,
+    classifiers=[],
+    keywords='',
+    author='Jan-Wijbrand Kolman',
+    author_email='jkolman at thehealthagency.com',
+    license='ZPL 2.1',
+    packages=find_packages('src'),
+    namespace_packages=['hurry'],
+    package_dir={'': 'src'},
+    include_package_data=True,
+    zip_safe=False,
+    install_requires=[
+        'setuptools',
+        'hurry.resource > 0.2',
+        ],
+    entry_points= {
+        'console_scripts': [
+            'jqueryprepare = hurry.jquery.prepare:main',
+            ]
+    },
+    extras_require={
+        'zopesupport': ['hurry.zoperesource'],
+        },
+    )

Added: hurry.jquery/trunk/src/hurry/__init__.py
===================================================================
--- hurry.jquery/trunk/src/hurry/__init__.py	                        (rev 0)
+++ hurry.jquery/trunk/src/hurry/__init__.py	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,7 @@
+# this is a namespace package
+try:
+    import pkg_resources
+    pkg_resources.declare_namespace(__name__)
+except ImportError:
+    import pkgutil
+    __path__ = pkgutil.extend_path(__path__, __name__)

Added: hurry.jquery/trunk/src/hurry/jquery/__init__.py
===================================================================
--- hurry.jquery/trunk/src/hurry/jquery/__init__.py	                        (rev 0)
+++ hurry.jquery/trunk/src/hurry/jquery/__init__.py	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,6 @@
+#package
+try:
+    from hurry.jquery._lib import jquery
+except ImportError:
+    pass
+

Added: hurry.jquery/trunk/src/hurry/jquery/configure.zcml
===================================================================
--- hurry.jquery/trunk/src/hurry/jquery/configure.zcml	                        (rev 0)
+++ hurry.jquery/trunk/src/hurry/jquery/configure.zcml	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,9 @@
+<configure
+  xmlns="http://namespaces.zope.org/zope"
+  xmlns:browser="http://namespaces.zope.org/browser">
+
+  <browser:resourceDirectory
+    name="jquery"
+    directory="jquery-build" />
+
+</configure>

Added: hurry.jquery/trunk/src/hurry/jquery/jquery.txt
===================================================================
--- hurry.jquery/trunk/src/hurry/jquery/jquery.txt	                        (rev 0)
+++ hurry.jquery/trunk/src/hurry/jquery/jquery.txt	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,32 @@
+"""
+hurry.jquery basic tests
+========================
+
+Here are some basic tests for hurry.jquery.
+
+Let's set up a way to render URLs; typically the framework has already
+done this::
+
+  >>> def get_library_url(library):
+  ...    return 'http://localhost/static/%s' % (library.name)
+  >>> from hurry.resource import Library
+  >>> from hurry.resource.interfaces import ILibraryUrl
+  >>> from zope import component
+  >>> # register the ILibraryUrl adaptation for the tests.
+  >>> component.provideAdapter(
+  ...     factory=get_library_url, adapts=(Library,), provides=ILibraryUrl)
+
+Render the inclusion::
+
+  >>> from hurry.resource import NeededInclusions
+  >>> from hurry.jquery import jquery
+  >>> needed = NeededInclusions()
+  >>> needed.need(jquery)
+  >>> print needed.render()
+  <script type="text/javascript" src="http://localhost/static/jquery/jquery-1.3.2.js"></script>
+
+  >>> needed.mode('minified')
+  >>> print needed.render()
+  <script type="text/javascript" src="http://localhost/static/jquery/jquery-1.3.2.min.js"></script>
+
+"""
\ No newline at end of file

Added: hurry.jquery/trunk/src/hurry/jquery/prepare.py
===================================================================
--- hurry.jquery/trunk/src/hurry/jquery/prepare.py	                        (rev 0)
+++ hurry.jquery/trunk/src/hurry/jquery/prepare.py	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,50 @@
+import os
+import shutil
+import sys
+import urllib2
+import urlparse
+from hurry.resource import generate_code, ResourceInclusion, Library
+
+BASEURL = "http://jqueryjs.googlecode.com/files/"
+MINIFIED = "jquery-1.3.2.min.js"
+FULL = "jquery-1.3.2.js"
+
+def main():
+    try:
+        version = sys.argv[1]
+    except IndexError:
+        print "Usage: jqueryprepare <jQuery version>"
+        return
+
+    package_dir = os.path.dirname(__file__)
+    jquery_dest_path = os.path.join(package_dir, 'jquery-build')
+
+    # remove previous jquery library build
+    print 'recursivly removing "%s"' % jquery_dest_path
+    shutil.rmtree(jquery_dest_path, ignore_errors=True)
+    print 'create new "%s"' % jquery_dest_path
+    os.mkdir(jquery_dest_path)
+
+    for filename in [MINIFIED, FULL]:
+        url = urlparse.urljoin(BASEURL, filename)
+        print 'downloading "%s"' % url
+        f = urllib2.urlopen(url)
+        file_data = f.read()
+        f.close()
+        dest_filename = os.path.join(jquery_dest_path, filename)
+        dest = open(dest_filename, 'wb')
+        print 'writing data to "%s"' % dest_filename
+        dest.write(file_data)
+        dest.close()
+
+    py_path = os.path.join(package_dir, '_lib.py')
+    print 'Generating inclusion module "%s"' % py_path
+
+    library = Library('jquery')
+    inclusion_map = {}
+    inclusion = inclusion_map['jquery'] = ResourceInclusion(library, FULL)
+    inclusion.modes['minified'] = ResourceInclusion(library, MINIFIED)
+    code = generate_code(**inclusion_map)
+    module = open(py_path, 'w')
+    module.write(code)
+    module.close()

Added: hurry.jquery/trunk/src/hurry/jquery/tests.py
===================================================================
--- hurry.jquery/trunk/src/hurry/jquery/tests.py	                        (rev 0)
+++ hurry.jquery/trunk/src/hurry/jquery/tests.py	2009-05-27 15:26:35 UTC (rev 100462)
@@ -0,0 +1,9 @@
+import unittest, doctest
+
+def test_suite():
+    globs = {}
+    optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
+    suite = unittest.TestSuite()
+    suite.addTest(doctest.DocFileSuite(
+        'jquery.txt', globs=globs, optionflags=optionflags))
+    return suite



More information about the Checkins mailing list