pageflow-support 16.0.0 → 16.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/pageflow/caching_test_helpers.rb +20 -0
- data/pageflow/dummy/app.rb +6 -3
- data/pageflow/dummy/config/pageflow.rb +15 -14
- data/pageflow/dummy/rails_template.rb +20 -4
- data/pageflow/global_config_api_test_helper.rb +5 -3
- data/pageflow/lint.rb +8 -8
- data/pageflow/support/config/capybara.rb +8 -18
- data/pageflow/support/config/paperclip.rb +1 -1
- data/pageflow/support/config/webmock.rb +7 -2
- metadata +10 -10
- data/pageflow/rails_version.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5025199d00a123265a8a38fc2ab1bb3450e577d61e0813fac8e5d971caf294f
|
4
|
+
data.tar.gz: 05dfba6fdfa469667ff2e98a6108c6f9b23dbade34680b74f1b80710f51be978
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/pageflow/dummy/app.rb
CHANGED
@@ -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(
|
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.
|
2
|
+
s3_bucket = config.paperclip_s3_default_options.dig(:s3_credentials, :bucket)
|
3
3
|
|
4
|
-
|
5
|
-
|
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
|
-
|
11
|
-
|
12
|
-
url: '
|
13
|
-
|
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
|
-
|
34
|
-
|
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 '
|
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:
|
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
|
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
|
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 =
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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:
|
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(:
|
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
|
-
|
6
|
-
|
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.
|
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:
|
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.
|
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.
|
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: '
|
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: '
|
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.
|
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.
|
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.
|
255
|
+
rubygems_version: 3.4.10
|
256
256
|
signing_key:
|
257
257
|
specification_version: 4
|
258
258
|
summary: Spec support for Pageflow extensions.
|
data/pageflow/rails_version.rb
DELETED
@@ -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
|