prawn_cocktail_rails 0.3.1 → 0.3.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 +26 -0
- data/.rubocop.yml +5 -0
- data/Gemfile +6 -1
- data/README.md +5 -3
- data/lib/prawn_cocktail_rails/controller.rb +2 -4
- data/lib/prawn_cocktail_rails/version.rb +1 -1
- data/prawn_cocktail_rails.gemspec +6 -6
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/boot.rb +5 -5
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/config/initializers/secret_token.rb +1 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/script/rails +3 -3
- data/spec/integration_spec.rb +2 -2
- metadata +7 -5
- data/.travis.yml +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac39360c48b9d97535316933f2c27b9a6168ac4fdf2e35e49729f4d3bba1354e
|
4
|
+
data.tar.gz: d47baa4f5ce4a84d01012fd7cdaeab492571b0d64c35fca95bf825197765ea88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8147b805f4d60e8c50f01ddfe7775a93bd33e693533baaaa5125bef2449e9dac1fcad88404c2fc4826bbf89bd098d0cb2b870c5918e78b6d02f2b2dd1a9feb8
|
7
|
+
data.tar.gz: 1b6dee0014c83d892682617994f3a1ee8340727369dc57b0e64d13b13a1190ed0cce1758b0c3618104524ef2aa6b53cb8dff969a7c320c6c42737e3fd5211217
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby-version: ["3.0", "2.7", "2.6", "2.5"]
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
21
|
+
uses: ruby/setup-ruby@ae9cb3b565e36682a2c6045e4f664388da4c73aa
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
25
|
+
- name: Run tests
|
26
|
+
run: bundle exec rake
|
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# PrawnCocktailRails
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Ruby CI](https://github.com/barsoom/prawn_cocktail_rails/actions/workflows/ci.yml/badge.svg)](https://github.com/barsoom/prawn_cocktail_rails/actions/workflows/ci.yml)
|
4
4
|
|
5
5
|
Ruby on Rails integration for [PrawnCocktail](http://github.com/barsoom/prawn_cocktail).
|
6
6
|
|
@@ -20,9 +20,11 @@ class InvoicesController < ApplicationController
|
|
20
20
|
end
|
21
21
|
```
|
22
22
|
|
23
|
-
|
23
|
+
The default [disposition](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) is `"attachment"`, meaning it should be downloaded rather than opened inline in the browser.
|
24
24
|
|
25
|
-
|
25
|
+
You can change disposition to `"inline"` with `send_pdf(document, disposition: "inline")`.
|
26
|
+
|
27
|
+
PrawnCocktailRails configures PrawnCocktail to look for its views in `app/views/documents`.
|
26
28
|
|
27
29
|
It also adds `app/documents/helpers` to the Rails autoload path so you can put your PrawnCocktail helpers there.
|
28
30
|
|
@@ -2,14 +2,12 @@ module PrawnCocktailRails
|
|
2
2
|
module Controller
|
3
3
|
private
|
4
4
|
|
5
|
-
def send_pdf(document,
|
6
|
-
disposition = opts.fetch(:disposition, "attachment")
|
7
|
-
|
5
|
+
def send_pdf(document, disposition: "attachment")
|
8
6
|
send_data(
|
9
7
|
document.render,
|
10
8
|
type: :pdf,
|
11
9
|
disposition: disposition,
|
12
|
-
filename: document.filename
|
10
|
+
filename: document.filename,
|
13
11
|
)
|
14
12
|
end
|
15
13
|
end
|
@@ -1,20 +1,20 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "prawn_cocktail_rails/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "prawn_cocktail_rails"
|
8
8
|
gem.version = PrawnCocktailRails::VERSION
|
9
|
-
gem.authors = ["Henrik Nyh"]
|
10
|
-
gem.email = ["henrik@barsoom.se"]
|
9
|
+
gem.authors = [ "Henrik Nyh" ]
|
10
|
+
gem.email = [ "henrik@barsoom.se" ]
|
11
11
|
gem.summary = "Simple documents, templates and helpers on top of Prawn. In Ruby on Rails."
|
12
12
|
gem.homepage = ""
|
13
|
+
gem.metadata = { "rubygems_mfa_required" => "true" }
|
13
14
|
|
14
15
|
gem.files = `git ls-files`.split($/)
|
15
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
-
gem.require_paths = ["lib"]
|
17
|
+
gem.require_paths = [ "lib" ]
|
18
18
|
|
19
19
|
gem.add_dependency "prawn_cocktail", ">=0.4.0"
|
20
20
|
gem.add_dependency "rails"
|
data/spec/dummy/Rakefile
CHANGED
@@ -2,5 +2,5 @@
|
|
2
2
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
3
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
4
|
|
5
|
-
require File.expand_path(
|
5
|
+
require File.expand_path("../config/application", __FILE__)
|
6
6
|
Dummy::Application.load_tasks
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
gemfile = File.expand_path(
|
1
|
+
require "rubygems"
|
2
|
+
gemfile = File.expand_path("../../../../Gemfile", __FILE__)
|
3
3
|
|
4
4
|
if File.exist?(gemfile)
|
5
|
-
ENV[
|
6
|
-
require
|
5
|
+
ENV["BUNDLE_GEMFILE"] = gemfile
|
6
|
+
require "bundler"
|
7
7
|
Bundler.setup
|
8
8
|
end
|
9
9
|
|
10
|
-
$:.unshift File.expand_path(
|
10
|
+
$:.unshift File.expand_path("../../../../lib", __FILE__)
|
@@ -22,7 +22,7 @@ Dummy::Application.configure do
|
|
22
22
|
config.action_dispatch.show_exceptions = false
|
23
23
|
|
24
24
|
# Disable request forgery protection in test environment
|
25
|
-
config.action_controller.allow_forgery_protection
|
25
|
+
config.action_controller.allow_forgery_protection = false
|
26
26
|
|
27
27
|
# Tell Action Mailer not to deliver emails to the real world.
|
28
28
|
# The :test delivery method accumulates sent emails in the
|
@@ -4,4 +4,4 @@
|
|
4
4
|
# If you change this key, all old signed cookies will become invalid!
|
5
5
|
# Make sure the secret is at least 30 characters and all random,
|
6
6
|
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Dummy::Application.config.secret_token =
|
7
|
+
Dummy::Application.config.secret_token = "ecc1e4d2f3688465864a194ce713e2a958d94741c8a39741775b5fd5c001fcf279c2f32540d95139f3cb814718a25d36b23de65d8c7d8d5643e5da61ba86e5a9"
|
data/spec/dummy/config/routes.rb
CHANGED
data/spec/dummy/config.ru
CHANGED
data/spec/dummy/script/rails
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
3
|
|
4
|
-
APP_PATH = File.expand_path(
|
5
|
-
require File.expand_path(
|
6
|
-
require
|
4
|
+
APP_PATH = File.expand_path("../../config/application", __FILE__)
|
5
|
+
require File.expand_path("../../config/boot", __FILE__)
|
6
|
+
require "rails/commands"
|
data/spec/integration_spec.rb
CHANGED
@@ -12,10 +12,10 @@ class IntegrationTest < ActionController::TestCase
|
|
12
12
|
def test_integration
|
13
13
|
get :show
|
14
14
|
assert_header "Content-Type", "application/pdf"
|
15
|
-
|
15
|
+
assert_match %r{attachment; filename="test\.pdf"}, response.headers["Content-Disposition"]
|
16
16
|
assert_pdf_strings [
|
17
17
|
"Helper works.",
|
18
|
-
"Message: test."
|
18
|
+
"Message: test.",
|
19
19
|
]
|
20
20
|
end
|
21
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn_cocktail_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Nyh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn_cocktail
|
@@ -73,8 +73,9 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".github/workflows/ci.yml"
|
76
77
|
- ".gitignore"
|
77
|
-
- ".
|
78
|
+
- ".rubocop.yml"
|
78
79
|
- Gemfile
|
79
80
|
- README.md
|
80
81
|
- Rakefile
|
@@ -104,7 +105,8 @@ files:
|
|
104
105
|
- spec/integration_spec.rb
|
105
106
|
homepage: ''
|
106
107
|
licenses: []
|
107
|
-
metadata:
|
108
|
+
metadata:
|
109
|
+
rubygems_mfa_required: 'true'
|
108
110
|
post_install_message:
|
109
111
|
rdoc_options: []
|
110
112
|
require_paths:
|
@@ -120,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
122
|
- !ruby/object:Gem::Version
|
121
123
|
version: '0'
|
122
124
|
requirements: []
|
123
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.2.31
|
124
126
|
signing_key:
|
125
127
|
specification_version: 4
|
126
128
|
summary: Simple documents, templates and helpers on top of Prawn. In Ruby on Rails.
|
data/.travis.yml
DELETED