Skip to content

Commit

Permalink
Add Gemspec and related cleanup (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
bermannoah authored and julik committed Dec 16, 2017
1 parent 2f9d7a5 commit 6c7d441
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rvm:
- 2.3.0
- 2.4.1
- 2.4.2
- jruby-9.0
sudo: false
cache: bundler
Expand Down
11 changes: 2 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
source 'https://rubygems.org'

# Used for reading the exif of TIFF and JPEG files
gem 'exifr'
# Used for validating the info we put into FileInformation
gem 'dry-validation'

group :development do
gem 'rspec'
gem 'pry'
end
# Gem dependencies specified in the gemspec
gemspec
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ Pass an IO object that responds to `read` and `seek` to `FormatParser`.

```ruby
file_info = FormatParser.parse(File.open("myimage.jpg", "rb"))
-file_info.file_nature #=> :image
-file_info.file_format #=> :JPG
-file_info.width_px #=> 320
-file_info.height_px #=> 240
-file_info.exif_rotation_degrees #=> 90
-file_info.display_aspect_ratio #=> [3, 4]
-file_info.image_channel_names #=> ["R", "G", "B"]
-file_info.bits_per_channel #=> 8
file_info.file_nature #=> :image
file_info.file_format #=> :JPG
file_info.width_px #=> 320
file_info.height_px #=> 240
file_info.exif_rotation_degrees #=> 90
file_info.display_aspect_ratio #=> [3, 4]
file_info.image_channel_names #=> ["R", "G", "B"]
file_info.bits_per_channel #=> 8
```
If nothing is detected, the result will be `nil`.

Expand Down
3 changes: 3 additions & 0 deletions lib/format_parser/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module FormatParser
VERSION = '0.1.0'
end
7 changes: 6 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
require 'simplecov'
SimpleCov.start do
add_filter "/spec/"
end

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'rspec'
require 'format_parser'
require 'format_parser'
41 changes: 41 additions & 0 deletions wt_format_parser.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'format_parser/version'

Gem::Specification.new do |spec|
spec.name = "wt_format_parser"
spec.version = FormatParser::VERSION
spec.authors = ["Noah Berman, Julik Tarkhanov"]
spec.email = ["noah@wetransfer.com, me@julik.nl"]

spec.summary = "A library for efficient parsing of file metadata"
spec.description = "A Ruby library for prying open files you can convert to a previewable format, such as video, image and audio files. It includes
a number of parser modules that try to recover metadata useful for post-processing and layout while reading the absolute
minimum amount of data possible."
spec.homepage = "https://github.com/WeTransfer/format_parser"
spec.license = "MIT"

# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
if spec.respond_to?(:metadata)
spec.metadata['allowed_push_host'] = "https://rubygems.org"
else
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
end

files = `git ls-files -z`.split("\x0").reject do |f|
# Make sure large fixture files are not packaged with the gem every time
f.match(%r{^spec/fixtures/})
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency 'exifr', '~> 1.0'
spec.add_dependency 'dry-validation', '~> 0.11'

spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'simplecov', '~> 0.15'
spec.add_development_dependency 'pry', '~> 0.11'
end

0 comments on commit 6c7d441

Please sign in to comment.