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.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/bin/wagon +64 -3
  4. data/bin/wagon_dev +11 -0
  5. data/generators/.DS_Store +0 -0
  6. data/generators/blank/Gemfile.tt +6 -2
  7. data/generators/blank/app/assets/stylesheets/app.scss +2 -0
  8. data/generators/blank/app/assets/stylesheets/sections/.empty_directory +1 -0
  9. data/generators/blank/app/views/pages/404.liquid +1 -1
  10. data/generators/blank/app/views/pages/index.liquid +1 -1
  11. data/generators/section/%type%.scss.tt +3 -0
  12. data/generators/section/template.liquid.tt +139 -80
  13. data/generators/webpack/app/assets/javascripts/.DS_Store +0 -0
  14. data/lib/locomotive/wagon.rb +15 -1
  15. data/lib/locomotive/wagon/cli.rb +11 -11
  16. data/lib/locomotive/wagon/commands/generate_command.rb +2 -7
  17. data/lib/locomotive/wagon/commands/push_command.rb +4 -8
  18. data/lib/locomotive/wagon/commands/serve_command.rb +5 -5
  19. data/lib/locomotive/wagon/generators/section.rb +121 -17
  20. data/lib/locomotive/wagon/generators/site/base.rb +0 -23
  21. data/lib/locomotive/wagon/version.rb +1 -1
  22. data/locomotivecms_wagon.gemspec +7 -4
  23. metadata +14 -233
  24. data/.gitignore +0 -36
  25. data/.rspec +0 -1
  26. data/.travis.yml +0 -11
  27. data/Gemfile +0 -30
  28. data/Rakefile +0 -32
  29. data/spec/fixtures/blog/app/content_types/comments.yml +0 -20
  30. data/spec/fixtures/blog/app/content_types/posts.yml +0 -19
  31. data/spec/fixtures/blog/app/views/pages/404.liquid +0 -11
  32. data/spec/fixtures/blog/app/views/pages/about-us.liquid.haml +0 -29
  33. data/spec/fixtures/blog/app/views/pages/index.liquid +0 -25
  34. data/spec/fixtures/blog/app/views/pages/posts.fr.liquid +0 -13
  35. data/spec/fixtures/blog/app/views/pages/posts.liquid +0 -13
  36. data/spec/fixtures/blog/app/views/pages/posts/content_type_template.fr.liquid +0 -14
  37. data/spec/fixtures/blog/app/views/pages/posts/content_type_template.liquid +0 -15
  38. data/spec/fixtures/blog/config/deploy.yml +0 -4
  39. data/spec/fixtures/blog/config/site.yml +0 -16
  40. data/spec/fixtures/blog/data/comments.yml +0 -16
  41. data/spec/fixtures/blog/data/posts.yml +0 -7
  42. data/spec/fixtures/cassettes/authenticate.yml +0 -236
  43. data/spec/fixtures/cassettes/delete.yml +0 -1255
  44. data/spec/fixtures/cassettes/push.yml +0 -9946
  45. data/spec/fixtures/cassettes/sync.yml +0 -11462
  46. data/spec/fixtures/default/README +0 -0
  47. data/spec/fixtures/default/app/content_types/bands.yml +0 -21
  48. data/spec/fixtures/default/app/content_types/events.yml +0 -25
  49. data/spec/fixtures/default/app/content_types/messages.yml +0 -17
  50. data/spec/fixtures/default/app/content_types/songs.yml +0 -25
  51. data/spec/fixtures/default/app/content_types/updates.yml +0 -33
  52. data/spec/fixtures/default/app/views/pages/404.liquid.haml +0 -10
  53. data/spec/fixtures/default/app/views/pages/about_us.fr.liquid.haml +0 -7
  54. data/spec/fixtures/default/app/views/pages/about_us.liquid.haml +0 -21
  55. data/spec/fixtures/default/app/views/pages/about_us.nb.liquid.haml +0 -4
  56. data/spec/fixtures/default/app/views/pages/about_us/jane_doe.liquid.haml +0 -4
  57. data/spec/fixtures/default/app/views/pages/about_us/john_doe.fr.liquid.haml +0 -5
  58. data/spec/fixtures/default/app/views/pages/about_us/john_doe.liquid.haml +0 -6
  59. data/spec/fixtures/default/app/views/pages/all.liquid.haml +0 -16
  60. data/spec/fixtures/default/app/views/pages/archives/news.liquid.haml +0 -10
  61. data/spec/fixtures/default/app/views/pages/contact.liquid.haml +0 -54
  62. data/spec/fixtures/default/app/views/pages/contest.liquid.haml +0 -18
  63. data/spec/fixtures/default/app/views/pages/events.liquid.haml +0 -64
  64. data/spec/fixtures/default/app/views/pages/filtered.liquid.haml +0 -20
  65. data/spec/fixtures/default/app/views/pages/grunge_bands.liquid.haml +0 -8
  66. data/spec/fixtures/default/app/views/pages/index.fr.liquid.haml +0 -3
  67. data/spec/fixtures/default/app/views/pages/index.liquid.haml +0 -101
  68. data/spec/fixtures/default/app/views/pages/layouts/simple.liquid.haml +0 -13
  69. data/spec/fixtures/default/app/views/pages/music.fr.liquid.haml +0 -4
  70. data/spec/fixtures/default/app/views/pages/music.liquid.haml +0 -42
  71. data/spec/fixtures/default/app/views/pages/songs/template.fr.liquid.haml +0 -16
  72. data/spec/fixtures/default/app/views/pages/songs/template.liquid.haml +0 -18
  73. data/spec/fixtures/default/app/views/pages/songs/template/band.liquid.haml +0 -16
  74. data/spec/fixtures/default/app/views/pages/store.fr.liquid.haml +0 -5
  75. data/spec/fixtures/default/app/views/pages/store.liquid +0 -5
  76. data/spec/fixtures/default/app/views/pages/tags/nav.liquid.haml +0 -6
  77. data/spec/fixtures/default/app/views/pages/tags/nav_in_deep.liquid.haml +0 -6
  78. data/spec/fixtures/default/app/views/pages/unlisted_pages.liquid.haml +0 -9
  79. data/spec/fixtures/default/app/views/snippets/A_Complicated-one.liquid.haml +0 -1
  80. data/spec/fixtures/default/app/views/snippets/footer.liquid.haml +0 -6
  81. data/spec/fixtures/default/app/views/snippets/header.liquid.haml +0 -1
  82. data/spec/fixtures/default/app/views/snippets/song.fr.liquid.haml +0 -8
  83. data/spec/fixtures/default/app/views/snippets/song.liquid +0 -12
  84. data/spec/fixtures/default/config/autoprefixer.yml +0 -2
  85. data/spec/fixtures/default/config/deploy.yml +0 -12
  86. data/spec/fixtures/default/config/deploy_example.yml +0 -12
  87. data/spec/fixtures/default/config/site.yml +0 -13
  88. data/spec/fixtures/default/config/translations.yml +0 -3
  89. data/spec/fixtures/default/data/bands.yml +0 -13
  90. data/spec/fixtures/default/data/events.yml +0 -54
  91. data/spec/fixtures/default/data/songs.yml +0 -46
  92. data/spec/fixtures/default/data/updates.yml +0 -48
  93. data/spec/fixtures/default/icon.png +0 -0
  94. data/spec/fixtures/default/public/fonts/chunkfive-webfont.eot +0 -0
  95. data/spec/fixtures/default/public/fonts/chunkfive-webfont.svg +0 -213
  96. data/spec/fixtures/default/public/fonts/chunkfive-webfont.ttf +0 -0
  97. data/spec/fixtures/default/public/fonts/chunkfive-webfont.woff +0 -0
  98. data/spec/fixtures/default/public/fonts/chunkfive.css +0 -8
  99. data/spec/fixtures/default/public/fonts/chunkfive.otf +0 -0
  100. data/spec/fixtures/default/public/images/nav_on.png +0 -0
  101. data/spec/fixtures/default/public/images/photo_frame.png +0 -0
  102. data/spec/fixtures/default/public/images/sep.png +0 -0
  103. data/spec/fixtures/default/public/images/top.jpg +0 -0
  104. data/spec/fixtures/default/public/javascripts/application.js.coffee +0 -2
  105. data/spec/fixtures/default/public/javascripts/common.js +0 -1
  106. data/spec/fixtures/default/public/samples/asset_collections/cover.jpg +0 -0
  107. data/spec/fixtures/default/public/samples/photo.jpg +0 -0
  108. data/spec/fixtures/default/public/samples/photo_2.jpg +0 -0
  109. data/spec/fixtures/default/public/stylesheets/application.css +0 -64
  110. data/spec/fixtures/default/public/stylesheets/other/extra.css.less +0 -8
  111. data/spec/fixtures/default/public/stylesheets/other/style.css.scss +0 -13
  112. data/spec/fixtures/default/public/stylesheets/reboot.css +0 -77
  113. data/spec/integration/cli_spec.rb +0 -17
  114. data/spec/integration/commands/authenticate_command_spec.rb +0 -60
  115. data/spec/integration/commands/delete_command_spec.rb +0 -147
  116. data/spec/integration/commands/push_command_spec.rb +0 -86
  117. data/spec/integration/commands/sync_command_spec.rb +0 -60
  118. data/spec/integration/generators/page_spec.rb +0 -87
  119. data/spec/integration/generators/relationship_spec.rb +0 -102
  120. data/spec/integration/integration_helper.rb +0 -15
  121. data/spec/spec_helper.rb +0 -19
  122. data/spec/support/api_settings.rb +0 -5
  123. data/spec/support/chronic.rb +0 -6
  124. data/spec/support/helpers.rb +0 -39
  125. data/spec/support/matchers.rb +0 -5
  126. data/spec/support/pry.rb +0 -4
  127. data/spec/support/thor.rb +0 -12
  128. data/spec/support/vcr.rb +0 -27
  129. data/spec/unit/commands/pull_sub_commands/concerns/assets_concern_spec.rb +0 -48
  130. data/spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb +0 -41
  131. data/spec/unit/commands/push_sub_commands/push_pages_command_spec.rb +0 -125
  132. data/spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb +0 -42
  133. data/spec/unit/decorators/content_entry_decorator_spec.rb +0 -104
  134. data/spec/unit/decorators/page_decorator_spec.rb +0 -35
  135. data/spec/unit/decorators/site_decorator_spec.rb +0 -62
  136. data/spec/unit/decorators/theme_asset_decorator_spec.rb +0 -89
  137. data/spec/unit/tools/glob_spec.rb +0 -26
  138. 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: 4afa7187e1d572da68484ff666c37873c60853ad6a1cfd926baf74ed84b8620d
4
- data.tar.gz: 5ac5bbd400e61bd616e34d968d139450a2ab09c52ee380d7aebc47069d1fdf26
3
+ metadata.gz: 57c2e34dcbc2bebe704d87beae5cf7cba03f745b98213d24a241be72639ea695
4
+ data.tar.gz: bfce871397862b72e3c683f903c8e8eb2d0185a90774271ba4dfe62fa30c4a44
5
5
  SHA512:
6
- metadata.gz: 396551c4762052faa7a1455e8e5a754412ce6bcaa26a651dd403918eca2e5f513849a7d07528662369ba6f0d1a1e41a504fb909751ae4990753f6170d334f92d
7
- data.tar.gz: af779bab2277b73d3c2bf43b35e1d0a76ac79f4950ca9ed466f0ce5e01791a4429c5884fbf53f65737736067a27bd219904718536ee1b6109326bef9f1a7376f
6
+ metadata.gz: 3bc8a189495793048947446e05e95b417c0059f0518efc71b9d7b5d8c7e6d86ab5f0337d4e156b0c75b289bb9b35a7780af325cf695347bef1e25d941e241bfc
7
+ data.tar.gz: e98dbbb7f68c1b573b8e9924c6687c39c9c82039ea4125209651ed4781178f0032f914b01b4b532b07f30e7fc16603668e1f9358a3ecd7f9563fa6a04a613d6e
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 NoCoffee
3
+ Copyright (c) 2019 NoCoffee
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/bin/wagon CHANGED
@@ -1,12 +1,73 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # needed if you launch it without bundler
4
- $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
5
- $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../vendor'))
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
@@ -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
@@ -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.9.1', require: 'rb-fsevent' if RUBY_PLATFORM.include?('darwin')
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.9', require: 'rb-inotify' if RUBY_PLATFORM.include?('linux')
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
@@ -1 +1,3 @@
1
1
  // Wagon main stylesheet file
2
+
3
+ // Register sections here. DO NOT REMOVE OR UPDATE THIS LINE
@@ -2,7 +2,7 @@
2
2
  title: Page not found
3
3
  published: true
4
4
  ---
5
- {% extends layouts/default %}
5
+ {% extends 'layouts/default' %}
6
6
 
7
7
  {% block 'main' %}
8
8
 
@@ -2,7 +2,7 @@
2
2
  title: Home page
3
3
  published: true
4
4
  ---
5
- {% extends layouts/default %}
5
+ {% extends 'layouts/default' %}
6
6
 
7
7
  {% block 'main' %}
8
8
 
@@ -0,0 +1,3 @@
1
+ .<%= options[:type].dasherize %>-section {
2
+
3
+ }
@@ -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
- - label: "My awesome title"
23
- id: title
24
- type: text
25
- <% if config[:global] -%>default: "Hello world"<% end %>
26
- - label: "An image"
27
- id: image
28
- type: image_picker
29
- <% if config[:global] -%>default: "/samples/images/default.svg"<% end %>
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
- - name: List item
35
- type: list_item
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
- - label: "Item title"
38
- id: title
39
- type: text
40
- default: "my title"
41
- - label: "Item image"
42
- id: image
43
- type: image_picker
44
- default: "/samples/images/default.svg"
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
- <% if config[:global] -%>
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 tobe used along with section_dropzone liquid tag
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
- title: "Hello world"
78
- blocks:
79
- - type: list_item
80
- settings:
81
- title: "Item #1"
82
- - type: list_item
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
- title: "Item #2"
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 filled with random settings and blocks.
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
- title: "My awesome section"
114
- blocks:
115
- - type: list_item
116
- settings:
117
- title: "Item #1"
118
- - type: list_item
119
- settings:
120
- title: "Item #2"
121
- - type: list_item
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
- title: "Item #3"
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
- title: "My awesome <%= config[:type].humanize %> section"
136
- blocks:
137
- - type: "list_item"
138
- settings:
139
- title: "Item #1"
140
- - type: "list_item"
141
- settings:
142
- title: "Item #2"
143
- - type: "list_item"
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
- title: "Item #3"
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>{{ section.settings.title }}</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
- {{ block.settings.title }}
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>
@@ -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, skip bundle flag]
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