Skip to content

Commit

Permalink
Merge branch 'release/0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjgeiger committed Apr 7, 2017
2 parents 8393568 + 115c244 commit 57e0ae8
Show file tree
Hide file tree
Showing 59 changed files with 855 additions and 588 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
**/bower_components
**/dist
**/node_modules
**/tmp
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage
dist
docs
tmp
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 6,
sourceType: 'module'
},
extends: 'eslint:recommended',
env: {
browser: true,
es6: true
},
globals: {
MathJax: true
},
rules: {}
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
.npmrc
npm-debug.log
testem.log
.idea

# Never commit configuration or private settings
config/*.yml
34 changes: 0 additions & 34 deletions .jshintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* jshint node:true */
/* eslint-env node */
'use strict';

module.exports = {
Expand Down
60 changes: 60 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
FROM node:boron

RUN apt-get update \
&& apt-get install -y \
git \
# Next 2 needed for yarn
apt-transport-https \
ca-certificates \
# watchman
build-essential \
automake \
autoconf \
python-dev \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y \
yarn \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

ENV WATCHMAN_VERSION 4.7.0
RUN cd /tmp \
&& git clone https://github.com/facebook/watchman.git \
&& cd watchman \
&& git checkout v$WATCHMAN_VERSION \
&& ./autogen.sh \
&& ./configure --enable-statedir=/tmp \
&& make \
&& make install \
&& mv watchman /usr/local/bin/watchman \
&& rm -Rf /tmp/watchman

RUN mkdir -p /code
WORKDIR /code

COPY ./package.json ./yarn.lock /code/
RUN yarn --pure-lockfile

COPY ./.bowerrc /code/.bowerrc
COPY ./bower.json /code/bower.json
RUN ./node_modules/bower/bin/bower install --allow-root --config.interactive=false

COPY ./ /code/

ARG GIT_COMMIT=
ENV GIT_COMMIT ${GIT_COMMIT}

ARG APP_ENV=production
ENV APP_ENV ${APP_ENV}
ARG BACKEND=local
ENV BACKEND ${BACKEND}
RUN ./node_modules/ember-cli/bin/ember build --env ${APP_ENV}

CMD ["yarn", "test"]
4 changes: 2 additions & 2 deletions addon/adapters/osf-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default DS.JSONAPIAdapter.extend(HasManyQuery.RESTAdapterMixin, GenericDa
* @param {String} url
* @param {Boolean} isBulk
**/
_createRelated(store, snapshot, createdSnapshots, relationship, url, isBulk = false) { // jshint ignore:line
_createRelated(store, snapshot, createdSnapshots, relationship, url) { //, isBulk = false) {
// TODO support bulk create?
// if (isBulk) {
//
Expand Down Expand Up @@ -183,7 +183,7 @@ export default DS.JSONAPIAdapter.extend(HasManyQuery.RESTAdapterMixin, GenericDa
* @param {String} url
* @param {Boolean} isBulk
**/
_deleteRelated(store, snapshot, deletedSnapshots, relationship, url, isBulk = false) { // jshint ignore:line
_deleteRelated(store, snapshot, deletedSnapshots) { //, relationship, url, isBulk = false) {
return this._removeRelated(...arguments).then(() => {
deletedSnapshots.forEach(s => s.record.unloadRecord());
});
Expand Down
7 changes: 3 additions & 4 deletions addon/components/dropzone-widget/component.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global Dropzone */

import Ember from 'ember';
import config from 'ember-get-config';

Expand Down Expand Up @@ -32,10 +34,7 @@ export default Ember.Component.extend({
let preUpload = this.get('preUpload');
let dropzoneOptions = this.get('options') || {};

if (!this.get('buildUrl') && !preUpload && !dropzoneOptions.url) {
console.error('Need to define url somewhere');
}
let drop = new Dropzone(`#${this.elementId}`, { // jshint ignore:line
let drop = new Dropzone(`#${this.elementId}`, {
url: file => typeof this.get('buildUrl') === 'function' ? this.get('buildUrl')(file) : this.get('buildUrl'),
autoProcessQueue: false,
dictDefaultMessage: this.get('defaultMessage') || 'Drop files here to upload'
Expand Down
6 changes: 0 additions & 6 deletions addon/components/file-widget/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ export default Ember.Component.extend({
selectNodeFile(file) {
this.send('selectFile', file.get('links.download'));
},
selectNode(node) {
console.log(node);
},
selectFile(url) {
console.log(url);
},
preUpload() {
return new Ember.RSVP.Promise((resolve) => resolve());
}
Expand Down
2 changes: 1 addition & 1 deletion addon/components/navbar-auth-dropdown/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default Ember.Component.extend({
actions: {
logout() {
const redirectUrl = this.get('redirectUrl');
const query = redirectUrl ? '?' + Ember.$.param({ redirect_url: redirectUrl }) : '';
const query = redirectUrl ? '?' + Ember.$.param({ next_url: redirectUrl }) : '';
// TODO: May not work well if logging out from page that requires login- check?
this.get('session').invalidate()
.then(() => window.location.href = `${config.OSF.url}logout/${query}`);
Expand Down
8 changes: 4 additions & 4 deletions addon/components/osf-footer/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<div class="col-sm-2 col-md-3 col-md-offset-1">
<h4>OSF</h4>
<ul>
<li><a href="explore/activity/">Explore</a></li>
<li><a href="/explore/activity/">Explore</a></li>
<li>
{{{supportEmail}}}
</li>
<li><a href="support">FAQ/Guides</a></li>
<li><a href="/support">FAQ/Guides</a></li>
<li><a href="https://api.osf.io/v2/docs/">API</a></li>
<li><a href="https://github.com/CenterForOpenScience/osf.io">Source Code</a></li>
</ul>
Expand All @@ -18,8 +18,8 @@
<h4>Center for Open Science</h4>
<ul>
<li><a href="http://cos.io">Home</a></li>
<li><a href="ezcuj/wiki/home/">Reproducibility Project: Psychology</a></li>
<li><a href="e81xl/wiki/home/">Reproducibility Project: Cancer Biology</a></li>
<li><a href="/ezcuj/wiki/home/">Reproducibility Project: Psychology</a></li>
<li><a href="/e81xl/wiki/home/">Reproducibility Project: Cancer Biology</a></li>
<li><a href="http://cos.io/top/">TOP Guidelines</a></li>
<li><a href="https://www.givinglibrary.org/organizations/center-for-open-science">Donate</a></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion addon/mixins/commentable.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default Ember.Mixin.create({
*/
reportComment() {
// TODO: Implement
console.log('Consider this comment reported');
// console.log('Consider this comment reported');
}
}
});
38 changes: 38 additions & 0 deletions addon/mixins/host-app-name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import config from 'ember-get-config';
import Ember from 'ember';

/**
* @module ember-osf
* @submodule mixins
*/

/**
* This mixin provides an attribute that holds the host app name, and is intended to be used with other ember-osf components.
*
* Sample usage:
* ```
* // components/componentA.js
* import hostAppName from ‘ember-osf/mixins/host-app-name’;
*
* export default Component.extend(hostAppName);
* ```
*
* ```
* // components/ComponentB.js
* import hostAppName from ‘ember-osf/mixins/host-app-name’;
*
* export default Component.extend(hostAppName);
*
* ```
* The above example will result in both component A and component B sharing the same attribute hostAppName.
*
*/

export default Ember.Mixin.create({
/**
* The name of the hosting app is stored in the config/environment.js. Use the package ember-get-config to
* gain access to the app's config file.
* @property {String} hostAppName
*/
hostAppName: config.appName
});
8 changes: 4 additions & 4 deletions addon/mixins/node-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default Ember.Mixin.create({
* @param {Boolean} sendEmail Whether user will receive an email when added. "default: true"
* @return {Promise} Returns a promise that resolves to the newly created contributor object.
*/
addContributor(userId, permission, isBibliographic, sendEmail) { // jshint ignore:line
addContributor() {
return this.get('_node').addContributor(...arguments);
},
/**
Expand All @@ -116,7 +116,7 @@ export default Ember.Mixin.create({
* @param {Boolean} sendEmail Whether user will receive an email when added. "default: true"
* @return {Promise} Returns a promise that resolves to an array of added contributors
*/
addContributors(contributors, sendEmail) { // jshint ignore:line
addContributors() {
return this.get('_node').addContributors(...arguments);
},
/**
Expand All @@ -141,7 +141,7 @@ export default Ember.Mixin.create({
* @return {Promise} Returns a promise that resolves to the updated node
* with edited contributor relationships.
*/
updateContributors(contributors, permissionsChanges, bibliographicChanges) { // jshint ignore:line
updateContributors() {
return this.get('_node').updateContributors(...arguments);
},

Expand All @@ -155,7 +155,7 @@ export default Ember.Mixin.create({
* @return {Promise} Returns a promise that resolves to the updated node
* with edited contributor relationships.
*/
updateContributor(contributor, permissions, bibliographic) { // jshint ignore:line
updateContributor() {
return this.get('_node').updateContributor(...arguments);
},
/**
Expand Down
2 changes: 1 addition & 1 deletion addon/mixins/osf-cookie-login-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export default Ember.Mixin.create({

// Block transition until auth attempt resolves. If auth fails, let the page load normally.
return this.get('session').authenticate('authenticator:osf-cookie')
.catch(err => console.log('Authentication failed: ', err));
.catch(err => Ember.Logger.log('Authentication failed: ', err));
}
});
2 changes: 1 addition & 1 deletion addon/mixins/osf-token-login-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ export default Ember.Mixin.create({
}

return this.get('session').authenticate('authenticator:osf-token', accessToken)
.catch(err => console.log('Authentication failed: ', err));
.catch(err => Ember.Logger.log('Authentication failed: ', err));
}
});
1 change: 1 addition & 0 deletions addon/models/file-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ import OsfModel from './osf-model';
*/
export default OsfModel.extend({
size: DS.attr('number'),
dateCreated: DS.attr('date'),
contentType: DS.attr('fixstring')
});
1 change: 1 addition & 0 deletions addon/models/preprint-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default OsfModel.extend({
logoPath: DS.attr('string'),
bannerPath: DS.attr('string'),
description: DS.attr('fixstring'),
domain: DS.attr('string'),
example: DS.attr('fixstring'),
advisoryBoard: DS.attr('string'),
emailContact: DS.attr('fixstring'),
Expand Down
2 changes: 1 addition & 1 deletion addon/serializers/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Ember from 'ember';
import OsfSerializer from './osf-serializer';

export default OsfSerializer.extend({
serialize(snapshot, options) { // jshint ignore:line
serialize(snapshot) {
// Add relationships field to identify comment target
let serialized = this._super(...arguments);

Expand Down
4 changes: 2 additions & 2 deletions addon/serializers/osf-serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default DS.JSONAPISerializer.extend({
return serialized;
},

serializeAttribute(snapshot, json, key, attribute) { // jshint ignore:line
serializeAttribute(snapshot, json, key) {
// In certain cases, a field may be omitted from the server payload, but have a value (undefined)
// when serialized from the model. (eg node.template_from)
// Omit fields with a value of undefined before sending to the server. (but still allow null to be sent)
Expand All @@ -114,7 +114,7 @@ export default DS.JSONAPISerializer.extend({
}
},

normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) { // jshint ignore:line
normalizeArrayResponse(store, primaryModelClass, payload) {
// Ember data does not yet support pagination. For any request that returns more than one result, add pagination data
// under meta, and then calculate total pages to be loaded.
let documentHash = this._super(...arguments);
Expand Down
1 change: 1 addition & 0 deletions app/mixins/host-app-name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default} from 'ember-osf/mixins/host-app-name';
11 changes: 6 additions & 5 deletions app/mixins/keen-tracker.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* eslint-disable no-unused-vars */
// This helps ember-browserify find npm modules in ember-cli addons

import md5 from 'npm:js-md5'; // jshint ignore:line
import config from 'ember-get-config'; // jshint ignore:line
import _get from 'npm:lodash/get'; // jshint ignore:line
import Cookie from 'npm:js-cookie'; // jshint ignore:line
import keenTracking from 'npm:keen-tracking'; // jshint ignore:line
import md5 from 'npm:js-md5';
import config from 'ember-get-config';
import _get from 'npm:lodash/get';
import Cookie from 'npm:js-cookie';
import keenTracking from 'npm:keen-tracking';

export {default} from 'ember-osf/mixins/keen-tracker';
6 changes: 0 additions & 6 deletions blueprints/.jshintrc

This file was deleted.

2 changes: 1 addition & 1 deletion blueprints/ember-osf/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*jshint node:true*/
/* eslint-env node */
var fs = require('fs');
var path = require('path');

Expand Down
1 change: 1 addition & 0 deletions config/coverage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env node */
'use strict';

//See https://github.com/kategengler/ember-cli-code-coverage/issues/41
Expand Down
Loading

0 comments on commit 57e0ae8

Please sign in to comment.