Skip to content

Commit be13617

Browse files
committed
Merge pull request #4 from dschmidt/integration
Add a default raven service that reads the revision from meta
2 parents 7e1b19e + 1e67527 commit be13617

File tree

3 files changed

+48
-26
lines changed

3 files changed

+48
-26
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ember-cli-deploy-sentry Changelog
22

3+
### 0.2.0
4+
5+
- Add service for usage with ember-cli-sentry
6+
37
### 0.1.0
48

59
- Initial release.

README.md

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,11 @@ ENV.sentry {
3636
```
3737
- Integrate [raven-js][2] in your page
3838

39-
By default a meta tag with the key name `sentry:revision` is inserted in your index.html, like so
40-
```html
41-
<meta name="sentry:revision" content="(revision)">
42-
```
39+
Install [ember-cli-sentry](https://github.com/damiencaselli/ember-cli-sentry) but import the raven service from `ember-cli-deploy-sentry/service/raven`,
40+
which will automatically handle setting up the release version for you. Sentry needs this to find the correct sourcemap for an error that occurs.
4341

44-
Disabling this behavior is done by configuring in `deploy.js`:
45-
```javascript
46-
ENV.sentry {
47-
// ... other config options
48-
enableRevisionTagging: false
49-
}
50-
```
42+
If you don't want to use `ember-cli-sentry` but set [raven-js][2] up manually see [Manual integration with raven-js](#manual-integration-with-raven-js).
5143

52-
When you setup [raven-js][2] you can retrieve it like so:
53-
54-
```javascript
55-
Raven.config({
56-
release: $("meta[name='sentry:revision']").attr('content')
57-
});
58-
```
59-
60-
Last but not least make sure to setup proper exception catching like [this](https://github.com/getsentry/raven-js/blob/master/plugins/ember.js).
61-
62-
63-
Also, [ember-cli-sentry](https://github.com/damiencaselli/ember-cli-sentry) is useful to get started quickly. (It also sets up the exception handlers for you)
64-
For it to work you will need to set `revisionKey` to your application's `config.APP.version` or set [raven-js][2]'s `release` option later via
65-
`Raven.setReleaseContext($("meta[name='sentry:revision']").attr('content'))`. Doing this automatically
6644

6745
- Build sourcemaps in production environment
6846

@@ -179,22 +157,51 @@ The revision string that is used to create releases in sentry.
179157
}
180158
```
181159

160+
### enableRevisionTagging
161+
162+
Enable adding a meta tag with the current revisionKey into the head of your `index.html`.
163+
164+
*Default* true
165+
182166
## Prerequisites
183167

184168
The following properties are expected to be present on the deployment `context` object:
185169

186170
- `distDir` (provided by [ember-cli-deploy-build][11])
187171
- `revisionData.revisionKey` (provided by [ember-cli-deploy-revision-data][12])
188172

173+
174+
## Manual integration with raven-js
175+
176+
By default a meta tag with the key name `sentry:revision` is inserted in your index.html:
177+
```html
178+
<meta name="sentry:revision" content="(revision)">
179+
180+
```
181+
182+
When you setup [raven-js][2] you can retrieve it like this:
183+
184+
```javascript
185+
Raven.config({
186+
release: $("meta[name='sentry:revision']").attr('content')
187+
});
188+
```
189+
190+
If you only want to use the sourcemap upload functionality of `ember-cli-deploy-sentry`, you can disable automatic meta tag insertion completely by setting [enableRevisionTagging](#enableRevisionTagging) to `false`.
191+
192+
193+
Last but not least make sure to setup proper exception catching like [this](https://github.com/getsentry/raven-js/blob/master/plugins/ember.js).
194+
189195
## Running Tests
190196

191197
- `npm test`
192198

193199
## TODO
194200

195-
- Tests ... right?
196201
- use `context.distFiles` from [ember-cli-deploy-build][11] instead globbing distDir again?
197202
- automatically setup raven-js? If you want this, let me know.
203+
- add revision tagging file pattern
204+
- make meta name configurable and document `service.releaseMetaName`
198205

199206
### State
200207

addon/services/raven.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import RavenService from 'ember-cli-sentry/services/raven';
2+
3+
export default RavenService.extend({
4+
releaseMetaName: 'sentry:revision',
5+
release: Ember.computed({
6+
get: function() {
7+
return $("meta[name='revision']").attr('content');
8+
}
9+
})
10+
});
11+

0 commit comments

Comments
 (0)