Skip to content

Commit

Permalink
Merge branch 'master' into feature/test-bench
Browse files Browse the repository at this point in the history
# Conflicts:
#	cloudpebble/settings.py
#	ide/models/files.py
  • Loading branch information
Joseph Atkins-Turkish committed Jul 5, 2016
2 parents 3fcf2e7 + 80e6d9f commit 619c1b4
Show file tree
Hide file tree
Showing 11 changed files with 198 additions and 18 deletions.
2 changes: 1 addition & 1 deletion bin/post_compile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ echo "Downloading SDK 2"
curl -o /tmp/pebblesdk2.tar.gz -L https://s3.amazonaws.com/assets.getpebble.com/sdk3/sdk-core/sdk-core-2.9.tar.bz2

echo "Downloading SDK 3"
curl -o /tmp/pebblesdk3.tar.gz -L https://s3.amazonaws.com/assets.getpebble.com/sdk3/release/sdk-core-3.13.tar.bz2
curl -o /tmp/pebblesdk3.tar.gz -L https://s3.amazonaws.com/assets.getpebble.com/sdk3/release/sdk-core-3.13.1.tar.bz2

echo "Downloading the toolchain"
curl -o /tmp/arm-cs-tools.tar https://cloudpebble-vagrant.s3.amazonaws.com/arm-cs-tools-stripped.tar
Expand Down
2 changes: 1 addition & 1 deletion cloudpebble/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def _node_bin(name):
'alexgorbatchev/jquery-textext',
'codemirror#4.2.0',
'bluebird#3.3.4',
'kanaka/noVNC',
'kanaka/noVNC#v0.5',
'react#15.0.1',
'classnames'
)
Expand Down
7 changes: 3 additions & 4 deletions ide/models/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import logging


from django.db import models
from django.utils.timezone import now
from django.utils.translation import ugettext as _
Expand All @@ -11,7 +10,7 @@

from ide.models.meta import IdeModel
from ide.models.s3file import S3File
from ide.models.scriptfile import ScriptFile
from ide.models.textfile import TextFile

__author__ = 'katharine'

Expand Down Expand Up @@ -228,7 +227,7 @@ def save(self, *args, **kwargs):
super(ResourceIdentifier, self).save(*args, **kwargs)


class SourceFile(ScriptFile):
class SourceFile(TextFile):
project = models.ForeignKey('Project', related_name='source_files')
file_name = models.CharField(max_length=100, validators=[RegexValidator(r"^[/a-zA-Z0-9_.-]+\.(c|h|js)$", message=_("Invalid filename."))])
folder = 'sources'
Expand All @@ -246,5 +245,5 @@ def project_path(self):
else:
return 'worker_src/%s' % self.file_name

class Meta(ScriptFile.Meta):
class Meta(TextFile.Meta):
unique_together = (('project', 'file_name'),)
6 changes: 3 additions & 3 deletions ide/models/monkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.utils.translation import ugettext as _

from django.core.urlresolvers import reverse
from ide.models.scriptfile import ScriptFile
from ide.models.textfile import TextFile
from ide.models.s3file import S3File
from ide.models.meta import IdeModel
from ide.utils.image_correction import uncorrect
Expand Down Expand Up @@ -184,7 +184,7 @@ class Meta(IdeModel.Meta):
ordering = ['original_name', '-session__date_added']


class TestFile(ScriptFile):
class TestFile(TextFile):
file_name = models.CharField(max_length=100, validators=[RegexValidator(r"^[/a-zA-Z0-9_-]+$")])
project = models.ForeignKey('Project', related_name='test_files')
folder = 'tests/scripts'
Expand Down Expand Up @@ -216,7 +216,7 @@ def latest_code(self):
def get_screenshot_sets(self):
return ScreenshotSet.objects.filter(test=self)

class Meta(ScriptFile.Meta):
class Meta(TextFile.Meta):
unique_together = (('project', 'file_name'),)
ordering = ['file_name']

Expand Down
6 changes: 3 additions & 3 deletions ide/models/scriptfile.py → ide/models/textfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from ide.models.s3file import S3File


class ScriptFile(S3File):
""" ScriptFiles add support to TextFiles for last-modified timestamps and code folding """
class TextFile(S3File):
""" TextFile adds support to S3File for last-modified timestamps and code folding """
last_modified = models.DateTimeField(blank=True, null=True, auto_now=True)
folded_lines = models.TextField(default="[]")
_create_local_if_not_exists = True
Expand All @@ -30,7 +30,7 @@ def save(self, *args, **kwargs):
if self.project:
self.project.last_modified = now()
self.project.save()
super(ScriptFile, self).save(*args, **kwargs)
super(TextFile, self).save(*args, **kwargs)

class Meta(S3File.Meta):
abstract = True
173 changes: 173 additions & 0 deletions ide/south_migrations/0047_remove_pebblejs_dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models

class Migration(DataMigration):

def forwards(self, orm):
""" Delete all dependencies for pebblejs projects. """
orm.Dependency.objects.filter(project__project_type='pebblejs').delete()

def backwards(self, orm):
pass

models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'ide.buildresult': {
'Meta': {'object_name': 'BuildResult'},
'finished': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'builds'", 'to': "orm['ide.Project']"}),
'started': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
'uuid': ('django.db.models.fields.CharField', [], {'default': "'6228d33c-ce42-4649-b7ee-2cb5d075c403'", 'max_length': '36'})
},
'ide.buildsize': {
'Meta': {'object_name': 'BuildSize'},
'binary_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'sizes'", 'to': "orm['ide.BuildResult']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'platform': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
'resource_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'total_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'worker_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
},
'ide.dependency': {
'Meta': {'unique_together': "(('project', 'name'),)", 'object_name': 'Dependency'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'dependencies'", 'to': "orm['ide.Project']"}),
'version': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'ide.project': {
'Meta': {'object_name': 'Project'},
'app_capabilities': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'app_company_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'app_is_hidden': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'app_is_shown_on_communication': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'app_is_watchface': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'app_jshint': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'app_keys': ('django.db.models.fields.TextField', [], {'default': "'{}'"}),
'app_keywords': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
'app_long_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'app_modern_multi_js': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'app_platforms': ('django.db.models.fields.TextField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'app_short_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'app_uuid': ('django.db.models.fields.CharField', [], {'default': "'7b46955b-0250-45d8-9347-559273c689d2'", 'max_length': '36', 'null': 'True', 'blank': 'True'}),
'app_version_label': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '40', 'null': 'True', 'blank': 'True'}),
'github_branch': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'github_hook_build': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'github_hook_uuid': ('django.db.models.fields.CharField', [], {'max_length': '36', 'null': 'True', 'blank': 'True'}),
'github_last_commit': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
'github_last_sync': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'github_repo': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'optimisation': ('django.db.models.fields.CharField', [], {'default': "'s'", 'max_length': '1'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}),
'project_type': ('django.db.models.fields.CharField', [], {'default': "'native'", 'max_length': '10'}),
'sdk_version': ('django.db.models.fields.CharField', [], {'default': "'2'", 'max_length': '6'})
},
'ide.resourcefile': {
'Meta': {'unique_together': "(('project', 'file_name'),)", 'object_name': 'ResourceFile'},
'file_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_menu_icon': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'kind': ('django.db.models.fields.CharField', [], {'max_length': '9'}),
'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'resources'", 'to': "orm['ide.Project']"})
},
'ide.resourceidentifier': {
'Meta': {'object_name': 'ResourceIdentifier'},
'character_regex': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'compatibility': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'memory_format': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'resource_file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'identifiers'", 'to': "orm['ide.ResourceFile']"}),
'resource_id': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'space_optimisation': ('django.db.models.fields.CharField', [], {'max_length': '7', 'null': 'True', 'blank': 'True'}),
'storage_format': ('django.db.models.fields.CharField', [], {'max_length': '3', 'null': 'True', 'blank': 'True'}),
'target_platforms': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '30', 'null': 'True', 'blank': 'True'}),
'tracking': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
},
'ide.resourcevariant': {
'Meta': {'unique_together': "(('resource_file', 'tags'),)", 'object_name': 'ResourceVariant'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_legacy': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'resource_file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'variants'", 'to': "orm['ide.ResourceFile']"}),
'tags': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '50', 'blank': 'True'})
},
'ide.sourcefile': {
'Meta': {'unique_together': "(('project', 'file_name'),)", 'object_name': 'SourceFile'},
'file_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'folded_lines': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'source_files'", 'to': "orm['ide.Project']"}),
'target': ('django.db.models.fields.CharField', [], {'default': "'app'", 'max_length': '10'})
},
'ide.templateproject': {
'Meta': {'object_name': 'TemplateProject', '_ormbases': ['ide.Project']},
u'project_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['ide.Project']", 'unique': 'True', 'primary_key': 'True'}),
'template_kind': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'})
},
'ide.usergithub': {
'Meta': {'object_name': 'UserGithub'},
'avatar': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'nonce': ('django.db.models.fields.CharField', [], {'max_length': '36', 'null': 'True', 'blank': 'True'}),
'token': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'github'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['auth.User']"}),
'username': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'})
},
'ide.usersettings': {
'Meta': {'object_name': 'UserSettings'},
'accepted_terms': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'autocomplete': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
'keybinds': ('django.db.models.fields.CharField', [], {'default': "'default'", 'max_length': '20'}),
'tab_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '2'}),
'theme': ('django.db.models.fields.CharField', [], {'default': "'cloudpebble'", 'max_length': '50'}),
'use_spaces': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}),
'whats_new': ('django.db.models.fields.PositiveIntegerField', [], {'default': '22'})
}
}

complete_apps = ['ide']
symmetrical = True
2 changes: 1 addition & 1 deletion ide/static/ide/js/gist_import.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $(function() {
return Ajax.Post('/ide/import/gist', {gist_id: gist_id}).then(function(data) {
return Ajax.PollTask(data.task_id, {milliseconds: 500});
}).then(function(result) {
return 'ide/project/' + result;
return '/ide/project/' + result;
});
};
});
5 changes: 1 addition & 4 deletions ide/tasks/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ def run_compile(build_result):
if f.kind not in ('png', 'bitmap'):
continue
target_dir = os.path.abspath(os.path.join(base_dir, resource_root, ResourceFile.DIR_MAP[f.kind]))
abs_target = os.path.abspath(os.path.join(target_dir, f.file_name))
if not abs_target.startswith(target_dir):
raise Exception("Suspicious filename: %s" % f.file_name)
f.get_default_variant().copy_to_path(abs_target)
f.copy_all_variants_to_dir(target_dir)

open(os.path.join(base_dir, manifest_filename), 'w').write(json.dumps(manifest_dict))

Expand Down
2 changes: 1 addition & 1 deletion ide/templates/ide/project.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ <h1 class="cloudpebble-logo" style="padding-left: 40px;">
{% endif %}
<li class="nav-header sdk3-only" id="sidebar-pane-timeline"><a href="#">Timeline (Preview)</a></li>
<li class="nav-header" id="sidebar-pane-compile"><a href="#">{% trans 'Compilation' %}</a></li>
{% if npm_manifest_support_enabled %}
{% if npm_manifest_support_enabled and project.project_type != 'pebblejs' %}
<li class="nav-header sdk3-only" id="sidebar-pane-dependencies"><a href="#">{% trans 'Dependencies' %}</a></li>
{% endif %}
<li id="sidebar-pane-github" class="nav-header {%if not project.owner.github%}disabled{%endif%}"><a href="#">GitHub</a></li>
Expand Down
Loading

0 comments on commit 619c1b4

Please sign in to comment.