locomotivecms_wagon 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/README.md +11 -23
- data/lib/locomotive/wagon/liquid/drops/site.rb +1 -1
- data/lib/locomotive/wagon/liquid/filters/translate.rb +1 -1
- data/lib/locomotive/wagon/misc/dragonfly.rb +0 -1
- data/lib/locomotive/wagon/server.rb +3 -4
- data/lib/locomotive/wagon/server/entry_submission.rb +5 -1
- data/lib/locomotive/wagon/server/middleware.rb +3 -1
- data/lib/locomotive/wagon/version.rb +1 -1
- data/locales/en.yml +1 -1
- data/locomotivecms_wagon.gemspec +2 -3
- data/spec/fixtures/default/README +0 -0
- data/spec/fixtures/default/app/content_types/bands.yml +19 -0
- data/spec/fixtures/default/app/content_types/events.yml +19 -0
- data/spec/fixtures/default/app/content_types/messages.yml +17 -0
- data/spec/fixtures/default/app/content_types/songs.yml +25 -0
- data/spec/fixtures/default/app/content_types/updates.yml +33 -0
- data/spec/fixtures/default/app/views/pages/404.liquid.haml +10 -0
- data/spec/fixtures/default/app/views/pages/about_us.fr.liquid.haml +7 -0
- data/spec/fixtures/default/app/views/pages/about_us.liquid.haml +20 -0
- data/spec/fixtures/default/app/views/pages/about_us.nb.liquid.haml +4 -0
- data/spec/fixtures/default/app/views/pages/about_us/jane_doe.liquid.haml +4 -0
- data/spec/fixtures/default/app/views/pages/about_us/john_doe.fr.liquid.haml +5 -0
- data/spec/fixtures/default/app/views/pages/about_us/john_doe.liquid.haml +4 -0
- data/spec/fixtures/default/app/views/pages/all.liquid.haml +13 -0
- data/spec/fixtures/default/app/views/pages/archives/news.liquid.haml +7 -0
- data/spec/fixtures/default/app/views/pages/contact.liquid.haml +54 -0
- data/spec/fixtures/default/app/views/pages/events.liquid.haml +29 -0
- data/spec/fixtures/default/app/views/pages/index.fr.liquid.haml +3 -0
- data/spec/fixtures/default/app/views/pages/index.liquid.haml +96 -0
- data/spec/fixtures/default/app/views/pages/music.liquid.haml +28 -0
- data/spec/fixtures/default/app/views/pages/songs/template.liquid.haml +13 -0
- data/spec/fixtures/default/app/views/pages/store.fr.liquid.haml +5 -0
- data/spec/fixtures/default/app/views/pages/store.liquid +5 -0
- data/spec/fixtures/default/app/views/snippets/header.liquid.haml +1 -0
- data/spec/fixtures/default/app/views/snippets/song.fr.liquid.haml +8 -0
- data/spec/fixtures/default/app/views/snippets/song.liquid +12 -0
- data/spec/fixtures/default/config/deploy.yml +12 -0
- data/spec/fixtures/default/config/deploy_example.yml +12 -0
- data/spec/fixtures/default/config/site.yml +15 -0
- data/spec/fixtures/default/config/translations.yml +3 -0
- data/spec/fixtures/default/data/bands.yml +10 -0
- data/spec/fixtures/default/data/events.yml +49 -0
- data/spec/fixtures/default/data/songs.yml +46 -0
- data/spec/fixtures/default/data/updates.yml +48 -0
- data/spec/fixtures/default/public/fonts/chunkfive-webfont.eot +0 -0
- data/spec/fixtures/default/public/fonts/chunkfive-webfont.svg +213 -0
- data/spec/fixtures/default/public/fonts/chunkfive-webfont.ttf +0 -0
- data/spec/fixtures/default/public/fonts/chunkfive-webfont.woff +0 -0
- data/spec/fixtures/default/public/fonts/chunkfive.css +8 -0
- data/spec/fixtures/default/public/fonts/chunkfive.otf +0 -0
- data/spec/fixtures/default/public/images/nav_on.png +0 -0
- data/spec/fixtures/default/public/images/photo_frame.png +0 -0
- data/spec/fixtures/default/public/images/sep.png +0 -0
- data/spec/fixtures/default/public/images/top.jpg +0 -0
- data/spec/fixtures/default/public/javascripts/application.js.coffee +2 -0
- data/spec/fixtures/default/public/javascripts/common.js +1 -0
- data/spec/fixtures/default/public/samples/asset_collections/cover.jpg +0 -0
- data/spec/fixtures/default/public/samples/photo.jpg +0 -0
- data/spec/fixtures/default/public/samples/photo_2.jpg +0 -0
- data/spec/fixtures/default/public/stylesheets/application.css +64 -0
- data/spec/fixtures/default/public/stylesheets/other/extra.css.less +8 -0
- data/spec/fixtures/default/public/stylesheets/other/style.css.scss +13 -0
- data/spec/fixtures/default/public/stylesheets/reboot.css +82 -0
- data/spec/integration/cassettes/push.yml +4 -4
- data/spec/integration/server/basic_spec.rb +53 -0
- data/spec/integration/server/contact_form_spec.rb +111 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/helpers.rb +14 -0
- data/spec/support/matchers.rb +5 -0
- metadata +120 -26
- data/spec/integration/server_spec.rb +0 -38
Binary file
|
Binary file
|
@@ -0,0 +1,8 @@
|
|
1
|
+
@font-face {
|
2
|
+
font-family: 'ChunkFiveRoman';
|
3
|
+
src: url('chunkfive-webfont.eot');
|
4
|
+
src: local('☺'), url('chunkfive-webfont.woff') format('woff'), url('chunkfive-webfont.ttf') format('truetype'), url('chunkfive-webfont.svg#webfontwlZ5ec8v') format('svg');
|
5
|
+
font-weight: normal;
|
6
|
+
font-style: normal;
|
7
|
+
}
|
8
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log('hello world')
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,64 @@
|
|
1
|
+
body { background: #f0eee3 url("/images/top.jpg") repeat-x center 0; color: #333; font-family: Georgia, helvetica; font-size: 14px; }
|
2
|
+
|
3
|
+
h2 { font-size: 30px; font-style: italic; font-weight: normal; font-family: ChunkFiveRoman; margin-bottom: 6px; }
|
4
|
+
|
5
|
+
a { color: #2196b2; text-decoration: none; }
|
6
|
+
a:hover { text-decoration: underline; }
|
7
|
+
|
8
|
+
.sep { height: 1px; width: 950px; background: transparent url(/images/sep.png) repeat-x 0 0; }
|
9
|
+
|
10
|
+
.more a { font-style: italic; font-weight: bold; }
|
11
|
+
|
12
|
+
.container { width: 950px; padding-top: 0px; }
|
13
|
+
|
14
|
+
.error { text-align: center; font-size: 24px; text-transform: capitalize; }
|
15
|
+
|
16
|
+
/* ___ menu ___ */
|
17
|
+
|
18
|
+
#menu { height: 40px; }
|
19
|
+
|
20
|
+
#nav { list-style: none; height: 40px; }
|
21
|
+
#nav li { float: left; padding: 0px 20px 0 20px; height: 40px; }
|
22
|
+
#nav li a { position: relative; top: 7px; color: #fff; font-size: 18px; text-transform: lowercase; font-family: ChunkFiveRoman; }
|
23
|
+
#nav li.on { background: transparent url(/images/nav_on.png) repeat-x 0 0; }
|
24
|
+
|
25
|
+
/* ___ banner ___ */
|
26
|
+
|
27
|
+
#banner { padding-top: 20px; background: transparent url(/images/sep.png) repeat-x 0 bottom; margin-bottom: 30px; padding-bottom: 20px; }
|
28
|
+
|
29
|
+
#banner .photo { float: left; position: relative; left: -23px; background: transparent url(/images/photo_frame.png) no-repeat 0 0; padding: 24px 0 0px 32px; width: 636px; height: 438px; }
|
30
|
+
#banner .text { padding-top: 130px; margin-left: 686px; }
|
31
|
+
#banner .text p { font-size: 18px; }
|
32
|
+
#banner .text p a { font-weight: bold; font-size: 17px; }
|
33
|
+
|
34
|
+
/* ___ list ___ */
|
35
|
+
|
36
|
+
.list { list-style: none; font-size: 13px; margin-bottom: 10px; }
|
37
|
+
.list li { margin-bottom: 5px; }
|
38
|
+
.list li em { font-weight: bold; }
|
39
|
+
|
40
|
+
/* ___ songs ___ */
|
41
|
+
|
42
|
+
.songs { list-style: none; }
|
43
|
+
.songs li { margin: 0 20px 20px 0; padding: 0 0 20px 0px; background: transparent url(/images/sep.png) repeat-x 0 bottom; }
|
44
|
+
.songs li h3 { font-style: italic; margin-bottom: 6px; }
|
45
|
+
.songs li .cover { float: left; }
|
46
|
+
.songs li .cover img { border: 4px solid #fff; }
|
47
|
+
.songs li .info { margin-left: 165px; }
|
48
|
+
.songs li .info .listen { text-align: right; margin: 5px 0 0 0; }
|
49
|
+
|
50
|
+
/* ___ contact form ___ */
|
51
|
+
|
52
|
+
#contactform { margin-top: 30px; }
|
53
|
+
#contactform p { margin-bottom: 10px; clear: both; }
|
54
|
+
#contactform p label { float: left; width: 200px; }
|
55
|
+
#contactform p input[type=text], #contactform p textarea { font-size: 1em; padding: 3px 5px; }
|
56
|
+
#contactform p input[type=text] { width: 200px; }
|
57
|
+
#contactform p textarea { width: 400px; height: 200px; }
|
58
|
+
#contactform p.action { padding: 0 0px 15px 200px; }
|
59
|
+
#contactform p.action input { background: #2196b2; color: #fff; padding: 3px 5px; text-transform: uppercase; margin: 0 5px; border: none; }
|
60
|
+
|
61
|
+
/* ___ footer ___ */
|
62
|
+
|
63
|
+
#footer { background: transparent url(/images/sep.png) repeat-x 0 0; margin-top: 20px; padding-top: 10px; }
|
64
|
+
#footer p { text-align: center; font-size: 12px; }
|
@@ -0,0 +1,82 @@
|
|
1
|
+
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
|
2
|
+
|
3
|
+
/* **************** GRIDS ***************** */
|
4
|
+
.container { margin: 0 auto; width: 900px; padding: 20px; text-align:left; }
|
5
|
+
.line, .lastUnit {overflow: hidden;_overflow:visible;_zoom:1;}
|
6
|
+
.line2 {_zoom:1; background-color:#FFF;}
|
7
|
+
.unit{float:left;_zoom:1;}
|
8
|
+
.unitExt{float:right;}
|
9
|
+
.size1of1{float:none;}
|
10
|
+
.size1of2{width:50%;}
|
11
|
+
.size1of3{width:33.33333%;}
|
12
|
+
.size2of3{width:66.66666%;}
|
13
|
+
.size1of4{width:25%;}
|
14
|
+
.size3of4{width:75%;}
|
15
|
+
.size1of5{width:20%;}
|
16
|
+
.size2of5{width:40%;}
|
17
|
+
.size3of5{width:60%;}
|
18
|
+
.size4of5{width:80%;}
|
19
|
+
.lastUnit {float:none;_position:relative; _left:-3px; _margin-right: -3px;width:auto;}
|
20
|
+
.padding10px{padding:10px;}
|
21
|
+
.padding15px{padding:15px;}
|
22
|
+
.padding20px{padding:20px;}
|
23
|
+
.clear{clear:both;height:1px;line-height:1px;}
|
24
|
+
|
25
|
+
/* **************** TYPOGRAPHY ***************** */
|
26
|
+
body {font-size:75%;line-height:1.5;}
|
27
|
+
h1, h2, h3, h4, h5, h6 {font-weight:normal;}
|
28
|
+
h1 {
|
29
|
+
font-size:3.6em;
|
30
|
+
line-height:1;
|
31
|
+
margin-bottom:0.5em;
|
32
|
+
color:#434343;
|
33
|
+
font-weight:bold;
|
34
|
+
letter-spacing:-0.05em;
|
35
|
+
}
|
36
|
+
h2 {font-size:2em;margin-bottom:0.75em; color:#434343;}
|
37
|
+
h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
|
38
|
+
h4 {font-size:1.25em;line-height:1.25;margin:0.5em 0 0.5em 0;color:#565757;font-weight:bold;}
|
39
|
+
h5 {
|
40
|
+
font-size:1.3em;
|
41
|
+
font-weight:normal;
|
42
|
+
color:#414240;
|
43
|
+
}
|
44
|
+
|
45
|
+
h6 {
|
46
|
+
font-size:1.3em;
|
47
|
+
font-weight:bold;
|
48
|
+
font-style:italic;
|
49
|
+
color:#434343;
|
50
|
+
margin:-20px 0 20px 0;
|
51
|
+
letter-spacing:-0.05em;
|
52
|
+
}
|
53
|
+
p {
|
54
|
+
margin:0 0 1.5em;
|
55
|
+
color:#414240;
|
56
|
+
}
|
57
|
+
|
58
|
+
/* **************** ALIGNMENTS ***************** */
|
59
|
+
.tcenter { text-align: center; }
|
60
|
+
.tright { text-align: right; }
|
61
|
+
.tleft { text-align: left; }
|
62
|
+
.tjustify { text-align: justify; }
|
63
|
+
.fright { float: right; }
|
64
|
+
|
65
|
+
/* **************** MARGINS ***************** */
|
66
|
+
.nomargin { margin: 0 !important; }
|
67
|
+
.mt30 { margin-top: 30px !important; }
|
68
|
+
.mt20 { margin-top: 20px !important; }
|
69
|
+
.mb20 { margin-bottom: 20px !important; }
|
70
|
+
.m20 { margin: 20px !important; }
|
71
|
+
.mt10 { margin-top: 10px !important; }
|
72
|
+
.ml10 { margin-left: 10px !important; }
|
73
|
+
.mr10 { margin-right: 10px !important; }
|
74
|
+
.mb10 { margin-bottom: 10px !important; }
|
75
|
+
.mb20 { margin-bottom: 20px !important; }
|
76
|
+
.mb30 { margin-bottom: 30px !important; }
|
77
|
+
.m10 { margin: 10px !important; }
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
@@ -781,8 +781,8 @@ http_interactions:
|
|
781
781
|
headers: {}
|
782
782
|
response:
|
783
783
|
status:
|
784
|
-
code:
|
785
|
-
message: ! '
|
784
|
+
code: 200
|
785
|
+
message: ! 'OK '
|
786
786
|
headers:
|
787
787
|
Content-Type:
|
788
788
|
- application/json; charset=utf-8
|
@@ -799,12 +799,12 @@ http_interactions:
|
|
799
799
|
Date:
|
800
800
|
- Wed, 27 Feb 2013 11:39:27 GMT
|
801
801
|
Content-Length:
|
802
|
-
- '
|
802
|
+
- '2'
|
803
803
|
Connection:
|
804
804
|
- Keep-Alive
|
805
805
|
body:
|
806
806
|
encoding: US-ASCII
|
807
|
-
string: ! '
|
807
|
+
string: ! '[]'
|
808
808
|
http_version:
|
809
809
|
recorded_at: Wed, 27 Feb 2013 11:39:27 GMT
|
810
810
|
recorded_with: VCR 2.3.0
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../integration_helper'
|
4
|
+
require 'locomotive/wagon/server'
|
5
|
+
require 'rack/test'
|
6
|
+
|
7
|
+
describe Locomotive::Wagon::Server do
|
8
|
+
|
9
|
+
include Rack::Test::Methods
|
10
|
+
|
11
|
+
def app
|
12
|
+
run_server
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'shows the index page' do
|
16
|
+
get '/index'
|
17
|
+
last_response.body.should =~ /Upcoming events/
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'shows the 404 page' do
|
21
|
+
get '/void'
|
22
|
+
last_response.body.should =~ /page not found/
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'shows content' do
|
26
|
+
get '/about-us/jane-doe'
|
27
|
+
last_response.body.should =~ /Lorem ipsum dolor sit amet/
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'shows a content type template ' do
|
31
|
+
get '/songs/song-1'
|
32
|
+
last_response.body.should =~ /Song #1/
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'translates strings' do
|
36
|
+
get '/en'
|
37
|
+
last_response.body.should =~ /Powered by/
|
38
|
+
get '/fr'
|
39
|
+
last_response.body.should =~ /Propulsé par/
|
40
|
+
get '/nb'
|
41
|
+
last_response.body.should_not =~ /Powered by/
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'returns all the pages' do
|
45
|
+
get '/all'
|
46
|
+
last_response.body.should =~ /Home page/
|
47
|
+
last_response.body.should =~ /<li>Home page<\/li>/
|
48
|
+
last_response.body.should =~ /<li>John-doe<\/li>/
|
49
|
+
last_response.body.should =~ /<li>Songs<\/li>/
|
50
|
+
last_response.body.should =~ /<li>A song template<\/li>/
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../integration_helper'
|
4
|
+
require 'locomotive/wagon/server'
|
5
|
+
require 'rack/test'
|
6
|
+
|
7
|
+
describe 'ContactForm' do
|
8
|
+
|
9
|
+
include Rack::Test::Methods
|
10
|
+
|
11
|
+
def app
|
12
|
+
run_server
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'renders the form' do
|
16
|
+
get '/contact'
|
17
|
+
last_response.body.should =~ /\/entry_submissions\/messages.json/
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#submit' do
|
21
|
+
|
22
|
+
let(:params) { {
|
23
|
+
'entry' => { 'name' => 'John', 'email' => 'j@doe.net', 'message' => 'Bla bla' },
|
24
|
+
'success_callback' => '/events',
|
25
|
+
'error_callback' => '/contact' } }
|
26
|
+
let(:response) { post_contact_form(params, false) }
|
27
|
+
let(:status) { response.status }
|
28
|
+
|
29
|
+
describe 'with json request' do
|
30
|
+
|
31
|
+
let(:response) { post_contact_form(params, true) }
|
32
|
+
let(:entry) { JSON.parse(response.body)['message'] }
|
33
|
+
|
34
|
+
context 'when not valid' do
|
35
|
+
|
36
|
+
let(:params) { {} }
|
37
|
+
|
38
|
+
it 'returns an error status' do
|
39
|
+
response.status.should == 422
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'errors' do
|
43
|
+
|
44
|
+
subject { entry['errors'] }
|
45
|
+
|
46
|
+
it { should have_key_with_value('name', "can't not be blank") }
|
47
|
+
|
48
|
+
it { should have_key_with_value('email', "can't not be blank") }
|
49
|
+
|
50
|
+
it { should have_key_with_value('message', "can't not be blank") }
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'when valid' do
|
57
|
+
|
58
|
+
it 'returns a success status' do
|
59
|
+
response.status.should == 200
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
describe 'with html request' do
|
67
|
+
|
68
|
+
context 'when not valid' do
|
69
|
+
|
70
|
+
let(:params) { { 'error_callback' => '/contact' } }
|
71
|
+
|
72
|
+
it 'returns a success status' do
|
73
|
+
response.status.should == 200
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'displays errors' do
|
77
|
+
response.body.to_s.should =~ /can't not be blank/
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'when valid' do
|
83
|
+
|
84
|
+
let(:response) { post_contact_form(params, false, true) }
|
85
|
+
|
86
|
+
it 'returns a success status' do
|
87
|
+
response.status.should == 200
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'displays a success message' do
|
91
|
+
response.body.should =~ /Thank you John/
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
def post_contact_form(params, json = false, follow_redirect = false)
|
101
|
+
url = '/entry_submissions/messages'
|
102
|
+
url += '.json' if json
|
103
|
+
params = params.symbolize_keys if json
|
104
|
+
post url, params
|
105
|
+
if follow_redirect
|
106
|
+
follow_redirect!
|
107
|
+
end
|
108
|
+
last_response
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/helpers.rb
CHANGED
@@ -1,13 +1,27 @@
|
|
1
1
|
module Spec
|
2
2
|
module Helpers
|
3
|
+
|
3
4
|
def reset!
|
4
5
|
FileUtils.rm_rf(File.expand_path('../../../site', __FILE__))
|
5
6
|
end
|
6
7
|
|
8
|
+
def remove_logs
|
9
|
+
FileUtils.rm_rf(File.expand_path('../../fixtures/default/log', __FILE__))
|
10
|
+
end
|
11
|
+
|
7
12
|
def clone_site
|
8
13
|
VCR.use_cassette('pull') do
|
9
14
|
Locomotive::Wagon.clone('site', {'host' => 'locomotive.engine.dev:3000'}, 'email' => 'admin@locomotivecms.com', 'password' => 'locomotive')
|
10
15
|
end
|
11
16
|
end
|
17
|
+
|
18
|
+
def run_server
|
19
|
+
path = 'spec/fixtures/default'
|
20
|
+
Locomotive::Wagon::Logger.setup(path, false)
|
21
|
+
reader = Locomotive::Mounter::Reader::FileSystem.instance
|
22
|
+
reader.run!(path: path)
|
23
|
+
Locomotive::Wagon::Server.new(reader, disable_listen: true)
|
24
|
+
end
|
25
|
+
|
12
26
|
end
|
13
27
|
end
|