diff --git a/.env b/.env new file mode 100644 index 00000000000..a087ee73a2a --- /dev/null +++ b/.env @@ -0,0 +1,25 @@ +# Credentials for uploading packages to S3, these can be blank if you're not +# publishing locally. +S3_BUCKET= +S3_ACCESS_KEY= +S3_SECRET_KEY= +# Not needed if the S3 bucket is in US standard +S3_REGION= + +# Credentials for talking to github, can be blank if you're not logging in. +# +# When registering a new application, be sure to set the callback url to the +# address `http://localhost:4200/authorize/github`. +GH_CLIENT_ID= +GH_CLIENT_SECRET= + +# Key to sign and encrypt cookies with +SESSION_KEY=badkey + +# Location of the *postgres* database +# (eg. postgres://postgres:@localhost/cargo_registry) +DATABASE_URL=postgres://postgres:@localhost/cargo_registry + +# Remote and local locations of the registry index +GIT_REPO_URL=file://./tmp/index-bare +GIT_REPO_CHECKOUT=./tmp/index-co diff --git a/app/controllers/crate/docs.js b/app/controllers/crate/docs.js new file mode 100644 index 00000000000..bd8bd406cd3 --- /dev/null +++ b/app/controllers/crate/docs.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.ObjectController.extend({ +}); diff --git a/app/router.js b/app/router.js index cf2246f9d2d..f244a6b4526 100644 --- a/app/router.js +++ b/app/router.js @@ -16,6 +16,9 @@ Router.map(function() { this.route('download'); this.route('versions'); this.route('reverse_dependencies'); + + // Well-known routes + this.route('docs'); }); this.route('me', function() { this.route('crates'); diff --git a/app/routes/crate/docs.js b/app/routes/crate/docs.js new file mode 100644 index 00000000000..68330c9c69c --- /dev/null +++ b/app/routes/crate/docs.js @@ -0,0 +1,28 @@ +import Ember from 'ember'; +import Crate from 'cargo/models/crate'; + +export default Ember.Route.extend({ + setupController: function(controller, data) { + var crate; + + if (data instanceof Crate) { + crate = data; + } else { + crate = data.crate; + } + + var documentation = crate.get('documentation'); + + if (documentation) { + window.location = documentation; + } else { + // Redirect to the crate's main page and show a flash error if + // no documentation is found + var message = 'Crate does not supply a documentation URL'; + this.controllerFor('application').set('nextFlashError', message); + this.replaceWith('crate', crate); + } + + this._super(controller, crate); + }, +}); diff --git a/app/templates/crate/docs.hbs b/app/templates/crate/docs.hbs new file mode 100644 index 00000000000..abe32552859 --- /dev/null +++ b/app/templates/crate/docs.hbs @@ -0,0 +1,8 @@ +
+ +

Documentation for {{name}}

+
+ +

+ Redirecting you to {{documentation}}… +