Skip to content

Commit

Permalink
Left panel (#8)
Browse files Browse the repository at this point in the history
* Update ember-cli-uglify

* Update some dependencies

* Update more dependencies

* Update yet more dependencies

* Upgrade ember-cli to 2.13

* Upgrade ember-data to 2.13

* Upgrade ember-data to 2.18

* Try to fix travis failure

* Upgrade to ember-cli-qunit@4

* Upgrade ember-cli-mirage

* Upgrade ember-cli to 2.14

* Upgrade ember-cli to 2.15

* Added info about where the backend is

* Fix didResize method undefined bug in canary (ember-cli#613)

* Support New module imports

* Changes after making ember-cli-cjs-transform configurable

* Update ember-cli-cjs-transform

* Support Ember 2.17 and 2.18

* Fix ability to sign in via github

* v0.14.1

* yarn upgrade

* Deprecate old versions of Ember

* Support Ember 3.0 - 3.2

* updates contribution guide (ember-cli#621)

* Try to upgrade ember-cli-qunit to 4.3.x

* Fixed the damn ember-cli-qunit build

* cleanup

* Fix tests for tests

* Refactor and reorganize ember-cli-build.js

* Migrate to using babel-preset-env. (ember-cli#627)

* Drop transpilation for IE.

`last 2 versions` will target IE10 and IE11, which we don't support...

* Migrate to using babel-preset-env.

This will lead to less transpilation (e.g. we can use native async/await
now, instead of transpiling).

* Adds keyboard shortcut option to comment javascript code. (ember-cli#622)

* adds shortcut comment option for javascript code

* Adds test

* change from `keypress` to `keydown` to trigger events

* comment logic moved to initializer

* fix test server shutdown

* adds keyboard shortcuts for `run now` and `save` (ember-cli#628)

* adds keyboard shortcuts for `run now` and `save`

* adds deps for unit test

* using e-keyboard test helper

* minor tweaks

* Bump Ember Data

* Fix dependency test was timing out again
  • Loading branch information
Gaurav0 authored and knownasilya committed Jul 3, 2018
1 parent 264ccdb commit af9eb6f
Show file tree
Hide file tree
Showing 43 changed files with 1,628 additions and 784 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ module.exports = {
visit: true,
waitForLoadedIFrame: true,
waitForUnloadedIFrame: true,
'$': true
'$': true,
CodeMirror: false
},
rules: {
'ember/new-module-imports': 'off'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
npm-debug.log*
yarn-error.log
testem.log
.vscode

# ember-try
.node_modules.ember-try/
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ You will need the following things properly installed on your computer.

### Running / Development Without Docker (Recommended)

* `node server.js` from your gatekeeper folder
* `node index.js` from your gatekeeper folder
* `yarn` from ember twiddle folder
* `bower install` from ember twiddle folder
* `ember server` from ember twiddle folder
Expand All @@ -55,7 +55,7 @@ You will need the following things properly installed on your computer.

#### Instructions

* `node server.js` from your gatekeeper folder
* `node index.js` from your gatekeeper folder
* `docker-compose up` from ember twiddle folder
* Visit your app at [http://localhost:4200](http://localhost:4200).

Expand Down Expand Up @@ -87,6 +87,6 @@ Make use of the many generators for code, try `ember help generate` for more det
* Upgrading the ember-cli version is extremely difficult, because we are using private apis. Try to upgrade in small pieces. Consider forking ember-cli during the upgrade process to upgrade its dependencies one by one. Don't forget to revert to a standard ember-cli version when done.
* Add tests with your PR.
* Upgrading ember-cli is usually not necessary to upgrade Ember or Ember Data.
* New Ember versions will not work without upgrades to the backend.
* New Ember versions will not work without upgrades to the [backend](https://github.com/joostdevries/twiddle-backend).
* The backend does not have tests. Until it does, please test by actually compiling addons with Docker and an AWS account before submitting PRs.
* If you are going to use a local backend, make changes to environment.js using [`git update-index skip-worktree [<file>...]`](https://medium.com/@igloude/git-skip-worktree-and-how-i-used-to-hate-config-files-e84a44a8c859) so that changes to your environment.js are not accidentally committed.
4 changes: 2 additions & 2 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Ember from 'ember';
import Application from '@ember/application';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

const App = Ember.Application.extend({
const App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
Expand Down
2 changes: 1 addition & 1 deletion app/components/build-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default Ember.Component.extend({
// eslint-disable-next-line no-console
console.error(error);
});
this.get('notify').info('Errors were dumped to console');
this.get('notify').error('Errors were dumped to console');
}
}
});
4 changes: 4 additions & 0 deletions app/components/dummy-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export default Ember.Component.extend(ResizeMixin, {

didInsertElement() {
this._super();
this.didResize();
},

didResize() {
let offset = this.$().offset(), width = this.$().width(),
height = this.$().height();

Expand Down
22 changes: 19 additions & 3 deletions app/components/main-gist.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import ColumnsMixin from "../mixins/columns";
import FilesMixin from "../mixins/files";
import TestFilesMixin from "../mixins/test-files";
import AppBuilderMixin from "../mixins/app-builder";
import { keyDown, EKMixin } from 'ember-keyboard';

const { inject, computed, run } = Ember;
const { inject, computed, run, on } = Ember;

export default Ember.Component.extend(AppBuilderMixin, ColumnsMixin, FilesMixin, TestFilesMixin, {
export default Ember.Component.extend(AppBuilderMixin, ColumnsMixin, FilesMixin, TestFilesMixin, EKMixin, {
emberCli: inject.service(),
dependencyResolver: inject.service(),
notify: inject.service(),
Expand All @@ -21,9 +22,24 @@ export default Ember.Component.extend(AppBuilderMixin, ColumnsMixin, FilesMixin,
init() {
this._super(...arguments);
this.createColumns();
this.set('activeEditorCol', '1');
this.setProperties({
activeEditorCol: '1',
keyboardActivated: true
});
},

// eslint-disable-next-line ember/no-on-calls-in-components
onReloadCommand: on(keyDown('Enter+cmd'), function () {
this.send('runNow');
}),

// eslint-disable-next-line ember/no-on-calls-in-components
onSaveCommand: on(keyDown('cmd+KeyS'), function (event) {
this.saveGist(this.get('model'));
this.send('runNow');
event.preventDefault();
}),

/**
* Output from the build, sets the `code` attr on the component
* @type {String}
Expand Down
1 change: 0 additions & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
testSupport: "{{rootURL}}assets/test-support.js",
testSupportCss: "{{rootURL}}assets/test-support.css",
testLoader: "{{rootURL}}assets/test-loader.js",
emberTestHelpers: "{{rootURL}}assets/ember-test-helpers.js",
emberQUnit: "{{rootURL}}assets/ember-qunit.js"
};
</script>
Expand Down
11 changes: 11 additions & 0 deletions app/initializers/app-initializer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export function initialize(/* application */) {
// adds "toggleCommentIndented" command to codemirror for default keymap

if (CodeMirror) {
CodeMirror.keyMap.default['Cmd-/'] = 'toggleCommentIndented';
}
}

export default {
initialize
};
5 changes: 2 additions & 3 deletions app/mixins/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Ember from 'ember';
import $ from 'jquery';

const {
computed,
run
} = Ember;

Expand All @@ -17,7 +16,7 @@ export default Ember.Mixin.create({
$(window).off('resize', this.get("resizeHandler"));
},

resizeHandler: computed(function() {
resizeHandler() {
return run.bind(this, 'didResize');
})
}
});
4 changes: 2 additions & 2 deletions app/router.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';
import EmberRouter from '@ember/routing/router';
import config from './config/environment';

const Router = Ember.Router.extend({
const Router = EmberRouter.extend({
location: config.locationType,
rootURL: config.rootURL
});
Expand Down
4 changes: 3 additions & 1 deletion app/routes/gist-base-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default Ember.Route.extend({

showRevision() {},
showCurrentVersion() {},
signInViaGithub() {}
signInViaGithub() {
this.send('signInWithGithub');
}
}
});
18 changes: 17 additions & 1 deletion app/routes/gist.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,21 @@ export default Ember.Route.extend({
actions: {
saveGist(gist) {
var newGist = gist.get('isNew');
let controller = this.get('controller');
if (!newGist && gist.get('ownerLogin') !== this.get('session.currentUser.login')) {
this.send('fork', gist);
return;
}
controller.set('isGistSaving', true);
gist.save().then(() => {
this.get('notify').info(`Saved to Gist ${gist.get('id')} on Github`);
this.send('setSaved');
if(newGist) {
gist.set('gistId', gist.get('id'));
this.transitionTo('gist.edit', gist);
}
}).catch((this.catchSaveError.bind(this)));
}).catch((this.catchSaveError.bind(this)))
.finally(() => controller.set('isGistSaving', false));
},

deleteGist(gist) {
Expand Down Expand Up @@ -115,6 +118,19 @@ export default Ember.Route.extend({
urlChanged(newUrl) {
this.get('app').postMessage({ newUrl });
},

signInWithGithub() {
this.session.open(this.get('toriiProvider')).catch(function(error) {
if (alert) {
alert('Could not sign you in: ' + error.message);
}
throw error;
});
},

signOut() {
this.session.close();
},

showCurrentVersion() {
this.get('store').unloadAll('gistFile');
Expand Down
43 changes: 36 additions & 7 deletions app/services/dependency-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,36 @@
import Ember from 'ember';
import config from '../config/environment';
import { task, timeout } from 'ember-concurrency';
import compareVersions from 'compare-versions';

const { computed, inject, RSVP, testing } = Ember;
const { computed, deprecate, inject, RSVP, testing } = Ember;

const EMBER_VERSIONS = ['2.16.2', '2.15.3', '2.14.1', '2.13.0', '2.12.0', '2.11.2', '2.10.2', '2.9.1', '2.8.2', '2.7.3', '2.6.2', '2.5.1', '2.4.5', '2.3.2', '2.2.2', '2.1.2', '2.0.3', '1.13.13', '1.12.2'];
const EMBER_DATA_VERSIONS = ['2.16.3', '2.15.3', '2.14.10', '2.13.2', '2.12.2', '2.11.3', '2.10.0', '2.9.0', '2.8.1', '2.7.0', '2.6.2', '2.5.5', '2.4.3', '2.3.3', '2.2.1', '2.1.0', '2.0.1', '1.13.15'];
const EMBER_VERSIONS = ['3.2.2', '3.1.3', '3.0.0', '2.18.2', '2.17.2', '2.16.2', '2.15.3', '2.14.1', '2.13.0', '2.12.0'];
const EMBER_DATA_VERSIONS = ['3.2.0', '3.1.1', '3.0.2', '2.18.2', '2.17.1', '2.16.4', '2.15.3', '2.14.10', '2.13.2', '2.12.2'];

const VERSION_REGEX = /^\d+.\d+.\d+(-beta\.\d+)?$/;

const CDN_MAP = {
'ember': {
pakage: 'ember-source',
library: 'ember.js',
fileName: 'ember.debug.js'
},

'ember-template-compiler': {
pakage: 'ember-source',
library: 'ember.js',
fileName: 'ember-template-compiler.js'
},

'ember-testing': {
pakage: 'ember-source',
library: 'ember.js',
fileName: 'ember-testing.js'
},

'ember-data': {
pakage: 'ember-data',
library: 'ember-data.js',
fileName: 'ember-data.js'
}
Expand All @@ -48,7 +53,7 @@ export default Ember.Service.extend({

resolveDependencies(dependencies) {
Object.keys(dependencies).forEach((name) => {
var value = dependencies[name];
let value = dependencies[name];

dependencies[name] = this.resolveDependency(name, value);
});
Expand Down Expand Up @@ -148,15 +153,39 @@ export default Ember.Service.extend({
},

channelURL(name, channel) {
var fileName = CHANNEL_FILENAME_MAP[name];
let fileName = CHANNEL_FILENAME_MAP[name];

return `//s3.amazonaws.com/builds.emberjs.com/${channel}/${fileName}`;
},

cdnURL(name, version) {
var { library, fileName } = CDN_MAP[name];
let { pakage, library, fileName } = CDN_MAP[name];

return `//cdnjs.cloudflare.com/ajax/libs/${library}/${version}/${fileName}`;
let deprecatedUrl = `//cdnjs.cloudflare.com/ajax/libs/${library}/${version}/${fileName}`;

if (name === 'ember-data') {
const msg = 'It is recommended you use ember-data as an addon';
deprecate(msg, testing, {
id: 'ember-twiddle.deprecate-ember-data-as-dependency',
until: '0.16.0',
});
this.get('notify').warning(msg);

return deprecatedUrl;
}

if (compareVersions(version, '2.12.0') === -1) {
const msg = 'Versions of Ember prior to 2.12.0 are no longer supported in Ember Twiddle';
deprecate(msg, testing, {
id: 'ember-twiddle.deprecate-ember-versions-before-2-12',
until: '0.16.0',
});
this.get('notify').warning(msg);

return deprecatedUrl;
}

return `//cdn.jsdelivr.net/npm/${pakage}@${version}/dist/${fileName}`;
},

emberVersions: computed(function() {
Expand Down
Loading

0 comments on commit af9eb6f

Please sign in to comment.