Skip to content

Commit f55ce5e

Browse files
committed
Merge branch 'release/0.1.0'
2 parents 3ae32cb + d88fd1f commit f55ce5e

File tree

659 files changed

+61369
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

659 files changed

+61369
-0
lines changed

.bowerrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"directory": "bower_components",
3+
"analytics": false
4+
}

.editorconfig

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
8+
[*]
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
indent_style = space
14+
indent_size = 4
15+
16+
[*.js]
17+
indent_style = space
18+
indent_size = 4
19+
20+
[*.hbs]
21+
insert_final_newline = false
22+
indent_style = space
23+
indent_size = 4
24+
25+
[*.css]
26+
indent_style = space
27+
indent_size = 4
28+
29+
[*.html]
30+
indent_style = space
31+
indent_size = 4
32+
33+
[*.{diff,md}]
34+
trim_trailing_whitespace = false

.ember-cli

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
/**
3+
Ember CLI sends analytics information by default. The data is completely
4+
anonymous, but there are times when you might want to disable this behavior.
5+
6+
Setting `disableAnalytics` to true will prevent any data from being sent.
7+
*/
8+
"disableAnalytics": false
9+
}

.github/CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Style/Conventions
2+
3+
### Checking your code
4+
5+
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:
6+
`npm run check-style`
7+
8+
### Naming conventions
9+
10+
Please review and adhere to the naming conventions defined [here](http://ember-cli.com/user-guide/#naming-conventions)
11+
12+
### Accessibility
13+
14+
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.
15+
16+
### Internationalization
17+
18+
_(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)
19+
20+
### Components
21+
22+
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:
23+
24+
- addon/components/<name>/
25+
- component.js
26+
- template.hbs
27+
- style.scss (optional)
28+
29+
#### Styling components
30+
31+
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.
32+
33+
# Testing
34+
35+
36+
## Unit tests
37+
38+
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):
39+
40+
**Models**
41+
_Do test_:
42+
- helper methods
43+
- custom transforms
44+
45+
**Components/Mixins**
46+
_Do test_:
47+
- methods
48+
- computed values
49+
50+
## Integration tests
51+
52+
Integration tests allow us to see how components behave while actually running in a browser enviornment. [TODO](https://openscience.atlassian.net/browse/EOSF-28)
53+
54+
#### Accessibility checks
55+
56+
We will use the [ember-a11y-testing](https://github.com/trentmwillis/ember-a11y-testing) addon to run a11y checks on all components.
57+

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Ticket
2+
3+
# Purpose
4+
5+
# Notes for Reviewers
6+
7+
## Routes Added/Updated
8+
9+

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
7+
# dependencies
8+
/node_modules
9+
/bower_components
10+
11+
# misc
12+
/.sass-cache
13+
/connect.lock
14+
/coverage/*
15+
/libpeerconnection.log
16+
npm-debug.log
17+
testem.log
18+
19+
config/*.yml

.jshintrc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"predef": [
3+
"server",
4+
"document",
5+
"window",
6+
"-Promise"
7+
],
8+
"browser": true,
9+
"boss": true,
10+
"curly": false,
11+
"debug": false,
12+
"devel": true,
13+
"eqeqeq": true,
14+
"evil": true,
15+
"forin": false,
16+
"immed": false,
17+
"laxbreak": false,
18+
"newcap": true,
19+
"noarg": true,
20+
"noempty": false,
21+
"nonew": false,
22+
"nomen": false,
23+
"onevar": false,
24+
"plusplus": false,
25+
"regexp": false,
26+
"undef": true,
27+
"sub": true,
28+
"strict": false,
29+
"white": false,
30+
"eqnull": true,
31+
"esnext": true,
32+
"unused": true
33+
}

.npmignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/bower_components
2+
/config/ember-try.js
3+
/dist
4+
/tests
5+
/tmp
6+
**/.gitkeep
7+
.bowerrc
8+
.editorconfig
9+
.ember-cli
10+
.gitignore
11+
.jshintrc
12+
.watchmanconfig
13+
.travis.yml
14+
bower.json
15+
ember-cli-build.js
16+
testem.js

.template-lintrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* jshint node:true */
2+
'use strict';
3+
4+
module.exports = {
5+
extends: 'recommended',
6+
7+
rules: {
8+
'block-indentation': 4
9+
}
10+
};

.travis.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
language: node_js
3+
node_js:
4+
- "4.3.2"
5+
6+
sudo: false
7+
8+
cache:
9+
directories:
10+
- node_modules
11+
12+
before_install:
13+
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
14+
- "npm config set spin false"
15+
- "npm install -g npm@^2"
16+
17+
install:
18+
- npm install -g bower
19+
- npm install
20+
- bower install
21+
22+
script:
23+
- npm run check-style && npm test

.watchmanconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignore_dirs": ["tmp", "dist"]
3+
}

NOTICE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Ember-OSF gratefully acknowledges the use of some third-party code.
2+
3+
4+
## Infinity custom mixin
5+
Adapts and extends [ember-infinity](https://github.com/hhff/ember-infinity).
6+
7+
The MIT License (MIT)
8+
9+
Copyright (c) 2016
10+
11+
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:
12+
13+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14+
15+
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.
16+

README.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Ember OSF
2+
3+
`master` Build Status: [![Build Status](https://travis-ci.org/CenterForOpenScience/ember-osf.svg?branch=master)](https://travis-ci.org/CenterForOpenScience/ember-osf)
4+
5+
`develop` Build Status: [![Build Status](https://travis-ci.org/CenterForOpenScience/ember-osf.svg?branch=develop)](https://travis-ci.org/CenterForOpenScience/ember-osf)
6+
7+
This repo contains code for interacting with the OSF APIv2 inside of an Ember app.
8+
9+
## Contributing?
10+
11+
Please read the [CONTRIBUTING.md](https://github.com/CenterForOpenScience/ember-osf/blob/develop/.github/CONTRIBUTING.md)
12+
13+
## Installation (for Development)
14+
15+
* `git clone` this repository
16+
* `npm install`
17+
* `bower install`
18+
19+
## Using this code in an Ember app
20+
21+
1. Clone the repository: `git clone https://github.com/CenterForOpenScience/ember-osf.git`
22+
2. From the consuming Ember app:
23+
- install the addon and it's dependencies: `ember install ../ember-osf`
24+
- this generates a config/local.yml file (see 'Configuration' below)
25+
- link the app for local development: `npm link ../ember-osf`
26+
- Import code from ember-osf like:
27+
```javascript
28+
import Ember from 'ember';
29+
import OsfTokenLoginRouteMixin from 'ember-osf/mixins/osf-token-login-route';
30+
31+
export default Ember.Route.extend(OsfLoginRouteMixin);
32+
```
33+
34+
> **Note**: Running ember install will automatically install all bower and npm dependencies for ember-osf.
35+
36+
## Configuration
37+
38+
#### local.yml settings
39+
40+
This file is structured like:
41+
```yaml
42+
<backend>:
43+
CLIENT_ID: null
44+
PERSONAL_ACCESS_TOKEN: null
45+
OAUTH_SCOPES: osf.full_read osf.full_write
46+
REDIRECT_URI: http://localhost:4200/login
47+
```
48+
49+
You will need to fill out options for each backend you want to use (see 'Running' below).
50+
We recommend using the 'test' backend for development and testing as it is the most stable
51+
of our environments. When configuring your application, make sure that your login redirect
52+
uri is correct. If it needs a trailing slash, be sure to include a trailing slash!
53+
54+
Edit the new file (installed in the config directory) and set:
55+
- `CLIENT_ID` to the client id of your developer application
56+
- `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)
57+
- REDIRECT_URI: Must exactly match the redirect URI used to register the OAuth developer application.
58+
Default value is appropriate for local development using `ember server`, with a login page at `/login`
59+
60+
Because of the potential for this file to include sensitive information, we strongly recommend adding this file to
61+
`.gitignore` for your project.
62+
63+
#### Using the Test API
64+
65+
To do this, you will need to [create a developer application](https://test.osf.io/settings/applications/) on the relevant version of the OSF.
66+
67+
#### Running the OSF Locally (optional)
68+
69+
For local development, you will need to be running the [OSF APIv2](https://github.com/CenterForOpenScience/osf.io#running-the-api-server).
70+
To connect to the APIv2 while using [fakecas](https://github.com/CenterForOpenScience/osf.io#running-the-osf), you will need to generate a
71+
personal access token on your local OSF instance [here](http://localhost:5000/settings/tokens/)--go ahead and grant access to all scopes.
72+
73+
#### Create a local settings file
74+
75+
If for some reason you don't have a config/local.yml you can generate one. To do this:
76+
```bash
77+
ember generate ember-osf
78+
```
79+
80+
## Usage
81+
82+
#### Ember Data: Using the OSF models
83+
84+
The models, serializers, adapters bundled in this addon with be available to you automatically.
85+
For example, simply do:
86+
```javascript
87+
this.store.findAll('node')
88+
```
89+
to fetch all nodes.
90+
91+
## Running
92+
93+
We recommend developers target out test server:
94+
- test (`test`): matches production features, very stable
95+
96+
Other options include:
97+
- local (`local`): for developers running the OSF stack locally
98+
- staging (`stage`): contains bleeding edge features, but less stable
99+
- staging2 (`stage2`): another version of staging using running a specific feature branch
100+
101+
Then (using test as an example) run:
102+
`BACKEND=test ember server`
103+
104+
and visit your app at http://localhost:4200.
105+
106+
**Note:** This runs the dummy app contained in /tests/dummy
107+
108+
## Running Tests
109+
110+
* `npm test` (Runs `ember try:testall` to test your addon against multiple Ember versions)
111+
* `ember test`
112+
* `ember test --server`
113+
114+
## Building
115+
116+
* `ember build`
117+
118+
For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).

addon/.gitkeep

Whitespace-only changes.

addon/adapters/collection.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import OsfAdapter from './osf-adapter';
2+
3+
export default OsfAdapter.extend({
4+
buildURL(_, __, ___, requestType) {
5+
// Embed linked_nodes
6+
var base = this._super(...arguments);
7+
if (['createRecord', 'updateRecord', 'deleteRecord'].indexOf(requestType) === -1) {
8+
return `${base}?embed=linked_nodes`;
9+
} else {
10+
return base;
11+
}
12+
}
13+
});

addon/adapters/comment-report.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import OsfAdapter from './osf-adapter';
2+
3+
export default OsfAdapter.extend({
4+
});

addon/adapters/comment.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import OsfAdapter from './osf-adapter';
2+
3+
export default OsfAdapter.extend({
4+
});

0 commit comments

Comments
 (0)