From 3e739e4bc9b5d2ce27d45afd711e2f0bda251b6a Mon Sep 17 00:00:00 2001 From: Greg Cobb and Luan Santos Date: Tue, 11 Mar 2014 10:46:35 -0700 Subject: [PATCH] Create jasmine-core python egg --- .gitignore | 4 +++ MANIFEST.in | 4 +++ RELEASE.md | 13 ++++++++ images/__init__.py | 0 lib/jasmine-core/__init__.py | 1 + lib/jasmine-core/core.py | 60 ++++++++++++++++++++++++++++++++++++ requirements.txt | 1 + setup.py | 47 ++++++++++++++++++++++++++++ 8 files changed, 130 insertions(+) create mode 100644 MANIFEST.in create mode 100644 images/__init__.py create mode 100644 lib/jasmine-core/__init__.py create mode 100644 lib/jasmine-core/core.py create mode 100644 requirements.txt create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index e5f9979d..277c7aab 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,10 @@ pkg/* .sass-cache/* src/html/.sass-cache/* node_modules/ +*.pyc sauce_connect.log *.swp +build/ +*.egg-info/ +dist/*.tar.gz nbproject/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..d41bf6e0 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +recursive-include . *.py +include lib/jasmine-core/*.js +include lib/jasmine-core/*.css +include images/*.png diff --git a/RELEASE.md b/RELEASE.md index bc52df8f..1f311357 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -36,13 +36,26 @@ When ready to release - specs are all green and the stories are done: 1. Update the release notes in `release_notes` - use the Anchorman gem to generate the markdown file and edit accordingly 1. Update the version in `package.json` to a release candidate 1. Update any links or top-level landing page for the Github Pages + +### Build standalone distribution + 1. Build the standalone distribution with `grunt buildStandaloneDist` 1. Make sure you add the new ZIP file to git + +### Release the Python egg + +1. `python setup.py register sdist upload` You will need pypi credentials to upload the egg. + +### Release the Ruby gem + 1. Copy version to the Ruby gem with `grunt build:copyVersionToGem` 1. __NOTE__: You will likely need to point to a local jasmine gem in order to run tests locally. _Do not_ push this version of the Gemfile. 1. __NOTE__: You will likely need to push a new jasmine gem with a dependent version right after this release. 1. Push these changes to GitHub and verify that this SHA is green 1. `rake release` - tags the repo with the version, builds the `jasmine-core` gem, pushes the gem to Rubygems.org. In order to release you will have to ensure you have rubygems creds locally. + +### Finally + 1. Visit the [Releases page for Jasmine](https://github.com/pivotal/jasmine/releases), find the tag just pushed. Paste in a link to the correct release notes for this release. The link should reference the blob and tag correctly, and the markdown file for the notes. If it is a pre-release, mark it as such. diff --git a/images/__init__.py b/images/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lib/jasmine-core/__init__.py b/lib/jasmine-core/__init__.py new file mode 100644 index 00000000..a8d584aa --- /dev/null +++ b/lib/jasmine-core/__init__.py @@ -0,0 +1 @@ +from .core import Core \ No newline at end of file diff --git a/lib/jasmine-core/core.py b/lib/jasmine-core/core.py new file mode 100644 index 00000000..226c95d7 --- /dev/null +++ b/lib/jasmine-core/core.py @@ -0,0 +1,60 @@ +import pkg_resources + +try: + from collections import OrderedDict +except ImportError: + from ordereddict import OrderedDict + +class Core(object): + @classmethod + def js_package(cls): + return __package__ + + @classmethod + def css_package(cls): + return __package__ + + @classmethod + def image_package(cls): + return __package__ + ".images" + + @classmethod + def js_files(cls): + js_files = sorted(list(filter(lambda x: '.js' in x, pkg_resources.resource_listdir(cls.js_package(), '.')))) + + # jasmine.js needs to be first + js_files.insert(0, 'jasmine.js') + + # boot needs to be last + js_files.remove('boot.js') + js_files.append('boot.js') + + return cls._uniq(js_files) + + @classmethod + def css_files(cls): + return cls._uniq(sorted(filter(lambda x: '.css' in x, pkg_resources.resource_listdir(cls.css_package(), '.')))) + + @classmethod + def favicon(cls): + return 'jasmine_favicon.png' + + @classmethod + def _uniq(self, items, idfun=None): + # order preserving + + if idfun is None: + def idfun(x): return x + seen = {} + result = [] + for item in items: + marker = idfun(item) + # in old Python versions: + # if seen.has_key(marker) + # but in new ones: + if marker in seen: + continue + + seen[marker] = 1 + result.append(item) + return result \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..591279c2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +ordereddict==1.1 diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..a10d0190 --- /dev/null +++ b/setup.py @@ -0,0 +1,47 @@ +from setuptools import setup, find_packages, os +import json + +with open('package.json') as packageFile: + version = json.load(packageFile)['version'] + +setup( + name="jasmine-core", + version=version, + url="http://pivotal.github.io/jasmine/", + author="Pivotal Labs", + author_email="jasmine-js@googlegroups.com", + description=('Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on '+ + 'browsers, DOM, or any JavaScript framework. Thus it\'s suited for websites, '+ + 'Node.js (http://nodejs.org) projects, or anywhere that JavaScript can run.'), + license='MIT', + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'Environment :: Web Environment', + 'Framework :: Django', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Topic :: Internet :: WWW/HTTP', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Software Development :: Build Tools', + 'Topic :: Software Development :: Quality Assurance', + 'Topic :: Software Development :: Testing', + ], + + packages=['jasmine_core', 'jasmine_core.images'], + package_dir={'jasmine_core': 'lib/jasmine-core', 'jasmine_core.images': 'images'}, + package_data={'jasmine_core': ['*.js', '*.css'], 'jasmine_core.images': ['*.png']}, + + include_package_data=True, + + install_requires=['glob2>=0.4.1', 'ordereddict==1.1'] +)