locomotivecms_wagon 3.0.0 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/bin/wagon +64 -3
- data/bin/wagon_dev +11 -0
- data/generators/.DS_Store +0 -0
- data/generators/blank/Gemfile.tt +6 -2
- data/generators/blank/app/assets/stylesheets/app.scss +2 -0
- data/generators/blank/app/assets/stylesheets/sections/.empty_directory +1 -0
- data/generators/blank/app/views/pages/404.liquid +1 -1
- data/generators/blank/app/views/pages/index.liquid +1 -1
- data/generators/section/%type%.scss.tt +3 -0
- data/generators/section/template.liquid.tt +139 -80
- data/generators/webpack/app/assets/javascripts/.DS_Store +0 -0
- data/lib/locomotive/wagon.rb +15 -1
- data/lib/locomotive/wagon/cli.rb +11 -11
- data/lib/locomotive/wagon/commands/generate_command.rb +2 -7
- data/lib/locomotive/wagon/commands/push_command.rb +4 -8
- data/lib/locomotive/wagon/commands/serve_command.rb +5 -5
- data/lib/locomotive/wagon/generators/section.rb +121 -17
- data/lib/locomotive/wagon/generators/site/base.rb +0 -23
- data/lib/locomotive/wagon/version.rb +1 -1
- data/locomotivecms_wagon.gemspec +7 -4
- metadata +14 -233
- data/.gitignore +0 -36
- data/.rspec +0 -1
- data/.travis.yml +0 -11
- data/Gemfile +0 -30
- data/Rakefile +0 -32
- data/spec/fixtures/blog/app/content_types/comments.yml +0 -20
- data/spec/fixtures/blog/app/content_types/posts.yml +0 -19
- data/spec/fixtures/blog/app/views/pages/404.liquid +0 -11
- data/spec/fixtures/blog/app/views/pages/about-us.liquid.haml +0 -29
- data/spec/fixtures/blog/app/views/pages/index.liquid +0 -25
- data/spec/fixtures/blog/app/views/pages/posts.fr.liquid +0 -13
- data/spec/fixtures/blog/app/views/pages/posts.liquid +0 -13
- data/spec/fixtures/blog/app/views/pages/posts/content_type_template.fr.liquid +0 -14
- data/spec/fixtures/blog/app/views/pages/posts/content_type_template.liquid +0 -15
- data/spec/fixtures/blog/config/deploy.yml +0 -4
- data/spec/fixtures/blog/config/site.yml +0 -16
- data/spec/fixtures/blog/data/comments.yml +0 -16
- data/spec/fixtures/blog/data/posts.yml +0 -7
- data/spec/fixtures/cassettes/authenticate.yml +0 -236
- data/spec/fixtures/cassettes/delete.yml +0 -1255
- data/spec/fixtures/cassettes/push.yml +0 -9946
- data/spec/fixtures/cassettes/sync.yml +0 -11462
- data/spec/fixtures/default/README +0 -0
- data/spec/fixtures/default/app/content_types/bands.yml +0 -21
- data/spec/fixtures/default/app/content_types/events.yml +0 -25
- data/spec/fixtures/default/app/content_types/messages.yml +0 -17
- data/spec/fixtures/default/app/content_types/songs.yml +0 -25
- data/spec/fixtures/default/app/content_types/updates.yml +0 -33
- data/spec/fixtures/default/app/views/pages/404.liquid.haml +0 -10
- data/spec/fixtures/default/app/views/pages/about_us.fr.liquid.haml +0 -7
- data/spec/fixtures/default/app/views/pages/about_us.liquid.haml +0 -21
- data/spec/fixtures/default/app/views/pages/about_us.nb.liquid.haml +0 -4
- data/spec/fixtures/default/app/views/pages/about_us/jane_doe.liquid.haml +0 -4
- data/spec/fixtures/default/app/views/pages/about_us/john_doe.fr.liquid.haml +0 -5
- data/spec/fixtures/default/app/views/pages/about_us/john_doe.liquid.haml +0 -6
- data/spec/fixtures/default/app/views/pages/all.liquid.haml +0 -16
- data/spec/fixtures/default/app/views/pages/archives/news.liquid.haml +0 -10
- data/spec/fixtures/default/app/views/pages/contact.liquid.haml +0 -54
- data/spec/fixtures/default/app/views/pages/contest.liquid.haml +0 -18
- data/spec/fixtures/default/app/views/pages/events.liquid.haml +0 -64
- data/spec/fixtures/default/app/views/pages/filtered.liquid.haml +0 -20
- data/spec/fixtures/default/app/views/pages/grunge_bands.liquid.haml +0 -8
- data/spec/fixtures/default/app/views/pages/index.fr.liquid.haml +0 -3
- data/spec/fixtures/default/app/views/pages/index.liquid.haml +0 -101
- data/spec/fixtures/default/app/views/pages/layouts/simple.liquid.haml +0 -13
- data/spec/fixtures/default/app/views/pages/music.fr.liquid.haml +0 -4
- data/spec/fixtures/default/app/views/pages/music.liquid.haml +0 -42
- data/spec/fixtures/default/app/views/pages/songs/template.fr.liquid.haml +0 -16
- data/spec/fixtures/default/app/views/pages/songs/template.liquid.haml +0 -18
- data/spec/fixtures/default/app/views/pages/songs/template/band.liquid.haml +0 -16
- data/spec/fixtures/default/app/views/pages/store.fr.liquid.haml +0 -5
- data/spec/fixtures/default/app/views/pages/store.liquid +0 -5
- data/spec/fixtures/default/app/views/pages/tags/nav.liquid.haml +0 -6
- data/spec/fixtures/default/app/views/pages/tags/nav_in_deep.liquid.haml +0 -6
- data/spec/fixtures/default/app/views/pages/unlisted_pages.liquid.haml +0 -9
- data/spec/fixtures/default/app/views/snippets/A_Complicated-one.liquid.haml +0 -1
- data/spec/fixtures/default/app/views/snippets/footer.liquid.haml +0 -6
- data/spec/fixtures/default/app/views/snippets/header.liquid.haml +0 -1
- data/spec/fixtures/default/app/views/snippets/song.fr.liquid.haml +0 -8
- data/spec/fixtures/default/app/views/snippets/song.liquid +0 -12
- data/spec/fixtures/default/config/autoprefixer.yml +0 -2
- data/spec/fixtures/default/config/deploy.yml +0 -12
- data/spec/fixtures/default/config/deploy_example.yml +0 -12
- data/spec/fixtures/default/config/site.yml +0 -13
- data/spec/fixtures/default/config/translations.yml +0 -3
- data/spec/fixtures/default/data/bands.yml +0 -13
- data/spec/fixtures/default/data/events.yml +0 -54
- data/spec/fixtures/default/data/songs.yml +0 -46
- data/spec/fixtures/default/data/updates.yml +0 -48
- data/spec/fixtures/default/icon.png +0 -0
- data/spec/fixtures/default/public/fonts/chunkfive-webfont.eot +0 -0
- data/spec/fixtures/default/public/fonts/chunkfive-webfont.svg +0 -213
- 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 +0 -8
- 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 +0 -2
- data/spec/fixtures/default/public/javascripts/common.js +0 -1
- 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 +0 -64
- data/spec/fixtures/default/public/stylesheets/other/extra.css.less +0 -8
- data/spec/fixtures/default/public/stylesheets/other/style.css.scss +0 -13
- data/spec/fixtures/default/public/stylesheets/reboot.css +0 -77
- data/spec/integration/cli_spec.rb +0 -17
- data/spec/integration/commands/authenticate_command_spec.rb +0 -60
- data/spec/integration/commands/delete_command_spec.rb +0 -147
- data/spec/integration/commands/push_command_spec.rb +0 -86
- data/spec/integration/commands/sync_command_spec.rb +0 -60
- data/spec/integration/generators/page_spec.rb +0 -87
- data/spec/integration/generators/relationship_spec.rb +0 -102
- data/spec/integration/integration_helper.rb +0 -15
- data/spec/spec_helper.rb +0 -19
- data/spec/support/api_settings.rb +0 -5
- data/spec/support/chronic.rb +0 -6
- data/spec/support/helpers.rb +0 -39
- data/spec/support/matchers.rb +0 -5
- data/spec/support/pry.rb +0 -4
- data/spec/support/thor.rb +0 -12
- data/spec/support/vcr.rb +0 -27
- data/spec/unit/commands/pull_sub_commands/concerns/assets_concern_spec.rb +0 -48
- data/spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb +0 -41
- data/spec/unit/commands/push_sub_commands/push_pages_command_spec.rb +0 -125
- data/spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb +0 -42
- data/spec/unit/decorators/content_entry_decorator_spec.rb +0 -104
- data/spec/unit/decorators/page_decorator_spec.rb +0 -35
- data/spec/unit/decorators/site_decorator_spec.rb +0 -62
- data/spec/unit/decorators/theme_asset_decorator_spec.rb +0 -89
- data/spec/unit/tools/glob_spec.rb +0 -26
- data/spec/unit/tools/yaml_ext_spec.rb +0 -46
Binary file
|
Binary file
|
@@ -1,8 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
console.log('hello world')
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,64 +0,0 @@
|
|
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; }
|
@@ -1,77 +0,0 @@
|
|
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
|
-
.m10 { margin: 10px !important; }
|
77
|
-
.mb30 { margin-bottom: 30px !important; }
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/integration_helper'
|
4
|
-
require 'locomotive/wagon/cli'
|
5
|
-
|
6
|
-
describe Locomotive::Wagon::CLI do
|
7
|
-
|
8
|
-
subject { capture(:stdout) { command } }
|
9
|
-
|
10
|
-
describe '#version' do
|
11
|
-
|
12
|
-
let(:command) { Locomotive::Wagon::CLI::Main.start(['version']) }
|
13
|
-
it { is_expected.to match /^3.0.0/ }
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../integration_helper'
|
4
|
-
require 'locomotive/wagon/commands/authenticate_command'
|
5
|
-
require 'thor'
|
6
|
-
|
7
|
-
describe Locomotive::Wagon::AuthenticateCommand do
|
8
|
-
|
9
|
-
before { VCR.insert_cassette 'authenticate', record: :new_episodes, match_requests_on: [:method, :query, :body] }
|
10
|
-
after { VCR.eject_cassette }
|
11
|
-
|
12
|
-
let(:platform_url) { TEST_PLATFORM_URL }
|
13
|
-
let(:shell) { Thor::Shell::Color.new }
|
14
|
-
let(:command) { described_class.new(platform_url, email, password, shell) }
|
15
|
-
|
16
|
-
describe '#authenticate' do
|
17
|
-
|
18
|
-
let(:netrc) { instance_double('netrc', save: true) }
|
19
|
-
|
20
|
-
before { allow(Netrc).to receive(:read).and_return(netrc) }
|
21
|
-
|
22
|
-
subject { command.authenticate }
|
23
|
-
|
24
|
-
context 'new account' do
|
25
|
-
|
26
|
-
let(:email) { 'john@doe.net' }
|
27
|
-
let(:password) { 'asimplepassword' }
|
28
|
-
|
29
|
-
before do
|
30
|
-
allow_any_instance_of(Locomotive::Coal::Resource).to receive(:api_key).and_return('42')
|
31
|
-
allow(Thor::LineEditor).to receive(:readline).and_return('Y', 'John')
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'creates a new account and puts the auto-login information in the .netrc file' do
|
35
|
-
expect(netrc).to receive(:[]=).with('localhost:3000', ['john@doe.net', '42'])
|
36
|
-
is_expected.to eq(true)
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'existing account' do
|
42
|
-
|
43
|
-
let(:email) { TEST_API_EMAIL }
|
44
|
-
let(:password) { TEST_API_PASSWORD }
|
45
|
-
let(:netrc) { instance_double('netrc', save: true) }
|
46
|
-
|
47
|
-
before do
|
48
|
-
allow_any_instance_of(Locomotive::Coal::Resource).to receive(:api_key).and_return('42')
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'only puts the auto-login information in the .netrc file' do
|
52
|
-
expect(netrc).to receive(:[]=).with('localhost:3000', ['admin@locomotivecms.com', '42'])
|
53
|
-
is_expected.to eq(true)
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
@@ -1,147 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/../integration_helper'
|
3
|
-
require 'locomotive/wagon/commands/authenticate_command'
|
4
|
-
require 'locomotive/wagon/commands/delete_command'
|
5
|
-
require 'thor'
|
6
|
-
|
7
|
-
describe Locomotive::Wagon::DeleteCommand do
|
8
|
-
|
9
|
-
before { VCR.insert_cassette 'delete', record: :new_episodes, match_requests_on: [:method, :uri, :body, :headers] }
|
10
|
-
after { VCR.eject_cassette }
|
11
|
-
|
12
|
-
let(:env) { 'production' }
|
13
|
-
let(:path) { default_site_path }
|
14
|
-
let(:shell) { Thor::Shell::Color.new }
|
15
|
-
let(:options) { { data: true, verbose: true } }
|
16
|
-
let(:api_uri) { 'http://www.example.com:3000' }
|
17
|
-
let(:api_credentials) { { email: TEST_API_EMAIL, api_key: TEST_API_KEY } }
|
18
|
-
let(:client_api) { Locomotive::Coal::Client.new(api_uri, api_credentials, handle: 'www') }
|
19
|
-
|
20
|
-
before do
|
21
|
-
allow_any_instance_of(described_class).to receive(:read_deploy_settings).and_return({})
|
22
|
-
allow_any_instance_of(described_class).to receive(:api_site_client)
|
23
|
-
.and_return(client_api)
|
24
|
-
end
|
25
|
-
|
26
|
-
describe 'delete the current site' do
|
27
|
-
|
28
|
-
let(:client_api) { Locomotive::Coal::Client.new(api_uri, api_credentials, handle: 'short-lived') }
|
29
|
-
let(:_client_api) { Locomotive::Coal::Client.new(api_uri, api_credentials) }
|
30
|
-
|
31
|
-
before { allow(shell).to receive(:ask).and_return 'short-lived' }
|
32
|
-
|
33
|
-
before { _client_api.sites.create(name: 'ShortLived', handle: 'short-lived') }
|
34
|
-
|
35
|
-
subject { described_class.delete(env, path, 'site', nil, shell) }
|
36
|
-
|
37
|
-
it { is_expected.to be_a(Locomotive::Coal::Resource) }
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'resource exists' do
|
42
|
-
|
43
|
-
let(:resource_id) { nil }
|
44
|
-
|
45
|
-
subject { described_class.delete(env, path, resource_type, resource_id, shell) }
|
46
|
-
|
47
|
-
describe 'delete page resource' do
|
48
|
-
|
49
|
-
let(:resource_type) { 'page' }
|
50
|
-
let(:resource_id) { 'hello-world' }
|
51
|
-
|
52
|
-
before { client_api.pages.create(title: 'Hello world', slug: 'hello-world', parent: 'index', template: 'Hello world!') }
|
53
|
-
it { is_expected.to be_a(Locomotive::Coal::Resource) }
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
describe 'delete content type resource' do
|
58
|
-
|
59
|
-
let(:resource_type) { 'content_type' }
|
60
|
-
let(:resource_id) { 'fake_messages' }
|
61
|
-
|
62
|
-
before { client_api.content_types.create(name: 'FakeMessages', slug: 'fake-messages', fields: [{ label: 'E-mail', name: 'email', type: 'string' }]) }
|
63
|
-
it { is_expected.to be_a(Locomotive::Coal::Resource) }
|
64
|
-
|
65
|
-
describe 'all of them' do
|
66
|
-
|
67
|
-
let(:resource_type) { 'content_types' }
|
68
|
-
|
69
|
-
before { client_api.content_types.create(name: 'FakeMessages', slug: 'fake-messages-2', fields: [{ label: 'E-mail', name: 'email', type: 'string' }]) }
|
70
|
-
it { expect(subject['deletions']).to be >= 1 }
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
describe 'delete snippet resource' do
|
77
|
-
|
78
|
-
let(:resource_type) { 'snippet' }
|
79
|
-
let(:resource_id) { 'analytics' }
|
80
|
-
|
81
|
-
before { client_api.snippets.create(name: 'Analytics', slug: 'analytics', template: 'Analytics') }
|
82
|
-
it { is_expected.to be_a(Locomotive::Coal::Resource) }
|
83
|
-
|
84
|
-
describe 'all of them' do
|
85
|
-
|
86
|
-
let(:resource_type) { 'snippets' }
|
87
|
-
|
88
|
-
before { client_api.snippets.create(name: 'Analytics', slug: 'analytics_2', template: 'Analytics') }
|
89
|
-
it { expect(subject['deletions']).to be >= 1 }
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
94
|
-
|
95
|
-
describe 'delete all theme asset resources' do
|
96
|
-
|
97
|
-
let(:resource_type) { 'theme_assets' }
|
98
|
-
|
99
|
-
before {
|
100
|
-
client_api.theme_assets.create(source: Locomotive::Coal::UploadIO.new(File.join(default_site_path, 'icon.png')))
|
101
|
-
client_api.theme_assets.create(source: Locomotive::Coal::UploadIO.new(File.join(default_site_path, 'public', 'samples', 'photo.jpg')))
|
102
|
-
}
|
103
|
-
|
104
|
-
it { expect(subject['deletions']).to be >= 2 }
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
describe 'delete translation resource' do
|
109
|
-
|
110
|
-
let(:resource_type) { 'translation' }
|
111
|
-
let(:resource_id) { 'hello_world' }
|
112
|
-
|
113
|
-
before { client_api.translations.create(key: 'hello_world', values: { fr: 'Bonjour le monde' }) }
|
114
|
-
it { is_expected.to be_a(Locomotive::Coal::Resource) }
|
115
|
-
|
116
|
-
describe 'all of them' do
|
117
|
-
|
118
|
-
let(:resource_type) { 'translations' }
|
119
|
-
|
120
|
-
before { client_api.translations.create(key: 'hello_world_2', values: { fr: 'Bonjour le monde' }) }
|
121
|
-
it { expect(subject['deletions']).to be >= 1 }
|
122
|
-
|
123
|
-
end
|
124
|
-
|
125
|
-
end
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
context 'resource does not exist' do
|
130
|
-
describe '.delete' do
|
131
|
-
[ ['page', 'bogus_id'],
|
132
|
-
['content_type', 'bogus_id'],
|
133
|
-
['snippet', 'bogus_id'],
|
134
|
-
['translation', 'bogus_id']
|
135
|
-
].each do |resource, id|
|
136
|
-
describe resource do
|
137
|
-
it 'raises an exception' do
|
138
|
-
expect { described_class.delete(env, path, resource, id) }
|
139
|
-
.to raise_error(Locomotive::Coal::UnknownResourceError)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
|
147
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../integration_helper'
|
4
|
-
require 'locomotive/wagon/commands/push_command'
|
5
|
-
require 'thor'
|
6
|
-
|
7
|
-
describe Locomotive::Wagon::PushCommand do
|
8
|
-
|
9
|
-
before { VCR.insert_cassette 'push', match_requests_on: [:uri, :method, :query, :body, :headers] }
|
10
|
-
after { VCR.eject_cassette }
|
11
|
-
|
12
|
-
let(:env) { 'production' }
|
13
|
-
let(:path) { default_site_path }
|
14
|
-
let(:shell) { Thor::Shell::Color.new }
|
15
|
-
let(:options) { { data: true, verbose: true } }
|
16
|
-
let(:command) { described_class.new(env, path, options, shell) }
|
17
|
-
|
18
|
-
describe '#push' do
|
19
|
-
|
20
|
-
subject { command.push }
|
21
|
-
|
22
|
-
context 'unknown env' do
|
23
|
-
|
24
|
-
let(:credentials) { instance_double('Credentials', login: TEST_API_EMAIL, password: TEST_API_KEY) }
|
25
|
-
let(:env) { 'hosting' }
|
26
|
-
|
27
|
-
before do
|
28
|
-
allow(command).to receive(:ask_for_performing).with('You are about to deploy a new site').and_return(true)
|
29
|
-
allow(Netrc).to receive(:read).and_return(TEST_PLATFORM_ALT_URL => credentials)
|
30
|
-
allow(command).to receive(:ask_for_performing).with("Warning! You're about to deploy data which will alter the content of your site.").and_return(true)
|
31
|
-
allow(shell).to receive(:ask).with("What is the URL of your platform? (default: https://station.locomotive.works)").and_return(TEST_PLATFORM_URL)
|
32
|
-
allow(shell).to receive(:ask).with('What is the handle of your site? (default: a random one)').and_return('wagon-test')
|
33
|
-
end
|
34
|
-
|
35
|
-
after { restore_deploy_file(default_site_path) }
|
36
|
-
|
37
|
-
context 'answer yes to the deployment of the data' do
|
38
|
-
|
39
|
-
before do
|
40
|
-
allow(shell).to receive(:yes?).with("Are you sure you want to perform this action? (answer yes or no)").and_return(true)
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'creates a site and push the site' do
|
44
|
-
resources = []
|
45
|
-
ActiveSupport::Notifications.subscribe('wagon.push') do |name, start, finish, id, payload|
|
46
|
-
resources << payload[:name]
|
47
|
-
end
|
48
|
-
is_expected.not_to eq nil
|
49
|
-
expect(resources).to eq %w(site content_types content_entries pages snippets sections theme_assets translations)
|
50
|
-
end
|
51
|
-
|
52
|
-
context 'no previous authentication' do
|
53
|
-
|
54
|
-
let(:credentials) { nil }
|
55
|
-
|
56
|
-
it 'stops the deployment' do
|
57
|
-
expect(shell).to receive(:say).with("Sorry, we were unable to find the credentials for this platform.\nPlease first login using the \"bundle exec wagon auth\"", :yellow)
|
58
|
-
is_expected.to eq nil
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
context 'answer no to the deployment of the data' do
|
66
|
-
|
67
|
-
before do
|
68
|
-
allow(command).to receive(:ask_for_performing).with("Warning! You're about to deploy data which will alter the content of your site.").and_return(nil)
|
69
|
-
end
|
70
|
-
|
71
|
-
it "doesn't push the site" do
|
72
|
-
resources = []
|
73
|
-
ActiveSupport::Notifications.subscribe('wagon.push') do |name, start, finish, id, payload|
|
74
|
-
resources << payload[:name]
|
75
|
-
end
|
76
|
-
is_expected.to eq nil
|
77
|
-
expect(resources).to eq([])
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|