pageflow-panorama 2.1.0 → 2.2.0

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: c457397c261ea9a1ade84a3bb97a17f20fa7268bbb3c9d23a0e46e96e7b240f3
4
- data.tar.gz: a1bcf318d142760ec391a51b2237fa5d76595653f9a104ea3e45624c6859b000
3
+ metadata.gz: 3db4ed7e2dac5aadca40c3177669f4c6640577eb9f941f568a8156890e7d3dd0
4
+ data.tar.gz: 5048ed5d21482edb03f99b9feca34518a35689864d8962af14031dcc6933de45
5
5
  SHA512:
6
- metadata.gz: e3e8c34ed50b57fc2d8127d811b795b7199180037a6171c38d48016472f705fd223476c1dcde4510d8bc1bf7f4a3d004f9a5ef5868f2f4848e5a1311b3860a52
7
- data.tar.gz: 12792526b512f691eafca8bb58cda0b4f5e228c9747d4e57677a3fc1444486ffbc30478f999ff0568736f20c81e997d26e8e77bdeae7cde15d083703ef069a1d
6
+ metadata.gz: 13c02586c8b56f9c40137bdfb917d16fb3e58ddb2737ffb648fc813e0daa7c6fc7ae2f243afb559ff8671a36e6d693092697e9d14c0761e00dd476923fd52c6c
7
+ data.tar.gz: 80fe4b7abf2332853ba64c46bec403dc8f50b1b4d5855a1f2c6157e33b5f49eba1feb15fa01f66ca1e87f8652dd67ce94c52768ea2aa7897949da1d7447255db
@@ -8,3 +8,6 @@ cache: bundler
8
8
 
9
9
  script:
10
10
  - bin/rspec
11
+
12
+ services:
13
+ - mysql
@@ -1,18 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
- ### Version 2.1.0
3
+ ### Version 2.2.0
4
4
 
5
- 2019-04-08
5
+ 2019-11-04
6
6
 
7
- [Compare changes](https://github.com/codevise/pageflow-panorama/compare/2-0-stable...v2.1.0)
7
+ [Compare changes](https://github.com/codevise/pageflow-panorama/compare/2-1-stable...v2.2.0)
8
8
 
9
- - Adapt page dom for pageflow 14
10
- ([#31](https://github.com/codevise/pageflow-panorama/pull/31))
11
- - Setup page type lint specs
12
- ([#30](https://github.com/codevise/pageflow-panorama/pull/30))
13
- - Allow bundler 2 in development dependencies
14
- ([#29](https://github.com/codevise/pageflow-panorama/pull/29))
9
+ - Add importer for Packages
10
+ ([#35](https://github.com/codevise/pageflow-panorama/pull/35))
11
+ - Fix Travis CI
12
+ ([#34](https://github.com/codevise/pageflow-panorama/pull/34))
13
+ - Always lookup files by revisions usage scope
14
+ ([#32](https://github.com/codevise/pageflow-panorama/pull/32))
15
15
 
16
16
  See
17
- [2-0-stable branch](https://github.com/codevise/pageflow-panorama/blob/2-0-stable/CHANGELOG.md)
17
+ [2-1-stable branch](https://github.com/codevise/pageflow-panorama/blob/2-1-stable/CHANGELOG.md)
18
18
  for previous changes.
@@ -1,4 +1,4 @@
1
- pageflow.panorama.Package = pageflow.HostedFile.extend({
1
+ pageflow.panorama.Package = pageflow.UploadableFile.extend({
2
2
  processingStages: [
3
3
  {
4
4
  name: 'unpacking',
@@ -1,3 +1,3 @@
1
- @include pageflow-hosted-file-stage('unpacking') {
1
+ @include pageflow-uploadable-file-stage('unpacking') {
2
2
  @include archive-icon;
3
3
  }
@@ -1,11 +1,13 @@
1
1
  module Pageflow
2
2
  module Panorama
3
3
  module PackagesHelper
4
+ include RevisionFileHelper
5
+
4
6
  def panorama_url(configuration)
5
7
  if configuration['panorama_source'] == 'url'
6
8
  configuration['panorama_url']
7
9
  else
8
- package = Package.find_by_id(configuration['panorama_package_id'])
10
+ package = find_file_in_entry(Package, configuration['panorama_package_id'])
9
11
  package ? package.index_document_path : nil
10
12
  end
11
13
  end
@@ -3,7 +3,7 @@ require 'zip'
3
3
  module Pageflow
4
4
  module Panorama
5
5
  class Package < ActiveRecord::Base
6
- include HostedFile
6
+ include UploadableFile
7
7
 
8
8
  processing_state_machine do
9
9
  state 'unpacking'
@@ -14,11 +14,11 @@ module Pageflow
14
14
  transition any => 'unpacking'
15
15
  end
16
16
 
17
- event :retry do
17
+ event :retry_unpacking do
18
18
  transition 'unpacking_failed' => 'unpacking'
19
19
  end
20
20
 
21
- before_transition on: :retry do |package|
21
+ before_transition on: :retry_unpacking do |package|
22
22
  JobStatusAttributes.reset(package, stage: :unpacking)
23
23
  end
24
24
 
@@ -47,6 +47,15 @@ module Pageflow
47
47
  def unpack_base_path
48
48
  attachment_on_s3.present? ? File.dirname(attachment_on_s3.path(:unpacked)) : nil
49
49
  end
50
+
51
+ # UploadableFile-overrides
52
+ def retry!
53
+ retry_unpacking!
54
+ end
55
+
56
+ def ready?
57
+ unpacked?
58
+ end
50
59
  end
51
60
  end
52
61
  end
@@ -10,11 +10,7 @@ module Pageflow
10
10
  end
11
11
 
12
12
  def file_types
13
- [
14
- FileType.new(model: Package,
15
- editor_partial: 'pageflow/panorama/editor/packages/package',
16
- top_level_type: true)
17
- ]
13
+ [Panorama.package_file_type]
18
14
  end
19
15
 
20
16
  def json_seed_template
@@ -23,10 +19,22 @@ module Pageflow
23
19
 
24
20
  def thumbnail_candidates
25
21
  [
26
- {attribute: 'thumbnail_image_id', file_collection: 'image_files'},
27
- {attribute: 'panorama_package_id', file_collection: 'pageflow_panorama_packages'}
22
+ {
23
+ attribute: 'thumbnail_image_id',
24
+ file_collection: 'image_files'
25
+ },
26
+ {
27
+ attribute: 'panorama_package_id',
28
+ file_collection: 'pageflow_panorama_packages'
29
+ }
28
30
  ]
29
31
  end
30
32
  end
33
+
34
+ def self.package_file_type
35
+ FileType.new(model: Package,
36
+ editor_partial: 'pageflow/panorama/editor/packages/package',
37
+ top_level_type: true)
38
+ end
31
39
  end
32
40
  end
@@ -1,5 +1,5 @@
1
1
  module Pageflow
2
2
  module Panorama
3
- VERSION = '2.1.0'.freeze
3
+ VERSION = '2.2.0'.freeze
4
4
  end
5
5
  end
@@ -18,12 +18,12 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.required_ruby_version = '~> 2.1'
20
20
 
21
- spec.add_runtime_dependency 'pageflow', '~> 14.x'
21
+ spec.add_runtime_dependency 'pageflow', '~> 15.x'
22
22
  spec.add_runtime_dependency 'rubyzip', '~> 1.1'
23
23
  spec.add_runtime_dependency 'aws-sdk-s3', '~> 1.17'
24
24
  spec.add_runtime_dependency 'pageflow-public-i18n', '~> 1.0'
25
25
 
26
- spec.add_development_dependency 'pageflow-support', '~> 14.x'
26
+ spec.add_development_dependency 'pageflow-support', '~> 15.x'
27
27
  spec.add_development_dependency 'bundler', ['>= 1.0', '< 3']
28
28
  spec.add_development_dependency 'rake', '~> 12.0'
29
29
  spec.add_development_dependency 'rspec-rails', '~> 3.7'
@@ -0,0 +1,11 @@
1
+ module Pageflow
2
+ module Panorama
3
+ FactoryBot.define do
4
+ factory :package, class: Package do
5
+ attachment { File.open(Engine.root.join('spec', 'fixtures', 'some.txt.zip')) }
6
+ index_document { true }
7
+ state { 'unpacked' }
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+ require 'pageflow/used_file_test_helper'
3
+
4
+ module Pageflow
5
+ module Panorama
6
+ describe PackagesHelper do
7
+ include UsedFileTestHelper
8
+
9
+ describe '#panorama_url' do
10
+ context 'URL panorama source' do
11
+ it 'should return specified panorama url when panorama source is URL' do
12
+ @entry = PublishedEntry.new(create(:entry, :published))
13
+ configuration = {
14
+ 'panorama_source' => 'url',
15
+ 'panorama_url' => 'S3-url'
16
+ }
17
+
18
+ url = helper.panorama_url(configuration)
19
+ expect(url).to eq('S3-url')
20
+ end
21
+ end
22
+
23
+ it 'should return nil if no package can be found' do
24
+ @entry = PublishedEntry.new(create(:entry, :published))
25
+ configuration = {
26
+ 'panorama_package_id' => 500
27
+ }
28
+
29
+ expect(helper.panorama_url(configuration)).to be_nil
30
+ end
31
+
32
+ it 'should return the packages index document path' do
33
+ panorama_package_file = create_used_file(:package)
34
+ configuration = {
35
+ 'panorama_package_id' => panorama_package_file.perma_id
36
+ }
37
+
38
+ url = helper.panorama_url(configuration)
39
+ expect(url).to match(/#{panorama_package_file.id}\/unpacked\/#{panorama_package_file.perma_id}/)
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+ require 'pageflow/lint'
3
+
4
+ module Pageflow
5
+ module Panorama
6
+ Pageflow::Lint.file_type(:package,
7
+ create_file_type: -> { Panorama.package_file_type },
8
+ create_file: -> { create(:package) })
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ require 'factory_bot_rails'
2
+
3
+ RSpec.configure do |config|
4
+ # Allow to use build and create methods without FactoryBot prefix.
5
+ config.include FactoryBot::Syntax::Methods
6
+
7
+ # Make sure factories are up to date when using spring. Skip in CI
8
+ # since reloading causes factories to be excluded in test coverage.
9
+ unless ENV['CI']
10
+ config.before(:all) do
11
+ FactoryBot.reload
12
+ end
13
+ end
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pageflow-panorama
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codevise Solutions
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-08 00:00:00.000000000 Z
11
+ date: 2019-11-04 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: 14.x
19
+ version: 15.x
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: 14.x
26
+ version: 15.x
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubyzip
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 14.x
75
+ version: 15.x
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 14.x
82
+ version: 15.x
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -216,10 +216,13 @@ files:
216
216
  - lib/pageflow/panorama/version.rb
217
217
  - lib/pageflow/panorama/zip_entry_paperclip_io_adapter.rb
218
218
  - pageflow-panorama.gemspec
219
+ - spec/factories/panorama_package.rb
219
220
  - spec/fixtures/dir_some.txt.zip
220
221
  - spec/fixtures/krpano.zip
221
222
  - spec/fixtures/krpano_with_unprocessable_thumbnail.zip
222
223
  - spec/fixtures/some.txt.zip
224
+ - spec/helpers/pageflow/panorama/packages_helper_spec.rb
225
+ - spec/integration/file_type_spec.rb
223
226
  - spec/integration/page_type_spec.rb
224
227
  - spec/models/pageflow/panorama/package_spec.rb
225
228
  - spec/pageflow/panorama/job_status_attributes_spec.rb
@@ -227,6 +230,7 @@ files:
227
230
  - spec/pageflow/panorama/validation/kr_pano_spec.rb
228
231
  - spec/spec_helper.rb
229
232
  - spec/support/config/active_job.rb
233
+ - spec/support/config/factory_bot.rb
230
234
  - spec/support/config/pageflow_panorama.rb
231
235
  - spec/support/helpers/doubles.rb
232
236
  homepage: https://github.com/codevise/pageflow-panorama
@@ -254,10 +258,13 @@ signing_key:
254
258
  specification_version: 4
255
259
  summary: Pagetype for iframe embedded 360° panoramas
256
260
  test_files:
261
+ - spec/factories/panorama_package.rb
257
262
  - spec/fixtures/dir_some.txt.zip
258
263
  - spec/fixtures/krpano.zip
259
264
  - spec/fixtures/krpano_with_unprocessable_thumbnail.zip
260
265
  - spec/fixtures/some.txt.zip
266
+ - spec/helpers/pageflow/panorama/packages_helper_spec.rb
267
+ - spec/integration/file_type_spec.rb
261
268
  - spec/integration/page_type_spec.rb
262
269
  - spec/models/pageflow/panorama/package_spec.rb
263
270
  - spec/pageflow/panorama/job_status_attributes_spec.rb
@@ -265,5 +272,6 @@ test_files:
265
272
  - spec/pageflow/panorama/validation/kr_pano_spec.rb
266
273
  - spec/spec_helper.rb
267
274
  - spec/support/config/active_job.rb
275
+ - spec/support/config/factory_bot.rb
268
276
  - spec/support/config/pageflow_panorama.rb
269
277
  - spec/support/helpers/doubles.rb