ratchetio 0.4.0 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. data/.gitignore +2 -0
  2. data/.travis.yml +15 -0
  3. data/CHANGELOG.md +29 -4
  4. data/Gemfile +5 -1
  5. data/README.md +45 -8
  6. data/Rakefile +13 -1
  7. data/THANKS +5 -0
  8. data/lib/generators/ratchetio/ratchetio_generator.rb +1 -1
  9. data/lib/generators/ratchetio/templates/initializer.rb +10 -0
  10. data/lib/ratchetio/configuration.rb +24 -10
  11. data/lib/ratchetio/goalie.rb +23 -0
  12. data/lib/ratchetio/rails/controller_methods.rb +8 -3
  13. data/lib/ratchetio/rails/middleware/exception_catcher.rb +2 -4
  14. data/lib/ratchetio/railtie.rb +1 -0
  15. data/lib/ratchetio/version.rb +1 -1
  16. data/lib/ratchetio.rb +186 -59
  17. data/ratchetio.gemspec +6 -3
  18. data/spec/controllers/home_controller_spec.rb +186 -0
  19. data/spec/dummyapp/.gitignore +73 -0
  20. data/spec/dummyapp/Rakefile +7 -0
  21. data/spec/dummyapp/app/assets/javascripts/application.js +3 -0
  22. data/spec/dummyapp/app/assets/stylesheets/application.css.scss +37 -0
  23. data/spec/dummyapp/app/controllers/application_controller.rb +3 -0
  24. data/spec/dummyapp/app/controllers/home_controller.rb +21 -0
  25. data/spec/dummyapp/app/controllers/users_controller.rb +12 -0
  26. data/spec/dummyapp/app/helpers/.gitkeep +0 -0
  27. data/spec/dummyapp/app/mailers/.gitkeep +0 -0
  28. data/spec/dummyapp/app/models/.gitkeep +0 -0
  29. data/spec/dummyapp/app/models/user.rb +11 -0
  30. data/spec/dummyapp/app/views/devise/registrations/edit.html.erb +27 -0
  31. data/spec/dummyapp/app/views/devise/registrations/new.html.erb +20 -0
  32. data/spec/dummyapp/app/views/devise/shared/_links.html.erb +25 -0
  33. data/spec/dummyapp/app/views/home/cause_exception.html.erb +1 -0
  34. data/spec/dummyapp/app/views/home/index.html.erb +4 -0
  35. data/spec/dummyapp/app/views/home/report_exception.html.erb +1 -0
  36. data/spec/dummyapp/app/views/layouts/_messages.html.erb +5 -0
  37. data/spec/dummyapp/app/views/layouts/_navigation.html.erb +21 -0
  38. data/spec/dummyapp/app/views/layouts/application.html.erb +25 -0
  39. data/spec/dummyapp/app/views/users/index.html.erb +8 -0
  40. data/spec/dummyapp/app/views/users/show.html.erb +3 -0
  41. data/spec/dummyapp/config/application.rb +60 -0
  42. data/spec/dummyapp/config/boot.rb +10 -0
  43. data/spec/dummyapp/config/database.yml +25 -0
  44. data/spec/dummyapp/config/environment.rb +5 -0
  45. data/spec/dummyapp/config/environments/development.rb +37 -0
  46. data/spec/dummyapp/config/environments/production.rb +67 -0
  47. data/spec/dummyapp/config/environments/test.rb +37 -0
  48. data/spec/dummyapp/config/initializers/backtrace_silencers.rb +7 -0
  49. data/spec/dummyapp/config/initializers/devise.rb +233 -0
  50. data/spec/dummyapp/config/initializers/inflections.rb +15 -0
  51. data/spec/dummyapp/config/initializers/mime_types.rb +5 -0
  52. data/spec/dummyapp/config/initializers/ratchetio.rb +20 -0
  53. data/spec/dummyapp/config/initializers/secret_token.rb +7 -0
  54. data/spec/dummyapp/config/initializers/session_store.rb +8 -0
  55. data/spec/dummyapp/config/initializers/wrap_parameters.rb +14 -0
  56. data/spec/dummyapp/config/locales/devise.en.yml +58 -0
  57. data/spec/dummyapp/config/locales/en.yml +5 -0
  58. data/spec/dummyapp/config/routes.rb +11 -0
  59. data/spec/dummyapp/config.ru +4 -0
  60. data/spec/dummyapp/db/migrate/20121121184652_devise_create_users.rb +46 -0
  61. data/spec/dummyapp/db/migrate/20121121184654_add_name_to_users.rb +5 -0
  62. data/spec/dummyapp/db/schema.rb +35 -0
  63. data/spec/dummyapp/db/seeds.rb +12 -0
  64. data/spec/dummyapp/lib/assets/.gitkeep +0 -0
  65. data/spec/dummyapp/public/404.html +26 -0
  66. data/spec/dummyapp/public/422.html +26 -0
  67. data/spec/dummyapp/public/500.html +25 -0
  68. data/spec/dummyapp/public/favicon.ico +0 -0
  69. data/spec/dummyapp/script/rails +6 -0
  70. data/spec/ratchetio_spec.rb +387 -1
  71. data/spec/spec_helper.rb +35 -0
  72. data/spec/support/devise.rb +3 -0
  73. metadata +195 -3
data/lib/ratchetio.rb CHANGED
@@ -1,80 +1,144 @@
1
1
  require 'net/https'
2
2
  require 'socket'
3
+ require 'thread'
3
4
  require 'uri'
4
5
 
5
6
  require 'ratchetio/version'
6
7
  require 'ratchetio/configuration'
7
- require 'ratchetio/railtie'
8
+ require 'ratchetio/railtie' if defined?(Rails)
9
+ require 'ratchetio/goalie' if defined?(Goalie)
10
+ require "girl_friday" if defined?(GirlFriday)
8
11
 
9
12
  module Ratchetio
10
-
11
13
  class << self
12
14
  attr_writer :configuration
13
15
 
16
+ # Configures the gem.
17
+ #
18
+ # Call on app startup to set the `access_token` (required) and other config params.
19
+ # In a Rails app, this is called by `config/initializers/ratchetio.rb` which is generated
20
+ # with `rails generate ratchetio access-token-here`
21
+ #
22
+ # @example
23
+ # Ratchetio.configure do |config|
24
+ # config.access_token = 'abcdefg'
25
+ # end
14
26
  def configure
15
27
  yield(configuration)
16
28
  end
29
+
30
+ def reconfigure
31
+ @configuration = Configuration.new
32
+ yield(configuration)
33
+ end
17
34
 
35
+ # Returns the configuration object.
36
+ #
37
+ # @return [Ratchetio::Configuration] The configuration object
18
38
  def configuration
19
39
  @configuration ||= Configuration.new
20
40
  end
21
41
 
22
- def report_exception(exception, request_data={}, person_data={})
23
- begin
24
- data = exception_data(exception)
25
- if request_data
26
- data[:request] = request_data
27
- end
28
- if person_data
29
- data[:person] = person_data
30
- end
42
+ # Reports an exception to Ratchet.io
43
+ #
44
+ # @example
45
+ # begin
46
+ # foo = bar
47
+ # rescue => e
48
+ # Ratchetio.report_exception(e)
49
+ # end
50
+ #
51
+ # @param exception [Exception] The exception object to report
52
+ # @param request_data [Hash] Data describing the request. Should be the result of calling
53
+ # `ratchetio_request_data`.
54
+ # @param person_data [Hash] Data describing the affected person. Should be the result of calling
55
+ # `ratchetio_person_data`
56
+ def report_exception(exception, request_data = nil, person_data = nil)
57
+ unless configuration.enabled
58
+ return
59
+ end
31
60
 
32
- payload = build_payload(data)
33
- send_payload(payload)
34
- rescue Exception => e
35
- logger.error "[Ratchet.io] Error reporting exception to Ratchet.io: #{e}"
61
+ filtered_level = configuration.exception_level_filters[exception.class.name]
62
+ if filtered_level == 'ignore'
63
+ # ignored - do nothing
64
+ return
36
65
  end
66
+
67
+ data = exception_data(exception, filtered_level)
68
+ data[:request] = request_data if request_data
69
+ data[:person] = person_data if person_data
70
+
71
+ payload = build_payload(data)
72
+ schedule_payload(payload)
73
+ rescue => e
74
+ logger.error "[Ratchet.io] Error reporting exception to Ratchet.io: #{e}"
75
+ end
76
+
77
+ # Reports an arbitrary message to Ratchet.io
78
+ #
79
+ # @example
80
+ # Ratchetio.report_message("User login failed", 'info', :user_id => 123)
81
+ #
82
+ # @param message [String] The message body. This will be used to identify the message within
83
+ # Ratchet. For best results, avoid putting variables in the message body; pass them as
84
+ # `extra_data` instead.
85
+ # @param level [String] The level. One of: 'critical', 'error', 'warning', 'info', 'debug'
86
+ # @param extra_data [Hash] Additional data to include alongside the body. Don't use 'body' as
87
+ # it is reserved.
88
+ def report_message(message, level = 'info', extra_data = {})
89
+ unless configuration.enabled
90
+ return
91
+ end
92
+
93
+ data = message_data(message, level, extra_data)
94
+ payload = build_payload(data)
95
+ schedule_payload(payload)
96
+ rescue => e
97
+ logger.error "[Ratchet.io] Error reporting message to Ratchet.io: #{e}"
37
98
  end
38
99
 
39
- def report_message(message, level="info", extra_data={})
100
+ def process_payload(payload)
40
101
  begin
41
- data = base_data(level)
42
-
43
- data[:body] = {
44
- :message => {
45
- :body => message.to_s
46
- }
47
- }
48
- data[:body][:message].merge!(extra_data)
49
- data[:server] = server_data
50
-
51
- payload = build_payload(data)
52
- send_payload(payload)
53
- rescue Exception => e
102
+ if configuration.write_to_file
103
+ write_payload(payload)
104
+ else
105
+ send_payload(payload)
106
+ end
107
+ rescue => e
54
108
  logger.error "[Ratchet.io] Error reporting message to Ratchet.io: #{e}"
55
109
  end
56
110
  end
57
111
 
58
- private
112
+ private
113
+
114
+ def message_data(message, level, extra_data)
115
+ data = base_data(level)
116
+
117
+ data[:body] = {
118
+ :message => {
119
+ :body => message.to_s
120
+ }
121
+ }
122
+ data[:body][:message].merge!(extra_data)
123
+ data[:server] = server_data
124
+
125
+ data
126
+ end
59
127
 
60
- def exception_data(exception)
128
+ def exception_data(exception, force_level = nil)
61
129
  data = base_data
130
+
131
+ data[:level] = force_level if force_level
62
132
 
63
133
  # parse backtrace
64
- frames = []
65
- exception.backtrace.each { |frame|
134
+ frames = exception.backtrace.map { |frame|
66
135
  # parse the line
67
136
  match = frame.match(/(.*):(\d+)(?::in `([^']+)')?/)
68
- frames.push({ :filename => match[1], :lineno => match[2].to_i, :method => match[3] })
137
+ { :filename => match[1], :lineno => match[2].to_i, :method => match[3] }
69
138
  }
70
139
  # reverse so that the order is as ratchet expects
71
140
  frames.reverse!
72
141
 
73
- filtered_level = configuration.exception_level_filters[exception.class.name]
74
- if filtered_level
75
- data[:level] = filtered_level
76
- end
77
-
78
142
  data[:body] = {
79
143
  :trace => {
80
144
  :frames => frames,
@@ -91,27 +155,79 @@ module Ratchetio
91
155
  end
92
156
 
93
157
  def logger
158
+ # init if not set
159
+ unless configuration.logger
160
+ configuration.logger = configuration.default_logger.call
161
+ end
94
162
  configuration.logger
95
163
  end
96
-
164
+
165
+ def write_payload(payload)
166
+ if configuration.use_async
167
+ @file_semaphore.synchronize {
168
+ do_write_payload(payload)
169
+ }
170
+ else
171
+ do_write_payload(payload)
172
+ end
173
+ end
174
+
175
+ def do_write_payload(payload)
176
+ logger.info '[Ratchet.io] Writing payload to file'
177
+
178
+ begin
179
+ unless @file
180
+ @file = File.open(configuration.filepath, "a")
181
+ end
182
+
183
+ @file.puts payload
184
+ @file.flush
185
+ logger.info "[Ratchet.io] Success"
186
+ rescue IOError => e
187
+ logger.error "[Ratchet.io] Error opening/writing to file: #{e}"
188
+ end
189
+ end
190
+
97
191
  def send_payload(payload)
98
- logger.info "[Ratchet.io] Sending payload"
99
-
192
+ logger.info '[Ratchet.io] Sending payload'
193
+
100
194
  uri = URI.parse(configuration.endpoint)
101
195
  http = Net::HTTP.new(uri.host, uri.port)
102
- http.use_ssl = true
103
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
196
+
197
+ if uri.scheme == 'https'
198
+ http.use_ssl = true
199
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
200
+ end
104
201
 
105
202
  request = Net::HTTP::Post.new(uri.request_uri)
106
203
  request.body = payload
107
204
  response = http.request(request)
108
205
 
109
206
  if response.code == '200'
110
- logger.info "[Ratchet.io] Success"
207
+ logger.info '[Ratchet.io] Success'
111
208
  else
112
- logger.warn "[Ratchet.io] Got unexpected status code from Ratchet.io api: " + response.code
113
- logger.info "[Ratchet.io] Response:"
114
- logger.info response.body
209
+ logger.warn "[Ratchet.io] Got unexpected status code from Ratchet.io api: #{response.code}"
210
+ logger.info "[Ratchet.io] Response: #{response.body}"
211
+ end
212
+ end
213
+
214
+ def schedule_payload(payload)
215
+ logger.info '[Ratchet.io] Scheduling payload'
216
+
217
+ if configuration.use_async
218
+ unless configuration.async_handler
219
+ configuration.async_handler = method(:default_async_handler)
220
+ end
221
+
222
+ if configuration.write_to_file
223
+ unless @file_semaphore
224
+ @file_semaphore = Mutex.new
225
+ end
226
+ end
227
+
228
+ configuration.async_handler.call(payload)
229
+ else
230
+ process_payload(payload)
115
231
  end
116
232
  end
117
233
 
@@ -123,16 +239,16 @@ module Ratchetio
123
239
  ActiveSupport::JSON.encode(payload)
124
240
  end
125
241
 
126
- def base_data(level="error")
242
+ def base_data(level = 'error')
127
243
  config = configuration
128
244
  {
129
245
  :timestamp => Time.now.to_i,
130
246
  :environment => config.environment,
131
247
  :level => level,
132
- :language => "ruby",
248
+ :language => 'ruby',
133
249
  :framework => config.framework,
134
250
  :notifier => {
135
- :name => "ratchetio-gem",
251
+ :name => 'ratchetio-gem',
136
252
  :version => VERSION
137
253
  }
138
254
  }
@@ -140,18 +256,29 @@ module Ratchetio
140
256
 
141
257
  def server_data
142
258
  config = configuration
259
+
143
260
  data = {
144
261
  :host => Socket.gethostname
145
262
  }
146
- if config.root
147
- data[:root] = config.root.to_s
148
- end
149
- if config.branch
150
- data[:branch] = config.branch
151
- end
263
+ data[:root] = config.root.to_s if config.root
264
+ data[:branch] = config.branch if config.branch
265
+
152
266
  data
153
267
  end
154
-
268
+
269
+ def default_async_handler(payload)
270
+ if defined?(GirlFriday)
271
+ unless @queue
272
+ @queue = GirlFriday::WorkQueue.new(nil, :size => 5) do |payload|
273
+ process_payload(payload)
274
+ end
275
+ end
276
+
277
+ @queue.push(payload)
278
+ else
279
+ logger.warn '[Ratchet.io] girl_friday not found to handle async call, falling back to Thread'
280
+ Thread.new { process_payload(payload) }
281
+ end
282
+ end
155
283
  end
156
284
  end
157
-
data/ratchetio.gemspec CHANGED
@@ -9,11 +9,14 @@ Gem::Specification.new do |gem|
9
9
  gem.homepage = "https://github.com/ratchetio/ratchetio-gem"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
12
+ gem.test_files = gem.files.grep(%r{^(spec)/})
14
13
  gem.name = "ratchetio"
15
14
  gem.require_paths = ["lib"]
16
15
  gem.version = Ratchetio::VERSION
17
16
 
18
- #gem.add_development_dependency "rspec", "~> 2.6"
17
+ gem.add_development_dependency 'rails', '~> 3.2.9'
18
+ gem.add_development_dependency 'devise', '>= 2.1.2'
19
+ gem.add_development_dependency 'rspec-rails', '~> 2.12.0'
20
+ gem.add_development_dependency 'database_cleaner', '>= 0.9.1'
21
+ gem.add_development_dependency 'girl_friday', '>= 0.11.1'
19
22
  end
@@ -0,0 +1,186 @@
1
+ require 'spec_helper'
2
+
3
+ describe HomeController do
4
+
5
+ before(:each) do
6
+ reset_configuration
7
+ Ratchetio.configure do |config|
8
+ config.access_token = 'aaaabbbbccccddddeeeeffff00001111'
9
+ config.environment = ::Rails.env
10
+ config.root = ::Rails.root
11
+ config.framework = "Rails: #{::Rails::VERSION::STRING}"
12
+ config.logger = logger_mock
13
+ end
14
+ end
15
+
16
+ let(:logger_mock) { double("Rails.logger").as_null_object }
17
+
18
+ context "ratchetio controller methods" do
19
+ # TODO run these for a a more-real request
20
+ it "should build valid request data" do
21
+ data = @controller.ratchetio_request_data
22
+ data.should have_key(:params)
23
+ data.should have_key(:url)
24
+ data.should have_key(:user_ip)
25
+ data.should have_key(:headers)
26
+ data.should have_key(:GET)
27
+ data.should have_key(:session)
28
+ data.should have_key(:method)
29
+ end
30
+
31
+ it "should build empty person data when no one is logged-in" do
32
+ data = @controller.ratchetio_person_data
33
+ data.should == {}
34
+ end
35
+
36
+ context "ratchetio_filter_params" do
37
+ it "should filter files" do
38
+ name = "John Doe"
39
+ file_hash = {
40
+ :filename => "test.txt",
41
+ :type => "text/plain",
42
+ :head => {},
43
+ :tempfile => "dummy"
44
+ }
45
+ file = ActionDispatch::Http::UploadedFile.new(file_hash)
46
+
47
+ params = {
48
+ :name => name,
49
+ :a_file => file
50
+ }
51
+
52
+ filtered = controller.send(:ratchetio_filter_params, params)
53
+
54
+ filtered[:name].should == name
55
+ filtered[:a_file].should be_a_kind_of(Hash)
56
+ filtered[:a_file][:content_type].should == file_hash[:type]
57
+ filtered[:a_file][:original_filename].should == file_hash[:filename]
58
+ filtered[:a_file][:size].should == file_hash[:tempfile].size
59
+ end
60
+
61
+ it "should filter files in nested params" do
62
+ name = "John Doe"
63
+ file_hash = {
64
+ :filename => "test.txt",
65
+ :type => "text/plain",
66
+ :head => {},
67
+ :tempfile => "dummy"
68
+ }
69
+ file = ActionDispatch::Http::UploadedFile.new(file_hash)
70
+
71
+ params = {
72
+ :name => name,
73
+ :wrapper => {
74
+ :wrapper2 => {
75
+ :a_file => file,
76
+ :foo => "bar"
77
+ }
78
+ }
79
+ }
80
+
81
+ filtered = controller.send(:ratchetio_filter_params, params)
82
+
83
+ filtered[:name].should == name
84
+ filtered[:wrapper][:wrapper2][:foo].should == "bar"
85
+
86
+ filtered_file = filtered[:wrapper][:wrapper2][:a_file]
87
+ filtered_file.should be_a_kind_of(Hash)
88
+ filtered_file[:content_type].should == file_hash[:type]
89
+ filtered_file[:original_filename].should == file_hash[:filename]
90
+ filtered_file[:size].should == file_hash[:tempfile].size
91
+ end
92
+
93
+ it "should scrub the default scrub_fields" do
94
+ params = {
95
+ :passwd => "hidden",
96
+ :password => "hidden",
97
+ :secret => "hidden",
98
+ :notpass => "visible"
99
+ }
100
+
101
+ filtered = controller.send(:ratchetio_filter_params, params)
102
+
103
+ filtered[:passwd].should == "******"
104
+ filtered[:password].should == "******"
105
+ filtered[:secret].should == "******"
106
+ filtered[:notpass].should == "visible"
107
+ end
108
+
109
+ it "should scrub custom scrub_fields" do
110
+ Ratchetio.configure do |config|
111
+ config.scrub_fields = [:notpass, :secret]
112
+ end
113
+
114
+ params = {
115
+ :passwd => "visible",
116
+ :password => "visible",
117
+ :secret => "hidden",
118
+ :notpass => "hidden"
119
+ }
120
+
121
+ filtered = controller.send(:ratchetio_filter_params, params)
122
+
123
+ filtered[:passwd].should == "visible"
124
+ filtered[:password].should == "visible"
125
+ filtered[:secret].should == "******"
126
+ filtered[:notpass].should == "******"
127
+ end
128
+ end
129
+
130
+ context "ratchetio_request_url" do
131
+ it "should build simple http urls" do
132
+ req = controller.request
133
+ req.host = 'ratchet.io'
134
+
135
+ controller.send(:ratchetio_request_url).should == 'http://ratchet.io'
136
+ end
137
+ end
138
+
139
+ context "ratchetio_user_ip" do
140
+ it "should use X-Real-Ip when set" do
141
+ controller.request.env["HTTP_X_REAL_IP"] = '1.1.1.1'
142
+ controller.request.env["HTTP_X_FORWARDED_FOR"] = '1.2.3.4'
143
+ controller.send(:ratchetio_user_ip).should == '1.1.1.1'
144
+ end
145
+
146
+ it "should use X-Forwarded-For when set" do
147
+ controller.request.env["HTTP_X_FORWARDED_FOR"] = '1.2.3.4'
148
+ controller.send(:ratchetio_user_ip).should == '1.2.3.4'
149
+ end
150
+
151
+ it "should use the remote_addr when neither is set" do
152
+ controller.send(:ratchetio_user_ip).should == '0.0.0.0'
153
+ end
154
+ end
155
+
156
+ end
157
+
158
+ describe "GET 'index'" do
159
+ it "should be successful and report a message" do
160
+ logger_mock.should_receive(:info).with('[Ratchet.io] Success')
161
+ get 'index'
162
+ response.should be_success
163
+ end
164
+ end
165
+
166
+ describe "GET 'report_exception'" do
167
+ it "should raise a NameError and report an exception" do
168
+ logger_mock.should_receive(:info).with('[Ratchet.io] Success')
169
+
170
+ get 'report_exception'
171
+ response.should be_success
172
+ end
173
+ end
174
+
175
+ # TODO need to figure out how to make a test request that uses enough of the middleware
176
+ # that it invokes the ratchetio exception catcher. just plain "get 'some_url'" doesn't
177
+ # seem to work.
178
+ it "should report uncaught exceptions"
179
+
180
+ after(:each) do
181
+ Ratchetio.configure do |config|
182
+ config.logger = ::Rails.logger
183
+ end
184
+ end
185
+
186
+ end
@@ -0,0 +1,73 @@
1
+ #----------------------------------------------------------------------------
2
+ # Ignore these files when commiting to a git repository.
3
+ #
4
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
5
+ #
6
+ # The original version of this file is found here:
7
+ # https://github.com/RailsApps/rails-composer/blob/master/files/gitignore.txt
8
+ #
9
+ # Corrections? Improvements? Create a GitHub issue:
10
+ # http://github.com/RailsApps/rails-composer/issues
11
+ #----------------------------------------------------------------------------
12
+
13
+ # bundler state
14
+ /.bundle
15
+ /vendor/bundle/
16
+ /vendor/ruby/
17
+
18
+ # minimal Rails specific artifacts
19
+ db/*.sqlite3
20
+ /log/*
21
+ /tmp/*
22
+
23
+ # various artifacts
24
+ **.war
25
+ *.rbc
26
+ *.sassc
27
+ .rspec
28
+ .redcar/
29
+ .sass-cache
30
+ /config/config.yml
31
+ /coverage.data
32
+ /coverage/
33
+ /db/*.javadb/
34
+ /db/*.sqlite3
35
+ /doc/api/
36
+ /doc/app/
37
+ /doc/features.html
38
+ /doc/specs.html
39
+ /public/cache
40
+ /public/stylesheets/compiled
41
+ /public/system/*
42
+ /spec/tmp/*
43
+ /cache
44
+ /capybara*
45
+ /capybara-*.html
46
+ /gems
47
+ /specifications
48
+ rerun.txt
49
+ pickle-email-*.html
50
+
51
+ # If you find yourself ignoring temporary files generated by your text editor
52
+ # or operating system, you probably want to add a global ignore instead:
53
+ # git config --global core.excludesfile ~/.gitignore_global
54
+ #
55
+ # Here are some files you may want to ignore globally:
56
+
57
+ # scm revert files
58
+ **.orig
59
+
60
+ # Mac finder artifacts
61
+ .DS_Store
62
+
63
+ # Netbeans project directory
64
+ /nbproject/
65
+
66
+ # RubyMine project files
67
+ .idea
68
+
69
+ # Textmate project files
70
+ /*.tmproj
71
+
72
+ # vim artifacts
73
+ **.swp
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require_tree .
@@ -0,0 +1,37 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
14
+ .brand {
15
+ float: left;
16
+ padding-right: 8px;
17
+ }
18
+ ul.nav {
19
+ list-style: none;
20
+ margin: 0 0 2em;
21
+ padding: 0;
22
+ }
23
+ ul.nav li {
24
+ display: inline;
25
+ }
26
+ #flash_notice, #flash_alert {
27
+ padding: 5px 8px;
28
+ margin: 10px 0;
29
+ }
30
+ #flash_notice {
31
+ background-color: #CFC;
32
+ border: solid 1px #6C6;
33
+ }
34
+ #flash_alert {
35
+ background-color: #FCC;
36
+ border: solid 1px #C66;
37
+ }
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,21 @@
1
+ class HomeController < ApplicationController
2
+ def index
3
+ @users = User.all
4
+
5
+ Ratchetio.report_message("Test message from controller with no data", "debug")
6
+ Ratchetio.report_message("Test message from controller with extra data", "debug",
7
+ :foo => "bar", :num_users => @users.length)
8
+ end
9
+
10
+ def report_exception
11
+ begin
12
+ foo = bar
13
+ rescue => e
14
+ Ratchetio.report_exception(e, ratchetio_request_data, ratchetio_person_data)
15
+ end
16
+ end
17
+
18
+ def cause_exception
19
+ foo = bar
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ class UsersController < ApplicationController
2
+ before_filter :authenticate_user!
3
+
4
+ def index
5
+ @users = User.all
6
+ end
7
+
8
+ def show
9
+ @user = User.find(params[:id])
10
+ end
11
+
12
+ end