nano-pure-pkg 0.0.1

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 (38) hide show
  1. checksums.yaml +7 -0
  2. data/ahoy_matey-5.5.0/CHANGELOG.md +403 -0
  3. data/ahoy_matey-5.5.0/CONTRIBUTING.md +42 -0
  4. data/ahoy_matey-5.5.0/LICENSE.txt +22 -0
  5. data/ahoy_matey-5.5.0/README.md +802 -0
  6. data/ahoy_matey-5.5.0/app/controllers/ahoy/base_controller.rb +44 -0
  7. data/ahoy_matey-5.5.0/app/controllers/ahoy/events_controller.rb +51 -0
  8. data/ahoy_matey-5.5.0/app/controllers/ahoy/visits_controller.rb +15 -0
  9. data/ahoy_matey-5.5.0/config/routes.rb +10 -0
  10. data/ahoy_matey-5.5.0/lib/ahoy/base_store.rb +104 -0
  11. data/ahoy_matey-5.5.0/lib/ahoy/controller.rb +56 -0
  12. data/ahoy_matey-5.5.0/lib/ahoy/database_store.rb +96 -0
  13. data/ahoy_matey-5.5.0/lib/ahoy/engine.rb +37 -0
  14. data/ahoy_matey-5.5.0/lib/ahoy/geocode_v2_job.rb +31 -0
  15. data/ahoy_matey-5.5.0/lib/ahoy/helper.rb +40 -0
  16. data/ahoy_matey-5.5.0/lib/ahoy/model.rb +15 -0
  17. data/ahoy_matey-5.5.0/lib/ahoy/query_methods.rb +88 -0
  18. data/ahoy_matey-5.5.0/lib/ahoy/tracker.rb +287 -0
  19. data/ahoy_matey-5.5.0/lib/ahoy/utils.rb +7 -0
  20. data/ahoy_matey-5.5.0/lib/ahoy/version.rb +3 -0
  21. data/ahoy_matey-5.5.0/lib/ahoy/visit_properties.rb +122 -0
  22. data/ahoy_matey-5.5.0/lib/ahoy/warden.rb +5 -0
  23. data/ahoy_matey-5.5.0/lib/ahoy.rb +167 -0
  24. data/ahoy_matey-5.5.0/lib/ahoy_matey.rb +1 -0
  25. data/ahoy_matey-5.5.0/lib/generators/ahoy/activerecord_generator.rb +59 -0
  26. data/ahoy_matey-5.5.0/lib/generators/ahoy/base_generator.rb +13 -0
  27. data/ahoy_matey-5.5.0/lib/generators/ahoy/install_generator.rb +44 -0
  28. data/ahoy_matey-5.5.0/lib/generators/ahoy/mongoid_generator.rb +16 -0
  29. data/ahoy_matey-5.5.0/lib/generators/ahoy/templates/active_record_event_model.rb.tt +10 -0
  30. data/ahoy_matey-5.5.0/lib/generators/ahoy/templates/active_record_migration.rb.tt +62 -0
  31. data/ahoy_matey-5.5.0/lib/generators/ahoy/templates/active_record_visit_model.rb.tt +6 -0
  32. data/ahoy_matey-5.5.0/lib/generators/ahoy/templates/base_store_initializer.rb.tt +25 -0
  33. data/ahoy_matey-5.5.0/lib/generators/ahoy/templates/database_store_initializer.rb.tt +10 -0
  34. data/ahoy_matey-5.5.0/lib/generators/ahoy/templates/mongoid_event_model.rb.tt +14 -0
  35. data/ahoy_matey-5.5.0/lib/generators/ahoy/templates/mongoid_visit_model.rb.tt +50 -0
  36. data/ahoy_matey-5.5.0/vendor/assets/javascripts/ahoy.js +544 -0
  37. data/nano-pure-pkg.gemspec +12 -0
  38. metadata +77 -0
@@ -0,0 +1,44 @@
1
+ require "rails/generators"
2
+
3
+ module Ahoy
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ source_root File.join(__dir__, "templates")
7
+
8
+ def copy_templates
9
+ activerecord = defined?(ActiveRecord)
10
+ mongoid = defined?(Mongoid)
11
+
12
+ selection =
13
+ if activerecord && mongoid
14
+ puts <<~MSG
15
+
16
+ Which data store would you like to use?
17
+ 1. ActiveRecord (default)
18
+ 2. Mongoid
19
+ 3. Neither
20
+ MSG
21
+
22
+ ask(">")
23
+ elsif activerecord
24
+ "1"
25
+ elsif mongoid
26
+ "2"
27
+ else
28
+ "3"
29
+ end
30
+
31
+ case selection
32
+ when "", "1"
33
+ invoke "ahoy:activerecord"
34
+ when "2"
35
+ invoke "ahoy:mongoid"
36
+ when "3"
37
+ invoke "ahoy:base"
38
+ else
39
+ abort "Error: must enter a number [1-3]"
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,16 @@
1
+ require "rails/generators"
2
+
3
+ module Ahoy
4
+ module Generators
5
+ class MongoidGenerator < Rails::Generators::Base
6
+ source_root File.join(__dir__, "templates")
7
+
8
+ def copy_templates
9
+ template "database_store_initializer.rb", "config/initializers/ahoy.rb"
10
+ template "mongoid_visit_model.rb", "app/models/ahoy/visit.rb"
11
+ template "mongoid_event_model.rb", "app/models/ahoy/event.rb"
12
+ puts "\nAlmost set! Last, run:\n\n rake db:mongoid:create_indexes"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ class Ahoy::Event < ApplicationRecord
2
+ include Ahoy::QueryMethods
3
+
4
+ self.table_name = "ahoy_events"
5
+
6
+ belongs_to :visit
7
+ belongs_to :user, optional: true<% if serialize_properties? %>
8
+
9
+ serialize :properties, coder: JSON<% end %>
10
+ end
@@ -0,0 +1,62 @@
1
+ class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
2
+ def change
3
+ create_table :ahoy_visits<%= primary_key_type %> do |t|
4
+ t.string :visit_token
5
+ t.string :visitor_token
6
+
7
+ # the rest are recommended but optional
8
+ # simply remove any you don't want
9
+
10
+ # user
11
+ t.references :user<%= foreign_key_type %>
12
+
13
+ # standard
14
+ t.string :ip
15
+ t.text :user_agent
16
+ t.text :referrer
17
+ t.string :referring_domain
18
+ t.text :landing_page
19
+
20
+ # technology
21
+ t.string :browser
22
+ t.string :os
23
+ t.string :device_type
24
+
25
+ # location
26
+ t.string :country
27
+ t.string :region
28
+ t.string :city
29
+ t.float :latitude
30
+ t.float :longitude
31
+
32
+ # utm parameters
33
+ t.string :utm_source
34
+ t.string :utm_medium
35
+ t.string :utm_term
36
+ t.string :utm_content
37
+ t.string :utm_campaign
38
+
39
+ # native apps
40
+ t.string :app_version
41
+ t.string :os_version
42
+ t.string :platform
43
+
44
+ t.datetime :started_at
45
+ end
46
+
47
+ add_index :ahoy_visits, :visit_token, unique: true
48
+ add_index :ahoy_visits, [:visitor_token, :started_at]
49
+
50
+ create_table :ahoy_events<%= primary_key_type %> do |t|
51
+ t.references :visit<%= foreign_key_type %>
52
+ t.references :user<%= foreign_key_type %>
53
+
54
+ t.string :name
55
+ t.<%= properties_type %> :properties
56
+ t.datetime :time
57
+ end
58
+
59
+ add_index :ahoy_events, [:name, :time]<% if properties_type == "jsonb" %>
60
+ add_index :ahoy_events, :properties, using: :gin, opclass: :jsonb_path_ops<% end %>
61
+ end
62
+ end
@@ -0,0 +1,6 @@
1
+ class Ahoy::Visit < ApplicationRecord
2
+ self.table_name = "ahoy_visits"
3
+
4
+ has_many :events, class_name: "Ahoy::Event"
5
+ belongs_to :user, optional: true
6
+ end
@@ -0,0 +1,25 @@
1
+ class Ahoy::Store < Ahoy::BaseStore
2
+ def track_visit(data)
3
+ # do
4
+ end
5
+
6
+ def track_event(data)
7
+ # something
8
+ end
9
+
10
+ def geocode(data)
11
+ # amazing
12
+ end
13
+
14
+ def authenticate(data)
15
+ # !!!
16
+ end
17
+ end
18
+
19
+ # set to true for JavaScript tracking
20
+ Ahoy.api = false
21
+
22
+ # set to true for geocoding (and add the geocoder gem to your Gemfile)
23
+ # we recommend configuring local geocoding as well
24
+ # see https://github.com/ankane/ahoy#geocoding
25
+ Ahoy.geocode = false
@@ -0,0 +1,10 @@
1
+ class Ahoy::Store < Ahoy::DatabaseStore
2
+ end
3
+
4
+ # set to true for JavaScript tracking
5
+ Ahoy.api = false
6
+
7
+ # set to true for geocoding (and add the geocoder gem to your Gemfile)
8
+ # we recommend configuring local geocoding as well
9
+ # see https://github.com/ankane/ahoy#geocoding
10
+ Ahoy.geocode = false
@@ -0,0 +1,14 @@
1
+ class Ahoy::Event
2
+ include Mongoid::Document
3
+
4
+ # associations
5
+ belongs_to :visit, class_name: "Ahoy::Visit", index: true
6
+ belongs_to :user, index: true, optional: true
7
+
8
+ # fields
9
+ field :name, type: String
10
+ field :properties, type: Hash
11
+ field :time, type: Time
12
+
13
+ index({name: 1, time: 1})
14
+ end
@@ -0,0 +1,50 @@
1
+ class Ahoy::Visit
2
+ include Mongoid::Document
3
+
4
+ # associations
5
+ has_many :events, class_name: "Ahoy::Event"
6
+ belongs_to :user, index: true, optional: true
7
+
8
+ # required
9
+ field :visit_token, type: String
10
+ field :visitor_token, type: String
11
+
12
+ # the rest are recommended but optional
13
+ # simply remove the columns you don't want
14
+
15
+ # standard
16
+ field :ip, type: String
17
+ field :user_agent, type: String
18
+ field :referrer, type: String
19
+ field :referring_domain, type: String
20
+ field :landing_page, type: String
21
+
22
+ # technology
23
+ field :browser, type: String
24
+ field :os, type: String
25
+ field :device_type, type: String
26
+
27
+ # location
28
+ field :country, type: String
29
+ field :region, type: String
30
+ field :city, type: String
31
+ field :latitude, type: Float
32
+ field :longitude, type: Float
33
+
34
+ # utm parameters
35
+ field :utm_source, type: String
36
+ field :utm_medium, type: String
37
+ field :utm_term, type: String
38
+ field :utm_content, type: String
39
+ field :utm_campaign, type: String
40
+
41
+ # native apps
42
+ field :app_version, type: String
43
+ field :os_version, type: String
44
+ field :platform, type: String
45
+
46
+ field :started_at, type: Time
47
+
48
+ index({visit_token: 1}, {unique: true})
49
+ index({visitor_token: 1, started_at: 1})
50
+ end