wat_catcher 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8043fade56d1b2f69326f18f41321ac3cde0473
4
- data.tar.gz: 3083ca694c6023f1fd8f09f50287cda1398cfe20
3
+ metadata.gz: e5b31f887aebec9fd6edad0d91e5efc0c954e68d
4
+ data.tar.gz: ac60246bfee12fd66a639d643ee35d4857c9aed4
5
5
  SHA512:
6
- metadata.gz: 3f1f77e169b7ed31147e10a0b623908498e19407918c453dafb6e63535b06444af91f663d9d17ca7a507e2c9d8ba3a526e2efa0ca1a84c3aa55634c60a17851f
7
- data.tar.gz: f7237fcb1f1e2d7492ce912b7c530f949b62843e22b7138360dfd4443b58ef87fc12514fcae6740c9b92936293ac267933d51a79e71a1778530dee5a0e5240c4
6
+ metadata.gz: 7b8bd8627b03b0e7f1158779cc78b4baaabcb92611e8093324327329bd87d03ab965301dddb469e3c3fb5f11cdd41b08024eafc21c14d1da3f5a3a2aa909dcb5
7
+ data.tar.gz: 43fab02a765bfa8c725e8f49ad7abe70437a994aeebe830c74b131d8396b214476e9a31a54d41af8bed375a9654076c4d5f7e18a029054f9efe509439b65a468
data/lib/wat_catcher.rb CHANGED
@@ -3,3 +3,21 @@ require "wat_catcher/version"
3
3
  require 'wat_catcher/backgrounder'
4
4
  require "wat_catcher/middleware"
5
5
  require "wat_catcher/wat_helper"
6
+
7
+ require "wat_catcher/railtie" if defined?(Rails::Railtie)
8
+
9
+ module WatCatcher
10
+ class << self
11
+ def configure(config_hash=nil)
12
+ config_hash.each do |k, v|
13
+ configuration.send("#{k}=", v)
14
+ end if config_hash
15
+
16
+ yield(configuration) if block_given?
17
+ end
18
+
19
+ def configuration
20
+ @configuration ||= OpenStruct.new
21
+ end
22
+ end
23
+ end
@@ -21,7 +21,7 @@ module WatCatcher
21
21
  url << ":#{request.port}" unless [80, 443].include?(request.port)
22
22
  url << request.fullpath
23
23
 
24
- @client.post("http://localhost:3000/wats",
24
+ @client.post("#{WatCatcher.configuration.host}/wats",
25
25
  "wat[page_url]" => page_url,
26
26
  "wat[request_params]" => params,
27
27
  "wat[session]" => session,
@@ -0,0 +1,27 @@
1
+ module WatCatcher
2
+ class Railtie < Rails::Railtie
3
+
4
+ config.before_initialize do
5
+ # Configure bugsnag rails defaults
6
+ WatCatcher.configure do |config|
7
+ config.logger = Rails.logger
8
+ config.release_stage = Rails.env.to_s
9
+ config.project_root = Rails.root.to_s
10
+ end
11
+
12
+ # Auto-load configuration settings from config/bugsnag.yml if it exists
13
+ config_file = Rails.root.join("config", "wat_catcher.yml")
14
+ config = YAML.load_file(config_file) if File.exists?(config_file)
15
+ WatCatcher.configure(config[Rails.env] ? config[Rails.env] : config) if config
16
+ end
17
+
18
+ initializer "wat_catcher.use_rack_middleware" do |app|
19
+ begin
20
+ app.config.middleware.insert_after ActionDispatch::DebugExceptions, "WatCatcher::Middleware"
21
+ rescue
22
+ app.config.middleware.use "WatCatcher::Middleware"
23
+ end
24
+ end
25
+ end
26
+
27
+ end
@@ -1,3 +1,3 @@
1
1
  module WatCatcher
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  module WatCatcher
2
2
  module Helper
3
3
  def watch_watcher_url
4
- "http://localhost:3000/assets/wat_catcher.js"
4
+ "#{WatCatcher.configuration.host}/assets/wat_catcher.js"
5
5
  end
6
6
  def javascript_include_wat_catcher
7
7
  "<script src='#{watch_watcher_url}' type='text/javascript'></script>".html_safe
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wat_catcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Constantine
@@ -55,6 +55,7 @@ files:
55
55
  - lib/wat_catcher.rb
56
56
  - lib/wat_catcher/backgrounder.rb
57
57
  - lib/wat_catcher/middleware.rb
58
+ - lib/wat_catcher/railtie.rb
58
59
  - lib/wat_catcher/version.rb
59
60
  - lib/wat_catcher/wat_helper.rb
60
61
  - wat_catcher.gemspec