jt-rails-toolbox 2.0.0 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd810e9c7430c064cb9abd1596be503f87790889
4
- data.tar.gz: a9c86ad1ec79f41101272716950317673522fe0a
3
+ metadata.gz: 25f6980f68e7d9623965444bee47fdf23769708a
4
+ data.tar.gz: 7990d495a90d5040ba9344efe6634ba61af73e3f
5
5
  SHA512:
6
- metadata.gz: 299d02c266b4253a03670a683d5878d1f85c07a5f43c081eb2560f9ac5bde0461961164e7d803be03b82e45e374d110e249a610e0742b5ed24fdfdef0e0f8446
7
- data.tar.gz: 090817f784b76f394f867fc3ce4f7326c25582f9b71ffce1abae6b0fad0808beb636b27d5653fd600daaedb411e4b6b727bab4179309eecc1007709365de7534
6
+ metadata.gz: 2a17c9a312993d3c716aec4e19dc99e6eb6bf2f19855171346a2ce120e30ab36bf6fd44948e2e9e0789a8a59a307d98155eadf6839c884060f9440508160f144
7
+ data.tar.gz: 8903e09b31dbe63a68b1b62f3e8c6f7a3dd8643f2fad439aee34b0adaa00f25dea79f218675d9862b1b2fb5892e82335bd00ab481a3e1d56cacd2c6e4035b04d
data/README.md CHANGED
@@ -14,7 +14,7 @@ Include the gem in your Gemfile:
14
14
 
15
15
  Create a `jt-toolbox.yml` file:
16
16
 
17
- rails g jt:toolbox
17
+ rails g jt:toolbox
18
18
 
19
19
  A simple configuration of `jt-toolbox.yml` file:
20
20
 
@@ -57,6 +57,7 @@ A simple configuration of `jt-toolbox.yml` file:
57
57
  - [jt-rails-generator-user](https://github.com/jonathantribouharet/jt-rails-generator-user) Generate a scaffold for user authentication
58
58
  - [jt-rails-tokenizable](https://github.com/jonathantribouharet/jt-rails-tokenizable) Generate tokens for ActiveRecord models
59
59
  - simplified configuration of hostnames and `ActionMailer` with a YAML file
60
+ - some helper methods
60
61
 
61
62
  ### Exception Notification
62
63
 
@@ -82,7 +83,9 @@ In addition to the default ignored exceptions, the following exceptions are also
82
83
 
83
84
  Don't forget to install redis server and to launch sidekiq with:
84
85
 
85
- `bundle exec sidekiq -e $RAILS_ENV -q default -q mailers -d -L log/sidekiq.log -P tmp/pids/sidekiq.pid`
86
+ ```
87
+ bundle exec sidekiq -e $RAILS_ENV -q default -q mailers -d -L log/sidekiq.log -P tmp/pids/sidekiq.pid
88
+ ```
86
89
 
87
90
  ### Hostname
88
91
 
@@ -96,6 +99,17 @@ It's a good practice to have a different domains for your web server and your fi
96
99
 
97
100
  ActionMailer can be configured easily just with `jt-toolbox.yml` file.
98
101
 
102
+ ### Helper methods
103
+
104
+ ### google_anaytics_tag
105
+
106
+ It will add automatically in production environment the javascript code for Google Analytics.
107
+ You just have add at the end of your `app/views/layouts/application.html.erb` file:
108
+
109
+ ```
110
+ <%= google_anaytics_tag 'UA-XXXXXXX-X' %>
111
+ ```
112
+
99
113
  ## Author
100
114
 
101
115
  - [Jonathan Tribouharet](https://github.com/jonathantribouharet) ([@johntribouharet](https://twitter.com/johntribouharet))
@@ -0,0 +1,13 @@
1
+ module JtRailsToolboxHelper
2
+
3
+ def google_anaytics_tag(tracking_id)
4
+ if Rails.env.production? && !tracking_id.blank?
5
+ javascript_tag do
6
+ "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
7
+ ga('create', '#{tracking_id}', 'auto');
8
+ ga('send', 'pageview');".html_safe
9
+ end
10
+ end
11
+ end
12
+
13
+ end
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
3
3
  s.summary = "Common libs used for Ruby On Rails development."
4
4
  s.description = "JTRailsToolbox contains a list of common libs used for Ruby On Rails development."
5
5
  s.homepage = 'https://github.com/jonathantribouharet/jt-rails-toolbox'
6
- s.version = '2.0.0'
6
+ s.version = '2.1.0'
7
7
  s.files = `git ls-files`.split("\n")
8
8
  s.require_paths = ['lib']
9
9
  s.authors = ['Jonathan TRIBOUHARET']
@@ -14,7 +14,7 @@ require 'yaml'
14
14
 
15
15
  module JTRailsToolbox
16
16
 
17
- class Railtie < ::Rails::Railtie
17
+ class Engine < ::Rails::Engine
18
18
 
19
19
  initializer "jt-rails-toolbox" do |app|
20
20
  @params = {}
@@ -122,5 +122,5 @@ module JTRailsToolbox
122
122
  end
123
123
 
124
124
  end
125
-
125
+
126
126
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jt-rails-toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan TRIBOUHARET
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-01 00:00:00.000000000 Z
11
+ date: 2016-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -175,6 +175,7 @@ files:
175
175
  - Gemfile
176
176
  - LICENSE
177
177
  - README.md
178
+ - app/helpers/jt_rails_toolbox_helper.rb
178
179
  - jt-rails-toolbox.gemspec
179
180
  - lib/generators/jt/toolbox/USAGE
180
181
  - lib/generators/jt/toolbox/templates/jt-toolbox.yml