workarea-google_analytics 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +20 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +217 -0
- data/CODE_OF_CONDUCT.md +3 -0
- data/CONTRIBUTING.md +3 -0
- data/Gemfile +6 -0
- data/LICENSE +52 -0
- data/README.md +589 -0
- data/Rakefile +31 -0
- data/app/assets/javascripts/workarea/storefront/google_analytics/modules/adapter.js +314 -0
- data/app/views/workarea/storefront/analytics/_google_analytics.html.haml +6 -0
- data/bin/rails +18 -0
- data/config/initializers/appends.rb +9 -0
- data/config/initializers/configuration.rb +1 -0
- data/config/routes.rb +2 -0
- data/lib/tasks/google_analytics_tasks.rake +4 -0
- data/lib/workarea/google_analytics/engine.rb +8 -0
- data/lib/workarea/google_analytics/version.rb +5 -0
- data/lib/workarea/google_analytics.rb +10 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.keep +0 -0
- data/test/dummy/app/models/.keep +0 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +34 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/config/application.rb +21 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +57 -0
- data/test/dummy/config/environments/production.rb +86 -0
- data/test/dummy/config/environments/test.rb +43 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/new_framework_defaults.rb +17 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/workarea.rb +7 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/seeds.rb +10 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +1 -0
- data/test/test_helper.rb +10 -0
- data/workarea-google_analytics.gemspec +21 -0
- metadata +132 -0
@@ -0,0 +1,314 @@
|
|
1
|
+
/* eslint no-console: "off" */
|
2
|
+
/* global console, ga */
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @namespace WORKAREA.googleAnalytics
|
6
|
+
*/
|
7
|
+
WORKAREA.analytics.registerAdapter('googleAnalytics', function () {
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
var propertyId = $('meta[property="ga-tracking-id"]').attr('content'),
|
11
|
+
send = function () {
|
12
|
+
if (WORKAREA.analytics.debug) {
|
13
|
+
console.log(arguments);
|
14
|
+
}
|
15
|
+
|
16
|
+
if (!WORKAREA.environment.isTest) {
|
17
|
+
ga.apply(ga, arguments);
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
send('create', propertyId, 'auto');
|
22
|
+
send('require', 'ec');
|
23
|
+
|
24
|
+
return {
|
25
|
+
'pageView': function() {
|
26
|
+
send('send', 'pageview');
|
27
|
+
},
|
28
|
+
|
29
|
+
'categoryView': function (payload) {
|
30
|
+
send('send', 'event', 'category', 'view', payload.name, {
|
31
|
+
'nonInteraction': true
|
32
|
+
});
|
33
|
+
send('send', 'event', 'category', 'view', payload.sort, {
|
34
|
+
'nonInteraction': true
|
35
|
+
});
|
36
|
+
send('send', 'event', 'category', 'view', 'page:' + payload.page, {
|
37
|
+
'nonInteraction': true
|
38
|
+
});
|
39
|
+
_.forEach(payload.filters, function (values, name) {
|
40
|
+
_.forEach(values, function (value) {
|
41
|
+
send('send', 'event', 'category', 'view', name + ':' + value, {
|
42
|
+
'nonInteraction': true
|
43
|
+
});
|
44
|
+
});
|
45
|
+
});
|
46
|
+
},
|
47
|
+
|
48
|
+
'searchResultsView': function (payload) {
|
49
|
+
send('send', 'event', 'search results', 'view', payload.terms, {
|
50
|
+
'nonInteraction': true
|
51
|
+
});
|
52
|
+
send('send', 'event', 'search results', 'view', payload.sort, {
|
53
|
+
'nonInteraction': true
|
54
|
+
});
|
55
|
+
send('send', 'event', 'search results', 'view', 'page:' + payload.page, {
|
56
|
+
'nonInteraction': true
|
57
|
+
});
|
58
|
+
_.forEach(payload.filters, function (values, name) {
|
59
|
+
_.forEach(values, function (value) {
|
60
|
+
send('send', 'event', 'search results', 'view', name + ':' + value, {
|
61
|
+
'nonInteraction': true
|
62
|
+
});
|
63
|
+
});
|
64
|
+
});
|
65
|
+
},
|
66
|
+
|
67
|
+
'productList': function (payload) {
|
68
|
+
_.each(payload.impressions, function (impression) {
|
69
|
+
send('ec:addImpression', {
|
70
|
+
'id': impression.id,
|
71
|
+
'name': impression.name,
|
72
|
+
'category': impression.category,
|
73
|
+
'variant': impression.sku,
|
74
|
+
'list': payload.name,
|
75
|
+
'position': impression.position
|
76
|
+
});
|
77
|
+
});
|
78
|
+
},
|
79
|
+
|
80
|
+
'productClick': function (payload) {
|
81
|
+
send('ec:addProduct', {
|
82
|
+
'id': payload.id,
|
83
|
+
'name': payload.name,
|
84
|
+
'category': payload.category,
|
85
|
+
'variant': payload.sku,
|
86
|
+
'position': payload.position
|
87
|
+
});
|
88
|
+
|
89
|
+
send('ec:setAction', 'click', { list: payload.list });
|
90
|
+
send('send', 'event', 'product', 'click', payload.list);
|
91
|
+
},
|
92
|
+
|
93
|
+
'productQuickView': function (payload) {
|
94
|
+
send('ec:addProduct', {
|
95
|
+
'id': payload.id,
|
96
|
+
'name': payload.name,
|
97
|
+
'category': payload.category,
|
98
|
+
'variant': payload.sku
|
99
|
+
});
|
100
|
+
|
101
|
+
send('ec:setAction', 'detail');
|
102
|
+
send('send', 'event', 'product', 'quickview');
|
103
|
+
},
|
104
|
+
|
105
|
+
'productView': function (payload) {
|
106
|
+
send('ec:addProduct', {
|
107
|
+
'id': payload.id,
|
108
|
+
'name': payload.name,
|
109
|
+
'category': payload.category,
|
110
|
+
'variant': payload.sku,
|
111
|
+
'nonInteraction': true
|
112
|
+
});
|
113
|
+
|
114
|
+
send('ec:setAction', 'detail');
|
115
|
+
},
|
116
|
+
|
117
|
+
'addToCart': function (payload) {
|
118
|
+
send('ec:addProduct', {
|
119
|
+
'id': payload.id,
|
120
|
+
'name': payload.name,
|
121
|
+
'category': payload.category,
|
122
|
+
'variant': payload.sku,
|
123
|
+
'price': payload.price,
|
124
|
+
'quantity': payload.quantity
|
125
|
+
});
|
126
|
+
|
127
|
+
send('ec:setAction', 'add');
|
128
|
+
send('send', 'event', 'product', 'click', 'add to cart');
|
129
|
+
},
|
130
|
+
|
131
|
+
'cartView': function (payload) {
|
132
|
+
_.each(payload.items, function (impression) {
|
133
|
+
send('ec:addProduct', {
|
134
|
+
'id': impression.product_id,
|
135
|
+
'name': impression.product_name,
|
136
|
+
'category': impression.category,
|
137
|
+
'variant': impression.sku,
|
138
|
+
'price': impression.price,
|
139
|
+
'quantity': impression.quantity,
|
140
|
+
'nonInteraction': true
|
141
|
+
});
|
142
|
+
});
|
143
|
+
|
144
|
+
send('ec:setAction', 'checkout', { 'step': 1 });
|
145
|
+
},
|
146
|
+
|
147
|
+
'updateCartItem': function () {
|
148
|
+
send('send', 'event', 'product', 'click', 'update cart');
|
149
|
+
},
|
150
|
+
|
151
|
+
'addToCartConfirmation': function() {
|
152
|
+
send('send', 'event', 'Add To Cart', 'confirm', 'item added');
|
153
|
+
},
|
154
|
+
|
155
|
+
'removeFromCart': function (payload) {
|
156
|
+
send('ec:addProduct', {
|
157
|
+
'id': payload.product_id,
|
158
|
+
'name': payload.product_name,
|
159
|
+
'category': payload.category,
|
160
|
+
'variant': payload.sku,
|
161
|
+
'price': payload.price,
|
162
|
+
'quantity': payload.quantity
|
163
|
+
});
|
164
|
+
|
165
|
+
send('ec:setAction', 'remove');
|
166
|
+
send('send', 'event', 'product', 'click', 'remove from cart');
|
167
|
+
},
|
168
|
+
|
169
|
+
'checkoutLogin': function () {
|
170
|
+
send('send', 'event', 'checkout', 'start', 'login');
|
171
|
+
},
|
172
|
+
|
173
|
+
'checkoutGuest': function () {
|
174
|
+
send('send', 'event', 'checkout', 'start', 'guest');
|
175
|
+
},
|
176
|
+
|
177
|
+
'checkoutAddressesView': function (payload) {
|
178
|
+
_.each(payload.items, function (impression) {
|
179
|
+
send('ec:addProduct', {
|
180
|
+
'id': impression.product_id,
|
181
|
+
'name': impression.product_name,
|
182
|
+
'category': impression.category,
|
183
|
+
'variant': impression.sku,
|
184
|
+
'price': impression.price,
|
185
|
+
'quantity': impression.quantity,
|
186
|
+
'nonInteraction': true
|
187
|
+
});
|
188
|
+
});
|
189
|
+
|
190
|
+
send('ec:setAction', 'checkout', { 'step': 2 });
|
191
|
+
},
|
192
|
+
|
193
|
+
'checkoutShippingView': function (payload) {
|
194
|
+
_.each(payload.items, function (impression) {
|
195
|
+
send('ec:addProduct', {
|
196
|
+
'id': impression.product_id,
|
197
|
+
'name': impression.product_name,
|
198
|
+
'category': impression.category,
|
199
|
+
'variant': impression.sku,
|
200
|
+
'price': impression.price,
|
201
|
+
'quantity': impression.quantity,
|
202
|
+
'nonInteraction': true
|
203
|
+
});
|
204
|
+
});
|
205
|
+
|
206
|
+
send('ec:setAction', 'checkout', { 'step': 3 });
|
207
|
+
},
|
208
|
+
|
209
|
+
'checkoutShippingMethodSelected': function (payload) {
|
210
|
+
send('ec:setAction', 'checkout_option', {
|
211
|
+
'step': 3,
|
212
|
+
'option': payload.name
|
213
|
+
});
|
214
|
+
|
215
|
+
send('send', 'event', 'checkout', 'click', 'select shipping method');
|
216
|
+
},
|
217
|
+
|
218
|
+
'checkoutPaymentView': function (payload) {
|
219
|
+
_.each(payload.items, function (impression) {
|
220
|
+
send('ec:addProduct', {
|
221
|
+
'id': impression.product_id,
|
222
|
+
'name': impression.product_name,
|
223
|
+
'category': impression.category,
|
224
|
+
'variant': impression.sku,
|
225
|
+
'price': impression.price,
|
226
|
+
'quantity': impression.quantity,
|
227
|
+
'nonInteraction': true
|
228
|
+
});
|
229
|
+
});
|
230
|
+
|
231
|
+
send('ec:setAction', 'checkout', { 'step': 4 });
|
232
|
+
},
|
233
|
+
|
234
|
+
'checkoutPaymentSelected': function (payload) {
|
235
|
+
send('ec:setAction', 'checkout_option', {
|
236
|
+
'step': 4,
|
237
|
+
'option': payload.type
|
238
|
+
});
|
239
|
+
|
240
|
+
send('send', 'event', 'checkout', 'click', 'select payment');
|
241
|
+
},
|
242
|
+
|
243
|
+
'checkoutOrderPlaced': function (payload) {
|
244
|
+
_.each(payload.items, function (impression) {
|
245
|
+
send('ec:addProduct', {
|
246
|
+
'id': impression.product_id,
|
247
|
+
'name': impression.product_name,
|
248
|
+
'category': impression.category,
|
249
|
+
'variant': impression.sku,
|
250
|
+
'price': impression.price,
|
251
|
+
'quantity': impression.quantity
|
252
|
+
});
|
253
|
+
});
|
254
|
+
|
255
|
+
send('ec:setAction', 'purchase', {
|
256
|
+
'id': payload.id,
|
257
|
+
'affiliation': payload.site_name,
|
258
|
+
'revenue': payload.total_price,
|
259
|
+
'tax': payload.tax_total,
|
260
|
+
'shipping': payload.shipping_total,
|
261
|
+
'coupon': payload.promo_codes.join(',')
|
262
|
+
});
|
263
|
+
},
|
264
|
+
|
265
|
+
'checkoutSignup': function () {
|
266
|
+
send('send', 'event', 'checkout', 'signup');
|
267
|
+
},
|
268
|
+
|
269
|
+
'login': function () {
|
270
|
+
send('send', 'event', 'account', 'login');
|
271
|
+
},
|
272
|
+
|
273
|
+
'logout': function () {
|
274
|
+
send('send', 'event', 'account', 'logout');
|
275
|
+
},
|
276
|
+
|
277
|
+
'forgotPassword': function () {
|
278
|
+
send('send', 'event', 'account', 'forgot password');
|
279
|
+
},
|
280
|
+
|
281
|
+
'signup': function () {
|
282
|
+
send('send', 'event', 'account', 'signup');
|
283
|
+
},
|
284
|
+
|
285
|
+
'share': function (payload) {
|
286
|
+
send('send', 'event', 'share', 'click', payload.type);
|
287
|
+
},
|
288
|
+
|
289
|
+
'emailSignup': function () {
|
290
|
+
send('send', 'event', 'email', 'signup');
|
291
|
+
},
|
292
|
+
|
293
|
+
'primaryNavigationClick': function(payload) {
|
294
|
+
send('send', 'event', 'nav', 'select', payload.name);
|
295
|
+
},
|
296
|
+
|
297
|
+
'checkoutEdit': function(payload) {
|
298
|
+
send('send', 'event', 'Edit Button', 'Click', payload.type);
|
299
|
+
},
|
300
|
+
|
301
|
+
'flashMessage': function(payload) {
|
302
|
+
send('send', 'event', 'Flash Messaging', 'Flash Messaging Triggered', payload.type);
|
303
|
+
},
|
304
|
+
|
305
|
+
'validationError': function(payload) {
|
306
|
+
var location = 'application';
|
307
|
+
|
308
|
+
if (!_.isEmpty(payload.model)) {
|
309
|
+
location = 'checkout - ' + payload.model;
|
310
|
+
}
|
311
|
+
send('send', 'event', 'JavaScript Validaton Error', 'JavaScript Validation Error Triggered', location);
|
312
|
+
}
|
313
|
+
};
|
314
|
+
});
|
@@ -0,0 +1,6 @@
|
|
1
|
+
%meta{ property: 'ga-tracking-id', content: Workarea.config.google_analytics_tracking_id }
|
2
|
+
:javascript
|
3
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
4
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
5
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
6
|
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
data/bin/rails
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
3
|
+
# installed from the root of your application.
|
4
|
+
|
5
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
6
|
+
ENGINE_PATH = File.expand_path('../../lib/workarea/google_analytics', __FILE__)
|
7
|
+
|
8
|
+
# Set up gems listed in the Gemfile.
|
9
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
10
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
11
|
+
|
12
|
+
require 'action_controller/railtie'
|
13
|
+
require 'action_view/railtie'
|
14
|
+
require 'action_mailer/railtie'
|
15
|
+
require 'rails/test_unit/railtie'
|
16
|
+
require 'sprockets/railtie'
|
17
|
+
|
18
|
+
require 'rails/engine/commands'
|
@@ -0,0 +1 @@
|
|
1
|
+
Workarea.config.google_analytics_tracking_id = 'TODO'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a starting point to setup your application.
|
15
|
+
# Add necessary setup steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
# puts "\n== Copying sample files =="
|
22
|
+
# unless File.exist?('config/database.yml')
|
23
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
24
|
+
# end
|
25
|
+
|
26
|
+
puts "\n== Preparing database =="
|
27
|
+
system! 'bin/rails db:setup'
|
28
|
+
|
29
|
+
puts "\n== Removing old logs and tempfiles =="
|
30
|
+
system! 'bin/rails log:clear tmp:clear'
|
31
|
+
|
32
|
+
puts "\n== Restarting application server =="
|
33
|
+
system! 'bin/rails restart'
|
34
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a way to update your development environment automatically.
|
15
|
+
# Add necessary update steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
puts "\n== Updating database =="
|
22
|
+
system! 'bin/rails db:migrate'
|
23
|
+
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
25
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system! 'bin/rails restart'
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'boot'
|
2
|
+
|
3
|
+
require 'action_controller/railtie'
|
4
|
+
require 'action_mailer/railtie'
|
5
|
+
require 'sprockets/railtie'
|
6
|
+
require 'rails/test_unit/railtie'
|
7
|
+
require 'workarea'
|
8
|
+
|
9
|
+
# Require the gems listed in Gemfile, including any gems
|
10
|
+
# you've limited to :test, :development, or :production.
|
11
|
+
Bundler.require(*Rails.groups)
|
12
|
+
|
13
|
+
module Dummy
|
14
|
+
class Application < Rails::Application
|
15
|
+
# Settings in config/environments/* take precedence over those specified here.
|
16
|
+
# Application configuration should go into files in config/initializers
|
17
|
+
# -- all .rb files in that directory are automatically loaded.
|
18
|
+
|
19
|
+
I18n.enforce_available_locales = false
|
20
|
+
end
|
21
|
+
end
|