Permalink
Browse files

Merge branch 'release-1.0a5' into production

  • Loading branch information...
zalun committed Sep 23, 2010
2 parents 52dc46f + f1fcdb8 commit 13c9c91cc0ab6595c3780002a3f1624fac6b4c7d
Showing with 589 additions and 213 deletions.
  1. BIN Docs/workflow.pdf
  2. BIN Docs/workflow.png
  3. +9 −7 Docs/workflow.svg
  4. +4 −1 INSTALL
  5. +1 −1 README
  6. +26 −11 flightdeck/amo/authentication.py
  7. +8 −1 flightdeck/api/default_settings.py
  8. +1 −1 flightdeck/api/templates/api.html
  9. +4 −0 flightdeck/api/views.py
  10. +2 −0 flightdeck/jetpack/default_settings.py
  11. +10 −5 flightdeck/jetpack/fixtures/test_basic_usecase.json
  12. +0 −63 flightdeck/jetpack/management.py
  13. +189 −0 flightdeck/jetpack/management/__init__.py
  14. 0 flightdeck/jetpack/management/commands/__init__.py
  15. +10 −0 flightdeck/jetpack/management/commands/add_jetpack_core.py
  16. +3 −0 flightdeck/jetpack/managers.py
  17. +11 −1 flightdeck/jetpack/media/css/UI.File_Listing.css
  18. +11 −16 flightdeck/jetpack/media/js/FlightDeck.Bespin.js
  19. +15 −4 flightdeck/jetpack/media/js/FlightDeck.Browser.js
  20. +18 −0 flightdeck/jetpack/media/js/FlightDeck.Editor.js
  21. +34 −0 flightdeck/jetpack/media/js/Package.js
  22. +48 −6 flightdeck/jetpack/models.py
  23. +11 −3 flightdeck/jetpack/templates/_core_library_item.html
  24. +4 −4 flightdeck/jetpack/templates/_package_edit_view_source_bar.html
  25. +1 −0 flightdeck/jetpack/templates/js/_edit_package_initiate.js
  26. +5 −0 flightdeck/jetpack/templates/json/sdk_switched.json
  27. +2 −1 flightdeck/jetpack/templates/json/test_xpi_created.json
  28. +3 −0 flightdeck/jetpack/urls.py
  29. +25 −3 flightdeck/jetpack/views.py
  30. +3 −3 flightdeck/jetpack/xpi_utils.py
  31. +26 −8 flightdeck/media/js/FlightDeck.js
  32. +34 −33 flightdeck/media/js/lib/mootools-1.2.4-core-nc.js
  33. +1 −1 flightdeck/settings.py
  34. +2 −0 flightdeck/settings_local-default.py
  35. +35 −10 scripts/install.sh
  36. +1 −0 tools/git-exclude
  37. +31 −30 tools/jetpack.vim
  38. +1 −0 tools/pip-requirements.txt
View
Binary file not shown.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -15,7 +15,7 @@
id="svg2"
version="1.1"
inkscape:version="0.47 r22583"
- sodipodi:docname="workflow.png"
+ sodipodi:docname="workflow.svg"
style="display:inline">
<sodipodi:namedview
id="base"
@@ -25,15 +25,15 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.7838384"
- inkscape:cx="458.89322"
+ inkscape:cx="469.9131"
inkscape:cy="926.0595"
inkscape:document-units="px"
inkscape:current-layer="layer12"
showgrid="false"
inkscape:window-width="1918"
- inkscape:window-height="1154"
+ inkscape:window-height="1169"
inkscape:window-x="0"
- inkscape:window-y="15"
+ inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:snap-global="true"
showguides="true"
@@ -1006,7 +1006,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
+ <dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -1207,7 +1207,8 @@
sodipodi:role="line"
id="tspan10424"
x="324.00586"
- y="98.362183">devel</tspan></text>
+ y="98.362183"
+ style="font-size:14px">master</tspan></text>
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Optima;-inkscape-font-specification:Optima Bold"
@@ -1218,7 +1219,8 @@
sodipodi:role="line"
id="tspan10430"
x="693.02344"
- y="98.362183">trunk</tspan></text>
+ y="98.362183"
+ style="font-size:14">production</tspan></text>
<text
xml:space="preserve"
style="font-size:24px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#999999;fill-opacity:1;stroke:none;font-family:Optima;-inkscape-font-specification:Optima Bold"
View
@@ -37,6 +37,8 @@ these steps (some commands are specific to Ubuntu with Bash):
$ virtualenv --no-site-packages flightdeckenv
6. Install via pip from requirements.txt and custom packages
+ # Jetpack SDK 0.6 will be installed
+ # please create sdk_versions/jetpack-sdk if it is not desired
$ ./scripts/install.sh
# change upload directory preferences so it will be writable by webserver
@@ -69,7 +71,8 @@ these steps (some commands are specific to Ubuntu with Bash):
9. Initiate database
$ ./scripts/syncdb.sh
# Choose your superadmin username and password
- # You may want to install test fixtures to save time
+ # You may want to install test fixtures to save time simply bare in mind
+ # these will not be able to create XPI
$ ./scripts/manage.sh loaddata test_users.json test_basic_usecase.json
10. Test FlightDeck applications
View
2 README
@@ -1,4 +1,4 @@
-Version 1.0a3
+Version 1.0a5
FlightDeck is a SDK for creating JetPack
(c) Mozilla Foundation
@@ -83,20 +83,28 @@ def authenticate(self, username, password):
)
user.save()
- # save current amo_session if different
+ # Manage profile
try:
profile = user.get_profile()
except Profile.DoesNotExist:
+ profile = Profile(user=user)
+
+ if not (user.first_name or profile.nickname):
+ # should fire for new and invalid accounts
# scrap initial profile data from AMO
response = br.follow_link(text='Edit Profile')
data = scrap_amo_profile(response)
+
+ is_user_changed = False
if 'firstname' in data:
user.first_name = data['firstname']
+ is_user_changed = True
if 'lastname' in data:
user.last_name = data['lastname']
- user.save()
+ is_user_changed = True
+ if is_user_changed:
+ user.save()
- profile = Profile(user=user)
if 'nickname' in data:
profile.nickname = data['nickname']
if 'location' in data:
@@ -106,7 +114,7 @@ def authenticate(self, username, password):
if 'homepage' in data:
profile.homepage = data['homepage']
if 'photo' in data:
- profile.homepage = data['photo']
+ profile.photo = data['photo']
profile.save()
@@ -124,17 +132,24 @@ def scrap_amo_profile(response):
data = {}
for inp in soup.findAll('input'):
try:
- if ('name', 'data[User][firstname]') in inp.attrs:
+ if ('name', 'firstname') in inp.attrs:
data['firstname'] = inp['value']
- elif ('name','data[User][lastname]') in inp.attrs:
+ elif ('name','lastname') in inp.attrs:
data['lastname'] = inp['value']
- elif ('name', 'data[User][nickname]') in inp.attrs:
+ elif ('name','display_name') in inp.attrs:
+ if inp['value']:
+ if not (data.get('firstname', False) or data.get('lastname', False)):
+ names = split(' ', inp['value'])
+ data['firstname'] = names[0]
+ if len(names) > 1:
+ data['lastname'] = names[-1]
+ elif ('name', 'username') in inp.attrs:
data['nickname'] = inp['value']
- elif ('name', 'data[User][location]') in inp.attrs:
+ elif ('name', 'location') in inp.attrs:
data['location'] = inp['value']
- elif ('name','data[User][occupation]') in inp.attrs:
+ elif ('name','occupation') in inp.attrs:
data['occupation'] = inp['value']
- elif ('name', 'data[User][homepage]') in inp.attrs:
+ elif ('name', 'homepage') in inp.attrs:
data['homepage'] = inp['value']
except:
pass
@@ -143,6 +158,6 @@ def scrap_amo_profile(response):
alts = filter(lambda x: x[0] == 'alt', img.attrs)
srcs = filter(lambda x: x[0] == 'src', img.attrs)
if classes and alts and srcs:
- if 'avatar' in classes[0][1] and 'No photo' not in alts[0][1]:
+ if 'avatar' in classes[0][1] and srcs[0][1] != 'https://addons.mozilla.org/media///img/zamboni/anon_user.png':
data['photo'] = 'https://addons.mozilla.org%s' % srcs[0][1]
return data
@@ -1,8 +1,15 @@
import os
from django.conf import settings
+from jetpack.models import SDK
+
+sdks = SDK.objects.all()
+if sdks.count() > 0:
+ SDKPACKAGESDIR = os.path.join(settings.FRAMEWORK_PATH,'sdk_versions',sdks[0].dir,'packages')
+ SDKVERSION = sdks[0].version
+else:
+ SDKPACKAGESDIR = os.path.join(settings.VIRTUAL_ENV,'src/jetpack-sdk/packages')
-SDKPACKAGESDIR = os.path.join(settings.VIRTUAL_ENV,'src/jetpack-sdk/packages')
# ------------------------------------------------------------------------
VIRTUAL_ENV = settings.VIRTUAL_ENV
VIRTUAL_SITE_PACKAGES = settings.VIRTUAL_SITE_PACKAGES
@@ -10,7 +10,7 @@
{% block app_sidebar %}
<h2 class="UI_Heading"><a title="Tutorial" href="{% url tutorial %}">Tutorial</a></h2>
<h2 class="UI_Heading"><a title="{{ package_name}}" href="{% url api_package package_name %}">
- {% if package.name == 'jetpack-core' %}Core Library{% else %}{{ package.name }}{% endif %}
+ {% if package.name == 'jetpack-core' %}Core Library ({{ sdk_version }}){% else %}{{ package.name }}{% endif %}
</a></h2>
{% include "_modules_list.html" %}
<h2 class="UI_Heading"><a title="Add-ons Builder SDK" href="https://jetpack.mozillalabs.com/sdk/latest/docs/">Add-ons Builder SDK</a></h2>
View
@@ -29,6 +29,7 @@ def _get_module_names(package_name):
def homepage(r, package_name='jetpack-core'):
page = 'apibrowser'
+ sdk_version = settings.SDKVERSION
package = {'name': package_name, 'modules': _get_module_names(package_name)}
return render_to_response(
@@ -43,6 +44,8 @@ def package(r, package_name='jetpack-core'):
"""
page = 'apibrowser'
+ sdk_version = settings.SDKVERSION
+
DOC_FILES = _get_module_filenames(package_name)
package = {'name': package_name, 'modules': []}
@@ -69,6 +72,7 @@ def package(r, package_name='jetpack-core'):
def module(r, package_name, module_name):
page = 'apibrowser'
+ sdk_version = settings.SDKVERSION
doc_file = '.'.join((module_name,'md'))
text = open(os.path.join(settings.SDKPACKAGESDIR,package_name,'docs',doc_file)).read()
# changing the tuples to dictionaries
@@ -1,4 +1,5 @@
from django.conf import settings
+import os.path
PACKAGES_PER_PAGE = getattr(settings, 'PACKAGES_PER_PAGE', 10)
MINIMUM_PACKAGE_ID = getattr(settings, 'MINIMUM_PACKAGE_ID', 1000000)
@@ -31,3 +32,4 @@
FRAMEWORK_PATH = settings.FRAMEWORK_PATH
DEBUG = settings.DEBUG
HOMEPAGE_ITEMS_LIMIT = settings.HOMEPAGE_ITEMS_LIMIT
+SDK_SOURCE_DIR = getattr(settings, 'SDK_SOURCE_DIR', os.path.join(FRAMEWORK_PATH, 'sdk_versions/'))
@@ -126,7 +126,8 @@
"author": 101,
"dependencies": [],
"version_name": "initial",
- "message": ""
+ "message": "",
+ "sdk": 1
}
},
{
@@ -142,7 +143,8 @@
"author": 101,
"dependencies": [],
"version_name": "",
- "message": ""
+ "message": "",
+ "sdk": 1
}
},
{
@@ -191,7 +193,8 @@
"author": 102,
"dependencies": [],
"version_name": "initial",
- "message": ""
+ "message": "",
+ "sdk": 1
}
},
{
@@ -207,7 +210,8 @@
"author": 102,
"dependencies": [],
"version_name": "with_module",
- "message": ""
+ "message": "",
+ "sdk": 1
}
},
{
@@ -223,7 +227,8 @@
"author": 102,
"dependencies": [103],
"version_name": "with_module_and_dependency",
- "message": ""
+ "message": "",
+ "sdk": 1
}
},
{
@@ -1,63 +0,0 @@
-import os
-import simplejson
-
-from django.db.models import signals
-from django.contrib.auth.models import User
-
-from jetpack import models as jetpack_models
-from jetpack.models import Package, Module, PackageRevision
-from jetpack import settings
-from person.models import Profile
-
-def install_jetpack_core(sender, created_models, **kwargs):
- # check if that's the syncdb to create jetpack models
- if not (jetpack_models.Package in created_models and \
- jetpack_models.PackageRevision in created_models):
- return
-
- # check if the jetpack-sdk was already installed
- sdk_dir = '%s/src/jetpack-sdk' % settings.VIRTUAL_ENV
- if not os.path.isdir(sdk_dir):
- raise Exception("Please install jetpack SDK first")
-
- # create core user
- core_author = User.objects.create(username='mozilla',first_name='Mozilla')
- Profile.objects.create(user=core_author)
-
- # create Jetpack Core Library
- handle = open('%s/packages/jetpack-core/package.json' % sdk_dir)
- core_manifest = simplejson.loads(handle.read())
- handle.close()
- core_contributors = [core_manifest['author']]
- core_contributors.extend(core_manifest['contributors'])
- core = Package(
- author=core_author, # sorry Atul
- full_name='Jetpack Core',
- name='jetpack-core',
- type='l',
- public_permission=2,
- description=core_manifest['description']
- )
- core.save()
- core_revision = core.latest
- core_revision.set_version(core_manifest['version'])
- core_revision.contributors = ', '.join(core_contributors)
- super(PackageRevision, core_revision).save()
- core_lib_dir = '%s/packages/jetpack-core/lib' % sdk_dir
- core_modules = os.listdir(core_lib_dir)
- for module_file in core_modules:
- module_path = '%s/%s' % (core_lib_dir, module_file)
- module_name = os.path.splitext(module_file)[0]
- handle = open(module_path, 'r')
- module_code = handle.read()
- handle.close()
- mod = Module.objects.create(
- filename=module_name,
- code=module_code,
- author=core_author
- )
- core_revision.modules.add(mod)
- print "Jetpack Core Library created successfully"
-
-signals.post_syncdb.connect(install_jetpack_core, sender=jetpack_models)
-
Oops, something went wrong.

0 comments on commit 13c9c91

Please sign in to comment.