stealth-mixpanel 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: abed3cdc42ecfd67ef90e2b4e1b0c8a13a34505a222be7e7565c8ebfe5da3bfe
4
+ data.tar.gz: 53fd0bfc635feb0cfd26bfb8326188b902e9c1318955f4f23129d00721ec52a3
5
+ SHA512:
6
+ metadata.gz: 00fd153baa1ed741ac81b6b9a20bdcef8765c53a1a4c28fefe090e49727dbf75c6b9bb144c95a0752f22657a45473120c08a1ddaf673f25a2db5bb7aab250e7c
7
+ data.tar.gz: a35500a9b20c9c10389deec89e6cb1b639e1714c3672d45961a8271611e74a02d9037ba0f5479e907bf49ed9a7d79b3410273c723c195e18405530eb19f67543
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ gemspec
2
+
3
+ source 'https://rubygems.org'
4
+ ruby '2.5.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,77 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ stealth-mixpanel (0.9.0)
5
+ mixpanel-ruby (~> 2.2)
6
+ stealth (~> 0.10)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (5.2.0.rc2)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 0.7, < 2)
14
+ minitest (~> 5.1)
15
+ tzinfo (~> 1.1)
16
+ concurrent-ruby (1.0.5)
17
+ connection_pool (2.2.1)
18
+ diff-lcs (1.3)
19
+ i18n (1.0.0)
20
+ concurrent-ruby (~> 1.0)
21
+ minitest (5.11.3)
22
+ mixpanel-ruby (2.2.0)
23
+ multi_json (1.13.1)
24
+ mustermann (1.0.2)
25
+ puma (3.11.3)
26
+ rack (2.0.4)
27
+ rack-protection (2.0.1)
28
+ rack
29
+ redis (4.0.1)
30
+ rspec (3.6.0)
31
+ rspec-core (~> 3.6.0)
32
+ rspec-expectations (~> 3.6.0)
33
+ rspec-mocks (~> 3.6.0)
34
+ rspec-core (3.6.0)
35
+ rspec-support (~> 3.6.0)
36
+ rspec-expectations (3.6.0)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.6.0)
39
+ rspec-mocks (3.6.0)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.6.0)
42
+ rspec-support (3.6.0)
43
+ sidekiq (5.1.1)
44
+ concurrent-ruby (~> 1.0)
45
+ connection_pool (~> 2.2, >= 2.2.0)
46
+ rack-protection (>= 1.5.0)
47
+ redis (>= 3.3.5, < 5)
48
+ sinatra (2.0.1)
49
+ mustermann (~> 1.0)
50
+ rack (~> 2.0)
51
+ rack-protection (= 2.0.1)
52
+ tilt (~> 2.0)
53
+ stealth (0.10.5)
54
+ activesupport (~> 5.2.0.rc1)
55
+ multi_json (~> 1.12)
56
+ puma (~> 3.10)
57
+ sidekiq (~> 5.0)
58
+ sinatra (~> 2.0)
59
+ thor (~> 0.20)
60
+ thor (0.20.0)
61
+ thread_safe (0.3.6)
62
+ tilt (2.0.8)
63
+ tzinfo (1.2.5)
64
+ thread_safe (~> 0.1)
65
+
66
+ PLATFORMS
67
+ ruby
68
+
69
+ DEPENDENCIES
70
+ rspec (= 3.6.0)
71
+ stealth-mixpanel!
72
+
73
+ RUBY VERSION
74
+ ruby 2.5.0p0
75
+
76
+ BUNDLED WITH
77
+ 1.16.1
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # stealth-mixpanel
2
+
3
+ This gem provides out-of-the-box tracking of state transitions inside of Stealth via the [Mixpanel](https://mixpanel.com) service. You are free to track additional events as needed, and we may add more baseline events in the future.
@@ -0,0 +1,23 @@
1
+ module Stealth
2
+ module MixpanelSessionTracking
3
+ def set(flow:, state:)
4
+ retval = super
5
+
6
+ if ENV['MIXPANEL_PROJECT_TOKEN'].present?
7
+ mixpanel = Stealth::Mixpanel.new
8
+ mixpanel.tracker.track(user_id, 'State Change', {
9
+ 'flow' => flow,
10
+ 'state' => state
11
+ })
12
+ Stealth::Logger.l(topic: "mixpanel", message: "tracked.")
13
+ end
14
+
15
+ retval
16
+ end
17
+ end
18
+
19
+ class Session
20
+ prepend Stealth::MixpanelSessionTracking
21
+ end
22
+
23
+ end
@@ -0,0 +1,11 @@
1
+ module Stealth
2
+ class Mixpanel
3
+
4
+ attr_reader :tracker
5
+
6
+ def initialize
7
+ @tracker = ::Mixpanel::Tracker.new(ENV['MIXPANEL_PROJECT_TOKEN'])
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ require 'mixpanel-ruby'
2
+ require 'stealth-mixpanel/tracker'
3
+ require 'stealth-mixpanel/state_transitions'
@@ -0,0 +1,85 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+
4
+ require 'rspec'
5
+ require 'mixpanel-ruby'
6
+ require 'stealth-mixpanel'
7
+
8
+ RSpec.configure do |config|
9
+ config.expect_with :rspec do |expectations|
10
+ # This option will default to `true` in RSpec 4. It makes the `description`
11
+ # and `failure_message` of custom matchers include text for helper methods
12
+ # defined using `chain`, e.g.:
13
+ # be_bigger_than(2).and_smaller_than(4).description
14
+ # # => "be bigger than 2 and smaller than 4"
15
+ # ...rather than:
16
+ # # => "be bigger than 2"
17
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
18
+ end
19
+
20
+ # rspec-mocks config goes here. You can use an alternate test double
21
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
22
+ config.mock_with :rspec do |mocks|
23
+ # Prevents you from mocking or stubbing a method that does not exist on
24
+ # a real object. This is generally recommended, and will default to
25
+ # `true` in RSpec 4.
26
+ mocks.verify_partial_doubles = true
27
+ end
28
+
29
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
30
+ # have no way to turn it off -- the option exists only for backwards
31
+ # compatibility in RSpec 3). It causes shared context metadata to be
32
+ # inherited by the metadata hash of host groups and examples, rather than
33
+ # triggering implicit auto-inclusion in groups with matching metadata.
34
+ config.shared_context_metadata_behavior = :apply_to_host_groups
35
+
36
+ # The settings below are suggested to provide a good initial experience
37
+ # with RSpec, but feel free to customize to your heart's content.
38
+ =begin
39
+ # This allows you to limit a spec run to individual examples or groups
40
+ # you care about by tagging them with `:focus` metadata. When nothing
41
+ # is tagged with `:focus`, all examples get run. RSpec also provides
42
+ # aliases for `it`, `describe`, and `context` that include `:focus`
43
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
44
+ config.filter_run_when_matching :focus
45
+
46
+ # Allows RSpec to persist some state between runs in order to support
47
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
48
+ # you configure your source control system to ignore this file.
49
+ config.example_status_persistence_file_path = "spec/examples.txt"
50
+
51
+ # Limits the available syntax to the non-monkey patched syntax that is
52
+ # recommended. For more details, see:
53
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
54
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
55
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
56
+ config.disable_monkey_patching!
57
+
58
+ # Many RSpec users commonly either run the entire suite or an individual
59
+ # file, and it's useful to allow more verbose output when running an
60
+ # individual spec file.
61
+ if config.files_to_run.one?
62
+ # Use the documentation formatter for detailed output,
63
+ # unless a formatter has already been configured
64
+ # (e.g. via a command-line flag).
65
+ config.default_formatter = 'doc'
66
+ end
67
+
68
+ # Print the 10 slowest examples and example groups at the
69
+ # end of the spec run, to help surface which specs are running
70
+ # particularly slow.
71
+ config.profile_examples = 10
72
+
73
+ # Run specs in random order to surface order dependencies. If you find an
74
+ # order dependency and want to debug it, you can fix the order by providing
75
+ # the seed, which is printed after each run.
76
+ # --seed 1234
77
+ config.order = :random
78
+
79
+ # Seed global randomization in this process using the `--seed` CLI option.
80
+ # Setting this allows you to use `--seed` to deterministically reproduce
81
+ # test failures related to randomization by passing the same `--seed` value
82
+ # as the one that triggered the failure.
83
+ Kernel.srand config.seed
84
+ =end
85
+ end
@@ -0,0 +1,18 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'stealth-mixpanel'
3
+ s.version = '0.9.0'
4
+ s.date = '2018-03-26'
5
+ s.summary = "Stealth Mixpanel"
6
+ s.description = "Built-in state tracking for Stealth bots with Mixpanel."
7
+ s.authors = ["Mauricio Gomes"]
8
+ s.email = 'mauricio@whoisblackops.com'
9
+ s.files = `git ls-files`.split("\n")
10
+ s.homepage = 'http://github.com/hellostealth/stealth-mixpanel'
11
+ s.license = 'MIT'
12
+
13
+ s.add_dependency 'stealth', '~> 0.10'
14
+ s.add_dependency 'mixpanel-ruby', '~> 2.2'
15
+
16
+ s.add_development_dependency "rspec", "3.6.0"
17
+
18
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stealth-mixpanel
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Mauricio Gomes
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: stealth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.10'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mixpanel-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.2'
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.6.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.6.0
55
+ description: Built-in state tracking for Stealth bots with Mixpanel.
56
+ email: mauricio@whoisblackops.com
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - ".rspec"
62
+ - Gemfile
63
+ - Gemfile.lock
64
+ - README.md
65
+ - lib/stealth-mixpanel.rb
66
+ - lib/stealth-mixpanel/state_transitions.rb
67
+ - lib/stealth-mixpanel/tracker.rb
68
+ - spec/spec_helper.rb
69
+ - stealth-mixpanel.gemspec
70
+ homepage: http://github.com/hellostealth/stealth-mixpanel
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.7.3
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: Stealth Mixpanel
94
+ test_files: []