toadhopper-sinatra 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ /pkg/
2
+ .yardoc
3
+ /doc/
4
+ Gemfile.lock
5
+ .bundle
data/Gemfile CHANGED
@@ -1,18 +1,2 @@
1
- source :gemcutter
2
-
3
- gem 'toadhopper', '~> 1.0'
4
- gem 'sinatra'
5
-
6
- group :development do
7
- gem 'bundler', '~> 1.0.11'
8
- gem 'rake'
9
- gem 'yard'
10
- gem 'jeweler'
11
- end
12
-
13
- group :test do
14
- gem 'rake'
15
- gem 'exemplor'
16
- gem 'rack-test', :require => "rack/test"
17
- gem 'rr'
18
- end
1
+ source :rubygems
2
+ gemspec
data/Rakefile CHANGED
@@ -1,20 +1,8 @@
1
- require 'bundler'
2
- Bundler.setup(:default, :development, :test)
3
- Bundler.require(:development, :test)
1
+ require 'bundler/setup'
4
2
 
5
- Jeweler::Tasks.new do |s|
6
- s.name = "toadhopper-sinatra"
7
- s.summary = "Post Hoptoad notifications from Sinatra"
8
- s.email = "t.lucas@toolmantim.com"
9
- s.homepage = "http://github.com/toolmantim/toadhopper-sinatra"
10
- s.authors = ["Tim Lucas"]
11
- s.extra_rdoc_files = ["README.md", "LICENSE", "example.rb"]
12
-
13
- require File.join(File.dirname(__FILE__), 'lib', 'sinatra', 'toadhopper')
14
- s.version = Sinatra::Toadhopper::VERSION
15
- end
3
+ Bundler::GemHelper.install_tasks
16
4
 
17
5
  desc "Run tests"
18
6
  task :test do
19
- exec "/usr/bin/env ruby #{File.dirname(__FILE__)}/test_example.rb"
7
+ exec "/usr/bin/env bundle exec ruby #{File.dirname(__FILE__)}/test_example.rb"
20
8
  end
@@ -1,35 +1,53 @@
1
1
  require 'sinatra/base'
2
2
  require 'toadhopper'
3
+ require 'sinatra/toadhopper/version'
3
4
 
4
5
  module Sinatra
5
- # The Toadhopper helper methods
6
6
  module Toadhopper
7
- VERSION = "1.0.3"
8
- # Reports the current sinatra error to Hoptoad
9
- def post_error_to_hoptoad!
10
- unless options.toadhopper && options.toadhopper[:api_key]
11
- STDERR.puts "Toadhopper api key not set, e.g. set :toadhopper, :api_key => 'my api key'"
12
- return
7
+
8
+ module Helpers
9
+ # Reports the current sinatra error to Hoptoad
10
+ def post_error_to_hoptoad!
11
+ unless toadhopper_api_key
12
+ STDERR.puts "Toadhopper api key not set, e.g. set :toadhopper, :api_key => 'my api key'"
13
+ return
14
+ end
15
+ toadhopper = ::Toadhopper.new(toadhopper_api_key, toadhopper_options)
16
+ toadhopper.filters = toadhopper_filters if toadhopper_filters
17
+ toadhopper.post!(
18
+ env['sinatra.error'],
19
+ {
20
+ :url => request.url,
21
+ :params => request.params,
22
+ :session => session.to_hash,
23
+ :environment => ENV.to_hash,
24
+ :framework_env => options.environment.to_s,
25
+ :project_root => options.root,
26
+ :notifier_name => (notifier_name = "toadhopper-sinatra"),
27
+ :notifier_version => VERSION,
28
+ :notifier_url => 'http://github.com/toolmantim/toadhopper-sinatra'
29
+ },
30
+ {'X-Hoptoad-Client-Name' => notifier_name}
31
+ )
13
32
  end
14
- filters = options.toadhopper.delete(:filters)
15
- toadhopper = ::Toadhopper.new(options.toadhopper.delete(:api_key), options.toadhopper)
16
- toadhopper.filters = filters if filters
17
- toadhopper.post!(
18
- env['sinatra.error'],
19
- {
20
- :url => request.url,
21
- :params => request.params,
22
- :session => session.to_hash,
23
- :environment => ENV.to_hash,
24
- :framework_env => options.environment.to_s,
25
- :project_root => options.root,
26
- :notifier_name => (notifier_name = "toadhopper-sinatra"),
27
- :notifier_version => VERSION,
28
- :notifier_url => 'http://github.com/toolmantim/toadhopper-sinatra'
29
- },
30
- {'X-Hoptoad-Client-Name' => notifier_name}
31
- )
33
+ private
34
+ def toadhopper_filters
35
+ settings.toadhopper[:filters]
36
+ end
37
+ def toadhopper_api_key
38
+ settings.toadhopper[:api_key]
39
+ end
40
+ def toadhopper_options
41
+ settings.toadhopper.reject {|k,_| [:api_key, :filters].include?(k)}
42
+ end
43
+ end
44
+
45
+ def self.registered(app)
46
+ app.helpers Toadhopper::Helpers
47
+ app.set :toadhopper, {}
32
48
  end
49
+
33
50
  end
34
- helpers Toadhopper
35
- end
51
+
52
+ register Toadhopper
53
+ end
@@ -0,0 +1,5 @@
1
+ module Sinatra
2
+ module Toadhopper
3
+ VERSION = "1.0.4"
4
+ end
5
+ end
@@ -1,5 +1,8 @@
1
- Bundler.setup(:default, :test)
2
- Bundler.require(:test)
1
+ Bundler.setup
2
+
3
+ require 'exemplor'
4
+ require 'rr'
5
+ require 'rack/test'
3
6
 
4
7
  $:.unshift "#{File.dirname(__FILE__)}/lib"
5
8
  require "#{File.dirname(__FILE__)}/example"
@@ -32,8 +35,7 @@ eg "Posting" do
32
35
  post "/register", :name => "Billy", :password => "Bob"
33
36
 
34
37
  Check(@api_key).is("apikey")
35
-
36
- Check(@toadhopper.filters).is([/password/])
38
+ Check(@toadhopper.send(:filters)).is([/password/])
37
39
 
38
40
  Check(@error.class).is(RuntimeError)
39
41
  Check(@error.message).is("Kaboom!")
@@ -1,61 +1,29 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
5
2
 
6
- Gem::Specification.new do |s|
7
- s.name = %q{toadhopper-sinatra}
8
- s.version = "1.0.3"
3
+ $: << File.expand_path('../lib', __FILE__)
4
+
5
+ require 'sinatra/toadhopper/version'
9
6
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Tim Lucas"]
12
- s.date = %q{2011-07-01}
13
- s.email = %q{t.lucas@toolmantim.com}
14
- s.extra_rdoc_files = [
15
- "LICENSE",
16
- "README.md",
17
- "example.rb"
18
- ]
19
- s.files = [
20
- ".yardopts",
21
- "Gemfile",
22
- "LICENSE",
23
- "README.md",
24
- "Rakefile",
25
- "example.rb",
26
- "lib/sinatra/toadhopper.rb",
27
- "test_example.rb"
28
- ]
29
- s.homepage = %q{http://github.com/toolmantim/toadhopper-sinatra}
30
- s.require_paths = ["lib"]
31
- s.rubygems_version = %q{1.6.2}
32
- s.summary = %q{Post Hoptoad notifications from Sinatra}
7
+ Gem::Specification.new do |s|
8
+ s.name = 'toadhopper-sinatra'
9
+ s.version = Sinatra::Toadhopper::VERSION
10
+ s.platform = Gem::Platform::RUBY
11
+ s.authors = ['Tim Lucas', 'Gabriel Horner', 'Kyle Drake']
12
+ s.email = ['t.lucas@toolmantim.com']
13
+ s.homepage = 'http://github.com/toolmantim/toadhopper-sinatra'
14
+ s.summary = %q{Post Hoptoad notifications from Sinatra}
33
15
 
34
- if s.respond_to? :specification_version then
35
- s.specification_version = 3
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ['lib']
20
+ s.extra_rdoc_files = ['README.md', 'LICENSE', 'example.rb']
36
21
 
37
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
38
- s.add_runtime_dependency(%q<toadhopper>, ["~> 1.0"])
39
- s.add_runtime_dependency(%q<sinatra>, [">= 0"])
40
- s.add_development_dependency(%q<bundler>, ["~> 1.0.11"])
41
- s.add_development_dependency(%q<rake>, [">= 0"])
42
- s.add_development_dependency(%q<yard>, [">= 0"])
43
- s.add_development_dependency(%q<jeweler>, [">= 0"])
44
- else
45
- s.add_dependency(%q<toadhopper>, ["~> 1.0"])
46
- s.add_dependency(%q<sinatra>, [">= 0"])
47
- s.add_dependency(%q<bundler>, ["~> 1.0.11"])
48
- s.add_dependency(%q<rake>, [">= 0"])
49
- s.add_dependency(%q<yard>, [">= 0"])
50
- s.add_dependency(%q<jeweler>, [">= 0"])
51
- end
52
- else
53
- s.add_dependency(%q<toadhopper>, ["~> 1.0"])
54
- s.add_dependency(%q<sinatra>, [">= 0"])
55
- s.add_dependency(%q<bundler>, ["~> 1.0.11"])
56
- s.add_dependency(%q<rake>, [">= 0"])
57
- s.add_dependency(%q<yard>, [">= 0"])
58
- s.add_dependency(%q<jeweler>, [">= 0"])
59
- end
22
+ s.add_dependency 'sinatra'
23
+ s.add_dependency 'toadhopper'
24
+
25
+ s.add_development_dependency 'rake'
26
+ s.add_development_dependency 'exemplor'
27
+ s.add_development_dependency 'rr'
28
+ s.add_development_dependency 'rack-test'
60
29
  end
61
-
metadata CHANGED
@@ -2,30 +2,31 @@
2
2
  name: toadhopper-sinatra
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.3
5
+ version: 1.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tim Lucas
9
+ - Gabriel Horner
10
+ - Kyle Drake
9
11
  autorequire:
10
12
  bindir: bin
11
13
  cert_chain: []
12
14
 
13
- date: 2011-07-01 00:00:00 -04:00
14
- default_executable:
15
+ date: 2011-07-26 00:00:00 Z
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
17
- name: toadhopper
18
+ name: sinatra
18
19
  requirement: &id001 !ruby/object:Gem::Requirement
19
20
  none: false
20
21
  requirements:
21
- - - ~>
22
+ - - ">="
22
23
  - !ruby/object:Gem::Version
23
- version: "1.0"
24
+ version: "0"
24
25
  type: :runtime
25
26
  prerelease: false
26
27
  version_requirements: *id001
27
28
  - !ruby/object:Gem::Dependency
28
- name: sinatra
29
+ name: toadhopper
29
30
  requirement: &id002 !ruby/object:Gem::Requirement
30
31
  none: false
31
32
  requirements:
@@ -36,18 +37,18 @@ dependencies:
36
37
  prerelease: false
37
38
  version_requirements: *id002
38
39
  - !ruby/object:Gem::Dependency
39
- name: bundler
40
+ name: rake
40
41
  requirement: &id003 !ruby/object:Gem::Requirement
41
42
  none: false
42
43
  requirements:
43
- - - ~>
44
+ - - ">="
44
45
  - !ruby/object:Gem::Version
45
- version: 1.0.11
46
+ version: "0"
46
47
  type: :development
47
48
  prerelease: false
48
49
  version_requirements: *id003
49
50
  - !ruby/object:Gem::Dependency
50
- name: rake
51
+ name: exemplor
51
52
  requirement: &id004 !ruby/object:Gem::Requirement
52
53
  none: false
53
54
  requirements:
@@ -58,7 +59,7 @@ dependencies:
58
59
  prerelease: false
59
60
  version_requirements: *id004
60
61
  - !ruby/object:Gem::Dependency
61
- name: yard
62
+ name: rr
62
63
  requirement: &id005 !ruby/object:Gem::Requirement
63
64
  none: false
64
65
  requirements:
@@ -69,7 +70,7 @@ dependencies:
69
70
  prerelease: false
70
71
  version_requirements: *id005
71
72
  - !ruby/object:Gem::Dependency
72
- name: jeweler
73
+ name: rack-test
73
74
  requirement: &id006 !ruby/object:Gem::Requirement
74
75
  none: false
75
76
  requirements:
@@ -80,16 +81,18 @@ dependencies:
80
81
  prerelease: false
81
82
  version_requirements: *id006
82
83
  description:
83
- email: t.lucas@toolmantim.com
84
+ email:
85
+ - t.lucas@toolmantim.com
84
86
  executables: []
85
87
 
86
88
  extensions: []
87
89
 
88
90
  extra_rdoc_files:
89
- - LICENSE
90
91
  - README.md
92
+ - LICENSE
91
93
  - example.rb
92
94
  files:
95
+ - .gitignore
93
96
  - .yardopts
94
97
  - Gemfile
95
98
  - LICENSE
@@ -97,9 +100,9 @@ files:
97
100
  - Rakefile
98
101
  - example.rb
99
102
  - lib/sinatra/toadhopper.rb
103
+ - lib/sinatra/toadhopper/version.rb
100
104
  - test_example.rb
101
105
  - toadhopper-sinatra.gemspec
102
- has_rdoc: true
103
106
  homepage: http://github.com/toolmantim/toadhopper-sinatra
104
107
  licenses: []
105
108
 
@@ -113,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
116
  requirements:
114
117
  - - ">="
115
118
  - !ruby/object:Gem::Version
116
- hash: 563281939583734295
119
+ hash: -2461237549134524370
117
120
  segments:
118
121
  - 0
119
122
  version: "0"
@@ -122,11 +125,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
125
  requirements:
123
126
  - - ">="
124
127
  - !ruby/object:Gem::Version
128
+ hash: -2461237549134524370
129
+ segments:
130
+ - 0
125
131
  version: "0"
126
132
  requirements: []
127
133
 
128
134
  rubyforge_project:
129
- rubygems_version: 1.6.2
135
+ rubygems_version: 1.8.5
130
136
  signing_key:
131
137
  specification_version: 3
132
138
  summary: Post Hoptoad notifications from Sinatra