opal-rollbar 1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 476341387f542953c32e7a7fab7f33d33ed30a16
4
+ data.tar.gz: 278f279f60b18febabc54261700f6ccdbf23f48c
5
+ SHA512:
6
+ metadata.gz: aed952e969b3a00b8ca26e74890e5b2455e72d33b96810ae7b5783565891242da6cee413a7f147ce276d4fff235bf92deebbd1fd14f234f674c41a86bc36cea3
7
+ data.tar.gz: 8c6d9877cce1579c5b5d2f89fe4852323d7109376c4b265bac5889c5045121572cd3253502fa6a87167bcc7d4d99c406ec5fdbe3e0bfa191a1e4272965f1b278
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,118 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+
4
+ # Multi-line method chaining should be done with trailing dots.
5
+ Layout/DotPosition:
6
+ EnforcedStyle: leading
7
+ SupportedStyles:
8
+ - leading
9
+ - trailing
10
+
11
+ Style/Documentation:
12
+ Description: 'Document classes and non-namespace modules.'
13
+ Enabled: false
14
+ Exclude:
15
+ - 'spec/**/*'
16
+ - 'test/**/*'
17
+
18
+ Style/DoubleNegation:
19
+ Description: 'Avoid the use of double negation (`!!`).'
20
+ Enabled: false
21
+
22
+ Style/FrozenStringLiteralComment:
23
+ Enabled: false
24
+
25
+ Style/MultilineBlockChain:
26
+ Description: 'Avoid multi-line chains of blocks.'
27
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
28
+ Enabled: false
29
+
30
+ Style/MutableConstant:
31
+ Description: 'Do not assign mutable objects to constants.'
32
+ Enabled: false
33
+
34
+ Style/SafeNavigation:
35
+ Enabled: false
36
+
37
+ Metrics/AbcSize:
38
+ # The ABC size is a calculated magnitude, so this number can be a Fixnum or
39
+ # a Float.
40
+ Max: 20
41
+
42
+ Metrics/BlockLength:
43
+ Description: 'Avoid long blocks with many lines.'
44
+ Enabled: false
45
+
46
+ Metrics/LineLength:
47
+ Max: 100
48
+
49
+ Style/BlockDelimiters:
50
+ EnforcedStyle: line_count_based
51
+ SupportedStyles:
52
+ # The `line_count_based` style enforces braces around single line blocks and
53
+ # do..end around multi-line blocks.
54
+ - line_count_based
55
+ # The `semantic` style enforces braces around functional blocks, where the
56
+ # primary purpose of the block is to return a value and do..end for
57
+ # procedural blocks, where the primary purpose of the block is its
58
+ # side-effects.
59
+ #
60
+ # This looks at the usage of a block's method to determine its type (e.g. is
61
+ # the result of a `map` assigned to a variable or passed to another
62
+ # method) but exceptions are permitted in the `ProceduralMethods`,
63
+ # `FunctionalMethods` and `IgnoredMethods` sections below.
64
+ - semantic
65
+ # The `braces_for_chaining` style enforces braces around single line blocks
66
+ # and do..end around multi-line blocks, except for multi-line blocks whose
67
+ # return value is being chained with another method (in which case braces
68
+ # are enforced).
69
+ - braces_for_chaining
70
+ ProceduralMethods:
71
+ # Methods that are known to be procedural in nature but look functional from
72
+ # their usage, e.g.
73
+ #
74
+ # time = Benchmark.realtime do
75
+ # foo.bar
76
+ # end
77
+ #
78
+ # Here, the return value of the block is discarded but the return value of
79
+ # `Benchmark.realtime` is used.
80
+ - benchmark
81
+ - bm
82
+ - bmbm
83
+ - create
84
+ - each_with_object
85
+ - measure
86
+ - new
87
+ - realtime
88
+ - tap
89
+ - with_object
90
+ FunctionalMethods:
91
+ # Methods that are known to be functional in nature but look procedural from
92
+ # their usage, e.g.
93
+ #
94
+ # let(:foo) { Foo.new }
95
+ #
96
+ # Here, the return value of `Foo.new` is used to define a `foo` helper but
97
+ # doesn't appear to be used from the return value of `let`.
98
+ - let
99
+ - let!
100
+ - subject
101
+ - watch
102
+ IgnoredMethods:
103
+ # Methods that can be either procedural or functional and cannot be
104
+ # categorised from their usage alone, e.g.
105
+ #
106
+ # foo = lambda do |x|
107
+ # puts "Hello, #{x}"
108
+ # end
109
+ #
110
+ # foo = lambda do |x|
111
+ # x * 100
112
+ # end
113
+ #
114
+ # Here, it is impossible to tell from the return value of `lambda` whether
115
+ # the inner block's return value is significant.
116
+ - lambda
117
+ - proc
118
+ - it
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.0
5
+ before_install: gem install bundler -v 1.16.1
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+ gemspec
3
+ gem 'opal'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 jmenaguale22
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Opal::Rollbar
2
+ Adds Client-Side Rollbar functionality in Opal
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'opal-rollbar'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install opal-rollbar
19
+
20
+ ## Usage
21
+
22
+ 1. Use this link to add javascript Rollbar functionality https://rollbar.com/docs/notifier/rollbar.js/
23
+ 2. Make sure to use your post_client_item access token from Rollbar for the accessToken in the above link.
24
+ 3. require 'opal-rollbar' in your javascript application file
25
+ 4. Use Rollbar just as you would on server-side Ruby.
26
+
27
+ Ex.
28
+ ```ruby
29
+ Rollbar.error('This is an error')
30
+ Rollbar.warning('This is a warning')
31
+ ```
32
+ etc.
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+
38
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jmenaguale22/opal-rollbar.
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "opal/rollbar"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,13 @@
1
+ require_relative 'opal-rollbar/version'
2
+
3
+ if RUBY_ENGINE == 'opal'
4
+ require_relative 'opal-rollbar/rollbar'
5
+ require_relative 'opal-rollbar/rollbar/rollbar_wrapper.rb'
6
+
7
+ if `Opal.global.Rollbar === undefined`
8
+ raise 'No Rollbar available'
9
+ end
10
+ else
11
+ require 'opal'
12
+ Opal.append_path File.expand_path('../', __FILE__).untaint
13
+ end
@@ -0,0 +1,18 @@
1
+ require_relative 'rollbar/rollbar_wrapper'
2
+ module Rollbar
3
+ METHODS = %i[error warning info critical debug log]
4
+
5
+ class << self
6
+ def instance
7
+ @instance ||= RollbarWrapper.new(`Rollbar`)
8
+ end
9
+
10
+ METHODS.each do |method|
11
+ RollbarWrapper.alias_native method
12
+
13
+ define_method(method) do |*args|
14
+ instance.send(method, *args)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ module Rollbar
2
+ class RollbarWrapper
3
+ include Native
4
+
5
+ def initialize(native)
6
+ @native = native
7
+ end
8
+
9
+ def to_n
10
+ @native
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Rollbar
2
+ VERSION = "1.0"
3
+ end
@@ -0,0 +1,27 @@
1
+
2
+ # lib = File.expand_path("../lib", __FILE__)
3
+ # $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ $:.push File.expand_path('../lib/', __FILE__)
5
+ require "opal-rollbar/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "opal-rollbar"
9
+ spec.version = '1.0'
10
+ spec.authors = ["jmenaguale22"]
11
+ spec.email = ["jasonm@catprint.com"]
12
+
13
+ spec.summary = %q{Allows for Opal client-side Rollbar}
14
+ spec.homepage = "https://github.com/jmenaguale22/opal-rollbar"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.16"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: opal-rollbar
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - jmenaguale22
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-02-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email:
57
+ - jasonm@catprint.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".rubocop.yml"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - lib/opal-rollbar.rb
73
+ - lib/opal-rollbar/rollbar.rb
74
+ - lib/opal-rollbar/rollbar/rollbar_wrapper.rb
75
+ - lib/opal-rollbar/version.rb
76
+ - opal-rollbar.gemspec
77
+ homepage: https://github.com/jmenaguale22/opal-rollbar
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.6.8
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: Allows for Opal client-side Rollbar
101
+ test_files: []