dugway 0.12.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/dugway.gemspec +3 -3
- data/lib/dugway/cart.rb +3 -3
- data/lib/dugway/cli/templates/source/contact.html +1 -6
- data/lib/dugway/contact_form_validator.rb +1 -7
- data/lib/dugway/liquid/drops/base_drop.rb +1 -1
- data/lib/dugway/liquid/drops/contact_drop.rb +9 -0
- data/lib/dugway/liquid/drops/pages_drop.rb +4 -0
- data/lib/dugway/liquid/drops/products_drop.rb +1 -1
- data/lib/dugway/liquid/filters/url_filters.rb +1 -1
- data/lib/dugway/version.rb +1 -1
- data/spec/features/contact_form_spec.rb +0 -7
- data/spec/features/page_rendering_spec.rb +1 -1
- data/spec/fixtures/store/page/about-us.json +1 -1
- data/spec/fixtures/theme/contact.html +1 -6
- data/spec/units/dugway/contact_form_validator_spec.rb +0 -11
- data/spec/units/dugway/liquid/drops/contact_drop_spec.rb +7 -1
- data/spec/units/dugway/liquid/drops/pages_drop_spec.rb +20 -1
- data/spec/units/dugway/theme_spec.rb +2 -2
- metadata +12 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7327098642f17da47ce2769de014026ed204725960b39133769b02943ceaae4
|
4
|
+
data.tar.gz: b158bab3913e4fedd00064531937abe052cda1325a0dace29332ab4f77cba70e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17dd683322eeb0b8abfd1e2f9c729a14ecaea0e72328e07160e355e6891da1a845777cc553f88d4e7ddc23187b54337c6d5dda7d4d04f23865ae47d2c5e560c6
|
7
|
+
data.tar.gz: 71b0394669bb047a8003bbd61e713fffe985e70ffbc76561e1ea5acdb744f26ad3c4e380ce8b2b9875c67985936f895774a64112e3eb43642ea44edec26f3dad
|
data/README.md
CHANGED
@@ -182,7 +182,7 @@ Run your theme in any browser by starting the Dugway server:
|
|
182
182
|
dugway server
|
183
183
|
```
|
184
184
|
|
185
|
-
By default this will serve your theme at http://
|
185
|
+
By default this will serve your theme at http://127.0.0.1:9292/. You can then stop
|
186
186
|
the server by hitting CTRL+C.
|
187
187
|
|
188
188
|
### Pow
|
data/dugway.gemspec
CHANGED
@@ -24,10 +24,10 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_dependency('activesupport', '~> 5.2')
|
25
25
|
s.add_dependency('liquid', '~> 3.0.6')
|
26
26
|
s.add_dependency('coffee-script', '~> 2.4.1')
|
27
|
-
s.add_dependency('sass', '~> 3.
|
27
|
+
s.add_dependency('sass', '~> 3.4.25')
|
28
28
|
s.add_dependency('sprockets', '~> 2.0')
|
29
29
|
s.add_dependency('sprockets-sass', '~> 1.3.1')
|
30
|
-
s.add_dependency('compass', '~> 0.
|
30
|
+
s.add_dependency('compass', '~> 1.0.3')
|
31
31
|
s.add_dependency('httparty', '~> 0.10.0')
|
32
32
|
s.add_dependency('better_errors', '~> 0.9.0')
|
33
33
|
s.add_dependency('will_paginate', '~> 3.0.4')
|
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_dependency('thor', '~> 0.20.3')
|
37
37
|
s.add_dependency('rubyzip', '~> 0.9.9')
|
38
38
|
s.add_dependency('uglifier', '~> 4.1')
|
39
|
-
s.add_dependency('thin', '~> 1.
|
39
|
+
s.add_dependency('thin', '~> 1.8.0')
|
40
40
|
s.add_dependency('bigcartel-theme-fonts')
|
41
41
|
s.add_dependency('bigcartel-currency-locales')
|
42
42
|
|
data/lib/dugway/cart.rb
CHANGED
@@ -31,7 +31,7 @@ module Dugway
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def shipping
|
34
|
-
{
|
34
|
+
{
|
35
35
|
'enabled' => false,
|
36
36
|
'amount' => 0.0,
|
37
37
|
'strict' => false,
|
@@ -40,14 +40,14 @@ module Dugway
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def tax
|
43
|
-
{
|
43
|
+
{
|
44
44
|
'enabled' => false,
|
45
45
|
'amount' => 0.0
|
46
46
|
}
|
47
47
|
end
|
48
48
|
|
49
49
|
def discount
|
50
|
-
{
|
50
|
+
{
|
51
51
|
'enabled' => false,
|
52
52
|
'pending' => false,
|
53
53
|
'amount' => 0.0
|
@@ -22,14 +22,9 @@
|
|
22
22
|
<label for="message">Message</label>
|
23
23
|
{{ contact | contact_input: 'message' }}
|
24
24
|
</li>
|
25
|
-
<li>
|
26
|
-
<label for="captcha">Spam check</label>
|
27
|
-
<p>Please enter the characters from the image.</p>
|
28
|
-
<div>{{ contact.captcha }}</div>
|
29
|
-
{{ contact | contact_input: 'captcha' }}
|
30
|
-
</li>
|
31
25
|
<li>
|
32
26
|
<button type="submit" name="submit" title="Send us an email">Send</button>
|
27
|
+
<div>{{ contact.recaptcha }}</div>
|
33
28
|
</li>
|
34
29
|
</ul>
|
35
30
|
</form>
|
@@ -12,25 +12,19 @@ module Dugway
|
|
12
12
|
'All fields are required'
|
13
13
|
elsif param_does_not_match(:email, email_format)
|
14
14
|
'Invalid email address'
|
15
|
-
elsif param_does_not_match(:captcha, captcha_format)
|
16
|
-
'Spam check was incorrect'
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
20
18
|
private
|
21
19
|
|
22
20
|
def required_fields
|
23
|
-
[ :name, :email, :subject, :message
|
21
|
+
[ :name, :email, :subject, :message ]
|
24
22
|
end
|
25
23
|
|
26
24
|
def email_format
|
27
25
|
/^([^@\s]+)@((?:[-a-zA-Z0-9]+\.)+[a-zA-Z]{2,})$/
|
28
26
|
end
|
29
27
|
|
30
|
-
def captcha_format
|
31
|
-
/^rQ9pC$/i
|
32
|
-
end
|
33
|
-
|
34
28
|
def param_does_not_match(param_name, regex)
|
35
29
|
!(params[param_name.to_sym] =~ regex)
|
36
30
|
end
|
@@ -21,6 +21,15 @@ module Dugway
|
|
21
21
|
%{<img id="captcha_image" src="https://s3.amazonaws.com/bigcartel/captcha/28e3d1288cbc70c0cd1a2d10845f8e11e1a90d14.png">}
|
22
22
|
end
|
23
23
|
|
24
|
+
def recaptcha
|
25
|
+
@recaptcha ||= begin
|
26
|
+
html = "This site is protected by reCAPTCHA and the Google "
|
27
|
+
html += '<a href="https://policies.google.com/privacy">Privacy Policy</a> and '
|
28
|
+
html += '<a href="https://policies.google.com/terms">Terms of Service</a> apply.'
|
29
|
+
html
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
24
33
|
def sent
|
25
34
|
request.path == '/contact' && request.post? && errors.blank?
|
26
35
|
end
|
data/lib/dugway/version.rb
CHANGED
@@ -16,18 +16,12 @@ feature 'Contact form' do
|
|
16
16
|
expect(page).to have_content('Invalid email address')
|
17
17
|
end
|
18
18
|
|
19
|
-
scenario 'with an invalid captcha' do
|
20
|
-
submit_contact_form(:captcha => 'blah')
|
21
|
-
expect(page).to have_content('Spam check was incorrect')
|
22
|
-
end
|
23
|
-
|
24
19
|
def submit_contact_form(fields={})
|
25
20
|
fields.reverse_merge!(
|
26
21
|
:name => 'Joe',
|
27
22
|
:email => 'joe@example.com',
|
28
23
|
:subject => 'Testing',
|
29
24
|
:message => 'Hi there',
|
30
|
-
:captcha => 'rQ9pC'
|
31
25
|
)
|
32
26
|
|
33
27
|
visit '/contact'
|
@@ -36,7 +30,6 @@ feature 'Contact form' do
|
|
36
30
|
fill_in 'Email', :with => fields[:email]
|
37
31
|
fill_in 'Subject', :with => fields[:subject]
|
38
32
|
fill_in 'Message', :with => fields[:message]
|
39
|
-
fill_in 'Spam check', :with => fields[:captcha]
|
40
33
|
|
41
34
|
click_button 'Send'
|
42
35
|
end
|
@@ -50,7 +50,7 @@ feature 'Page rendering' do
|
|
50
50
|
visit '/contact'
|
51
51
|
expect(page).to have_content('Dugway') # layout.html
|
52
52
|
expect(page).to have_content('Contact')
|
53
|
-
expect(page).to have_content('
|
53
|
+
expect(page).to have_content('protected by reCAPTCHA')
|
54
54
|
end
|
55
55
|
|
56
56
|
scenario 'maintenance.html' do
|
@@ -1 +1 @@
|
|
1
|
-
{"category":"custom","content":"<p>We're really cool!</p>","permalink":"about-us","name":"About Us","id":95821979,"url":"/about-us"}
|
1
|
+
{"category":"custom","content":"<p>We're really cool!</p>","permalink":"about-us","name":"About Us","id":95821979,"url":"/about-us"}
|
@@ -22,14 +22,9 @@
|
|
22
22
|
<label for="message">Message</label>
|
23
23
|
{{ contact | contact_input: 'message' }}
|
24
24
|
</li>
|
25
|
-
<li>
|
26
|
-
<label for="captcha">Spam check</label>
|
27
|
-
<p>Please enter the characters from the image.</p>
|
28
|
-
<div>{{ contact.captcha }}</div>
|
29
|
-
{{ contact | contact_input: 'captcha' }}
|
30
|
-
</li>
|
31
25
|
<li>
|
32
26
|
<button type="submit" name="submit" title="Send us an email">Send</button>
|
27
|
+
<div>{{ contact.recaptcha }}</div>
|
33
28
|
</li>
|
34
29
|
</ul>
|
35
30
|
</form>
|
@@ -11,7 +11,6 @@ describe Dugway::ContactFormValidator do
|
|
11
11
|
:email => "name@example.com",
|
12
12
|
:subject => "subject",
|
13
13
|
:message => "message",
|
14
|
-
:captcha => "rQ9pc",
|
15
14
|
}
|
16
15
|
end
|
17
16
|
|
@@ -36,21 +35,11 @@ describe Dugway::ContactFormValidator do
|
|
36
35
|
assert_required_fields_error
|
37
36
|
end
|
38
37
|
|
39
|
-
it "returns an error for a missing captcha" do
|
40
|
-
validator.params[:captcha] = " "
|
41
|
-
assert_required_fields_error
|
42
|
-
end
|
43
|
-
|
44
38
|
it "returns an error for invalid email format" do
|
45
39
|
validator.params[:email] = "foo-at-foo-dot-net"
|
46
40
|
expect(validator.error_message).to eq "Invalid email address"
|
47
41
|
end
|
48
42
|
|
49
|
-
it "returns an error for incorrect captcha" do
|
50
|
-
validator.params[:captcha] = "oops"
|
51
|
-
expect(validator.error_message).to eq "Spam check was incorrect"
|
52
|
-
end
|
53
|
-
|
54
43
|
def assert_required_fields_error
|
55
44
|
expect(validator.error_message).to eql "All fields are required"
|
56
45
|
end
|
@@ -13,7 +13,7 @@ describe Dugway::Drops::ContactDrop do
|
|
13
13
|
Rack::MockRequest::DEFAULT_ENV.update({
|
14
14
|
'PATH_INFO' => '/contact'
|
15
15
|
})}
|
16
|
-
|
16
|
+
|
17
17
|
let(:request) { Dugway::Request.new(env) }
|
18
18
|
|
19
19
|
let(:errors) {
|
@@ -96,6 +96,12 @@ describe Dugway::Drops::ContactDrop do
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
+
describe "#recaptcha" do
|
100
|
+
it "returns the recaptcha branding text" do
|
101
|
+
contact.recaptcha.should == %{This site is protected by reCAPTCHA and the Google <a href="https://policies.google.com/privacy">Privacy Policy</a> and <a href="https://policies.google.com/terms">Terms of Service</a> apply.}
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
99
105
|
describe "#sent" do
|
100
106
|
it "should return false before the form has been sent" do
|
101
107
|
contact.sent.should be(false)
|
@@ -1,7 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Dugway::Drops::PagesDrop do
|
4
|
-
let(:pages)
|
4
|
+
let(:pages) do
|
5
|
+
Dugway::Drops::PagesDrop.new(
|
6
|
+
Dugway.store.pages.map do |p|
|
7
|
+
case p["permalink"]
|
8
|
+
when "cart"
|
9
|
+
Dugway::Drops::CartDrop.new(p)
|
10
|
+
else
|
11
|
+
Dugway::Drops::PageDrop.new(p)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
)
|
15
|
+
end
|
5
16
|
|
6
17
|
describe "#all" do
|
7
18
|
it "should return an array of all pages" do
|
@@ -15,6 +26,14 @@ describe Dugway::Drops::PagesDrop do
|
|
15
26
|
end
|
16
27
|
end
|
17
28
|
|
29
|
+
describe "#cart" do
|
30
|
+
it "returns the cart drop instead of the cart class instance" do
|
31
|
+
cart = pages.cart
|
32
|
+
cart.should be_an_instance_of(Dugway::Drops::CartDrop)
|
33
|
+
cart.name.should == 'Cart'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
18
37
|
describe "#permalink" do
|
19
38
|
it "should return the page by permalink" do
|
20
39
|
page = pages.contact
|
@@ -118,7 +118,7 @@ describe Dugway::Theme do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
it "should sprocketize and liquify theme.css" do
|
121
|
-
theme.file_content('theme.css').gsub(/\s+/, '').should == %{html,body{height:100%;}a{background
|
121
|
+
theme.file_content('theme.css').gsub(/\s+/, '').should == %{html,body{height:100%;}a{background:#0f0;color:red;}footercitea{background:url(/images/bc_badge.png)no-repeat;}/**/}
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -134,7 +134,7 @@ describe Dugway::Theme do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
it "should sprocketize and not liquify theme.css" do
|
137
|
-
theme.build_file('theme.css').gsub(/\s+/, '').should == %{html,body{height:100%;}a{background
|
137
|
+
theme.build_file('theme.css').gsub(/\s+/, '').should == %{html,body{height:100%;}a{background:#0f0;color:{{theme.link_color}};}footercitea{background:url({{'bc_badge.png'|theme_image_url}})no-repeat;}/**/}
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dugway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Big Cartel
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 3.
|
103
|
+
version: 3.4.25
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 3.
|
110
|
+
version: 3.4.25
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: sprockets
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
145
|
+
version: 1.0.3
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
152
|
+
version: 1.0.3
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: httparty
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -268,14 +268,14 @@ dependencies:
|
|
268
268
|
requirements:
|
269
269
|
- - "~>"
|
270
270
|
- !ruby/object:Gem::Version
|
271
|
-
version: 1.
|
271
|
+
version: 1.8.0
|
272
272
|
type: :runtime
|
273
273
|
prerelease: false
|
274
274
|
version_requirements: !ruby/object:Gem::Requirement
|
275
275
|
requirements:
|
276
276
|
- - "~>"
|
277
277
|
- !ruby/object:Gem::Version
|
278
|
-
version: 1.
|
278
|
+
version: 1.8.0
|
279
279
|
- !ruby/object:Gem::Dependency
|
280
280
|
name: bigcartel-theme-fonts
|
281
281
|
requirement: !ruby/object:Gem::Requirement
|
@@ -545,7 +545,7 @@ homepage: https://github.com/bigcartel/dugway
|
|
545
545
|
licenses:
|
546
546
|
- MIT
|
547
547
|
metadata: {}
|
548
|
-
post_install_message:
|
548
|
+
post_install_message:
|
549
549
|
rdoc_options: []
|
550
550
|
require_paths:
|
551
551
|
- lib
|
@@ -560,9 +560,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
560
560
|
- !ruby/object:Gem::Version
|
561
561
|
version: '0'
|
562
562
|
requirements: []
|
563
|
-
|
564
|
-
|
565
|
-
signing_key:
|
563
|
+
rubygems_version: 3.0.6
|
564
|
+
signing_key:
|
566
565
|
specification_version: 4
|
567
566
|
summary: Easily build and test Big Cartel themes.
|
568
567
|
test_files:
|