pageflow-support 16.0.0 → 16.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8a94f3475148af3c9a6615c75796b97df0c85584e87f975d6f2b23f5b3bd3e0
4
- data.tar.gz: f12b3476e0da841819f6a99cec6438624450559371dee32cbab9e7c07b1719f2
3
+ metadata.gz: f5025199d00a123265a8a38fc2ab1bb3450e577d61e0813fac8e5d971caf294f
4
+ data.tar.gz: 05dfba6fdfa469667ff2e98a6108c6f9b23dbade34680b74f1b80710f51be978
5
5
  SHA512:
6
- metadata.gz: 30bb3817ba2efd1c4450518a19d604c719517cab54dd41d8aba9bc48d8890dc50c2186904d1dd69104eda4d85445c2b39f079ec42e35a45976f9c03d3de5363d
7
- data.tar.gz: f6fe10eba2e0bdd08aba9e2e1fea7e22067375fcc836fed248b994ab421db3110e9164c4a48b44cdf81ba8c7f68321ed6139fd368b9c6bef30c37881cf283e8c
6
+ metadata.gz: 93baec3ea0932a52a834a9fd6a3c5957e03702274488c775c32ec501a733903b84bc3ff760c7ae319e30e6cf3c2bc4fce700ab947229af606964bf0ca1b40e46
7
+ data.tar.gz: a882466b94aa06c45741770e2ca9030dd75e807535fe94b74dbf80d12637108059bb3e54771c882d3697506e345e350a6601402db0ac8a4594b8beb5901c7a39
@@ -0,0 +1,20 @@
1
+ RSpec.configure do |config|
2
+ # Inspired by
3
+ # https://gitlab.com/gitlab-org/gitlab-foss/-/blob/6f5be4b446db2f17fc0307c4fce8ae285b35d89a/spec/support/caching.rb
4
+ config.around(:each, :use_clean_rails_memory_store_fragment_caching) do |example|
5
+ rails_cache = Rails.cache
6
+ controller_cache_store = ActionController::Base.cache_store
7
+
8
+ # Also replace Rails.cache for consistency since JBuilder uses
9
+ # it directly to cache fragments instead of going through
10
+ # ActionController::Base.cache_store.
11
+ ActionController::Base.cache_store = Rails.cache = ActiveSupport::Cache::MemoryStore.new
12
+ ActionController::Base.perform_caching = true
13
+
14
+ example.run
15
+ ensure
16
+ ActionController::Base.perform_caching = false
17
+ ActionController::Base.cache_store = controller_cache_store
18
+ Rails.cache = rails_cache
19
+ end
20
+ end
@@ -1,5 +1,6 @@
1
1
  require 'pageflow/version'
2
2
  require 'pageflow/dummy/exit_on_failure_patch'
3
+ require 'pageflow/rails_version'
3
4
 
4
5
  module Pageflow
5
6
  module Dummy
@@ -10,13 +11,13 @@ module Pageflow
10
11
  if File.exist?(directory)
11
12
  puts("Dummy directory #{directory} exists.")
12
13
  else
13
- system("bundle exec rails new #{directory} " \
14
+ system('SKIP_EAGER_LOAD=true ' \
15
+ "bundle exec rails new #{directory} --skip-spring " \
14
16
  "--template #{template_path} #{rails_new_options}") ||
15
17
  raise('Error generating dummy app.')
16
18
  end
17
19
 
18
20
  require(File.join(ENV['RAILS_ROOT'], 'config', 'environment'))
19
- require('pageflow/dummy/config/pageflow')
20
21
  end
21
22
 
22
23
  def directory
@@ -29,7 +30,9 @@ module Pageflow
29
30
  end
30
31
 
31
32
  def rails_new_options
32
- '--skip-test-unit --skip-bundle --database=mysql'
33
+ result = '--skip-test-unit --skip-bundle --database=mysql'
34
+ result << ' --skip-javascript'
35
+ result
33
36
  end
34
37
  end
35
38
  end
@@ -1,19 +1,20 @@
1
1
  Pageflow.configure do |config|
2
- config.paperclip_s3_root = 'test-host'
2
+ s3_bucket = config.paperclip_s3_default_options.dig(:s3_credentials, :bucket)
3
3
 
4
- config.paperclip_s3_default_options.merge!(
5
- storage: :filesystem,
6
- url: '/system/s3/:class/:attachment/:id_partition/:style/:filename',
7
- path: ':rails_root/public:url'
8
- )
4
+ if s3_bucket == 'com-example-pageflow-development'
5
+ config.paperclip_s3_root = 'test-host'
9
6
 
10
- config.paperclip_direct_upload_options = lambda do |_|
11
- {
12
- url: '#',
13
- fields: []
14
- }
7
+ config.paperclip_s3_default_options.merge!(
8
+ storage: :filesystem,
9
+ url: '/system/s3/:class/:attachment/:id_partition/:style/:filename',
10
+ path: ':rails_root/public:url'
11
+ )
12
+
13
+ config.paperclip_direct_upload_options = lambda do |_|
14
+ {
15
+ url: '#',
16
+ fields: []
17
+ }
18
+ end
15
19
  end
16
20
  end
17
-
18
- # Reconstruct current config to ensure config block above is used
19
- Pageflow.configure!
@@ -1,3 +1,5 @@
1
+ require 'pageflow/rails_version'
2
+
1
3
  def source_paths
2
4
  [File.join(File.expand_path(File.dirname(__FILE__)), 'templates')]
3
5
  end
@@ -19,6 +21,10 @@ gsub_file('config/database.yml',
19
21
  /^ database: /,
20
22
  " database: #{database_prefix}-")
21
23
 
24
+ gsub_file('config/environments/test.rb',
25
+ 'config.eager_load = ENV["CI"].present?',
26
+ 'config.eager_load = ENV["CI"].present? && !ENV["SKIP_EAGER_LOAD"]')
27
+
22
28
  append_to_file('config/application.rb', <<-END)
23
29
  if ENV['PAGEFLOW_DB_HOST'].present?
24
30
  ActiveRecord::Tasks::DatabaseTasks::LOCAL_HOSTS << ENV['PAGEFLOW_DB_HOST']
@@ -30,17 +36,21 @@ inject_into_file('config/application.rb',
30
36
  "require 'pageflow'\n",
31
37
  after: "Bundler.require(*Rails.groups)\n")
32
38
 
33
- # Remove requires to missing gems (i.e. turbolinks)
34
- gsub_file('app/assets/javascripts/application.js', %r'//=.*', '')
39
+ if in_root { File.exist?('app/assets/javascripts/application.js') }
40
+ # Remove requires to missing gems (i.e. turbolinks)
41
+ gsub_file('app/assets/javascripts/application.js', %r'//=.*', '')
42
+ end
35
43
 
36
44
  # Recreate db. Ignore if it does not exist.
37
45
 
38
46
  in_root { run('rake db:environment:set db:drop:all', capture: true, abort_on_failure: false) }
47
+
48
+ rake 'db:create' # workaround for https://github.com/rails/rails/issues/50038
39
49
  rake 'db:create:all'
40
50
 
41
51
  # Install Webpacker
42
52
 
43
- rake 'webpacker:install' if ENV['PAGEFLOW_INSTALL_WEBPACKER'] == 'true'
53
+ rake 'shakapacker:install' if ENV['PAGEFLOW_INSTALL_SHAKAPACKER'] == 'true'
44
54
 
45
55
  # Install pageflow and the tested engine via their generators.
46
56
 
@@ -59,6 +69,12 @@ prepend_to_file('config/initializers/pageflow.rb', <<-END)
59
69
  ActiveAdmin.application.load_paths.unshift(Dir[Rails.root.join('app/admin')].first)\n
60
70
  END
61
71
 
72
+ # Adapt default configuration
73
+
74
+ inject_into_file('config/initializers/pageflow.rb',
75
+ "require 'pageflow/dummy/config/pageflow'\n",
76
+ after: "Pageflow.finalize!\n")
77
+
62
78
  # Add required files for test theme
63
79
 
64
80
  copy_file('test_theme.scss',
@@ -87,4 +103,4 @@ copy_file('create_test_revision_components.rb',
87
103
  copy_file('add_custom_fields.rb',
88
104
  'db/migrate/99990000000000_add_custom_fields.rb')
89
105
 
90
- rake 'db:migrate db:test:load', env: 'development'
106
+ rake 'db:migrate db:test:load_schema', env: 'development'
@@ -24,7 +24,7 @@ module Pageflow
24
24
  # # ...
25
25
  # end
26
26
  def pageflow_configure(&block)
27
- GlobalConfigApiTestHelper.custom_configure_block = block
27
+ GlobalConfigApiTestHelper.custom_configure_block << block
28
28
  Pageflow.configure!
29
29
  end
30
30
 
@@ -39,12 +39,14 @@ module Pageflow
39
39
 
40
40
  config.before(:suite) do
41
41
  Pageflow.configure do |pageflow_config|
42
- GlobalConfigApiTestHelper.custom_configure_block&.call(pageflow_config)
42
+ GlobalConfigApiTestHelper.custom_configure_block.each do |block|
43
+ block.call(pageflow_config)
44
+ end
43
45
  end
44
46
  end
45
47
 
46
48
  config.before do
47
- GlobalConfigApiTestHelper.custom_configure_block = nil
49
+ GlobalConfigApiTestHelper.custom_configure_block = []
48
50
  Pageflow.configure!
49
51
  end
50
52
  end
data/pageflow/lint.rb CHANGED
@@ -25,8 +25,8 @@ module Pageflow
25
25
  # require 'pageflow/lint'
26
26
  #
27
27
  # Pageflow::Lint.entry_type(SomePlugin.entry_type)
28
- def self.entry_type(*args)
29
- Lint::EntryType.lint(*args)
28
+ def self.entry_type(*args, **kws)
29
+ Lint::EntryType.lint(*args, **kws)
30
30
  end
31
31
 
32
32
  # Ensure file type json partials render correctly.
@@ -52,8 +52,8 @@ module Pageflow
52
52
  # create_file_type: -> { SomePlugin.file_type },
53
53
  # create_file: -> { create(:some_file) })
54
54
  # end
55
- def self.file_type(*args)
56
- Lint::FileType.lint(*args)
55
+ def self.file_type(*args, **kws)
56
+ Lint::FileType.lint(*args, **kws)
57
57
  end
58
58
 
59
59
  # Contract specs for page types
@@ -70,8 +70,8 @@ module Pageflow
70
70
  # module SomePlugin
71
71
  # Pageflow::Lint.page_type(SomePLugin.page_type)
72
72
  # end
73
- def self.page_type(*args)
74
- Lint::PageType.lint(*args)
73
+ def self.page_type(*args, **kws)
74
+ Lint::PageType.lint(*args, **kws)
75
75
  end
76
76
 
77
77
  # Contracts specs for file import plugin
@@ -83,8 +83,8 @@ module Pageflow
83
83
  # module SomePlugin
84
84
  # Pageflow::Lint.file_import(SomePLugin.file_import)
85
85
  # end
86
- def self.file_import(*args)
87
- Lint::FileImport.lint(*args)
86
+ def self.file_import(*args, **kws)
87
+ Lint::FileImport.lint(*args, **kws)
88
88
  end
89
89
  end
90
90
  end
@@ -1,29 +1,19 @@
1
1
  require 'capybara/rspec'
2
2
  require 'selenium-webdriver'
3
3
  require 'capybara/chromedriver/logger'
4
- require 'webdrivers/chromedriver'
5
4
 
6
5
  Capybara.register_driver :selenium_chrome_headless_no_sandbox do |app|
7
- browser_options = ::Selenium::WebDriver::Chrome::Options.new
8
- browser_options.args << '--headless'
9
- browser_options.args << '--disable-gpu'
10
- # Required for chrome to work in container based Travis environment
11
- # (see https://docs.travis-ci.com/user/chrome)
12
- browser_options.args << '--no-sandbox'
13
-
14
- capabilities = {
15
- # see https://github.com/SeleniumHQ/selenium/issues/3738
16
- loggingPrefs: {browser: 'ALL'},
17
- # see https://github.com/dbalatero/capybara-chromedriver-logger/issues/11
18
- chromeOptions: {
19
- w3c: false
20
- }
21
- }
6
+ options = Selenium::WebDriver::Options.chrome(
7
+ logging_prefs: {browser: 'ALL'}
8
+ )
9
+
10
+ options.add_argument('--headless=new')
11
+ options.add_argument('--no-sandbox')
12
+ options.add_argument('--disable-gpu') if Gem.win_platform?
22
13
 
23
14
  Capybara::Selenium::Driver.new(app,
24
15
  browser: :chrome,
25
- options: browser_options,
26
- desired_capabilities: capabilities)
16
+ options: options)
27
17
  end
28
18
 
29
19
  Capybara.javascript_driver = :selenium_chrome_headless_no_sandbox
@@ -13,7 +13,7 @@ RSpec.configure do |config|
13
13
 
14
14
  config.before(:each) do |example|
15
15
  unless example.metadata[:unstub_paperclip] || example.metadata[:js]
16
- allow_any_instance_of(Paperclip::Attachment).to receive(:post_process)
16
+ allow_any_instance_of(Paperclip::Attachment).to receive(:post_process_styles)
17
17
  allow(Paperclip).to receive(:run).and_return('100x100')
18
18
  end
19
19
  end
@@ -2,7 +2,12 @@ require 'webmock/rspec'
2
2
 
3
3
  RSpec.configure do |config|
4
4
  config.before(:each) do
5
- driver_urls = Webdrivers::Common.subclasses.map(&:base_url)
6
- WebMock.disable_net_connect!(allow_localhost: true, allow: driver_urls)
5
+ WebMock.disable_net_connect!(
6
+ allow_localhost: true,
7
+ allow: [
8
+ 'https://googlechromelabs.github.io',
9
+ 'https://edgedl.me.gvt1.com'
10
+ ]
11
+ )
7
12
  end
8
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pageflow-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.0.0
4
+ version: 16.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codevise Solutions Ltd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-11 00:00:00.000000000 Z
11
+ date: 2024-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pageflow
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 16.0.0
19
+ version: 16.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 16.0.0
26
+ version: 16.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mysql2
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.5'
117
+ version: '4.10'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '2.5'
124
+ version: '4.10'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: ar_after_transaction
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.5.0
131
+ version: 0.10.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.5.0
138
+ version: 0.10.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: redis
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -185,6 +185,7 @@ executables: []
185
185
  extensions: []
186
186
  extra_rdoc_files: []
187
187
  files:
188
+ - pageflow/caching_test_helpers.rb
188
189
  - pageflow/dom.rb
189
190
  - pageflow/dom/admin.rb
190
191
  - pageflow/dom/admin/attributes_tables.rb
@@ -222,7 +223,6 @@ files:
222
223
  - pageflow/lint/page_type.rb
223
224
  - pageflow/matchers/have_json_ld.rb
224
225
  - pageflow/matchers/have_meta_tag.rb
225
- - pageflow/rails_version.rb
226
226
  - pageflow/render_page_test_helper.rb
227
227
  - pageflow/shared_contexts/fake_translations.rb
228
228
  - pageflow/support.rb
@@ -252,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  - !ruby/object:Gem::Version
253
253
  version: '0'
254
254
  requirements: []
255
- rubygems_version: 3.0.3.1
255
+ rubygems_version: 3.4.10
256
256
  signing_key:
257
257
  specification_version: 4
258
258
  summary: Spec support for Pageflow extensions.
@@ -1,23 +0,0 @@
1
- module Pageflow
2
- module RailsVersion
3
- extend self
4
-
5
- RAILS_VERSION_FILE = File.expand_path('../../../../.rails_version')
6
-
7
- def detect
8
- from_env || from_file || '5.2.0'
9
- end
10
-
11
- private
12
-
13
- def from_env
14
- ENV['PAGEFLOW_RAILS_VERSION']
15
- end
16
-
17
- def from_file
18
- if File.exists?(RAILS_VERSION_FILE)
19
- File.read(RAILS_VERSION_FILE).chomp.strip.presence
20
- end
21
- end
22
- end
23
- end