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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57c2e34dcbc2bebe704d87beae5cf7cba03f745b98213d24a241be72639ea695
|
4
|
+
data.tar.gz: bfce871397862b72e3c683f903c8e8eb2d0185a90774271ba4dfe62fa30c4a44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bc8a189495793048947446e05e95b417c0059f0518efc71b9d7b5d8c7e6d86ab5f0337d4e156b0c75b289bb9b35a7780af325cf695347bef1e25d941e241bfc
|
7
|
+
data.tar.gz: e98dbbb7f68c1b573b8e9924c6687c39c9c82039ea4125209651ed4781178f0032f914b01b4b532b07f30e7fc16603668e1f9358a3ecd7f9563fa6a04a613d6e
|
data/MIT-LICENSE
CHANGED
data/bin/wagon
CHANGED
@@ -1,12 +1,73 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
#
|
4
|
-
|
5
|
-
|
3
|
+
# Rbenv shims and the bundler/inline feature don't work quite well, at least in Ruby 2.5.0.
|
4
|
+
#
|
5
|
+
# The reasons is that Wagon rbenv shim activates all the gems of the Wagon gem.
|
6
|
+
# When activating them, it might load versions of the gems different from
|
7
|
+
# the ones specified by the gemfile statement.
|
8
|
+
#
|
9
|
+
# Hopefully, it just activates meaning it doesn't load them.
|
10
|
+
# So the solution is simple: reset both the Gem loaded specs and the $LOAD_PATH variable.
|
11
|
+
def reset_gem_specs!
|
12
|
+
return unless Gem.loaded_specs.keys.include?('locomotivecms_wagon')
|
13
|
+
|
14
|
+
core_gems = %w(did_you_mean).freeze
|
15
|
+
|
16
|
+
Gem.loaded_specs.values.each do |spec|
|
17
|
+
next if core_gems.include?(spec.name)
|
18
|
+
spec.full_require_paths.each do |path|
|
19
|
+
$LOAD_PATH.delete(path)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Without this statement, bundler will raise the infamous "You have already activated ..."
|
23
|
+
Gem.loaded_specs.delete(spec.name)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if ENV["BUNDLE_BIN_PATH"]
|
28
|
+
# Wagon is launched within the Bundler context (basically with bundle exec wagon),
|
29
|
+
# do nothing since Bundler already took take care of loading the right gems.
|
30
|
+
ENV['WAGON_GEMFILE'] = '1'
|
31
|
+
elsif ENV['WAGON_GEMFILE']
|
32
|
+
reset_gem_specs!
|
33
|
+
|
34
|
+
# For LocomotiveCMS developers who want to run a local version of Wagon
|
35
|
+
# with gems like Steam, Coal and Common pointing to the local sources
|
36
|
+
puts "!!!WARNING!!! Using Wagon described in the following Gemfile: #{ENV['WAGON_GEMFILE']}"
|
37
|
+
|
38
|
+
ENV['BUNDLE_GEMFILE'] ||= ENV['WAGON_GEMFILE']
|
39
|
+
|
40
|
+
require 'bundler'
|
41
|
+
Bundler.require
|
42
|
+
else
|
43
|
+
reset_gem_specs!
|
44
|
+
|
45
|
+
# Almost of all the users will rely on the gems described in
|
46
|
+
# the gemspec of the current Wagon version.
|
47
|
+
require 'bundler/inline'
|
48
|
+
|
49
|
+
gemfile do
|
50
|
+
source 'https://rubygems.org'
|
51
|
+
|
52
|
+
gemspec path: File.dirname(__FILE__) + '/..'
|
53
|
+
|
54
|
+
# Mac OS X
|
55
|
+
gem 'rb-fsevent', '~> 0.10.3', require: 'rb-fsevent' if RUBY_PLATFORM.include?('darwin')
|
56
|
+
|
57
|
+
# Unix
|
58
|
+
gem 'therubyracer', require: 'v8', platforms: :ruby unless RUBY_PLATFORM.include?('darwin')
|
59
|
+
|
60
|
+
gem 'rb-inotify', '~> 0.10.0', require: 'rb-inotify' if RUBY_PLATFORM.include?('linux')
|
61
|
+
|
62
|
+
# Windows
|
63
|
+
gem 'wdm', '~> 0.1.1', require: 'wdm' if RUBY_PLATFORM =~ /mswin|mingw/i
|
64
|
+
end
|
65
|
+
end
|
6
66
|
|
7
67
|
$stdout.sync = true
|
8
68
|
|
9
69
|
require 'locomotive/wagon'
|
10
70
|
require 'locomotive/wagon/cli'
|
11
71
|
|
72
|
+
# Let the magin happens
|
12
73
|
Locomotive::Wagon::CLI::Main.start
|
data/bin/wagon_dev
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
bin = File.dirname(__FILE__) + '/wagon'
|
4
|
+
gemfile = File.dirname(__FILE__) + '/../Gemfile'
|
5
|
+
cmd = "BUNDLE_GEMFILE=#{gemfile} bundle exec #{bin} #{ARGV.join(' ')}"
|
6
|
+
|
7
|
+
begin
|
8
|
+
system(cmd)
|
9
|
+
rescue SignalException => e
|
10
|
+
# do nothing
|
11
|
+
end
|
Binary file
|
data/generators/blank/Gemfile.tt
CHANGED
@@ -1,15 +1,19 @@
|
|
1
|
+
# By default, Wagon 3 doesn't need `bundle exec` to be executed.
|
2
|
+
# However, if down the road, you want to run a specific version of Wagon or try a new version
|
3
|
+
# without overriding the global Wagon binary, please use this Gemfile.
|
4
|
+
|
1
5
|
source 'https://rubygems.org'
|
2
6
|
|
3
7
|
gem 'locomotivecms_wagon', '~> <%= config[:version] -%>'
|
4
8
|
|
5
9
|
group :development do
|
6
10
|
# Mac OS X
|
7
|
-
gem 'rb-fsevent', '~> 0.
|
11
|
+
gem 'rb-fsevent', '~> 0.10.0', require: 'rb-fsevent' if RUBY_PLATFORM.include?('darwin')
|
8
12
|
|
9
13
|
# Unix
|
10
14
|
gem 'therubyracer', require: 'v8', platforms: :ruby unless RUBY_PLATFORM.include?('darwin')
|
11
15
|
|
12
|
-
gem 'rb-inotify', '~> 0.
|
16
|
+
gem 'rb-inotify', '~> 0.10.0', require: 'rb-inotify' if RUBY_PLATFORM.include?('linux')
|
13
17
|
|
14
18
|
# Windows
|
15
19
|
gem 'wdm', '~> 0.1.1', require: 'wdm' if RUBY_PLATFORM =~ /mswin|mingw/i
|
@@ -0,0 +1 @@
|
|
1
|
+
.empty_directory
|
@@ -18,88 +18,99 @@ icon: <%= config[:icon] || 'image_text' %>
|
|
18
18
|
# keep_icon: true
|
19
19
|
|
20
20
|
# Definition of the settings:
|
21
|
+
# A setting type can be one of the following values: text, image_picker, checkbox, radio, select, url, hint, content_type.
|
22
|
+
# Please visit: https://doc.locomotivecms.com/docs/json-definition for more explanation.
|
21
23
|
settings:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
<%- config[:settings].each do |setting| -%>
|
25
|
+
- label: "<%= setting.label %>"
|
26
|
+
id: <%= setting.id %>
|
27
|
+
type: <%= setting.type %>
|
28
|
+
<%- case setting.type -%>
|
29
|
+
<%- when 'text' -%>
|
30
|
+
# html: true
|
31
|
+
# line_break: true
|
32
|
+
<%- when 'select', 'radio' -%>
|
33
|
+
options:
|
34
|
+
- label: Option 1
|
35
|
+
value: option_1
|
36
|
+
- label: Option 2
|
37
|
+
value: option_2
|
38
|
+
<%- end -%>
|
39
|
+
<% if config[:global] && setting.has_value? -%>default: <%= setting.default %><% end -%>
|
40
|
+
|
41
|
+
<%- end -%>
|
31
42
|
# Definition of the blocks.
|
32
|
-
# You can define as many types of blocks you want.
|
33
|
-
blocks:
|
34
|
-
|
35
|
-
|
43
|
+
# You can define as many types of blocks as you want.
|
44
|
+
blocks: <%- if config[:blocks].blank? -%>[]
|
45
|
+
<% end %>
|
46
|
+
<%- config[:blocks].each do |(type, settings)| -%>
|
47
|
+
- name: "<%= type.humanize %>"
|
48
|
+
type: <%= type %>
|
36
49
|
settings:
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
50
|
+
<%- settings.each do |setting| -%>
|
51
|
+
- label: "<%= setting.label %>"
|
52
|
+
id: <%= setting.id %>
|
53
|
+
type: <%= setting.type %>
|
54
|
+
<%- case setting.type -%>
|
55
|
+
<%- when 'text' -%>
|
56
|
+
# html: true
|
57
|
+
# line_break: true
|
58
|
+
<%- when 'select', 'radio' -%>
|
59
|
+
options:
|
60
|
+
- label: Option 1
|
61
|
+
value: option_1
|
62
|
+
- label: Option 2
|
63
|
+
value: option_2
|
64
|
+
<%- end -%>
|
65
|
+
<%- if setting.has_value? -%>
|
66
|
+
default: <%= setting.default %>
|
67
|
+
<%- end -%>
|
68
|
+
<%- end -%>
|
69
|
+
|
70
|
+
<%- end -%>
|
46
71
|
# By default, in the editor UI, blocks will be listed below the "Content" title.
|
47
72
|
# The title can be changed with the following property:
|
48
73
|
# blocks_label: "My list of items"
|
49
74
|
|
50
|
-
<%
|
51
|
-
# Content of the global section. This content will be used in all the pages
|
52
|
-
# referencing this section.
|
53
|
-
default:
|
54
|
-
settings:
|
55
|
-
title: "Hello world"
|
56
|
-
image: "/samples/images/default.png"
|
57
|
-
blocks:
|
58
|
-
- type: list_item
|
59
|
-
settings:
|
60
|
-
title: "Item #1"
|
61
|
-
image: "/samples/images/default.png"
|
62
|
-
- type: list_item
|
63
|
-
settings:
|
64
|
-
title: "Item #2"
|
65
|
-
image: "/samples/images/default.png"
|
66
|
-
- type: list_item
|
67
|
-
settings:
|
68
|
-
title: "Item #3"
|
69
|
-
image: "/samples/images/default.png"
|
70
|
-
<% else -%>
|
75
|
+
<% unless config[:global] -%>
|
71
76
|
# Presets can be seen as different versions of a same section.
|
72
|
-
# Useless if the section is not aimed
|
77
|
+
# Useless if the section is not aimed to be used along with section_dropzone liquid tag
|
73
78
|
presets:
|
74
79
|
- name: "<%= config[:name] %>"
|
75
80
|
category: "Category"
|
76
81
|
settings:
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
82
|
+
<%- config[:settings].each do |setting| -%>
|
83
|
+
<%- next unless setting.has_value? -%>
|
84
|
+
<%= setting.id %>: <%= setting.default %>
|
85
|
+
<%- end -%>
|
86
|
+
blocks: <%- if config[:blocks].blank? -%>[]
|
87
|
+
<% end %>
|
88
|
+
<%- 3.times do -%>
|
89
|
+
<%- config[:blocks].each do |(type, settings)| -%>
|
90
|
+
- type: <%= type %>
|
83
91
|
settings:
|
84
|
-
|
92
|
+
<%- settings.each do |setting| -%>
|
93
|
+
<%- next unless setting.has_value? -%>
|
94
|
+
<%= setting.id %>: <%= setting.default %>
|
95
|
+
<%- end -%>
|
96
|
+
<%- end -%>
|
97
|
+
<%- end -%>
|
85
98
|
<% end %>
|
86
99
|
---
|
87
100
|
{% comment %}
|
88
|
-
Above is the YAML definition of your section
|
89
|
-
The setting's type can be one of the following values: checkbox, image_picker, index, radio, text, select, url.
|
90
|
-
Modify it to match your needs. Please visit: https://doc.locomotivecms.com/v4.0/docs/json-definition.
|
101
|
+
Above is the YAML definition of your section. Modify it to match your needs.
|
91
102
|
|
92
103
|
<% if config[:global] -%>
|
93
104
|
To use your global section, just add the following code in your layout template:
|
94
105
|
|
95
|
-
{% global_section <%= config[:type] %> %}
|
106
|
+
{% global_section '<%= config[:type] %>' %}
|
96
107
|
|
97
108
|
<% else -%>
|
98
109
|
To use your section, 2 possibilities:
|
99
110
|
|
100
111
|
1. within a dropzone
|
101
112
|
|
102
|
-
Make sure that your layouts includes the following liquid tag:
|
113
|
+
Make sure that your layouts or your page includes the following liquid tag:
|
103
114
|
|
104
115
|
{% sections_dropzone %}
|
105
116
|
|
@@ -110,21 +121,26 @@ lines in the YAML section of any page including the {% sections_dropzone %}
|
|
110
121
|
sections_dropzone_content:
|
111
122
|
- type: "<%= config[:type] %>"
|
112
123
|
settings:
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
- type:
|
124
|
+
<%- config[:settings].each do |setting| -%>
|
125
|
+
<%- next unless setting.has_value? -%>
|
126
|
+
<%= setting.id %>: <%= setting.default %>
|
127
|
+
<%- end -%>
|
128
|
+
blocks: <%- if config[:blocks].blank? -%>[]
|
129
|
+
<% end %>
|
130
|
+
<%- 3.times do -%>
|
131
|
+
<%- config[:blocks].each do |(type, settings)| -%>
|
132
|
+
- type: <%= type %>
|
122
133
|
settings:
|
123
|
-
|
134
|
+
<%- settings.each do |setting| -%>
|
135
|
+
<%- next unless setting.has_value? -%>
|
136
|
+
<%= setting.id %>: <%= setting.default %>
|
137
|
+
<%- end -%>
|
138
|
+
<%- end -%>
|
139
|
+
<%- end -%>
|
124
140
|
|
125
141
|
2. as stand-alone section
|
126
142
|
|
127
|
-
{% section <%= config[:type] %> %}
|
143
|
+
{% section '<%= config[:type] %>' %}
|
128
144
|
|
129
145
|
If you want to test this section in your Wagon site, add the following
|
130
146
|
lines in the YAML section of the page including the statement above or complete it.
|
@@ -132,27 +148,70 @@ lines in the YAML section of the page including the statement above or complete
|
|
132
148
|
sections_content:
|
133
149
|
<%= config[:type] %>:
|
134
150
|
settings:
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
- type:
|
151
|
+
<%- config[:settings].each do |setting| -%>
|
152
|
+
<%- next unless setting.has_value? -%>
|
153
|
+
<%= setting.id %>: <%= setting.default %>
|
154
|
+
<%- end -%>
|
155
|
+
blocks: <%- if config[:blocks].blank? -%>[]
|
156
|
+
<% end %>
|
157
|
+
<%- 3.times do -%>
|
158
|
+
<%- config[:blocks].each do |(type, settings)| -%>
|
159
|
+
- type: <%= type %>
|
144
160
|
settings:
|
145
|
-
|
161
|
+
<%- settings.each do |setting| -%>
|
162
|
+
<%- next unless setting.has_value? -%>
|
163
|
+
<%= setting.id %>: <%= setting.default %>
|
164
|
+
<%- end -%>
|
165
|
+
<%- end -%>
|
166
|
+
<%- end -%>
|
146
167
|
|
147
168
|
<% end -%>
|
148
169
|
{% endcomment %}
|
149
170
|
<div id="{{ section.anchor_id }}" class="<%= config[:type].dasherize %>-section" {{ section.locomotive_attributes }}>
|
150
|
-
<h2>
|
171
|
+
<h2>Section : <%= config[:name] %></h2>
|
172
|
+
|
173
|
+
<hr/>
|
174
|
+
|
175
|
+
<h3>Settings</h3>
|
176
|
+
<%- config[:settings].each do |setting| -%>
|
177
|
+
<%- next unless setting.has_value? -%>
|
178
|
+
<%- case setting.type -%>
|
179
|
+
<%- when 'text' %>
|
180
|
+
<div>{{ section.settings.<%= setting.id -%> }}</div>
|
181
|
+
<%- when 'image_picker' -%>
|
182
|
+
<p><img src="{{ section.settings.<%= setting.id -%> }}" /></p>
|
183
|
+
<%- when 'url' -%>
|
184
|
+
<p><a href="{{ section.settings.<%= setting.id -%> }}" {{ section.settings.<%= setting.id -%>.new_window_attribute }}><%= setting.label -%></a></p>
|
185
|
+
<%- when 'select', 'radio', 'checkbox' -%>
|
186
|
+
<p><%= setting.type -%>: {{ section.settings.<%= setting.id -%> }}</p>
|
187
|
+
<%- end -%>
|
188
|
+
<%- end -%>
|
189
|
+
|
190
|
+
<% unless config[:blocks].blank? -%>
|
191
|
+
<hr/>
|
192
|
+
|
193
|
+
<h3>Blocks</h3>
|
151
194
|
<ul>
|
152
195
|
{% for block in section.blocks %}
|
153
|
-
<li {{ block.locomotive_attributes }}>
|
154
|
-
|
196
|
+
<li {{ block.locomotive_attributes }} data-index="{{ forloop.index0 }}">
|
197
|
+
<%- config[:blocks].each do |(type, settings)| -%>
|
198
|
+
<h4>Settings for <%= type.humanize -%></h4>
|
199
|
+
<%- settings.each do |setting| -%>
|
200
|
+
<%- next unless setting.has_value? -%>
|
201
|
+
<%- case setting.type -%>
|
202
|
+
<%- when 'text' %>
|
203
|
+
<div>{{ block.settings.<%= setting.id -%> }}</div>
|
204
|
+
<%- when 'image_picker' -%>
|
205
|
+
<p><img src="{{ block.settings.<%= setting.id -%> }}" /></p>
|
206
|
+
<%- when 'url' -%>
|
207
|
+
<p><a href="{{ block.settings.<%= setting.id -%> }}" {{ block.settings.<%= setting.id -%>.new_window_attribute }}><%= setting.label -%></a></p>
|
208
|
+
<%- when 'select', 'radio', 'checkbox' -%>
|
209
|
+
<p><%= setting.type -%>: {{ block.settings.<%= setting.id -%> }}</p>
|
210
|
+
<%- end -%>
|
211
|
+
<%- end -%>
|
212
|
+
<%- end -%>
|
155
213
|
</li>
|
156
214
|
{% endfor %}
|
157
215
|
</ul>
|
216
|
+
<% end %>
|
158
217
|
</div>
|
Binary file
|
data/lib/locomotive/wagon.rb
CHANGED
@@ -22,7 +22,7 @@ module Locomotive
|
|
22
22
|
# Create a site from a site generator.
|
23
23
|
#
|
24
24
|
# @param [ Object ] generator The wrapping class of the generator itself
|
25
|
-
# @param [ Array ] args [name of the site, destination path of the site
|
25
|
+
# @param [ Array ] args [name of the site, destination path of the site]
|
26
26
|
# @param [ Hash ] options General options (ex: --force-color)
|
27
27
|
#
|
28
28
|
def self.init(generator_klass, args, options = {})
|
@@ -121,5 +121,19 @@ module Locomotive
|
|
121
121
|
Locomotive::Wagon::DeleteCommand.delete(env, path, resource, slug, shell)
|
122
122
|
end
|
123
123
|
|
124
|
+
def self.require_misc_gems
|
125
|
+
return if ENV['WAGON_GEMFILE'].nil?
|
126
|
+
|
127
|
+
# at this point, we are sure that in a bundle exec contact
|
128
|
+
begin
|
129
|
+
require 'bundler'
|
130
|
+
::Bundler.require(:misc)
|
131
|
+
rescue Exception => e
|
132
|
+
puts "Warning: cant' require the Gemfile misc group, reason: #{e.message}"
|
133
|
+
# Bundler is not defined or there is an issue
|
134
|
+
# with one of the gems in the misc group
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
124
138
|
end
|
125
139
|
end
|