source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | cjbottaro/param_protected | https://github.com/cjbottaro/param_protected | test/conditions_controller_test.rb | Ruby | mit | 84 | master | 209 | require "test_helper"
class ConditionsControllerTest < ActionController::TestCase
test_action :first do
assert_params %w[a c]
end
test_action :second do
assert_params %w[a b]
end
end |
github | cjbottaro/param_protected | https://github.com/cjbottaro/param_protected | test/accessible_except_test.rb | Ruby | mit | 84 | master | 224 | require "test_helper"
class AccessibleExceptControllerTest < ActionController::TestCase
test_action :first do
assert_params %w[a b c d e f g h]
end
test_action :second do
assert_params %w[a]
end
end |
github | cjbottaro/param_protected | https://github.com/cjbottaro/param_protected | test/test_helper.rb | Ruby | mit | 84 | master | 814 | ENV['RAILS_ENV'] ||= 'test'
# Load the Rails environment and testing framework
require "#{File.dirname(__FILE__)}/app_root/config/environment"
require 'rails/test_help'
require 'param_protected'
class ActionController::TestCase
PARAMS = {
"a" => "a",
"b" => "b",
"c" => "c",
"d" => "d",
"e" => "e... |
github | cjbottaro/param_protected | https://github.com/cjbottaro/param_protected | test/app_root/config/application.rb | Ruby | mit | 84 | master | 573 | require File.expand_path('../boot', __FILE__)
require "action_controller/railtie"
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module TestApp
class Application < Rails::Ap... |
github | cjbottaro/param_protected | https://github.com/cjbottaro/param_protected | test/app_root/app/controllers/merge_controller.rb | Ruby | mit | 84 | master | 230 | class MergeController < ApplicationController
param_accessible :a, :only => :first
param_accessible :b
param_accessible({ :h => :c}, :except => :first)
param_accessible :h => :b
def first; end
def second; end
end |
github | cjbottaro/param_protected | https://github.com/cjbottaro/param_protected | test/app_root/app/controllers/conditions_controller.rb | Ruby | mit | 84 | master | 425 | class ConditionsController < ApplicationController
param_accessible :a, :if => :something?
param_accessible :b, :unless => false
param_protected :b, :if => :first_action?
param_accessible :c, :if => lambda { |controller| controller.instance_eval { first_action? } }
def first; end
def second; end
p... |
github | cjbottaro/param_protected | https://github.com/cjbottaro/param_protected | test/app_root/app/controllers/protected_controller.rb | Ruby | mit | 84 | master | 846 | class ProtectedController < ApplicationController
param_protected :a
def an_action; end
param_protected :b, :only => :only_one_action
def only_one_action; end
param_protected :c, :except => :except_one_action
def except_one_action; end
param_protected [:d, :e], :only => :params_as_array
def ... |
github | cjbottaro/param_protected | https://github.com/cjbottaro/param_protected | test/app_root/lib/console_with_fixtures.rb | Ruby | mit | 84 | master | 312 | # Loads fixtures into the database when running the test app via the console
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(Rails.root, '../fixtures/*.{yml,csv}'))).each do |fixture_file|
Fixtures.create_fixtures(File.join(Rails.root, '../fixtures'), File.basename(fixture_file, '.*'))
end |
github | cjbottaro/param_protected | https://github.com/cjbottaro/param_protected | lib/param_protected.rb | Ruby | mit | 84 | master | 204 | require "param_protected/constants"
require "param_protected/protector"
require "param_protected/controller_modifications"
ActionController::Base.send(:include, ParamProtected::ControllerModifications) |
github | cjbottaro/param_protected | https://github.com/cjbottaro/param_protected | lib/param_protected/protector.rb | Ruby | mit | 84 | master | 6,471 | module ParamProtected
class Protector
def initialize
@protections = []
end
def initialize_copy(copy)
copy.instance_variable_set(:@protections, deep_copy(@protections))
end
def declare_protection(params, options, exclusivity)
params = normalize_params(params)
actions, con... |
github | cjbottaro/param_protected | https://github.com/cjbottaro/param_protected | lib/param_protected/controller_modifications.rb | Ruby | mit | 84 | master | 935 | module ParamProtected
module ControllerModifications
extend ActiveSupport::Concern
included do
alias_method_chain :params, :protection
end
module ClassMethods
def _protector
@_protector ||= Protector.new
end
def _protector=(value)
@_protector = value
en... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | Rakefile | Ruby | mit | 84 | master | 504 | require "rubygems"
require "bundler"
Bundler.setup
require 'rake'
require 'rspec/core/rake_task'
require 'roodi'
require 'roodi_task'
desc "Default Task"
task :default => [ :spec ]
# run all rspecs
desc "Run all rspec files"
RSpec::Core::RakeTask.new("spec") do |t|
t.rspec_opts = ["--color", "--format progress"]
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | preflight.gemspec | Ruby | mit | 84 | master | 1,003 | Gem::Specification.new do |s|
s.name = "preflight"
s.version = "0.3.0"
s.summary = "Check PDF files conform to various standards"
s.description = "Provides a programatic way to check a PDF file conforms to standards like PDF-X/1a"
s.license = "MIT"
s.author ... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight.rb | Ruby | mit | 84 | master | 207 | require 'pdf/reader'
require 'preflight/measurements'
require 'preflight/issue'
require 'preflight/profile'
require 'preflight/rules'
require 'preflight/profiles'
module Preflight
VERSION = "0.0.6"
end |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules.rb | Ruby | mit | 84 | master | 1,409 | require 'preflight/rules/box_nesting'
require 'preflight/rules/box_presence'
require 'preflight/rules/compression_algorithms'
require 'preflight/rules/consistent_boxes'
require 'preflight/rules/cropbox_matches_mediabox'
require 'preflight/rules/document_id'
require 'preflight/rules/info_has_keys'
require 'preflight/rul... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/measurements.rb | Ruby | mit | 84 | master | 769 | # encoding: utf-8
#
require 'bigdecimal'
module Preflight
module Measurements
private
# convert inches to standard PDF points
#
def in2pt(inch)
return inch * BigDecimal.new("72")
end
# convert mm to standard PDF points
#
def mm2pt(mm)
return mm * (BigDecimal.new("72") ... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/issue.rb | Ruby | mit | 84 | master | 641 | # encoding: utf-8
module Preflight
class Issue
attr_reader :description, :rule, :attributes
def initialize(description, rule, attributes = {})
@description = description
if rule.is_a?(Class)
@rule = rule.to_s.to_sym
else
@rule = rule.class.to_s.to_sym
end
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/profile.rb | Ruby | mit | 84 | master | 3,362 | # coding: utf-8
module Preflight
# base functionality for all profiles.
#
module Profile
def self.included(base) # :nodoc:
base.class_eval do
extend Preflight::Profile::ClassMethods
include InstanceMethods
end
end
module ClassMethods
def profile_name(str)
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/print_boxes.rb | Ruby | mit | 84 | master | 969 | # coding: utf-8
module Preflight
module Rules
# For PDFX/1a, every page must have MediaBox, plus either ArtBox or
# TrimBox
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::PrintBoxes
# end
#
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/pdfx_output_intent_has_keys.rb | Ruby | mit | 84 | master | 1,252 | # coding: utf-8
module Preflight
module Rules
# All PDFX files MUST have a GTS_PDFX OutputIntent with certain keys
# GTS_PDFX OutputIntent.
#
# This doesn't raise an error if there is no GTS_PDFX, that's another
# rules job.
#
# Arguments: none
#
# Usage:
#
# class MyPr... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/no_devicen.rb | Ruby | mit | 84 | master | 2,688 | # coding: utf-8
require 'forwardable'
module Preflight
module Rules
# Some print workflows forbid the use of DeviceN colours (one or
# more spot colours).
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rule... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/min_bleed.rb | Ruby | mit | 84 | master | 5,452 | # coding: utf-8
require 'forwardable'
require 'matrix'
module Preflight
module Rules
# To print colour to the edge of the page you must print past the intended
# page edge and then trim the printed sheet. The printed area that will be
# trimmed is called bleed. Generally you will probably want 3-4mm of... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/no_filespecs.rb | Ruby | mit | 84 | master | 831 | # coding: utf-8
module Preflight
module Rules
# Check the target PDF doesn't use Filespecs to refer to external files.
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::NoFilespecs
# end
#
clas... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/info_specifies_trapping.rb | Ruby | mit | 84 | master | 808 | # coding: utf-8
module Preflight
module Rules
# Every PDF has an optional 'Info' dictionary. Check that the dictionary
# has a 'Trapped' entry that is set to True or False
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule ... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/min_ppi.rb | Ruby | mit | 84 | master | 3,499 | # coding: utf-8
require 'matrix'
require 'forwardable'
module Preflight
module Rules
# For high quality prints, you generally want raster images to be
# AT LEAST 300 points-per-inch (ppi). 600 is better, 1200 better again.
#
# Arguments: the lowest PPI that is ok
#
# Usage:
#
# cl... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/compression_algorithms.rb | Ruby | mit | 84 | master | 1,085 | # coding: utf-8
module Preflight
module Rules
# check a file doesn't use unwanted compression algorithms
#
# Arguments: a list of permitted compression algorithms.
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::CompressionAl... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/max_ink_density.rb | Ruby | mit | 84 | master | 1,774 | # coding: utf-8
require 'yaml'
require 'matrix'
module Preflight
module Rules
# Most CMYK printers will have a stated upper tolerance for ink density. If
# the total percentage of the 4 components (C, M, Y and K) is over that
# tolerance then the result can be unpredictable and often ugly.
#
# ... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/no_gray.rb | Ruby | mit | 84 | master | 2,590 | # coding: utf-8
require 'forwardable'
module Preflight
module Rules
# Some print workflows forbid the use of Gray colour.
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::NoGray
# end
#
class... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/no_separation.rb | Ruby | mit | 84 | master | 2,617 | # coding: utf-8
require 'forwardable'
module Preflight
module Rules
# Some print workflows forbid the use of Separation colours (like
# Pantones).
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::NoSep... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/consistent_boxes.rb | Ruby | mit | 84 | master | 1,690 | # coding: utf-8
module Preflight
module Rules
# Every page should have identical page boxes
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::BoxNesting
# end
#
class ConsistentBoxes
# D... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/mediabox_at_origin.rb | Ruby | mit | 84 | master | 871 | # coding: utf-8
require 'bigdecimal'
module Preflight
module Rules
# Checks the MediaBox for every page is at 0,0. This isn't required by
# any standards but is good practice to ensure correct rendering with
# some applications.
#
# Arguments: none
#
# Usage:
#
# class MyPrefl... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/page_box_size.rb | Ruby | mit | 84 | master | 3,035 | # coding: utf-8
module Preflight
module Rules
# Ensure that the requests page box (MediaBox, TrimBox, etc) on every page
# has the requested size. Dimensions can be in points, mm or inches. Skips
# the page if the requested box isn't defined, it's up to other rules to
# check for the existence of th... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/no_private_data.rb | Ruby | mit | 84 | master | 854 | # coding: utf-8
module Preflight
module Rules
# Ensure the target file contains no private application data.
#
# PDF generating apps (like Adobe Illustrator) can embed their own private
# data in saved PDFs. This data is generally harmless and ignored by all
# other PDF consumers, but it can lea... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/match_info_entries.rb | Ruby | mit | 84 | master | 1,111 | # coding: utf-8
module Preflight
module Rules
# Every PDF has an optional 'Info' dictionary. Check that the target file
# has certain keys and that the keys match a given regexp
#
# Arguments: the required keys
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/box_presence.rb | Ruby | mit | 84 | master | 1,463 | # coding: utf-8
module Preflight
module Rules
# Specify the presence of page boxes
#
# Arguments: hash containing :any or :all key with an array value of box
# names as symbols
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rul... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/no_cmyk.rb | Ruby | mit | 84 | master | 2,936 | # coding: utf-8
require 'forwardable'
module Preflight
module Rules
# Some print workflows forbid the use of CMYK colour.
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::NoCmyk
# end
#
class... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/no_registration_black.rb | Ruby | mit | 84 | master | 2,607 | # coding: utf-8
require 'forwardable'
module Preflight
module Rules
# Some print workflows forbid the use of Registration Black
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::NoRegistrationBlack
# ... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/info_has_keys.rb | Ruby | mit | 84 | master | 726 | # coding: utf-8
module Preflight
module Rules
# Every PDF has an optional 'Info' dictionary. Check that the target file
# has certain keys
#
# Arguments: the required keys
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::I... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/page_box_width.rb | Ruby | mit | 84 | master | 2,895 | # coding: utf-8
module Preflight
module Rules
# Ensure the requested page box (MediaBox, TrimBox, etc) on every page has
# the requested width. Dimensions can be in points, mm or inches. Skips
# the page if the requested box isn't defined, it's up to other rules to
# check for the existence of the b... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/no_transparency.rb | Ruby | mit | 84 | master | 2,492 | # coding: utf-8
require 'forwardable'
module Preflight
module Rules
# For some print workflows transparency is forbidden.
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::NoTransparency
# end
#
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/box_nesting.rb | Ruby | mit | 84 | master | 2,691 | # coding: utf-8
module Preflight
module Rules
# For each page MediaBox must be the biggest box, followed by the
# BleedBox or ArtBox, followed by the TrimBox.
#
# Boxes may be omitted, but if they're provided they must be correctly nested.
#
# Arguments: none
#
# Usage:
#
# ... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/document_id.rb | Ruby | mit | 84 | master | 474 | # coding: utf-8
module Preflight
module Rules
# check the file has a document ID
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::DocumentId
# end
#
class DocumentId
def check_hash(ohash... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/no_rgb.rb | Ruby | mit | 84 | master | 2,813 | # coding: utf-8
require 'forwardable'
module Preflight
module Rules
# Some print workflows forbid the use of RGB colour.
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::NoRgb
# end
#
class N... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/max_version.rb | Ruby | mit | 84 | master | 818 | # coding: utf-8
module Preflight
module Rules
# ensure the PDF version of the file under review is not more recent
# than desired
#
# Arguments: the maximum version
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::MaxVersio... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/output_intent_for_pdfx.rb | Ruby | mit | 84 | master | 863 | # coding: utf-8
module Preflight
module Rules
# Check the target PDF contains an output intent suitable for PDFX
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::OutputIntentForPdfx
# end
#
cl... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/page_count.rb | Ruby | mit | 84 | master | 2,247 | # coding: utf-8
module Preflight
module Rules
# Ensure the page count matches certain criteria.
#
# Arguments: An integer, range, :even or :odd
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::PageCount, 1
# rule Prefl... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/no_page_rotation.rb | Ruby | mit | 84 | master | 765 | # coding: utf-8
module Preflight
module Rules
# Ensure the target file contains no page rotation.
#
# Rotating pages is generally acceptable in most specs but it can cause
# rendering issues with poor waulity PDF consumers.
#
# Arguments: none
#
# Usage:
#
# class MyPreflig... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/page_box_height.rb | Ruby | mit | 84 | master | 2,940 | # coding: utf-8
module Preflight
module Rules
# Ensure the requested page box (MediaBox, TrimBox, etc) on every page has
# the requested height. Dimensions can be in points, mm or inches. Skips
# the page if the requested box isn't defined, it's up to other rules to
# check for the existence of the ... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/no_font_subsets.rb | Ruby | mit | 84 | master | 863 | # coding: utf-8
module Preflight
module Rules
# check a file has no font subsets. Subsets are handy and valid in
# standards like PDFX/1a, but they can make it hard to edit a file
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# ... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/only_embedded_fonts.rb | Ruby | mit | 84 | master | 1,233 | # coding: utf-8
module Preflight
module Rules
# Check the target PDF only uses embedded fonts
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::OnlyEmbeddedFonts
# end
#
class OnlyEmbeddedFonts... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/cropbox_matches_mediabox.rb | Ruby | mit | 84 | master | 786 | # coding: utf-8
module Preflight
module Rules
# Every page should have a CropBox that matches the MediaBox
#
# Arguments: none
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules::CropboxMatchesMediabox
# end
#
class... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/rules/root_has_keys.rb | Ruby | mit | 84 | master | 719 | # coding: utf-8
module Preflight
module Rules
# Every PDF has a 'Root' dictionary, check that the target file has
# certain keys in it's Root
#
# Arguments: the required keys
#
# Usage:
#
# class MyPreflight
# include Preflight::Profile
#
# rule Preflight::Rules... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/profiles/pdfa1a.rb | Ruby | mit | 84 | master | 353 | # coding: utf-8
module Preflight
module Profiles
class PDFA1A
include Preflight::Profile
profile_name "pdfa-1a"
# hard failures of the pdfx/1a spec
rule Preflight::Rules::CompressionAlgorithms, :CCITTFaxDecode, :DCTDecode, :FlateDecode, :RunLengthDecode
rule Preflight::Rules::Only... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | lib/preflight/profiles/pdfx1a.rb | Ruby | mit | 84 | master | 1,098 | # coding: utf-8
module Preflight
module Profiles
class PDFX1A
include Preflight::Profile
profile_name "pdfx-1a"
rule Preflight::Rules::MatchInfoEntries, {:GTS_PDFXVersion => /\APDF\/X/,
:GTS_PDFXConformance => /\APDF\/X-1a/}
rule Preflight... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/spec_helper.rb | Ruby | mit | 84 | master | 344 | require "rubygems"
require "bundler"
Bundler.setup
require 'rspec'
require 'preflight'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f }
RSpec.configure do |config|
config.include ... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/issue_spec.rb | Ruby | mit | 84 | master | 853 | require File.dirname(__FILE__) + "/spec_helper"
describe Preflight::Issue do
describe "initialisation" do
let!(:issue) do
Preflight::Issue.new("Transparency detected",
Preflight::Rules::NoTransparency,
{:page => 1}
)
end
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/profiles/mutating_rule_arguments_spec.rb | Ruby | mit | 84 | master | 525 | require "spec_helper"
class MutatingProfile
include Preflight::Profile
rule Preflight::Rules::PageBoxSize, :MediaBox, [
{ :width => 216, :height => 279.5, :units => :mm }
]
end
describe "A profile with a rule that mutates it's arguments" do
it "passes a valid file 2 consequtive times" do
filename =... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/profiles/invalid_rules_spec.rb | Ruby | mit | 84 | master | 407 | require File.dirname(__FILE__) + "/../spec_helper"
class InvalidProfile
include Preflight::Profile
profile_name "invalid"
rule String, 1.3
end
describe "Profile with an invalid rule" do
it "should raise an exception" do
filename = pdf_spec_file("version_1_4")
preflight = InvalidProfile.new
lamb... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/profiles/pdfx1a_spec.rb | Ruby | mit | 84 | master | 1,526 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Profiles::PDFX1A do
it "correctly pass a valid PDF/X-1a file that uses font subsetting" do
filename = pdf_spec_file("pdfx-1a-subsetting")
preflight = Preflight::Profiles::PDFX1A.new
messages = preflight.check(filename)
message... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/profiles/pdfa1a_spec.rb | Ruby | mit | 84 | master | 318 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Profiles::PDFA1A do
it "correctly pass a valid PDF/A-1a file" do
filename = pdf_spec_file("pdfa-1a")
preflight = Preflight::Profiles::PDFA1A.new
messages = preflight.check(filename)
messages.empty?.should be_true
end
end |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/profiles/custom_import_profile_spec.rb | Ruby | mit | 84 | master | 1,158 | require File.dirname(__FILE__) + "/../spec_helper"
class CustomImportProfile
include Preflight::Profile
profile_name "custom"
import Preflight::Profiles::PDFX1A
rule Preflight::Rules::MinPpi, 300
end
describe "Customised profile that imports the standard PDF/X-1a profile" do
it "pass a valid PDF/X-1a fi... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/profiles/instance_rules_spec.rb | Ruby | mit | 84 | master | 722 | require File.dirname(__FILE__) + "/../spec_helper"
class InstanceRuleProfile
include Preflight::Profile
profile_name "custom"
end
describe InstanceRuleProfile do
it "correctly pass a valid file when no rules are defined" do
filename = pdf_spec_file("version_1_4")
preflight = InstanceRuleProfile.new
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/profiles/custom_profile_spec.rb | Ruby | mit | 84 | master | 1,078 | require File.dirname(__FILE__) + "/../spec_helper"
class CustomProfile
include Preflight::Profile
profile_name "custom"
rule Preflight::Rules::MaxVersion, 1.3
end
class PpiProfile
include Preflight::Profile
rule Preflight::Rules::MinPpi, 200
end
describe "Customised profile" do
it "fail files with a ... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/no_cmyk_spec.rb | Ruby | mit | 84 | master | 4,704 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::NoCmyk do
context "a page with a CMYK fill colour" do
let!(:filename) { pdf_spec_file("cmyk") }
it "should have one an issue" do
rule = Preflight::Rules::NoCmyk.new
PDF::Reader.open(filename) do |reader|
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/page_count_spec.rb | Ruby | mit | 84 | master | 2,895 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::PageCount do
it "should pass files with correct page count specified by Fixnum" do
filename = pdf_spec_file("pdfx-1a-subsetting")
ohash = PDF::Reader::ObjectHash.new(filename)
rule = Preflight::Rules::PageCount.new(1)
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/only_embedded_fonts_spec.rb | Ruby | mit | 84 | master | 1,094 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::OnlyEmbeddedFonts do
it "should pass a PDF/X-1a file with a no subsetting" do
filename = pdf_spec_file("pdfx-1a-no-subsetting")
rule = Preflight::Rules::OnlyEmbeddedFonts.new
PDF::Reader.open(filename) do |reader|
r... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/max_ink_density_spec.rb | Ruby | mit | 84 | master | 981 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::MaxInkDensity do
it "pass files with a no CYMK colors" do
filename = pdf_spec_file("rgb-hexagon")
rule = Preflight::Rules::MaxInkDensity.new(100)
PDF::Reader.open(filename) do |reader|
reader.page(1).walk(rule)
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/no_rgb_spec.rb | Ruby | mit | 84 | master | 4,679 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::NoRgb do
context "a page with an RGB fill colour" do
let!(:filename) { pdf_spec_file("rgb") }
it "should have one an issue" do
rule = Preflight::Rules::NoRgb.new
PDF::Reader.open(filename) do |reader|
rea... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/output_intent_for_pdfx_spec.rb | Ruby | mit | 84 | master | 624 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::OutputIntentForPdfx do
it "fail files with no OutputIntent for PDF/X" do
filename = pdf_spec_file("pdfa-1a")
ohash = PDF::Reader::ObjectHash.new(filename)
chk = Preflight::Rules::OutputIntentForPdfx.new
chk.check_... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/no_font_subsets_spec.rb | Ruby | mit | 84 | master | 611 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::NoFontSubsets do
it "fail files with a subsetted TTF font" do
filename = pdf_spec_file("pdfx-1a-subsetting")
ohash = PDF::Reader::ObjectHash.new(filename)
chk = Preflight::Rules::NoFontSubsets.new
chk.check_hash(o... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/page_box_height_spec.rb | Ruby | mit | 84 | master | 4,147 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::PageBoxHeight do
it "should pass files with a correctly sized MediaBox defined by Float points" do
filename = pdf_spec_file("pdfx-1a-subsetting")
rule = Preflight::Rules::PageBoxHeight.new(:MediaBox, 841.89, :pts)
PDF::Re... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/document_id_spec.rb | Ruby | mit | 84 | master | 614 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::DocumentId do
it "fail files with no document ID in the trailer" do
filename = pdf_spec_file("no_document_id")
ohash = PDF::Reader::ObjectHash.new(filename)
chk = Preflight::Rules::DocumentId.new
chk.check_hash(oh... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/mediabox_at_origin_spec.rb | Ruby | mit | 84 | master | 670 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::MediaboxAtOrigin do
it "pass files with the MediaBox at 0,0" do
filename = pdf_spec_file("pdfx-1a-subsetting")
rule = Preflight::Rules::MediaboxAtOrigin.new
PDF::Reader.open(filename) do |reader|
reader.page(1).walk... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/cropbox_matches_mediabox_spec.rb | Ruby | mit | 84 | master | 741 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::CropboxMatchesMediabox do
it "should pass files with a CrobBox that matches the MediaBox" do
filename = pdf_spec_file("pdfx-1a-subsetting")
rule = Preflight::Rules::CropboxMatchesMediabox.new
PDF::Reader.open(filename) do... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/min_ppi_spec.rb | Ruby | mit | 84 | master | 2,217 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::MinPpi do
it "pass files with a no raster images" do
filename = pdf_spec_file("pdfx-1a-subsetting")
rule = Preflight::Rules::MinPpi.new(300)
PDF::Reader.open(filename) do |reader|
reader.page(1).walk(rule)
rul... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/print_boxes_spec.rb | Ruby | mit | 84 | master | 1,230 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::PrintBoxes do
it "pass files with required page boxes" do
filename = pdf_spec_file("pdfx-1a-subsetting")
rule = Preflight::Rules::PrintBoxes.new
PDF::Reader.open(filename) do |reader|
reader.page(1).walk(rule)
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/info_has_keys_spec.rb | Ruby | mit | 84 | master | 637 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::InfoHasKeys do
it "fail files with no Title entry in the Info dict" do
filename = pdf_spec_file("no_document_id")
ohash = PDF::Reader::ObjectHash.new(filename)
chk = Preflight::Rules::InfoHasKeys.new(:Title)
chk.c... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/root_has_keys_spec.rb | Ruby | mit | 84 | master | 674 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::RootHasKeys do
it "fail files with no GTS_PDFXVersion entry in the Info dict" do
filename = pdf_spec_file("no_document_id")
ohash = PDF::Reader::ObjectHash.new(filename)
chk = Preflight::Rules::RootHasKeys.new(:OutputI... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/no_private_data_spec.rb | Ruby | mit | 84 | master | 717 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::NoPrivateData do
it "pass files with no page level PieceInfo entry" do
filename = pdf_spec_file("pdfx-1a-subsetting")
rule = Preflight::Rules::NoPrivateData.new
PDF::Reader.open(filename) do |reader|
reader.page(1).... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/match_info_entries_spec.rb | Ruby | mit | 84 | master | 717 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::MatchInfoEntries do
it "fail files with no GTS_PDFXVersion entry in the Info dict" do
filename = pdf_spec_file("no_document_id")
ohash = PDF::Reader::ObjectHash.new(filename)
chk = Preflight::Rules::MatchInfoEntries.ne... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/info_specifies_trapping_spec.rb | Ruby | mit | 84 | master | 663 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::InfoSpecifiesTrapping do
it "fail files without Trapping specified in the Info dict" do
filename = pdf_spec_file("no_document_id")
ohash = PDF::Reader::ObjectHash.new(filename)
chk = Preflight::Rules::InfoSpecifiesTrap... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/no_registration_black_spec.rb | Ruby | mit | 84 | master | 4,561 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::NoRegistrationBlack do
context "a page with a CMYK fill colour (1,1,1,1)" do
let!(:filename) { pdf_spec_file("registration_black") }
it "should have one an issue" do
rule = Preflight::Rules::NoRegistrationBlack.new
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/no_transparency_spec.rb | Ruby | mit | 84 | master | 1,140 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::NoTransparency do
context "a page with transparent xobjects" do
let!(:filename) { pdf_spec_file("transparency") }
it "should fail with an issue" do
rule = Preflight::Rules::NoTransparency.new
PDF::Reader.open(fil... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/consistent_boxes_spec.rb | Ruby | mit | 84 | master | 1,179 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::ConsistentBoxes do
it "pass files with identical MediaBox on each page" do
filename = pdf_spec_file("two_pages")
rule = Preflight::Rules::ConsistentBoxes.new
PDF::Reader.open(filename) do |reader|
reader.pages.each ... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/box_nesting_spec.rb | Ruby | mit | 84 | master | 977 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::BoxNesting do
it "pass files with page boxes nested appropriately" do
filename = pdf_spec_file("pdfx-1a-subsetting")
rule = Preflight::Rules::BoxNesting.new
PDF::Reader.open(filename) do |reader|
reader.page(1).walk... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/page_box_width_spec.rb | Ruby | mit | 84 | master | 4,131 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::PageBoxWidth do
it "should pass files with a correctly sized MediaBox defined by Float points" do
filename = pdf_spec_file("pdfx-1a-subsetting")
rule = Preflight::Rules::PageBoxWidth.new(:MediaBox, 595.276, :pts)
PDF::Rea... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/no_page_rotation_spec.rb | Ruby | mit | 84 | master | 643 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::NoPageRotation do
it "pass files with no page Rotate entry" do
filename = pdf_spec_file("pdfx-1a-subsetting")
rule = Preflight::Rules::NoPageRotation.new
PDF::Reader.open(filename) do |reader|
reader.page(1).walk(ru... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/no_gray_spec.rb | Ruby | mit | 84 | master | 2,412 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::NoGray do
context "a page with a Gray fill colour" do
let!(:filename) { pdf_spec_file("gray") }
it "should have one an issue" do
rule = Preflight::Rules::NoGray.new
PDF::Reader.open(filename) do |reader|
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/min_bleed_spec.rb | Ruby | mit | 84 | master | 2,185 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::MinBleed do
it "pass files with an image that doesn't require bleed" do
filename = pdf_spec_file("image_no_bleed_5mm_gap")
# objects within 1mm of the TrimBox must have at least 4mm bleed
rule = Preflight::Rules::MinBleed... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/box_presence_spec.rb | Ruby | mit | 84 | master | 1,700 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::BoxPresence do
it "pass files with all required page boxes" do
filename = pdf_spec_file("pdfx-1a-subsetting")
rule = Preflight::Rules::BoxPresence.new(:all => [:MediaBox, :CropBox])
PDF::Reader.open(filename) do |reader|
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/no_separation_spec.rb | Ruby | mit | 84 | master | 4,914 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::NoSeparation do
context "a page with a CMYK fill colour defined in the page resources" do
let!(:filename) { pdf_spec_file("spot") }
it "should have one an issue" do
rule = Preflight::Rules::NoSeparation.new
PDF::... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/max_version_spec.rb | Ruby | mit | 84 | master | 868 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::MaxVersion do
it "correctly fail files with a higher version" do
filename = pdf_spec_file("version_1_4")
ohash = PDF::Reader::ObjectHash.new(filename)
chk = Preflight::Rules::MaxVersion.new("1.3")
chk.check_hash(o... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/page_box_size_spec.rb | Ruby | mit | 84 | master | 5,207 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::PageBoxSize do
it "should pass files with a correctly sized MediaBox defined by Float points" do
filename = pdf_spec_file("pdfx-1a-subsetting")
rule = Preflight::Rules::PageBoxSize.new(:MediaBox,
... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/compression_algorithms_spec.rb | Ruby | mit | 84 | master | 692 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::CompressionAlgorithms do
it "correctly fail files with a disallowed compression algorithm" do
filename = pdf_spec_file("jbig2")
ohash = PDF::Reader::ObjectHash.new(filename)
chk = Preflight::Rules::CompressionAlgorithm... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/rules/no_devicen_spec.rb | Ruby | mit | 84 | master | 4,829 | require File.dirname(__FILE__) + "/../spec_helper"
describe Preflight::Rules::NoDevicen do
context "a page with a DeviceN fill colour" do
let!(:filename) { pdf_spec_file("devicen") }
it "should have one an issue" do
rule = Preflight::Rules::NoDevicen.new
PDF::Reader.open(filename) do |read... |
github | yob/pdf-preflight | https://github.com/yob/pdf-preflight | spec/support/preflight_spec_helper.rb | Ruby | mit | 84 | master | 744 | # coding: utf-8
# some helper methods available to all specs
module PreflightSpecHelper
def pdf_spec_file(base)
base_path = File.expand_path(File.dirname(__FILE__) + "/../pdfs")
filename = File.join(base_path, "#{base}.pdf")
if File.file?(filename)
return filename
else
raise ArgumentErr... |
github | byalextran/southwest-checkin | https://github.com/byalextran/southwest-checkin | autoluv.gemspec | Ruby | mit | 84 | master | 1,313 | require_relative 'lib/autoluv/version'
Gem::Specification.new do |spec|
spec.name = "autoluv"
spec.version = Autoluv::VERSION
spec.authors = ["Alex Tran"]
spec.email = ["hello@alextran.org"]
spec.summary = "Easy-to-use gem to check in to Southwest flights automatically. Al... |
github | byalextran/southwest-checkin | https://github.com/byalextran/southwest-checkin | lib/autoluv.rb | Ruby | mit | 84 | master | 1,944 | require "autoluv/version"
require "autoluv/southwestclient"
require "pony"
require "logger"
require "fileutils"
require "dotenv"
Dotenv.load("#{Dir.home}/.autoluv.env")
module Autoluv
class Error < StandardError; end
PONY_OPTIONS = {
from: "#{ENV["LUV_FROM_EMAIL"]}",
via: :smtp,
via_options: {
... |
github | byalextran/southwest-checkin | https://github.com/byalextran/southwest-checkin | lib/autoluv/southwestclient.rb | Ruby | mit | 84 | master | 4,807 | require "rest-client"
require "securerandom"
require "json"
require "tzinfo"
require "shellwords"
module Autoluv
class SouthwestClient
# minimum required headers for all API calls
DEFAULT_HEADERS = {
"Content-Type": "application/json",
"X-API-Key": "l7xx0a43088fe6254712b10787646d1b298e",
"X... |
github | MoskitoHero/barley | https://github.com/MoskitoHero/barley | barley.gemspec | Ruby | mit | 84 | main | 1,153 | require_relative "lib/barley/version"
Gem::Specification.new do |spec|
spec.name = "barley"
spec.version = Barley::VERSION
spec.authors = ["Cedric Delalande"]
spec.email = ["weengs@moskitohero.com"]
spec.summary = "Barley is a dead simple, fast, and efficient ActiveModel serializer."
spec.description = "Ce... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.