growth 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ee77886cb39fe345de52ca160066a2ca1c22686
4
- data.tar.gz: fcc83ab9af722cd9fceed140d8dda29f7aa5b2e5
3
+ metadata.gz: b6ba36ed28a1a468536f96321c036a2a12658e58
4
+ data.tar.gz: f56cd0f551134a2eb4b9c8a38c5bb8e92774075d
5
5
  SHA512:
6
- metadata.gz: 03e145bd470a0d2a81fc49db698a64d88f494a1907bd778cd4e1692e668a655b9cab32033c79a16e9e3d8fea22f7edec899ded19d6c3e345940acbc1135f3af5
7
- data.tar.gz: c908c94fb2e31a3e5a5398563203d456cb11aa6ca742c8e06bd59467a9ceb24e91bbb3f296bf8b53877500ffb1f2459d2c031a6aef84c519e1b00bd5fc59ddeb
6
+ metadata.gz: d1d9f13fe4712e543014d961bc6c5f5543b329a722276b91e02baaed155216384128a121195dd11b52220349202127b7fdd9d44cf8918047e04064cc0c70889e
7
+ data.tar.gz: badd962a8bcba94692708c0ca24196acd3c5a2d4475ce4793f0894d51b8b882adabed07b69701adb2f4b4bd57f460526846adf72a750640fee9a355955d938ae
data/README.md CHANGED
@@ -33,17 +33,17 @@ end
33
33
  Growth.models_to_measure = ApplicationRecord.descendants.map { |model| model.to_s }
34
34
  ```
35
35
 
36
- You can customize the models you'd like to measure by passing an array of models, i.e.:
36
+ You can customize the models you'd like to measure by passing an array of models as strings, i.e.:
37
37
 
38
38
  ```ruby
39
- Growth.models_to_measure = [ User, Post, Comment ]
39
+ Growth.models_to_measure = [ 'User', 'Post', 'Comment' ]
40
40
  ```
41
41
 
42
42
  Options in your config file are:
43
43
 
44
- ```Growth.models_to_measure``` takes an array of models, ex. [Posts, Users, Comments], that you'd like to measure. The default measures all models.
44
+ ```Growth.models_to_measure``` takes an array of models as strings, ex. [ 'Posts', 'Users', 'Comments' ], that you'd like to measure. The default measures all models.
45
45
 
46
- ```Growth.model_blacklist``` takes an array of models, ex. [AdminUsers], that you want to prevent the gem from measuring.
46
+ ```Growth.model_blacklist``` takes an array of models, ex. [ 'AdminUsers' ], that you want to prevent the gem from measuring.
47
47
 
48
48
  ```Growth.username ``` is your username for http_basic_auth
49
49
 
@@ -6,7 +6,7 @@ require_dependency "growth/transactions/generate_retention_report"
6
6
  module Growth
7
7
  class StatsController < ApplicationController
8
8
  def index
9
- resources = Growth.models_to_measure
9
+ resources = Growth.models_to_measure.map(&:constantize)
10
10
 
11
11
  render :index, locals: {year: get_year, resources: resources}
12
12
  end
@@ -1,3 +1,5 @@
1
+ require "groupdate"
2
+
1
3
  module Growth
2
4
  module ApplicationHelper
3
5
  def get_grouped_options(resources)
@@ -1,13 +1,13 @@
1
1
  Growth.setup do |config|
2
2
  # Default: Measures all models.
3
- # models_to_measure takes an array of Rails models, for example:
3
+ # models_to_measure takes an array of Rails models as strings, for example:
4
4
  #
5
- # Growth.models_to_measure = [ User, Product, Order, Payment ]
5
+ # Growth.models_to_measure = [ 'User', 'Product', 'Order', 'Payment' ]
6
6
 
7
7
  # Default: Prevent specific models from being measured
8
8
  # model_blacklist takes an array of Rails models, for example:
9
9
  #
10
- # Growth.model_blacklist = [ AdminUser ]
10
+ # Growth.model_blacklist = [ 'AdminUser' ]
11
11
 
12
12
  # This is your username for securing the '/growth' route
13
13
  # You will be prompted to enter this when viewing the page
data/lib/growth.rb CHANGED
@@ -3,11 +3,10 @@ require "growth/engine"
3
3
  module Growth
4
4
  mattr_accessor :username
5
5
  mattr_accessor :password
6
-
7
6
  mattr_accessor :model_blacklist
8
- @@model_blacklist = []
7
+ mattr_writer :models_to_measure
9
8
 
10
- mattr_writer :models_to_measure
9
+ @@model_blacklist = []
11
10
 
12
11
  def self.models_to_measure
13
12
  @@models_to_measure ||= ::ActiveRecord::Base.descendants.map(&:name) - ::ActiveRecord::Base.send(:subclasses).map(&:name)
@@ -1,3 +1,3 @@
1
1
  module Growth
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: growth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Friedman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-10-30 00:00:00.000000000 Z
12
+ date: 2019-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails