Dhalang 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 976f451a66958a17261f84b2f79c2740323f74efc48c2e003fdb95b3f72111fd
4
- data.tar.gz: 75e517eea1ec5a62a26a7beccdd3ee5adcf6c257e4cc5eb96782548728e00868
3
+ metadata.gz: 0e81627f9004f346443d46b9ab0befaec1c11c95a6c81521c9e1340901d97427
4
+ data.tar.gz: adb156ead06f2b4886f7ce0972b4477f56a1a793d3fa4fd9fe289e899088f309
5
5
  SHA512:
6
- metadata.gz: 3ae7a907a31cf50d0bd5e6f78a27b4ccd77e2a9c6baa13b8430f48f00944af5160844a84ae428f1f0db8cba9afa083560f22d50de1f492052702773d1464ce77
7
- data.tar.gz: 1244560c1a4cd3b2ae2a1020c79c99f30bfa6ce1b2fe413dabc5d24e7ba66f16101c8f1460b69d35edfbffcaa86c22e6687fed1cef39f2c785bc822bd03bbe66
6
+ metadata.gz: 6019c5635f2020d8c49c5dfc4cab09f4bd59c5445402016e894579fd4a68097b2675559950aa7f2a8cdf014db4ae1d0381682ecbcc04e7de6bf0e57195caf1fa
7
+ data.tar.gz: c833cdfb54c3f4f99b3e047fa1381555025c1faf48f723ec38eff8a29ad572b20b22d9dfada76fda0b71d9c45b734ea3fbae378ef5d4ca7872aa07f1abd698e6
data/.gitignore CHANGED
@@ -1,51 +1,52 @@
1
- *.gem
2
- *.rbc
3
- /.config
4
- /coverage/
5
- /InstalledFiles
6
- /pkg/
7
- /spec/reports/
8
- /spec/examples.txt
9
- /test/tmp/
10
- /test/version_tmp/
11
- /tmp/
12
- .idea/*
13
-
14
- # Used by dotenv library to load environment variables.
15
- # .env
16
-
17
- ## Specific to RubyMotion:
18
- .dat*
19
- .repl_history
20
- build/
21
- *.bridgesupport
22
- build-iPhoneOS/
23
- build-iPhoneSimulator/
24
-
25
- ## Specific to RubyMotion (use of CocoaPods):
26
- #
27
- # We recommend against adding the Pods directory to your .gitignore. However
28
- # you should judge for yourself, the pros and cons are mentioned at:
29
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
30
- #
31
- # vendor/Pods/
32
-
33
- ## Documentation cache and generated files:
34
- /.yardoc/
35
- /_yardoc/
36
- /doc/
37
- /rdoc/
38
-
39
- ## Environment normalization:
40
- /.bundle/
41
- /vendor/bundle
42
- /lib/bundler/man/
43
-
44
- # for a library or gem, you might want to ignore these files since the code is
45
- # intended to run in multiple environments; otherwise, check them in:
46
- # Gemfile.lock
47
- # .ruby-version
48
- # .ruby-gemset
49
-
50
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
51
- .rvmrc
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /node_modules/
12
+ /tmp/
13
+ .idea/*
14
+
15
+ # Used by dotenv library to load environment variables.
16
+ # .env
17
+
18
+ ## Specific to RubyMotion:
19
+ .dat*
20
+ .repl_history
21
+ build/
22
+ *.bridgesupport
23
+ build-iPhoneOS/
24
+ build-iPhoneSimulator/
25
+
26
+ ## Specific to RubyMotion (use of CocoaPods):
27
+ #
28
+ # We recommend against adding the Pods directory to your .gitignore. However
29
+ # you should judge for yourself, the pros and cons are mentioned at:
30
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
31
+ #
32
+ # vendor/Pods/
33
+
34
+ ## Documentation cache and generated files:
35
+ /.yardoc/
36
+ /_yardoc/
37
+ /doc/
38
+ /rdoc/
39
+
40
+ ## Environment normalization:
41
+ /.bundle/
42
+ /vendor/bundle
43
+ /lib/bundler/man/
44
+
45
+ # for a library or gem, you might want to ignore these files since the code is
46
+ # intended to run in multiple environments; otherwise, check them in:
47
+ # Gemfile.lock
48
+ # .ruby-version
49
+ # .ruby-gemset
50
+
51
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
52
+ .rvmrc
@@ -1,9 +1,9 @@
1
- language: ruby
2
- rvm:
3
- - 2.6
4
- addons:
5
- chrome: stable
6
- install:
7
- - bundle install
8
- - npm install
1
+ language: ruby
2
+ rvm:
3
+ - 2.6
4
+ addons:
5
+ chrome: stable
6
+ install:
7
+ - bundle install
8
+ - npm install
9
9
  script: bundle exec rake spec
@@ -1,39 +1,32 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "Dhalang/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "Dhalang"
8
- spec.version = Dhalang::VERSION
9
- spec.authors = ["Niels Steensma"]
10
- spec.email = ["nielssteensma@yahoo.nl"]
11
- spec.licenses = ['MIT']
12
-
13
- spec.summary = "Ruby wrapper for Puppeteer. Generate screenshots and PDF's from HTML!"
14
- spec.homepage = "https://github.com/NielsSteensma/Dhalang"
15
-
16
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
- # to allow pushing to a single host or delete this section to allow pushing to any host.
18
- if spec.respond_to?(:metadata)
19
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
- else
21
- raise "RubyGems 2.0 or newer is required to protect against " \
22
- "public gem pushes."
23
- end
24
-
25
- # Specify which files should be added to the gem when it is released.
26
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
- end
30
- spec.bindir = "exe"
31
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
- spec.require_paths = ["lib"]
33
-
34
- spec.add_development_dependency "bundler", "~> 1.16"
35
- spec.add_development_dependency "rake", "~> 10.0"
36
- spec.add_development_dependency "rspec", "~> 3.0"
37
- spec.add_development_dependency "pdf-reader", "~> 2.2"
38
- spec.add_development_dependency "fastimage", "~> 1.8"
39
- end
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "Dhalang/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "Dhalang"
8
+ spec.version = Dhalang::VERSION
9
+ spec.authors = ["Niels Steensma"]
10
+ spec.email = ["nielssteensma@yahoo.nl"]
11
+ spec.licenses = ['MIT']
12
+
13
+ spec.summary = "Ruby wrapper for Puppeteer. Generate screenshots and PDF's from HTML!"
14
+ spec.homepage = "https://github.com/NielsSteensma/Dhalang"
15
+
16
+
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.16"
28
+ spec.add_development_dependency "rake", "~> 13.0.1"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ spec.add_development_dependency "pdf-reader", "~> 2.2"
31
+ spec.add_development_dependency "fastimage", "~> 1.8"
32
+ end
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in Dhalang.gemspec
6
- gemspec
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in Dhalang.gemspec
6
+ gemspec
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Dhalang (0.1.0)
4
+ Dhalang (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -13,30 +13,31 @@ GEM
13
13
  fastimage (1.9.0)
14
14
  addressable (~> 2.3.5)
15
15
  hashery (2.1.2)
16
- pdf-reader (2.2.0)
16
+ pdf-reader (2.4.0)
17
17
  Ascii85 (~> 1.0.0)
18
18
  afm (~> 0.2.1)
19
19
  hashery (~> 2.0)
20
20
  ruby-rc4
21
21
  ttfunk
22
- rake (10.5.0)
23
- rspec (3.8.0)
24
- rspec-core (~> 3.8.0)
25
- rspec-expectations (~> 3.8.0)
26
- rspec-mocks (~> 3.8.0)
27
- rspec-core (3.8.0)
28
- rspec-support (~> 3.8.0)
29
- rspec-expectations (3.8.2)
22
+ rake (13.0.1)
23
+ rspec (3.9.0)
24
+ rspec-core (~> 3.9.0)
25
+ rspec-expectations (~> 3.9.0)
26
+ rspec-mocks (~> 3.9.0)
27
+ rspec-core (3.9.1)
28
+ rspec-support (~> 3.9.1)
29
+ rspec-expectations (3.9.0)
30
30
  diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.8.0)
32
- rspec-mocks (3.8.0)
31
+ rspec-support (~> 3.9.0)
32
+ rspec-mocks (3.9.1)
33
33
  diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.8.0)
35
- rspec-support (3.8.0)
34
+ rspec-support (~> 3.9.0)
35
+ rspec-support (3.9.2)
36
36
  ruby-rc4 (0.1.5)
37
- ttfunk (1.5.1)
37
+ ttfunk (1.6.2.1)
38
38
 
39
39
  PLATFORMS
40
+ ruby
40
41
  x64-mingw32
41
42
 
42
43
  DEPENDENCIES
@@ -44,8 +45,8 @@ DEPENDENCIES
44
45
  bundler (~> 1.16)
45
46
  fastimage (~> 1.8)
46
47
  pdf-reader (~> 2.2)
47
- rake (~> 10.0)
48
+ rake (~> 13.0.1)
48
49
  rspec (~> 3.0)
49
50
 
50
51
  BUNDLED WITH
51
- 1.16.1
52
+ 1.17.2
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 NielsS
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2019 NielsS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,42 +1,63 @@
1
- # Dhalang [![Build Status](https://travis-ci.com/NielsSteensma/Dhalang.svg?token=XZgKAByw2KZjcrsCh8gW&branch=master)](https://travis-ci.com/NielsSteensma/Dhalang)
2
-
3
- > Dhalang is a Ruby wrapper for Google's Puppeteer.
4
-
5
-
6
- ## Features
7
- * Generate PDFs from pages
8
- * Generate PDFs from html ( external images/stylesheets supported )
9
-
10
- More will come.
11
-
12
- ## Installation
13
- Add this line to your application's Gemfile:
14
-
15
- gem 'Dhalang'
16
-
17
- And then execute:
18
-
19
- $ bundle update
20
-
21
- Install puppeteer in your application's root directory:
22
-
23
- $ npm install puppeteer
24
-
25
- <sub>NodeJS v7.6.0 or greater is required</sub>
26
- ## Usage
27
- __Get a PDF of a website url__
28
- `Dhalang::PDF.get_from_url("https://www.google.com")`
29
- It is important to pass the complete url, leaving out https://, http:// or www. will result in an error.
30
-
31
- __Get a PDF of a HTML string__
32
- `Dhalang::PDF.get_from_html("<html><head></head><body><h1>examplestring</h1></body></html>")`
33
-
34
- Both methods return a string containing the PDF in binary.
35
-
36
- To return the PDF from a Rails controller you can do the following:
37
- ```
38
- def example_controller_method
39
- binary_pdf = Dhalang::PDF.get_from_url("https://www.google.com")
40
- send_data(binary_pdf, filename: 'pdfofgoogle.pdf', type: 'application/pdf')
41
- end
42
- ```
1
+ # Dhalang [![Build Status](https://travis-ci.com/NielsSteensma/Dhalang.svg?token=XZgKAByw2KZjcrsCh8gW&branch=master)](https://travis-ci.com/NielsSteensma/Dhalang)
2
+
3
+ > Dhalang is a Ruby wrapper for Google's Puppeteer.
4
+
5
+
6
+ ## Features
7
+ * Generate PDFs from pages
8
+ * Generate PDFs from html ( external images/stylesheets supported )
9
+ * Capture a screenshot of a webpage
10
+
11
+ ## Installation
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'Dhalang'
15
+
16
+ And then execute:
17
+
18
+ $ bundle update
19
+
20
+ Install puppeteer in your application's root directory:
21
+
22
+ $ npm install puppeteer
23
+
24
+ <sub>NodeJS v7.6.0 or greater is required</sub>
25
+ ## Usage
26
+ __Get a PDF of a website url__
27
+ `Dhalang::PDF.get_from_url("https://www.google.com")`
28
+ It is important to pass the complete url, leaving out https://, http:// or www. will result in an error.
29
+
30
+ __Get a PDF of a HTML string__
31
+ `Dhalang::PDF.get_from_html("<html><head></head><body><h1>examplestring</h1></body></html>")`
32
+
33
+ __Get a PNG screenshot of a website__
34
+ `Dhalang::Screenshot.get_from_url_as_png("https://www.google.com")`
35
+
36
+ __Get a JPEG screenshot of a website__
37
+ `Dhalang::Screenshot.get_from_url_as_jpeg("https://www.google.com")`
38
+
39
+ All methods return a string containing the PDF or JPEG/PNG in binary.
40
+
41
+ To return the PDF from a Rails controller you can do the following:
42
+ ```
43
+ def example_controller_method
44
+ binary_pdf = Dhalang::PDF.get_from_url("https://www.google.com")
45
+ send_data(binary_pdf, filename: 'pdfofgoogle.pdf', type: 'application/pdf')
46
+ end
47
+ ```
48
+
49
+ To return the PNG from a Rails controller you can do the following:
50
+ ```
51
+ def example_controller_method
52
+ binary_png = Dhalang::Screenshot.get_from_url_as_png("https://www.google.com")
53
+ send_data(binary_png, filename: 'screenshotofgoogle.png', type: 'image/png')
54
+ end
55
+ ```
56
+
57
+ To return the JPEG from a Rails controller you can do the following:
58
+ ```
59
+ def example_controller_method
60
+ binary_jpeg = Dhalang::Screenshot.get_from_url_as_jpeg("https://www.google.com")
61
+ send_data(binary_jpeg, filename: 'screenshotofgoogle.jpeg', type: 'image/jpeg')
62
+ end
63
+ ```
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec