-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
659 changed files
with
61,369 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"directory": "bower_components", | ||
"analytics": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.js] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.hbs] | ||
insert_final_newline = false | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.css] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.html] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{diff,md}] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
/** | ||
Ember CLI sends analytics information by default. The data is completely | ||
anonymous, but there are times when you might want to disable this behavior. | ||
|
||
Setting `disableAnalytics` to true will prevent any data from being sent. | ||
*/ | ||
"disableAnalytics": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Style/Conventions | ||
|
||
### Checking your code | ||
|
||
Code style checking is part of the Travis build, and PRs that do not meet the code style guidelines will not be merged. You can run these checks locally with: | ||
`npm run check-style` | ||
|
||
### Naming conventions | ||
|
||
Please review and adhere to the naming conventions defined [here](http://ember-cli.com/user-guide/#naming-conventions) | ||
|
||
### Accessibility | ||
|
||
The [ember-a11y](https://www.npmjs.com/package/ember-a11y) addon is a dependency of this addon, and helps facilitate compliance with the guidelines laid out by the [A11y Project](http://a11yproject.com/). This requires one simple change: wherever you would normally use the `{{outlet}}` helper, instead use `{{focusing-outlet}}`. See the project page for more details. | ||
|
||
### Internationalization | ||
|
||
_(In Progress)_ We plan to use the [ember-i18n](https://github.com/jamesarosen/ember-i18n) addon for internationalization support in all components. The main change required here is that all blocks of text should be wrapped with the `t` helper supplied by this library. Read more here: [https://github.com/jamesarosen/ember-i18n/wiki/Doc:-Translating-Text](https://github.com/jamesarosen/ember-i18n/wiki/Doc:-Translating-Text) | ||
|
||
### Components | ||
|
||
We will use "pod" style structure for all of the components in this addon. This means when generating component scaffolds with ember-cli you must pass the --pod flag: `ember g component my-component --pod`. Basically components should be structured like: | ||
|
||
- addon/components/<name>/ | ||
- component.js | ||
- template.hbs | ||
- style.scss (optional) | ||
|
||
#### Styling components | ||
|
||
Leveraging the [ember-component-css](https://github.com/ebryn/ember-component-css) addon will allow us to bundle [Sass](http://sass-lang.com/) files inside components' pod structure, and will automatically namespace those styles to avoid all possible CSS collisions. This approach will allow for easy overrides and paramterization via top-level Sass variables. | ||
|
||
# Testing | ||
|
||
|
||
## Unit tests | ||
|
||
We aim to have near-full test coverage of the code in this addon. That said we want to avoid testing the Ember core or third-party libraries, so some general guidelines for unit tets (minumum requirements): | ||
|
||
**Models** | ||
_Do test_: | ||
- helper methods | ||
- custom transforms | ||
|
||
**Components/Mixins** | ||
_Do test_: | ||
- methods | ||
- computed values | ||
|
||
## Integration tests | ||
|
||
Integration tests allow us to see how components behave while actually running in a browser enviornment. [TODO](https://openscience.atlassian.net/browse/EOSF-28) | ||
|
||
#### Accessibility checks | ||
|
||
We will use the [ember-a11y-testing](https://github.com/trentmwillis/ember-a11y-testing) addon to run a11y checks on all components. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## Ticket | ||
|
||
# Purpose | ||
|
||
# Notes for Reviewers | ||
|
||
## Routes Added/Updated | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# compiled output | ||
/dist | ||
/tmp | ||
|
||
# dependencies | ||
/node_modules | ||
/bower_components | ||
|
||
# misc | ||
/.sass-cache | ||
/connect.lock | ||
/coverage/* | ||
/libpeerconnection.log | ||
npm-debug.log | ||
testem.log | ||
|
||
config/*.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"predef": [ | ||
"server", | ||
"document", | ||
"window", | ||
"-Promise" | ||
], | ||
"browser": true, | ||
"boss": true, | ||
"curly": false, | ||
"debug": false, | ||
"devel": true, | ||
"eqeqeq": true, | ||
"evil": true, | ||
"forin": false, | ||
"immed": false, | ||
"laxbreak": false, | ||
"newcap": true, | ||
"noarg": true, | ||
"noempty": false, | ||
"nonew": false, | ||
"nomen": false, | ||
"onevar": false, | ||
"plusplus": false, | ||
"regexp": false, | ||
"undef": true, | ||
"sub": true, | ||
"strict": false, | ||
"white": false, | ||
"eqnull": true, | ||
"esnext": true, | ||
"unused": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/bower_components | ||
/config/ember-try.js | ||
/dist | ||
/tests | ||
/tmp | ||
**/.gitkeep | ||
.bowerrc | ||
.editorconfig | ||
.ember-cli | ||
.gitignore | ||
.jshintrc | ||
.watchmanconfig | ||
.travis.yml | ||
bower.json | ||
ember-cli-build.js | ||
testem.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* jshint node:true */ | ||
'use strict'; | ||
|
||
module.exports = { | ||
extends: 'recommended', | ||
|
||
rules: { | ||
'block-indentation': 4 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
language: node_js | ||
node_js: | ||
- "4.3.2" | ||
|
||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- node_modules | ||
|
||
before_install: | ||
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH | ||
- "npm config set spin false" | ||
- "npm install -g npm@^2" | ||
|
||
install: | ||
- npm install -g bower | ||
- npm install | ||
- bower install | ||
|
||
script: | ||
- npm run check-style && npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"ignore_dirs": ["tmp", "dist"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Ember-OSF gratefully acknowledges the use of some third-party code. | ||
|
||
|
||
## Infinity custom mixin | ||
Adapts and extends [ember-infinity](https://github.com/hhff/ember-infinity). | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# Ember OSF | ||
|
||
`master` Build Status: [![Build Status](https://travis-ci.org/CenterForOpenScience/ember-osf.svg?branch=master)](https://travis-ci.org/CenterForOpenScience/ember-osf) | ||
|
||
`develop` Build Status: [![Build Status](https://travis-ci.org/CenterForOpenScience/ember-osf.svg?branch=develop)](https://travis-ci.org/CenterForOpenScience/ember-osf) | ||
|
||
This repo contains code for interacting with the OSF APIv2 inside of an Ember app. | ||
|
||
## Contributing? | ||
|
||
Please read the [CONTRIBUTING.md](https://github.com/CenterForOpenScience/ember-osf/blob/develop/.github/CONTRIBUTING.md) | ||
|
||
## Installation (for Development) | ||
|
||
* `git clone` this repository | ||
* `npm install` | ||
* `bower install` | ||
|
||
## Using this code in an Ember app | ||
|
||
1. Clone the repository: `git clone https://github.com/CenterForOpenScience/ember-osf.git` | ||
2. From the consuming Ember app: | ||
- install the addon and it's dependencies: `ember install ../ember-osf` | ||
- this generates a config/local.yml file (see 'Configuration' below) | ||
- link the app for local development: `npm link ../ember-osf` | ||
- Import code from ember-osf like: | ||
```javascript | ||
import Ember from 'ember'; | ||
import OsfTokenLoginRouteMixin from 'ember-osf/mixins/osf-token-login-route'; | ||
|
||
export default Ember.Route.extend(OsfLoginRouteMixin); | ||
``` | ||
|
||
> **Note**: Running ember install will automatically install all bower and npm dependencies for ember-osf. | ||
## Configuration | ||
|
||
#### local.yml settings | ||
|
||
This file is structured like: | ||
```yaml | ||
<backend>: | ||
CLIENT_ID: null | ||
PERSONAL_ACCESS_TOKEN: null | ||
OAUTH_SCOPES: osf.full_read osf.full_write | ||
REDIRECT_URI: http://localhost:4200/login | ||
``` | ||
You will need to fill out options for each backend you want to use (see 'Running' below). | ||
We recommend using the 'test' backend for development and testing as it is the most stable | ||
of our environments. When configuring your application, make sure that your login redirect | ||
uri is correct. If it needs a trailing slash, be sure to include a trailing slash! | ||
Edit the new file (installed in the config directory) and set: | ||
- `CLIENT_ID` to the client id of your developer application | ||
- `PERSONAL_ACCESS_TOKEN` to the newly generated token (Only required or recognized for the LOCAL backend; do not set this value for staging, production, or test backends) | ||
- REDIRECT_URI: Must exactly match the redirect URI used to register the OAuth developer application. | ||
Default value is appropriate for local development using `ember server`, with a login page at `/login` | ||
|
||
Because of the potential for this file to include sensitive information, we strongly recommend adding this file to | ||
`.gitignore` for your project. | ||
|
||
#### Using the Test API | ||
|
||
To do this, you will need to [create a developer application](https://test.osf.io/settings/applications/) on the relevant version of the OSF. | ||
|
||
#### Running the OSF Locally (optional) | ||
|
||
For local development, you will need to be running the [OSF APIv2](https://github.com/CenterForOpenScience/osf.io#running-the-api-server). | ||
To connect to the APIv2 while using [fakecas](https://github.com/CenterForOpenScience/osf.io#running-the-osf), you will need to generate a | ||
personal access token on your local OSF instance [here](http://localhost:5000/settings/tokens/)--go ahead and grant access to all scopes. | ||
|
||
#### Create a local settings file | ||
|
||
If for some reason you don't have a config/local.yml you can generate one. To do this: | ||
```bash | ||
ember generate ember-osf | ||
``` | ||
|
||
## Usage | ||
|
||
#### Ember Data: Using the OSF models | ||
|
||
The models, serializers, adapters bundled in this addon with be available to you automatically. | ||
For example, simply do: | ||
```javascript | ||
this.store.findAll('node') | ||
``` | ||
to fetch all nodes. | ||
|
||
## Running | ||
|
||
We recommend developers target out test server: | ||
- test (`test`): matches production features, very stable | ||
|
||
Other options include: | ||
- local (`local`): for developers running the OSF stack locally | ||
- staging (`stage`): contains bleeding edge features, but less stable | ||
- staging2 (`stage2`): another version of staging using running a specific feature branch | ||
|
||
Then (using test as an example) run: | ||
`BACKEND=test ember server` | ||
|
||
and visit your app at http://localhost:4200. | ||
|
||
**Note:** This runs the dummy app contained in /tests/dummy | ||
|
||
## Running Tests | ||
|
||
* `npm test` (Runs `ember try:testall` to test your addon against multiple Ember versions) | ||
* `ember test` | ||
* `ember test --server` | ||
|
||
## Building | ||
|
||
* `ember build` | ||
|
||
For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/). |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import OsfAdapter from './osf-adapter'; | ||
|
||
export default OsfAdapter.extend({ | ||
buildURL(_, __, ___, requestType) { | ||
// Embed linked_nodes | ||
var base = this._super(...arguments); | ||
if (['createRecord', 'updateRecord', 'deleteRecord'].indexOf(requestType) === -1) { | ||
return `${base}?embed=linked_nodes`; | ||
} else { | ||
return base; | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import OsfAdapter from './osf-adapter'; | ||
|
||
export default OsfAdapter.extend({ | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import OsfAdapter from './osf-adapter'; | ||
|
||
export default OsfAdapter.extend({ | ||
}); |
Oops, something went wrong.