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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef8156cc6673d1a9cf46289e5321a4a4ccba3fb6592c99ab2a93b929aff4c33b
4
- data.tar.gz: eb48652b4e495b6336c34a14a92d71cebfb2f566a9aaa7dae9c6418c285ba75c
3
+ metadata.gz: ac39360c48b9d97535316933f2c27b9a6168ac4fdf2e35e49729f4d3bba1354e
4
+ data.tar.gz: d47baa4f5ce4a84d01012fd7cdaeab492571b0d64c35fca95bf825197765ea88
5
5
  SHA512:
6
- metadata.gz: 7ebe4993941ec855617944660dd4685c2621e43da8d16fb73795895f05e87863e16f807cc6f677010a2978929db28faef0e7cd01006197f31d43bce686a547fb
7
- data.tar.gz: 644e8fb3b19cb173d4a0d5708f1615a78529f8fa5385811248e1144470a9c28be5ea9634bafdfd244edd03f5efdf8e5a101e3379de85925d3f8daa2fc6280249
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
@@ -0,0 +1,5 @@
1
+ AllCops:
2
+ Exclude:
3
+ - "tmp/**/*"
4
+ inherit_gem:
5
+ barsoom_utils: shared_rubocop.yml
data/Gemfile CHANGED
@@ -1,4 +1,9 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in prawn_cocktail.gemspec
4
4
  gemspec
5
+
6
+ group :development do
7
+ gem "barsoom_utils", github: "barsoom/barsoom_utils"
8
+ gem "rubocop"
9
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # PrawnCocktailRails
2
2
 
3
- [![Build status](https://secure.travis-ci.org/barsoom/prawn_cocktail_rails.png)](https://travis-ci.org/#!/barsoom/prawn_cocktail_rails/builds)
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
- You can change disposition with `send_pdf(document, disposition: "inline")`, without the option it will default to `"attachment"`.
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
- It configures PrawnCocktail to look for its views in `app/views/documents`.
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, opts = {})
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,3 +1,3 @@
1
1
  module PrawnCocktailRails
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -1,20 +1,20 @@
1
1
  # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'prawn_cocktail_rails/version'
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('../config/application', __FILE__)
5
+ require File.expand_path("../config/application", __FILE__)
6
6
  Dummy::Application.load_tasks
@@ -1,4 +1,4 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ require File.expand_path("../boot", __FILE__)
2
2
 
3
3
  # Pick the frameworks you want:
4
4
  require "action_controller/railtie"
@@ -1,10 +1,10 @@
1
- require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
1
+ require "rubygems"
2
+ gemfile = File.expand_path("../../../../Gemfile", __FILE__)
3
3
 
4
4
  if File.exist?(gemfile)
5
- ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
5
+ ENV["BUNDLE_GEMFILE"] = gemfile
6
+ require "bundler"
7
7
  Bundler.setup
8
8
  end
9
9
 
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
10
+ $:.unshift File.expand_path("../../../../lib", __FILE__)
@@ -1,5 +1,5 @@
1
1
  # Load the rails application
2
- require File.expand_path('../application', __FILE__)
2
+ require File.expand_path("../application", __FILE__)
3
3
 
4
4
  # Initialize the rails application
5
5
  Dummy::Application.initialize!
@@ -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 = false
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 = 'ecc1e4d2f3688465864a194ce713e2a958d94741c8a39741775b5fd5c001fcf279c2f32540d95139f3cb814718a25d36b23de65d8c7d8d5643e5da61ba86e5a9'
7
+ Dummy::Application.config.secret_token = "ecc1e4d2f3688465864a194ce713e2a958d94741c8a39741775b5fd5c001fcf279c2f32540d95139f3cb814718a25d36b23de65d8c7d8d5643e5da61ba86e5a9"
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
3
+ Dummy::Application.config.session_store :cookie_store, key: "_dummy_session"
@@ -1,3 +1,3 @@
1
1
  Dummy::Application.routes.draw do
2
- get 'document' => 'dummy#show'
2
+ get "document" => "dummy#show"
3
3
  end
data/spec/dummy/config.ru CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path("../config/environment", __FILE__)
4
4
  run Dummy::Application
@@ -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('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
4
+ APP_PATH = File.expand_path("../../config/application", __FILE__)
5
+ require File.expand_path("../../config/boot", __FILE__)
6
+ require "rails/commands"
@@ -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
- assert_header "Content-Disposition", 'attachment; filename="test.pdf"'
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.1
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: 2019-05-09 00:00:00.000000000 Z
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
- - ".travis.yml"
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.0.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
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0