locomotivecms_wagon 3.0.5 → 3.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92d89676829bf8c36fbe78d8ba8ae6027c85511f1ddf83681bfe2db4643caa37
4
- data.tar.gz: 37e6d118553983814533030e8af5ef1087cf6bf20600c7a2beabe2ef77e3875f
3
+ metadata.gz: f54629f1032bae52a1fe919219aeb57f893626cf4e2572707b5d284104495b96
4
+ data.tar.gz: 9a7515c89ceca996654f7d2c96a59ec7f6267991873495cfdd119d146ef4a248
5
5
  SHA512:
6
- metadata.gz: a6f64d982b4995cdbfd8bda086d0e07e0f5312b3f7f104b2ad69dee41a4bfea1a40887f8d7d95d702434452535b41726ccdfef5c9f1da72c4d68a137ac469b81
7
- data.tar.gz: ed49b5c7d752f94973f8a841e008dacab47d9a189460a393733310b1c4656e3d306a79d58effc49c90afa4fc7998e2d685b856dd4d193776850cb7c0020b114f
6
+ metadata.gz: 29ca4b5df0580e63103ce5f36f84f793af08308cf86b370b0f95d990f20fb62752b979cd2ceb6c1da4cffa43ea3030166d5d869f98def4f9b5255d1ddedbe920
7
+ data.tar.gz: 8860c33d3a50e38f43696a8c7010394b0692db0fe7d71051713dc76f703f57826cb6c643b3edaa453772d9204321cfbbbebd86db294918c40a063ae3ad76dabe
data/generators/.DS_Store CHANGED
Binary file
@@ -180,6 +180,8 @@ sections_content:
180
180
  <div>{{ section.settings.<%= setting.id -%> }}</div>
181
181
  <%- when 'image_picker' -%>
182
182
  <p><img src="{{ section.settings.<%= setting.id -%> }}" /></p>
183
+ <%- when 'asset_picker' -%>
184
+ <p><a href="{{ section.settings.<%= setting.id -%> }}">{{ section.settings.<%= setting.id -%>.name }}</a></p>
183
185
  <%- when 'url' -%>
184
186
  <p><a href="{{ section.settings.<%= setting.id -%> }}" {{ section.settings.<%= setting.id -%>.new_window_attribute }}><%= setting.label -%></a></p>
185
187
  <%- when 'select', 'radio', 'checkbox' -%>
@@ -203,6 +205,8 @@ sections_content:
203
205
  <div>{{ block.settings.<%= setting.id -%> }}</div>
204
206
  <%- when 'image_picker' -%>
205
207
  <p><img src="{{ block.settings.<%= setting.id -%> }}" /></p>
208
+ <%- when 'asset_picker' -%>
209
+ <p><a href="{{ block.settings.<%= setting.id -%> }}">{{ block.settings.<%= setting.id -%>.name }}</a></p>
206
210
  <%- when 'url' -%>
207
211
  <p><a href="{{ block.settings.<%= setting.id -%> }}" {{ block.settings.<%= setting.id -%>.new_window_attribute }}><%= setting.label -%></a></p>
208
212
  <%- when 'select', 'radio', 'checkbox' -%>
@@ -304,12 +304,12 @@ module Locomotive
304
304
  end
305
305
 
306
306
  desc 'serve [PATH]', 'Serve a site from the file system'
307
- option :host, aliases: '-h', type: 'string', default: '0.0.0.0', desc: 'The host (address) of the Thin server'
308
- option :port, aliases: '-p', type: 'string', default: '3333', desc: 'The port of the Thin server'
307
+ option :host, aliases: '-h', type: 'string', default: 'localhost', desc: 'The host (address) of the server'
308
+ option :port, aliases: '-p', type: 'string', default: '3333', desc: 'The port of the server'
309
309
  option :env, aliases: '-e', type: 'string', default: 'local', desc: 'The env used to the data of the pages and content entries'
310
- option :daemonize, aliases: '-d', type: 'boolean', default: false, desc: 'Run daemonized Thin server in the background'
310
+ option :daemonize, aliases: '-d', type: 'boolean', default: false, desc: 'Run daemonized server in the background'
311
311
  option :force_polling, aliases: '-o', type: 'boolean', default: false, desc: 'Force polling of files for reload'
312
- option :force, aliases: '-f', type: 'boolean', default: false, desc: 'Stop the current daemonized Thin server if found before starting a new one'
312
+ option :force, aliases: '-f', type: 'boolean', default: false, desc: 'Stop the current daemonized server if found before starting a new one'
313
313
  option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'Display the full error stack trace if an error occurs'
314
314
  option :debug, type: 'boolean', default: false, desc: 'Display some debugging information (rack middleware stack)'
315
315
  def serve(path = '.')
@@ -13,7 +13,7 @@ module Locomotive::Wagon
13
13
 
14
14
  class PullCommand < Struct.new(:env, :path, :options, :shell)
15
15
 
16
- RESOURCES = %w(site pages content_types content_entries snippets theme_assets translations content_assets).freeze
16
+ RESOURCES = %w(site pages content_types content_entries snippets sections theme_assets translations content_assets).freeze
17
17
 
18
18
  include ApiConcern
19
19
  include DeployFileConcern
@@ -7,7 +7,7 @@ module Locomotive::Wagon
7
7
 
8
8
  module AssetsConcern
9
9
 
10
- REGEX = /((https?:\/\/\S+)?\/sites\/[0-9a-f]{24}\/(assets|pages|theme|content_entry[0-9a-f]{24})\/(([^;.]+)\/)*([a-zA-Z_\-0-9.%]+)(\?\w+)?)/
10
+ REGEX = /((https?:\/\/\S+)?\/sites\/[0-9a-f]{24}\/(assets|pages|theme|content_entry[0-9a-f]{24})\/(([^;.\"]+)\/)*([a-zA-Z_\-0-9.%]+)(\?\w+)?)/
11
11
 
12
12
  # The content assets on the remote engine follows the format: /sites/<id>/assets/<type>/<file>
13
13
  # This method replaces these urls by their local representation. <type>/<file>
@@ -50,7 +50,7 @@ module Locomotive::Wagon
50
50
  private
51
51
 
52
52
  def find_unique_filepath(filepath, binary_file, index = 1)
53
- if File.exists?(filepath)
53
+ if File.exists?(filepath) && File.file?(filepath)
54
54
  # required because we need to make sure we use the content of file from its start
55
55
  binary_file.rewind
56
56
 
@@ -50,10 +50,17 @@ module Locomotive::Wagon
50
50
  _filepath = File.join(path, filepath)
51
51
 
52
52
  folder = File.dirname(_filepath)
53
+
53
54
  FileUtils.mkdir_p(folder) unless File.exists?(folder)
54
55
 
55
56
  File.open(_filepath, mode) do |file|
56
- file.write(content ? content : yield)
57
+ if content
58
+ file.write(content)
59
+ elsif block_given?
60
+ file.write(yield)
61
+ else
62
+ file.write('')
63
+ end
57
64
  end
58
65
  end
59
66
 
@@ -0,0 +1,28 @@
1
+ module Locomotive::Wagon
2
+
3
+ class PullSectionsCommand < PullBaseCommand
4
+
5
+ def _pull
6
+ api_client.sections.all.each do |section|
7
+ write_section(section)
8
+ end
9
+ end
10
+
11
+ def write_section(section)
12
+ write_to_file(section_filepath(section), <<-FRONT_MATTER
13
+ #{section.definition.to_yaml}
14
+ ---
15
+ #{section.template}
16
+ FRONT_MATTER
17
+ )
18
+ end
19
+
20
+ private
21
+
22
+ def section_filepath(section)
23
+ File.join('app', 'views', 'sections', section.slug + '.liquid')
24
+ end
25
+
26
+ end
27
+
28
+ end
@@ -101,7 +101,7 @@ module Locomotive::Wagon
101
101
  attributes[name] = {}
102
102
 
103
103
  value.each do |locale, _value|
104
- __value = JSON.parse(_value)
104
+ __value = _value ? JSON.parse(_value) : {}
105
105
  attributes[name][locale] = block_given? ? yield(__value) : __value
106
106
  end
107
107
  else
@@ -4,6 +4,8 @@ module Locomotive::Wagon
4
4
 
5
5
  class PushThemeAssetsCommand < PushBaseCommand
6
6
 
7
+ WEBPACK_BUNDLED_ASSETS = ['stylesheets/bundle.css', 'javascripts/bundle.js'].freeze
8
+
7
9
  def entities
8
10
  repositories.theme_asset.all.map do |entity|
9
11
  next if skip?(entity)
@@ -43,7 +45,7 @@ module Locomotive::Wagon
43
45
  content = compress_and_minify(entity)
44
46
 
45
47
  # replace paths to images or fonts by the absolute URL used in the Engine
46
- replace_assets!(content)
48
+ content = replace_assets(content)
47
49
 
48
50
  file.write(content)
49
51
 
@@ -53,8 +55,8 @@ module Locomotive::Wagon
53
55
  end
54
56
  end
55
57
 
56
- def replace_assets!(content)
57
- content.gsub!(/([("'])\/((images|fonts)\/[^)"']+)([)"''])/) do
58
+ def replace_assets(content)
59
+ content.gsub(/([("'])\/((images|fonts)\/[^)"']+)([)"''])/) do
58
60
  leading_char, local_path, trailing_char = $1, $2, $4
59
61
  local_path.gsub!(/\?[^\/]+\Z/, '') # remove query string if present
60
62
  "#{leading_char}#{(@remote_urls || {})[local_path] || local_path}#{trailing_char}"
@@ -87,10 +89,14 @@ module Locomotive::Wagon
87
89
 
88
90
  def compress_and_minify(entity)
89
91
  begin
92
+ if WEBPACK_BUNDLED_ASSETS.include?(entity.short_relative_url)
93
+ raise 'already compressed and minified by Webpack'
94
+ end
95
+
90
96
  sprockets_env[entity.short_relative_url].to_s
91
97
  rescue Exception => e
92
98
  instrument :warning, message: "Unable to compress and minify it, error: #{e.message}"
93
- # use the original file instead
99
+ # use the original file instead"
94
100
  File.read(File.join(path, entity.source))
95
101
  end
96
102
  end
@@ -17,7 +17,8 @@ module Locomotive
17
17
  public_submission_accounts
18
18
  public_submission_title_template
19
19
  public_submission_email_attachments
20
- recaptcha_required entry_template display_settings filter_fields)
20
+ recaptcha_required entry_template display_settings filter_fields
21
+ import_enabled)
21
22
  end
22
23
 
23
24
  def fields
@@ -83,6 +84,10 @@ module Locomotive
83
84
  self[:recaptcha_required]
84
85
  end
85
86
 
87
+ def import_enabled
88
+ self[:import_enabled]
89
+ end
90
+
86
91
  def with_relationships?
87
92
  __getobj__.fields.associations.count > 0
88
93
  end
@@ -48,6 +48,10 @@ module Locomotive
48
48
  end
49
49
  end
50
50
 
51
+ def overwrite_same_content_assets
52
+ self[:overwrite_same_content_assets]
53
+ end
54
+
51
55
  %i(robots_txt timezone seo_title meta_keywords meta_description asset_host routes).each do |name|
52
56
  define_method(name) do
53
57
  self[name]
@@ -55,9 +59,8 @@ module Locomotive
55
59
  end
56
60
 
57
61
  def __attributes__
58
- %i(name handle robots_txt locales timezone seo_title meta_keywords meta_description picture metafields_schema metafields metafields_ui asset_host sections_content routes)
62
+ %i(name handle robots_txt locales timezone seo_title meta_keywords meta_description picture metafields_schema metafields metafields_ui asset_host sections_content routes overwrite_same_content_assets)
59
63
  end
60
-
61
64
  end
62
65
 
63
66
  class RemoteSiteDecorator < SimpleDelegator
@@ -71,7 +74,7 @@ module Locomotive
71
74
  class UpdateSiteDecorator < SiteDecorator
72
75
 
73
76
  def __attributes__
74
- %i(picture timezone locales metafields_schema metafields metafields_ui asset_host sections_content routes)
77
+ %i(picture timezone locales metafields_schema metafields metafields_ui asset_host sections_content routes overwrite_same_content_assets)
75
78
  end
76
79
 
77
80
  end
@@ -156,6 +156,7 @@ export { default as #{js_class_name} } from './#{@options[:type]}';
156
156
  case type
157
157
  when 'text' then "\"#{Faker::Lorem.sentence}\""
158
158
  when 'image_picker' then "\"/samples/images/default.svg\""
159
+ when 'asset_picker' then "\"/samples/images/default.svg\""
159
160
  when 'checkbox' then true
160
161
  when 'radio', 'select' then 'option_1'
161
162
  when 'url' then "\"#\""
@@ -1,5 +1,5 @@
1
1
  module Locomotive
2
2
  module Wagon
3
- VERSION = '3.0.5'
3
+ VERSION = '3.1.0.beta1'
4
4
  end
5
5
  end
@@ -25,17 +25,17 @@ Gem::Specification.new do |gem|
25
25
  gem.add_development_dependency 'rake', '~> 13.0.1'
26
26
 
27
27
  gem.add_dependency 'thor', '~> 0.20.3'
28
- gem.add_dependency 'puma', '~> 4.3.0'
28
+ gem.add_dependency 'puma', '~> 5.0.4'
29
29
  gem.add_dependency 'netrc', '~> 0.11.0'
30
- gem.add_dependency 'oj', '~> 3.9.2'
30
+ gem.add_dependency 'oj', '~> 3.10.16'
31
31
 
32
32
  gem.add_dependency 'locomotivecms_common', '~> 0.4.0'
33
- gem.add_dependency 'locomotivecms_coal', '~> 1.6.0'
34
- gem.add_dependency 'locomotivecms_steam', '~> 1.5.3'
33
+ gem.add_dependency 'locomotivecms_coal', '~> 1.7.0'
34
+ gem.add_dependency 'locomotivecms_steam', '~> 1.6.0.beta1'
35
35
 
36
36
  gem.add_dependency 'haml', '~> 5.1.2'
37
- gem.add_dependency 'listen', '~> 3.1.5'
38
- gem.add_dependency 'neatjson', '~> 0.8.4'
37
+ gem.add_dependency 'listen', '~> 3.3.1'
38
+ gem.add_dependency 'neatjson', '~> 0.9'
39
39
 
40
40
  gem.add_dependency 'faker', '~> 1.6'
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms_wagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.1.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-02-28 00:00:00.000000000 Z
12
+ date: 2021-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 4.3.0
48
+ version: 5.0.4
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 4.3.0
55
+ version: 5.0.4
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: netrc
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -73,14 +73,14 @@ dependencies:
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: 3.9.2
76
+ version: 3.10.16
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: 3.9.2
83
+ version: 3.10.16
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: locomotivecms_common
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -101,28 +101,28 @@ dependencies:
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: 1.6.0
104
+ version: 1.7.0
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 1.6.0
111
+ version: 1.7.0
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: locomotivecms_steam
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 1.5.3
118
+ version: 1.6.0.beta1
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: 1.5.3
125
+ version: 1.6.0.beta1
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: haml
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -143,28 +143,28 @@ dependencies:
143
143
  requirements:
144
144
  - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: 3.1.5
146
+ version: 3.3.1
147
147
  type: :runtime
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: 3.1.5
153
+ version: 3.3.1
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: neatjson
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - "~>"
159
159
  - !ruby/object:Gem::Version
160
- version: 0.8.4
160
+ version: '0.9'
161
161
  type: :runtime
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
165
  - - "~>"
166
166
  - !ruby/object:Gem::Version
167
- version: 0.8.4
167
+ version: '0.9'
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: faker
170
170
  requirement: !ruby/object:Gem::Requirement
@@ -284,6 +284,7 @@ files:
284
284
  - lib/locomotive/wagon/commands/pull_sub_commands/pull_content_entries_command.rb
285
285
  - lib/locomotive/wagon/commands/pull_sub_commands/pull_content_types_command.rb
286
286
  - lib/locomotive/wagon/commands/pull_sub_commands/pull_pages_command.rb
287
+ - lib/locomotive/wagon/commands/pull_sub_commands/pull_sections_command.rb
287
288
  - lib/locomotive/wagon/commands/pull_sub_commands/pull_site_command.rb
288
289
  - lib/locomotive/wagon/commands/pull_sub_commands/pull_snippets_command.rb
289
290
  - lib/locomotive/wagon/commands/pull_sub_commands/pull_theme_assets_command.rb
@@ -356,11 +357,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
356
357
  version: '0'
357
358
  required_rubygems_version: !ruby/object:Gem::Requirement
358
359
  requirements:
359
- - - ">="
360
+ - - ">"
360
361
  - !ruby/object:Gem::Version
361
- version: '0'
362
+ version: 1.3.1
362
363
  requirements: []
363
- rubygems_version: 3.0.6
364
+ rubygems_version: 3.1.4
364
365
  signing_key:
365
366
  specification_version: 4
366
367
  summary: Wagon is a site generator for the LocomotiveCMS engine powered by all the