disco_app 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/disco_app/components/custom/rules-editor.es6.jsx +77 -20
- data/app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-empty-state.es6.jsx +3 -3
- data/app/assets/javascripts/disco_app/disco_app.js +0 -1
- data/app/assets/stylesheets/disco_app/admin/_header.scss +16 -7
- data/app/assets/stylesheets/disco_app/admin/_layout.scss +1 -9
- data/app/assets/stylesheets/disco_app/admin/_nav.scss +15 -3
- data/app/assets/stylesheets/disco_app/disco_app.scss +3 -0
- data/app/assets/stylesheets/disco_app/frame/_buttons.scss +1 -1
- data/app/assets/stylesheets/disco_app/frame/_forms.scss +1 -1
- data/app/assets/stylesheets/disco_app/frame/_type.scss +2 -9
- data/app/assets/stylesheets/disco_app/frame.scss +1 -0
- data/app/assets/stylesheets/disco_app/ui-kit/_ui-empty-state.scss +27 -0
- data/app/assets/stylesheets/disco_app/ui-kit/_ui-footer-help.scss +13 -10
- data/app/assets/stylesheets/disco_app/ui-kit/_ui-kit.scss +94 -67
- data/app/assets/stylesheets/disco_app/ui-kit/_ui-tabs.scss +15 -3
- data/app/jobs/disco_app/concerns/shop_update_job.rb +2 -5
- data/app/models/disco_app/concerns/shop.rb +0 -13
- data/app/resources/disco_app/admin/resources/concerns/shop_resource.rb +18 -2
- data/db/migrate/20160521135510_move_shop_to_synchronises.rb +61 -0
- data/lib/disco_app/engine.rb +0 -1
- data/lib/disco_app/version.rb +1 -1
- data/lib/generators/disco_app/disco_app_generator.rb +42 -3
- data/lib/generators/disco_app/{monitorify/templates → templates}/config/newrelic.yml +0 -0
- data/lib/generators/disco_app/{monitorify/templates → templates}/initializers/rollbar.rb +0 -0
- data/lib/generators/disco_app/templates/root/CHECKS +4 -0
- data/lib/tasks/shops.rake +10 -0
- data/test/dummy/app/jobs/disco_app/app_uninstalled_job.rb +1 -1
- data/test/dummy/app/models/disco_app/shop.rb +1 -1
- data/test/dummy/config/database.gitlab-ci.yml +24 -0
- data/test/dummy/db/schema.rb +7 -22
- data/test/fixtures/disco_app/shops.yml +2 -2
- data/test/jobs/disco_app/app_installed_job_test.rb +1 -1
- data/test/jobs/disco_app/app_uninstalled_job_test.rb +1 -1
- metadata +8 -5
- data/lib/generators/disco_app/mailify/mailify_generator.rb +0 -54
- data/lib/generators/disco_app/monitorify/monitorify_generator.rb +0 -28
@@ -394,31 +394,28 @@ hr.helper--divider {
|
|
394
394
|
margin: 20px 0;
|
395
395
|
}
|
396
396
|
|
397
|
-
@font-face {
|
398
|
-
font-family: 'Golos-Bold';
|
399
|
-
src: url(/golos-bold.eot);
|
400
|
-
}
|
401
|
-
|
402
|
-
@font-face {
|
403
|
-
font-family: 'Golos-Bold';
|
404
|
-
src: url(/golos-bold.woff) format("woff"), url(/golos-bold.ttf) format("truetype");
|
405
|
-
font-weight: normal;
|
406
|
-
font-style: normal;
|
407
|
-
}
|
408
|
-
|
409
397
|
html {
|
410
|
-
font-size:
|
398
|
+
font-size: 87.5%;
|
411
399
|
-webkit-text-size-adjust: 100%;
|
412
400
|
-ms-text-size-adjust: 100%;
|
413
401
|
text-size-adjust: 100%;
|
402
|
+
text-rendering: optimizeLegibility;
|
414
403
|
}
|
415
404
|
|
416
405
|
body {
|
417
|
-
|
418
|
-
font-size:
|
419
|
-
|
420
|
-
font-
|
421
|
-
text-
|
406
|
+
color: rgba(0,0,0,0.9);
|
407
|
+
font-size: 1.07143rem;
|
408
|
+
line-height: 1.42857rem;
|
409
|
+
font-weight: 400;
|
410
|
+
text-transform: initial;
|
411
|
+
letter-spacing: initial;
|
412
|
+
-webkit-font-smoothing: antialiased;
|
413
|
+
-moz-osx-font-smoothing: grayscale;
|
414
|
+
font-family: $font-family;
|
415
|
+
|
416
|
+
@media screen and (min-width: 640px) {
|
417
|
+
font-size: 1rem;
|
418
|
+
}
|
422
419
|
}
|
423
420
|
|
424
421
|
strong {
|
@@ -533,7 +530,7 @@ code {
|
|
533
530
|
input {
|
534
531
|
font-size: 13px;
|
535
532
|
line-height: 18px;
|
536
|
-
font-family:
|
533
|
+
font-family: $font-family;
|
537
534
|
}
|
538
535
|
|
539
536
|
del {
|
@@ -1327,6 +1324,37 @@ a.type--subdued:hover {
|
|
1327
1324
|
padding-left: 20px;
|
1328
1325
|
}
|
1329
1326
|
|
1327
|
+
.btn {
|
1328
|
+
color: rgba(0,0,0,0.9);
|
1329
|
+
font-size: 1.14286rem;
|
1330
|
+
line-height: 1.71429rem;
|
1331
|
+
font-weight: 400;
|
1332
|
+
text-transform: initial;
|
1333
|
+
letter-spacing: initial;
|
1334
|
+
-webkit-font-smoothing: antialiased;
|
1335
|
+
-moz-osx-font-smoothing: grayscale;
|
1336
|
+
line-height: 1.14286rem;
|
1337
|
+
box-sizing: border-box;
|
1338
|
+
cursor: pointer;
|
1339
|
+
display: inline-block;
|
1340
|
+
padding: 9px 15px;
|
1341
|
+
margin: 0;
|
1342
|
+
border-radius: 3px;
|
1343
|
+
height: auto;
|
1344
|
+
white-space: nowrap;
|
1345
|
+
text-transform: none;
|
1346
|
+
font-family: inherit;
|
1347
|
+
font-weight: normal;
|
1348
|
+
position: relative;
|
1349
|
+
vertical-align: middle;
|
1350
|
+
-webkit-user-select: none;
|
1351
|
+
-moz-user-select: none;
|
1352
|
+
-ms-user-select: none;
|
1353
|
+
user-select: none;
|
1354
|
+
-webkit-appearance: none;
|
1355
|
+
-webkit-tap-highlight-color: transparent;
|
1356
|
+
}
|
1357
|
+
|
1330
1358
|
.btn-default, .btn {
|
1331
1359
|
background-color: #ffffff;
|
1332
1360
|
color: #479ccf;
|
@@ -1507,30 +1535,6 @@ a.type--subdued:hover {
|
|
1507
1535
|
background: rgba(49, 55, 61, 0.1);
|
1508
1536
|
}
|
1509
1537
|
|
1510
|
-
.btn {
|
1511
|
-
box-sizing: border-box;
|
1512
|
-
cursor: pointer;
|
1513
|
-
display: inline-block;
|
1514
|
-
padding: 8.5px 15px;
|
1515
|
-
margin: 0;
|
1516
|
-
border-radius: 3px;
|
1517
|
-
font-size: 13px;
|
1518
|
-
line-height: 1;
|
1519
|
-
height: auto;
|
1520
|
-
white-space: nowrap;
|
1521
|
-
text-transform: none;
|
1522
|
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
1523
|
-
font-weight: normal;
|
1524
|
-
position: relative;
|
1525
|
-
vertical-align: middle;
|
1526
|
-
-webkit-user-select: none;
|
1527
|
-
-moz-user-select: none;
|
1528
|
-
-ms-user-select: none;
|
1529
|
-
user-select: none;
|
1530
|
-
-webkit-appearance: none;
|
1531
|
-
-webkit-tap-highlight-color: transparent;
|
1532
|
-
}
|
1533
|
-
|
1534
1538
|
.btn.has-loading::before {
|
1535
1539
|
background-position: 50% 50% !important;
|
1536
1540
|
background-repeat: no-repeat !important;
|
@@ -1636,7 +1640,7 @@ input[type="submit"].btn-disabled.btn--outline,
|
|
1636
1640
|
z-index: 226;
|
1637
1641
|
border-radius: 0;
|
1638
1642
|
left: 0;
|
1639
|
-
min-width:
|
1643
|
+
min-width: 240px;
|
1640
1644
|
padding: 20px 0 !important;
|
1641
1645
|
text-align: center;
|
1642
1646
|
top: 0;
|
@@ -2545,8 +2549,8 @@ input, textarea {
|
|
2545
2549
|
max-width: 100%;
|
2546
2550
|
vertical-align: top;
|
2547
2551
|
height: 28px;
|
2548
|
-
font-family:
|
2549
|
-
font-size:
|
2552
|
+
font-family: $font-family;
|
2553
|
+
font-size: 14px;
|
2550
2554
|
padding: 4px;
|
2551
2555
|
margin: 0;
|
2552
2556
|
border: 1px solid #d3dbe2;
|
@@ -2739,8 +2743,8 @@ textarea.is-expanded {
|
|
2739
2743
|
|
2740
2744
|
select {
|
2741
2745
|
margin: 0;
|
2742
|
-
font-family:
|
2743
|
-
font-size:
|
2746
|
+
font-family: $font-family;
|
2747
|
+
font-size: 14px;
|
2744
2748
|
display: inline-block;
|
2745
2749
|
color: #222;
|
2746
2750
|
vertical-align: top;
|
@@ -3138,7 +3142,7 @@ input.attached-to-both {
|
|
3138
3142
|
padding: 0;
|
3139
3143
|
}
|
3140
3144
|
|
3141
|
-
.next-input, .next-input--stylized, .next-input--invisible {
|
3145
|
+
.next-input, .sp-input, .next-input--stylized, .next-input--invisible {
|
3142
3146
|
display: inline-block;
|
3143
3147
|
max-width: auto;
|
3144
3148
|
min-width: 75px;
|
@@ -3205,16 +3209,21 @@ input[type=button].next-input--button {
|
|
3205
3209
|
-moz-appearance: none;
|
3206
3210
|
}
|
3207
3211
|
|
3208
|
-
.next-input, .next-input--stylized, .next-textarea {
|
3212
|
+
.next-input, .sp-input, .next-input--stylized, .next-textarea, .next-token-list--is-input {
|
3209
3213
|
padding: 5px 10px;
|
3210
3214
|
border: 1px solid #d3dbe2;
|
3211
3215
|
border-radius: 3px;
|
3212
|
-
|
3213
|
-
|
3216
|
+
color: rgba(0,0,0,0.9);
|
3217
|
+
font-size: 1.14286rem;
|
3218
|
+
line-height: 1.71429rem;
|
3219
|
+
font-weight: 400;
|
3220
|
+
text-transform: initial;
|
3221
|
+
letter-spacing: initial;
|
3222
|
+
-webkit-font-smoothing: antialiased;
|
3223
|
+
-moz-osx-font-smoothing: grayscale;
|
3214
3224
|
box-sizing: border-box;
|
3215
3225
|
display: block;
|
3216
3226
|
width: 100%;
|
3217
|
-
line-height: 20px;
|
3218
3227
|
}
|
3219
3228
|
|
3220
3229
|
.next-input::-webkit-input-placeholder, .next-input--stylized::-webkit-input-placeholder, .next-textarea::-webkit-input-placeholder {
|
@@ -3244,10 +3253,19 @@ input[type=button].next-input--button {
|
|
3244
3253
|
.next-label {
|
3245
3254
|
display: block;
|
3246
3255
|
margin-bottom: 5px;
|
3247
|
-
color:
|
3248
|
-
font-size:
|
3249
|
-
|
3256
|
+
color: rgba(0,0,0,0.9);
|
3257
|
+
font-size: 1.07143rem;
|
3258
|
+
line-height: 1.42857rem;
|
3259
|
+
font-weight: 400;
|
3260
|
+
text-transform: initial;
|
3261
|
+
letter-spacing: initial;
|
3262
|
+
-webkit-font-smoothing: antialiased;
|
3263
|
+
-moz-osx-font-smoothing: grayscale;
|
3250
3264
|
cursor: pointer;
|
3265
|
+
|
3266
|
+
@media screen and (min-width: 640px) {
|
3267
|
+
font-size: 1rem;
|
3268
|
+
}
|
3251
3269
|
}
|
3252
3270
|
|
3253
3271
|
.next-label--inline {
|
@@ -3487,7 +3505,7 @@ input[type=checkbox].next-checkbox, .next-radio--styled, .next-checkbox--styled
|
|
3487
3505
|
display: block;
|
3488
3506
|
position: absolute;
|
3489
3507
|
left: 0;
|
3490
|
-
top: 0;
|
3508
|
+
top: 0.15em;
|
3491
3509
|
height: 16px;
|
3492
3510
|
width: 16px;
|
3493
3511
|
border: 1px solid #d3dbe2;
|
@@ -3646,17 +3664,22 @@ input[type=checkbox].next-checkbox {
|
|
3646
3664
|
-webkit-appearance: none;
|
3647
3665
|
-moz-appearance: none;
|
3648
3666
|
width: 100%;
|
3649
|
-
|
3667
|
+
color: rgba(0,0,0,0.9);
|
3668
|
+
font-size: 1.14286rem;
|
3669
|
+
line-height: 1.71429rem;
|
3670
|
+
font-weight: 400;
|
3671
|
+
text-transform: initial;
|
3672
|
+
letter-spacing: initial;
|
3673
|
+
-webkit-font-smoothing: antialiased;
|
3674
|
+
-moz-osx-font-smoothing: grayscale;
|
3650
3675
|
background: transparent;
|
3651
3676
|
padding: 5px 10px;
|
3652
3677
|
padding-right: 32px;
|
3653
|
-
border:
|
3678
|
+
border: 0;
|
3654
3679
|
box-sizing: border-box;
|
3655
3680
|
height: auto;
|
3656
|
-
line-height: 20px;
|
3657
3681
|
max-width: none;
|
3658
3682
|
display: block;
|
3659
|
-
color: #31373d;
|
3660
3683
|
}
|
3661
3684
|
|
3662
3685
|
.next-select:focus {
|
@@ -3772,11 +3795,15 @@ input[type=checkbox].next-checkbox {
|
|
3772
3795
|
}
|
3773
3796
|
|
3774
3797
|
.next-heading {
|
3775
|
-
color:
|
3776
|
-
|
3777
|
-
|
3778
|
-
font-
|
3779
|
-
|
3798
|
+
color: rgba(0,0,0,0.9);
|
3799
|
+
font-size: 1.21429rem;
|
3800
|
+
line-height: 1.71429rem;
|
3801
|
+
font-weight: 600;
|
3802
|
+
margin: 0 0 20px;
|
3803
|
+
|
3804
|
+
@media screen and (min-width: 640px) {
|
3805
|
+
font-size: 1.14286rem;
|
3806
|
+
}
|
3780
3807
|
}
|
3781
3808
|
|
3782
3809
|
.next-heading--1 {
|
@@ -5038,11 +5065,11 @@ td a.subdued:hover {
|
|
5038
5065
|
}
|
5039
5066
|
|
5040
5067
|
.ui-annotated-section__annotation {
|
5068
|
+
color: rgba(0,0,0,0.56);
|
5041
5069
|
-webkit-box-flex: 1;
|
5042
5070
|
-webkit-flex: 1 0 240px;
|
5043
5071
|
-ms-flex: 1 0 240px;
|
5044
5072
|
flex: 1 0 240px;
|
5045
|
-
color: #798c9c;
|
5046
5073
|
}
|
5047
5074
|
|
5048
5075
|
.ui-annotated-section__title {
|
@@ -30,19 +30,30 @@
|
|
30
30
|
}
|
31
31
|
|
32
32
|
.next-tab {
|
33
|
+
color: rgba(0,0,0,0.56);
|
33
34
|
padding: 15px 20px;
|
34
35
|
text-decoration: none;
|
35
|
-
color: #798c9c;
|
36
36
|
border-right: 1px solid #ebeef0;
|
37
37
|
border-bottom: 1px solid #ebeef0;
|
38
38
|
text-align: center;
|
39
39
|
line-height: 1;
|
40
40
|
cursor: pointer;
|
41
41
|
position: relative;
|
42
|
-
|
42
|
+
-webkit-box-flex: 1;
|
43
|
+
-webkit-flex-grow: 1;
|
44
|
+
-ms-flex-positive: 1;
|
43
45
|
flex-grow: 1;
|
46
|
+
display: -webkit-box;
|
47
|
+
display: -webkit-flex;
|
48
|
+
display: -ms-flexbox;
|
44
49
|
display: flex;
|
50
|
+
-webkit-box-align: center;
|
51
|
+
-webkit-align-items: center;
|
52
|
+
-ms-flex-align: center;
|
45
53
|
align-items: center;
|
54
|
+
-webkit-box-pack: center;
|
55
|
+
-webkit-justify-content: center;
|
56
|
+
-ms-flex-pack: center;
|
46
57
|
justify-content: center;
|
47
58
|
|
48
59
|
&:focus,
|
@@ -54,8 +65,9 @@
|
|
54
65
|
}
|
55
66
|
|
56
67
|
&.next-tab--is-active {
|
68
|
+
font-weight: normal;
|
69
|
+
color: rgba(0,0,0,0.9);
|
57
70
|
background-color: #ffffff;
|
58
|
-
color: #31373d;
|
59
71
|
border-bottom-color: #ffffff;
|
60
72
|
cursor: default;
|
61
73
|
text-decoration: none;
|
@@ -6,11 +6,8 @@ module DiscoApp::Concerns::ShopUpdateJob
|
|
6
6
|
# If we weren't provided with shop data (eg from a webhook), fetch it.
|
7
7
|
shop_data ||= ActiveSupport::JSON::decode(ShopifyAPI::Shop.current.to_json)
|
8
8
|
|
9
|
-
#
|
10
|
-
shop_data
|
11
|
-
|
12
|
-
# Update model attributes present in both our model and the data hash.
|
13
|
-
@shop.update_attributes(shop_data.except(:id, :created_at).slice(*DiscoApp::Shop.column_names))
|
9
|
+
# Update attributes stored directly on the Shop model, along with the data hash itself.
|
10
|
+
@shop.update(shop_data.with_indifferent_access.slice(*DiscoApp::Shop.column_names).except(:id, :created_at).merge(data: shop_data))
|
14
11
|
end
|
15
12
|
|
16
13
|
end
|
@@ -23,19 +23,6 @@ module DiscoApp::Concerns::Shop
|
|
23
23
|
# Alias 'with_shopify_session' as 'temp', as per our existing conventions.
|
24
24
|
alias_method :temp, :with_shopify_session
|
25
25
|
|
26
|
-
# Return a hash of attributes that should be used to create a new charge for this shop.
|
27
|
-
# This method can be overridden by the inheriting Shop class in order to provide charges
|
28
|
-
# customised to a particular shop. Otherwise, the default settings configured in application.rb
|
29
|
-
# will be used.
|
30
|
-
def new_charge_attributes
|
31
|
-
{
|
32
|
-
type: Rails.configuration.x.shopify_charges_default_type,
|
33
|
-
name: DiscoApp.configuration.app_name,
|
34
|
-
price: Rails.configuration.x.shopify_charges_default_price,
|
35
|
-
trial_days: Rails.configuration.x.shopify_charges_default_trial_days,
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
26
|
# Convenience method to check if this shop has a current subscription.
|
40
27
|
def current_subscription?
|
41
28
|
current_subscription.present?
|
@@ -5,8 +5,8 @@ module DiscoApp::Admin::Resources::Concerns::ShopResource
|
|
5
5
|
|
6
6
|
included do
|
7
7
|
|
8
|
-
attributes :domain, :status, :
|
9
|
-
attributes :
|
8
|
+
attributes :domain, :status, :created_at
|
9
|
+
attributes :email, :country_name, :currency, :plan_display_name
|
10
10
|
attributes :current_subscription_id, :current_subscription_display_amount, :current_subscription_display_plan, :current_subscription_display_plan_code, :current_subscription_source
|
11
11
|
attributes :installed_duration
|
12
12
|
|
@@ -45,6 +45,22 @@ module DiscoApp::Admin::Resources::Concerns::ShopResource
|
|
45
45
|
[]
|
46
46
|
end
|
47
47
|
|
48
|
+
def email
|
49
|
+
@model.data['email']
|
50
|
+
end
|
51
|
+
|
52
|
+
def country_name
|
53
|
+
@model.data['country_name']
|
54
|
+
end
|
55
|
+
|
56
|
+
def currency
|
57
|
+
@model.data['currency']
|
58
|
+
end
|
59
|
+
|
60
|
+
def plan_display_name
|
61
|
+
@model.data['plan_display_name']
|
62
|
+
end
|
63
|
+
|
48
64
|
def current_subscription_id
|
49
65
|
if @model.current_subscription?
|
50
66
|
@model.current_subscription.id
|
@@ -0,0 +1,61 @@
|
|
1
|
+
class MoveShopToSynchronises < ActiveRecord::Migration
|
2
|
+
|
3
|
+
class DiscoApp::Shop < ActiveRecord::Base
|
4
|
+
end
|
5
|
+
|
6
|
+
ATTRIBUTES_TO_MIGRATE = [
|
7
|
+
:email, :country_name, :currency, :money_format,
|
8
|
+
:money_with_currency_format, :plan_display_name,
|
9
|
+
:latitude, :longitude, :customer_email, :password_enabled, :phone,
|
10
|
+
:primary_locale, :ships_to_countries, :timezone, :iana_timezone,
|
11
|
+
:has_storefront
|
12
|
+
]
|
13
|
+
|
14
|
+
def up
|
15
|
+
add_column :disco_app_shops, :data, :jsonb, default: {}
|
16
|
+
|
17
|
+
DiscoApp::Shop.find_each do |shop|
|
18
|
+
data = shop.data
|
19
|
+
ATTRIBUTES_TO_MIGRATE.each do |attribute|
|
20
|
+
data[attribute.to_s] = shop.send(attribute)
|
21
|
+
end
|
22
|
+
shop.update(data: data)
|
23
|
+
end
|
24
|
+
|
25
|
+
ATTRIBUTES_TO_MIGRATE.each do |attribute|
|
26
|
+
remove_column :disco_app_shops, attribute
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def down
|
31
|
+
ATTRIBUTES_TO_MIGRATE.each do |attribute|
|
32
|
+
add_column :disco_app_shops, attribute, attribute_column_type(attribute)
|
33
|
+
end
|
34
|
+
|
35
|
+
DiscoApp::Shop.find_each do |shop|
|
36
|
+
shop.update(Hash[ATTRIBUTES_TO_MIGRATE.map do |attribute|
|
37
|
+
[attribute, shop.data[attribute.to_s]]
|
38
|
+
end])
|
39
|
+
end
|
40
|
+
|
41
|
+
remove_column :disco_app_shops, :data
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def attribute_column_type(attribute)
|
47
|
+
case attribute
|
48
|
+
when :password_enabled
|
49
|
+
:boolean
|
50
|
+
when :has_storefront
|
51
|
+
:boolean
|
52
|
+
when :latitude
|
53
|
+
:decimal
|
54
|
+
when :longitude
|
55
|
+
:decimal
|
56
|
+
else
|
57
|
+
:string
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/lib/disco_app/engine.rb
CHANGED
data/lib/disco_app/version.rb
CHANGED
@@ -9,7 +9,7 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
9
9
|
# - Default simple Procfile for Heroku.
|
10
10
|
#
|
11
11
|
def copy_root_files
|
12
|
-
%w(.env .env.local .gitignore Procfile).each do |file|
|
12
|
+
%w(.env .env.local .gitignore Procfile CHECKS).each do |file|
|
13
13
|
copy_file "root/#{file}", file
|
14
14
|
end
|
15
15
|
end
|
@@ -30,7 +30,6 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
30
30
|
gem 'shopify_app', '~> 6.4.1'
|
31
31
|
gem 'sidekiq', '~> 4.0.2'
|
32
32
|
gem 'puma', '~> 2.14.0'
|
33
|
-
gem 'bootstrap-sass', '~> 3.3.5.1'
|
34
33
|
gem 'activerecord-session_store', '~> 0.1.2'
|
35
34
|
gem 'activeresource', github: 'shopify/activeresource', tag: '4.2-threadsafe'
|
36
35
|
gem 'rails-bigint-pk', '~> 1.2.0'
|
@@ -39,6 +38,10 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
39
38
|
gem 'react-rails', '~> 1.6.0'
|
40
39
|
gem 'classnames-rails', '~> 2.1.5'
|
41
40
|
gem 'active_link_to', '~> 1.0.2'
|
41
|
+
# Add premailer gem to Gemfile.
|
42
|
+
gem 'premailer-rails', '~> 1.8.2'
|
43
|
+
# Add explicit dependency on Nokogiri
|
44
|
+
gem 'nokogiri', '~> 1.6.7.2'
|
42
45
|
|
43
46
|
# Add gems for development and testing only.
|
44
47
|
gem_group :development, :test do
|
@@ -51,7 +54,13 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
51
54
|
# Add gems for production only.
|
52
55
|
gem_group :production do
|
53
56
|
gem 'rails_12factor', '~> 0.0.3'
|
57
|
+
gem 'mailgun_rails', '~> 0.7.0'
|
54
58
|
end
|
59
|
+
|
60
|
+
# Add monitoring gems to Gemfile
|
61
|
+
gem 'rollbar', '~> 2.8.0'
|
62
|
+
gem 'oj', '~> 2.14.5'
|
63
|
+
gem 'newrelic_rpm', '~> 3.15.2.317'
|
55
64
|
end
|
56
65
|
|
57
66
|
# copy template for pg configuration
|
@@ -113,6 +122,36 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
113
122
|
|
114
123
|
# Copy over the default puma configuration.
|
115
124
|
copy_file 'config/puma.rb', 'config/puma.rb'
|
125
|
+
|
126
|
+
# Mail configuration
|
127
|
+
configuration = <<-CONFIG.strip_heredoc
|
128
|
+
|
129
|
+
# Configure ActionMailer to use MailGun
|
130
|
+
if ENV['MAILGUN_API_KEY']
|
131
|
+
config.action_mailer.delivery_method = :mailgun
|
132
|
+
config.action_mailer.mailgun_settings = {
|
133
|
+
api_key: ENV['MAILGUN_API_KEY'],
|
134
|
+
domain: ENV['MAILGUN_API_DOMAIN']
|
135
|
+
}
|
136
|
+
end
|
137
|
+
CONFIG
|
138
|
+
application configuration, env: :production
|
139
|
+
|
140
|
+
# Monitoring configuration
|
141
|
+
copy_file 'initializers/rollbar.rb', 'config/initializers/rollbar.rb'
|
142
|
+
copy_file 'config/newrelic.yml', 'config/newrelic.yml'
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
# Add entries to .env and .env.local
|
147
|
+
def add_env_variables
|
148
|
+
configuration = <<-CONFIG.strip_heredoc
|
149
|
+
|
150
|
+
MAILGUN_API_KEY=
|
151
|
+
MAILGUN_API_DOMAIN=
|
152
|
+
CONFIG
|
153
|
+
append_to_file '.env', configuration
|
154
|
+
append_to_file '.env.local', configuration
|
116
155
|
end
|
117
156
|
|
118
157
|
# Set up routes.
|
@@ -182,7 +221,7 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
182
221
|
# This should be the last operation, to allow all other operations to run in the initial Ruby version.
|
183
222
|
def set_ruby_version
|
184
223
|
copy_file 'root/.ruby-version', '.ruby-version'
|
185
|
-
prepend_to_file 'Gemfile', "ruby '2.3.
|
224
|
+
prepend_to_file 'Gemfile', "ruby '2.3.1'\n"
|
186
225
|
end
|
187
226
|
|
188
227
|
private
|
File without changes
|
File without changes
|
@@ -5,7 +5,7 @@ class DiscoApp::AppUninstalledJob < DiscoApp::ShopJob
|
|
5
5
|
# 'Nowhere' on uninstallation.
|
6
6
|
def perform(domain, shop_data)
|
7
7
|
super(domain, shop_data)
|
8
|
-
@shop.update(country_name: 'Nowhere')
|
8
|
+
@shop.update(data: @shop.data.merge(country_name: 'Nowhere'))
|
9
9
|
end
|
10
10
|
|
11
11
|
end
|
@@ -6,7 +6,7 @@ class DiscoApp::Shop < ActiveRecord::Base
|
|
6
6
|
# Extend the Shop model to return the Shop's country as an ActiveUtils country.
|
7
7
|
def country
|
8
8
|
begin
|
9
|
-
ActiveUtils::Country.find(country_name)
|
9
|
+
ActiveUtils::Country.find(data['country_name'])
|
10
10
|
rescue ActiveUtils::InvalidCountryCodeError
|
11
11
|
nil
|
12
12
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
development:
|
2
|
+
adapter: postgresql
|
3
|
+
host: postgres
|
4
|
+
encoding: unicode
|
5
|
+
pool: 10
|
6
|
+
username: disco_pguser
|
7
|
+
template: template1
|
8
|
+
password: disco_pgpassword
|
9
|
+
database: disco_app
|
10
|
+
port: 5432
|
11
|
+
sslmode: disable
|
12
|
+
|
13
|
+
test:
|
14
|
+
adapter: postgresql
|
15
|
+
host: postgres
|
16
|
+
encoding: unicode
|
17
|
+
pool: 10
|
18
|
+
username: disco_pguser
|
19
|
+
template: template1
|
20
|
+
password: disco_pgpassword
|
21
|
+
database: disco_app
|
22
|
+
port: 5432
|
23
|
+
sslmode: disable
|
24
|
+
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20160521135510) do
|
15
15
|
|
16
16
|
# These are extensions that must be enabled in order to support this database
|
17
17
|
enable_extension "plpgsql"
|
@@ -76,30 +76,15 @@ ActiveRecord::Schema.define(version: 20160513140727) do
|
|
76
76
|
add_index "disco_app_sessions", ["updated_at"], name: "index_disco_app_sessions_on_updated_at", using: :btree
|
77
77
|
|
78
78
|
create_table "disco_app_shops", force: :cascade do |t|
|
79
|
-
t.string "shopify_domain",
|
80
|
-
t.string "shopify_token",
|
81
|
-
t.datetime "created_at",
|
82
|
-
t.datetime "updated_at",
|
83
|
-
t.integer "status",
|
84
|
-
t.string "email"
|
85
|
-
t.string "country_name"
|
86
|
-
t.string "currency"
|
87
|
-
t.string "money_format"
|
88
|
-
t.string "money_with_currency_format"
|
79
|
+
t.string "shopify_domain", null: false
|
80
|
+
t.string "shopify_token", null: false
|
81
|
+
t.datetime "created_at", null: false
|
82
|
+
t.datetime "updated_at", null: false
|
83
|
+
t.integer "status", default: 0
|
89
84
|
t.string "domain"
|
90
85
|
t.string "plan_name"
|
91
|
-
t.string "plan_display_name"
|
92
|
-
t.decimal "latitude"
|
93
|
-
t.decimal "longitude"
|
94
|
-
t.string "customer_email"
|
95
|
-
t.boolean "password_enabled"
|
96
|
-
t.string "phone"
|
97
|
-
t.string "primary_locale"
|
98
|
-
t.string "ships_to_countries"
|
99
|
-
t.string "timezone"
|
100
|
-
t.string "iana_timezone"
|
101
|
-
t.boolean "has_storefront"
|
102
86
|
t.string "name"
|
87
|
+
t.jsonb "data", default: {}
|
103
88
|
end
|
104
89
|
|
105
90
|
add_index "disco_app_shops", ["shopify_domain"], name: "index_disco_app_shops_on_shopify_domain", unique: true, using: :btree
|
@@ -1,10 +1,10 @@
|
|
1
1
|
widget_store:
|
2
2
|
shopify_domain: widgets.myshopify.com
|
3
3
|
shopify_token: 00000000000000000000000000000000
|
4
|
-
country_name: Australia
|
4
|
+
data: '{ "country_name": "Australia" }'
|
5
5
|
|
6
6
|
widget_store_dev:
|
7
7
|
shopify_domain: widgets-dev.myshopify.com
|
8
8
|
shopify_token: 00000000000000000000000000000000
|
9
9
|
status: 3
|
10
|
-
country_name: Australia
|
10
|
+
data: '{ "country_name": "Australia" }'
|