rollbar 0.9.4 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ **0.9.6**
4
+ - Fix for Rails 4 support
5
+
6
+ **0.9.5**
7
+ - Support for configuring the access token with an environment variable.
8
+
3
9
  **0.9.4**
4
10
  - Fixed issue using rollbar-gem outside of Rails
5
11
  - Clarified the "details: " link log message
data/README.md CHANGED
@@ -20,7 +20,23 @@ Then, run the following command from your rails root:
20
20
 
21
21
  $ rails generate rollbar YOUR_ROLLBAR_PROJECT_ACCESS_TOKEN
22
22
 
23
- That will create the file `config/initializers/rollbar.rb`, which holds the configuration values (currently just your access token) and is all you need to use Rollbar with Rails.
23
+ That will create the file `config/initializers/rollbar.rb`, which holds the configuration values (currently just your access token).
24
+
25
+ If you want to store your access token outside of your repo, run the same command without arguments:
26
+
27
+ $ rails generate rollbar
28
+
29
+ Then, create an environment variable `ROLLBAR_ACCESS_TOKEN` and set it to your server-side access token.
30
+
31
+ $ export ROLLBAR_ACCESS_TOKEN=YOUR_ROLLBAR_PROJECT_ACCESS_TOKEN
32
+
33
+ or
34
+
35
+ $ heroku config:add ROLLBAR_ACCESS_TOKEN=YOUR_ROLLBAR_PROJECT_ACCESS_TOKEN
36
+
37
+ if you are using Heroku.
38
+
39
+ That's all you need to use Rollbar with Rails.
24
40
 
25
41
  To confirm that it worked, run:
26
42
 
data/THANKS CHANGED
@@ -4,9 +4,11 @@ arr-ee
4
4
  dimko
5
5
  firstbanco
6
6
  JoshuaOSHickman
7
+ juggler
7
8
  kavu
8
9
  magnolia-fan
9
10
  mipearson
11
+ siong1987
10
12
  trisweb
11
13
  tysontate
12
14
  wbond
@@ -4,19 +4,29 @@ require 'rails/generators/named_base'
4
4
  module Rollbar
5
5
  module Generators
6
6
  class RollbarGenerator < ::Rails::Generators::Base
7
- argument :access_token, :type => :string, :banner => 'access_token'
7
+ argument :access_token, :type => :string, :banner => 'access_token', :default => :use_env_sentinel
8
8
 
9
9
  source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
10
10
 
11
11
  def create_initializer
12
- puts "creating initializer..."
12
+ say "creating initializer..."
13
13
  if access_token_configured?
14
- puts "It looks like you've already configured Rollbar."
15
- puts "To re-create the config file, remove it first: config/initializers/rollbar.rb"
14
+ say "It looks like you've already configured Rollbar."
15
+ say "To re-create the config file, remove it first: config/initializers/rollbar.rb"
16
16
  exit
17
17
  end
18
18
 
19
- puts "access token: " << access_token
19
+ if access_token === :use_env_sentinel
20
+ say "Generator run without an access token; assuming you want to configure using an environment variable."
21
+ say "You'll need to add an environment variable ROLLBAR_ACCESS_TOKEN with your access token:"
22
+ say "\n$ export ROLLBAR_ACCESS_TOKEN=yourtokenhere"
23
+ say "\nIf that's not what you wanted to do:"
24
+ say "\n$ rm config/initializers/rollbar.rb"
25
+ say "$ rails generate rollbar yourtokenhere"
26
+ say "\n"
27
+ else
28
+ say "access token: " << access_token
29
+ end
20
30
 
21
31
  template 'initializer.rb', 'config/initializers/rollbar.rb',
22
32
  :assigns => { :access_token => access_token_expr }
@@ -24,25 +34,12 @@ module Rollbar
24
34
  # TODO run rake test task
25
35
  end
26
36
 
27
- #def add_options!(opt)
28
- # opt.on('-a', '--access-token=token', String, "Your Rollbar project access token") { |v| options[:access_token] = v }
29
- #end
30
- #
31
- # def manifest
32
- # if !access_token_configured? && !options[:access_token]
33
- # puts "access_token is required. Pass --access-token=YOUR_ACCESS_TOKEN"
34
- # exit
35
- # end
36
- #
37
- # record do |m|
38
- # m.template 'initializer.rb', 'config/initializers/rollbar.rb',
39
- # :assigns => { :access_token => access_token_expr }
40
- # # TODO run rake test task
41
- # end
42
- # end
43
-
44
37
  def access_token_expr
45
- "'#{access_token}'"
38
+ if access_token === :use_env_sentinel
39
+ "ENV['ROLLBAR_ACCESS_TOKEN']"
40
+ else
41
+ "'#{access_token}'"
42
+ end
46
43
  end
47
44
 
48
45
  def access_token_configured?
@@ -44,12 +44,12 @@ namespace :rollbar do
44
44
  nil
45
45
  end
46
46
  end
47
-
47
+
48
48
  class RollbarTestController < ApplicationController; end
49
49
 
50
50
  Rails.application.routes_reloader.execute_if_updated
51
51
  Rails.application.routes.draw do
52
- match 'verify' => 'application#verify', :as => 'verify'
52
+ get 'verify' => 'application#verify', :as => 'verify'
53
53
  end
54
54
 
55
55
  puts "Processing..."
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.6"
3
3
  end
data/rollbar.gemspec CHANGED
@@ -21,4 +21,5 @@ Gem::Specification.new do |gem|
21
21
  gem.add_development_dependency 'rspec-rails', '~> 2.12.0'
22
22
  gem.add_development_dependency 'database_cleaner', '>= 0.9.1'
23
23
  gem.add_development_dependency 'girl_friday', '>= 0.11.1'
24
+ gem.add_development_dependency 'genspec', '>= 0.2.7'
24
25
  end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe :rollbar do
4
+ context "with no arguments" do
5
+ it "outputs a help message" do
6
+ subject.should output(/You'll need to add an environment variable ROLLBAR_ACCESS_TOKEN with your access token/)
7
+ end
8
+
9
+ it "generates a Rollbar initializer with ENV" do
10
+ subject.should generate("config/initializers/rollbar.rb") { |content|
11
+ content.should =~ /config.access_token = ENV\['ROLLBAR_ACCESS_TOKEN'\]/
12
+ }
13
+ end
14
+ end
15
+
16
+ with_args 'aaaabbbbccccddddeeeeffff00001111' do
17
+ it "generates a Rollbar initializer with access token" do
18
+ subject.should generate("config/initializers/rollbar.rb") do |content|
19
+ content.should =~ /aaaabbbbccccddddeeeeffff00001111/
20
+ content.should =~ /config.access_token = 'aaaabbbbccccddddeeeeffff00001111'/
21
+ end
22
+ end
23
+ end
24
+ end
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,7 @@ ENV['RAILS_ENV'] = 'test'
4
4
  require File.expand_path('../dummyapp/config/environment', __FILE__)
5
5
  require 'rspec/rails'
6
6
  require 'database_cleaner'
7
+ require 'genspec'
7
8
 
8
9
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
9
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-20 00:00:00.000000000 Z
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -107,6 +107,22 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: 0.11.1
110
+ - !ruby/object:Gem::Dependency
111
+ name: genspec
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 0.2.7
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: 0.2.7
110
126
  description: Rails plugin to catch and send exceptions to Rollbar
111
127
  email:
112
128
  - brian@rollbar.com
@@ -197,6 +213,7 @@ files:
197
213
  - spec/dummyapp/public/500.html
198
214
  - spec/dummyapp/public/favicon.ico
199
215
  - spec/dummyapp/script/rails
216
+ - spec/generators/rollbar/rollbar_generator_spec.rb
200
217
  - spec/requests/home_spec.rb
201
218
  - spec/rollbar_spec.rb
202
219
  - spec/spec_helper.rb
@@ -278,6 +295,7 @@ test_files:
278
295
  - spec/dummyapp/public/500.html
279
296
  - spec/dummyapp/public/favicon.ico
280
297
  - spec/dummyapp/script/rails
298
+ - spec/generators/rollbar/rollbar_generator_spec.rb
281
299
  - spec/requests/home_spec.rb
282
300
  - spec/rollbar_spec.rb
283
301
  - spec/spec_helper.rb