activestorage-office-previewer 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +33 -0
- data/.gitignore +3 -0
- data/Appraisals +8 -0
- data/Gemfile.lock +6 -2
- data/activestorage-office-previewer.gemspec +3 -2
- data/gemfiles/rails_6.0.gemfile +7 -0
- data/gemfiles/rails_master.gemfile +7 -0
- data/lib/active_storage/previewer/office_previewer.rb +2 -2
- data/test/dummy/db/migrate/20191204133417_create_active_storage_tables.active_storage.rb +6 -5
- data/test/office_previewer_test.rb +6 -6
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0e244b0f3233795591d219542fac46b19bc1efc87e64ca5560a75e6ca56f9e3
|
4
|
+
data.tar.gz: 6963f641fd72c599266e629cddee3d8b4ccf5dfdbd288973f75c74378e6ba245
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57f20a13cfb1e64615796709f27fa67a0cfc9464677e173051956fd5fad1a375ab32b503765dfaa5af2a4870cb6ca0c0c4b47ddf6f356b29aa2abba5d0f57c8b
|
7
|
+
data.tar.gz: 35541067f2cca532716f2e49bf979159d478a484038783486123466644d34dd7e2101ea634124b62992cd27521c966499e6f87e7fe5e22c660f8c6005fdb06e6
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
tests:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
|
7
|
+
strategy:
|
8
|
+
matrix:
|
9
|
+
gemfile:
|
10
|
+
- gemfiles/rails_6.0.gemfile
|
11
|
+
- gemfiles/rails_master.gemfile
|
12
|
+
|
13
|
+
env:
|
14
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v1
|
18
|
+
|
19
|
+
- name: Set up Ruby 2.6
|
20
|
+
uses: actions/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: 2.6.x
|
23
|
+
|
24
|
+
- name: Install dependencies
|
25
|
+
run: |
|
26
|
+
sudo apt-get update
|
27
|
+
sudo apt-get install libreoffice libsqlite3-dev
|
28
|
+
|
29
|
+
gem install bundler
|
30
|
+
bundle install --jobs 4 --retry 3
|
31
|
+
|
32
|
+
- name: Run tests
|
33
|
+
run: bundle exec rake test
|
data/.gitignore
CHANGED
data/Appraisals
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activestorage-office-previewer (0.1.
|
4
|
+
activestorage-office-previewer (0.1.2)
|
5
5
|
activestorage (>= 6.0.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -62,6 +62,10 @@ GEM
|
|
62
62
|
minitest (~> 5.1)
|
63
63
|
tzinfo (~> 1.1)
|
64
64
|
zeitwerk (~> 2.2)
|
65
|
+
appraisal (2.2.0)
|
66
|
+
bundler
|
67
|
+
rake
|
68
|
+
thor (>= 0.14.0)
|
65
69
|
builder (3.2.3)
|
66
70
|
byebug (11.0.1)
|
67
71
|
concurrent-ruby (1.1.5)
|
@@ -139,7 +143,7 @@ PLATFORMS
|
|
139
143
|
|
140
144
|
DEPENDENCIES
|
141
145
|
activestorage-office-previewer!
|
142
|
-
|
146
|
+
appraisal (~> 2.2)
|
143
147
|
byebug
|
144
148
|
mini_magick (~> 4.9.5)
|
145
149
|
minitest (~> 5.13.0)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "activestorage-office-previewer"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.2"
|
4
4
|
s.authors = "George Claghorn"
|
5
5
|
s.email = "george@basecamp.com"
|
6
6
|
s.summary = "Active Storage previewer for Microsoft Office files based on LibreOffice"
|
@@ -14,7 +14,8 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.add_dependency "activestorage", ">= 6.0.0"
|
16
16
|
|
17
|
-
s.add_development_dependency "
|
17
|
+
s.add_development_dependency "appraisal", "~> 2.2"
|
18
|
+
|
18
19
|
s.add_development_dependency "rake", "~> 13.0.0"
|
19
20
|
s.add_development_dependency "minitest", "~> 5.13.0"
|
20
21
|
s.add_development_dependency "mini_magick", "~> 4.9.5"
|
@@ -30,10 +30,10 @@ class ActiveStorage::Previewer::OfficePreviewer < ActiveStorage::Previewer
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def preview
|
33
|
+
def preview(**options)
|
34
34
|
download_blob_to_tempfile do |input|
|
35
35
|
draw_poster_image_from input do |output|
|
36
|
-
yield io: output, filename: "#{blob.filename.base}.png", content_type: "image/png"
|
36
|
+
yield io: output, filename: "#{blob.filename.base}.png", content_type: "image/png", **options
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -2,13 +2,14 @@
|
|
2
2
|
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
3
3
|
def change
|
4
4
|
create_table :active_storage_blobs do |t|
|
5
|
-
t.string :key,
|
6
|
-
t.string :
|
5
|
+
t.string :key, null: false
|
6
|
+
t.string :service_name
|
7
|
+
t.string :filename, null: false
|
7
8
|
t.string :content_type
|
8
9
|
t.text :metadata
|
9
|
-
t.bigint :byte_size,
|
10
|
-
t.string :checksum,
|
11
|
-
t.datetime :created_at,
|
10
|
+
t.bigint :byte_size, null: false
|
11
|
+
t.string :checksum, null: false
|
12
|
+
t.datetime :created_at, null: false
|
12
13
|
|
13
14
|
t.index [ :key ], unique: true
|
14
15
|
end
|
@@ -14,8 +14,8 @@ class ActiveStorage::Previewer::OfficePreviewerTest < ActiveSupport::TestCase
|
|
14
14
|
assert_equal "hello.png", attachable[:filename]
|
15
15
|
|
16
16
|
image = MiniMagick::Image.read(attachable[:io])
|
17
|
-
|
18
|
-
|
17
|
+
assert_operator image.width, :>, 500
|
18
|
+
assert_operator image.height, :>, 500
|
19
19
|
assert_equal "image/png", image.mime_type
|
20
20
|
end
|
21
21
|
end
|
@@ -30,8 +30,8 @@ class ActiveStorage::Previewer::OfficePreviewerTest < ActiveSupport::TestCase
|
|
30
30
|
assert_equal "hello.png", attachable[:filename]
|
31
31
|
|
32
32
|
image = MiniMagick::Image.read(attachable[:io])
|
33
|
-
|
34
|
-
|
33
|
+
assert_operator image.width, :>, 500
|
34
|
+
assert_operator image.height, :>, 500
|
35
35
|
assert_equal "image/png", image.mime_type
|
36
36
|
end
|
37
37
|
end
|
@@ -46,8 +46,8 @@ class ActiveStorage::Previewer::OfficePreviewerTest < ActiveSupport::TestCase
|
|
46
46
|
assert_equal "hello.png", attachable[:filename]
|
47
47
|
|
48
48
|
image = MiniMagick::Image.read(attachable[:io])
|
49
|
-
|
50
|
-
|
49
|
+
assert_operator image.width, :>, 500
|
50
|
+
assert_operator image.height, :>, 500
|
51
51
|
assert_equal "image/png", image.mime_type
|
52
52
|
end
|
53
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage-office-previewer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- George Claghorn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 6.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: appraisal
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.2'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,13 +128,17 @@ executables: []
|
|
128
128
|
extensions: []
|
129
129
|
extra_rdoc_files: []
|
130
130
|
files:
|
131
|
+
- ".github/workflows/ci.yml"
|
131
132
|
- ".gitignore"
|
133
|
+
- Appraisals
|
132
134
|
- Gemfile
|
133
135
|
- Gemfile.lock
|
134
136
|
- LICENSE.md
|
135
137
|
- README.md
|
136
138
|
- Rakefile
|
137
139
|
- activestorage-office-previewer.gemspec
|
140
|
+
- gemfiles/rails_6.0.gemfile
|
141
|
+
- gemfiles/rails_master.gemfile
|
138
142
|
- lib/active_storage/previewer/office_previewer.rb
|
139
143
|
- lib/activestorage-office-previewer.rb
|
140
144
|
- test/database/setup.rb
|
@@ -241,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
245
|
- !ruby/object:Gem::Version
|
242
246
|
version: '0'
|
243
247
|
requirements: []
|
244
|
-
rubygems_version: 3.
|
248
|
+
rubygems_version: 3.1.2
|
245
249
|
signing_key:
|
246
250
|
specification_version: 4
|
247
251
|
summary: Active Storage previewer for Microsoft Office files based on LibreOffice
|