gastly 1.0.1 → 1.1.0

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
  SHA1:
3
- metadata.gz: 34d8fc80985ccb279101b3b66ef09fdb460ed934
4
- data.tar.gz: 354e2abb36088e5d2e43da016952b8dd806a4d7e
3
+ metadata.gz: 7825b37663690656b92aeb9ff48ac57461fe1ca1
4
+ data.tar.gz: a00e6b600dbc19b77d9502d5b4f30ad70e8a3ade
5
5
  SHA512:
6
- metadata.gz: 4b1efd1a7c471d3158f1a0aea37b47740ed8e8a843ab3eaa08fda2af1d32279195ad8268d9c86edcecd62895d2c5123e6811f87c08cc522cee9c7bf6d70bbd95
7
- data.tar.gz: 3666679498a77e264607ac86875bec7456bac2371f5945516d7fe17ebe43e82128d96e13c15509059c7c22ad6ddca3ca4e99085b118bb3a2716753af1fa1e2a6
6
+ metadata.gz: e9f8daf6095af2e710a48817ccbc1c5cfb3a86bd9fddcba753c86a620b73473610beac22dcc686fc058da161a2b5a49ac64dfbf0dac02c77e29227ef8368c1bc
7
+ data.tar.gz: 2948a1bcd65853becc73a7073f2eeba0f35e2c1006eb6767ce3136a83201c4e22a18ce71b404b77674113db8b8be14a4cab46ee05aeb09de09f71ade3ce94cd8
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Grachev Mikhail
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,4 +1,4 @@
1
- # Gastly
1
+ # 👻 Gastly
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/gastly.svg)](http://badge.fury.io/rb/gastly)
4
4
  [![Dependency Status](https://gemnasium.com/mgrachev/gastly.svg)](https://gemnasium.com/mgrachev/gastly)
@@ -6,7 +6,9 @@
6
6
  [![Build Status](https://travis-ci.org/mgrachev/gastly.svg?branch=master)](https://travis-ci.org/mgrachev/gastly)
7
7
  [![Coverage Status](https://coveralls.io/repos/github/mgrachev/gastly/badge.svg?branch=master)](https://coveralls.io/github/mgrachev/gastly?branch=master)
8
8
 
9
- Create screenshots or previews of web pages using Gastly. Under the hood [Phantom.js](https://github.com/ariya/phantomjs/) and [MiniMagick](https://github.com/minimagick/minimagick). Gastly, I choose you!
9
+ Create screenshots or previews of web pages using Gastly. Under the hood [Phantom.js](https://github.com/ariya/phantomjs/) and [MiniMagick](https://github.com/minimagick/minimagick).
10
+
11
+ Gastly, I choose you!
10
12
 
11
13
  ![Gastly](https://github.com/mgrachev/gastly/raw/master/gastly.png)
12
14
 
@@ -32,7 +34,7 @@ Or install it yourself as:
32
34
  Gastly.capture('http://google.com', 'output.png')
33
35
  ```
34
36
 
35
- It is also possible to further customize the creation of screenshots and further processing of the resulting image:
37
+ It's also possible to further customize the creation of screenshots and further processing of the resulting image:
36
38
 
37
39
  ```ruby
38
40
  screenshot = Gastly.screenshot('http://google.com')
@@ -43,6 +45,7 @@ screenshot.timeout = 1000 # Default: 0 seconds
43
45
  screenshot.cookies = { user_id: 1, auth_token: 'abcd' } # If you need
44
46
  screenshot.proxy_host = '10.10.10.1' # If you want to use a http proxy
45
47
  screenshot.proxy_port = '8080'
48
+ screenshot.phantomjs_options = '--ignore-ssl-errors=true'
46
49
  image = screenshot.capture
47
50
  ```
48
51
 
@@ -53,11 +56,12 @@ screenshot = Gastly.screenshot('http://google.com', selector: '#hplogo', timeout
53
56
  image = screenshot.capture
54
57
  ```
55
58
 
56
- You can resize or change the format of the screenshot:
59
+ You can resize, crop or change the format of the screenshot:
57
60
 
58
61
  ```ruby
59
62
  image = screenshot.capture
60
- image.resize(width: 110, height: 110) # Creates a previews of web-page
63
+ image.crop(width: 250, height: 250, x: 10, y: 0) # Crop with an offset
64
+ image.resize(width: 110, height: 110) # Creates a preview of the web page
61
65
  image.format('png')
62
66
  image.save('output.png')
63
67
  ```
@@ -70,7 +74,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
70
74
 
71
75
  ## Contributing
72
76
 
73
- 1. Fork it ( https://github.com/[my-github-username]/gastly/fork )
77
+ 1. Fork it ( https://github.com/mgrachev/gastly/fork )
74
78
  2. Create your feature branch (`git checkout -b my-new-feature`)
75
79
  3. Commit your changes (`git commit -am 'Add some feature'`)
76
80
  4. Push to the branch (`git push origin my-new-feature`)
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.required_ruby_version = '>= 2.1.0'
22
22
 
23
23
  spec.add_development_dependency 'bundler'
24
- spec.add_development_dependency 'rake', '~> 10.0'
25
- spec.add_development_dependency 'rubocop'
24
+ spec.add_development_dependency 'rake', '~> 12.3'
25
+ spec.add_development_dependency 'rubocop', '0.68'
26
26
  spec.add_development_dependency 'rspec', '~> 3.4.0'
27
27
 
28
28
  spec.add_dependency 'phantomjs', '~> 2.1.1'
@@ -14,6 +14,15 @@ module Gastly
14
14
  image.resize(dimensions)
15
15
  end
16
16
 
17
+ # @param width [Fixnum] Crop width
18
+ # @param height [Fixnum] Crop height
19
+ # @param x [Fixnum] Crop x offset
20
+ # @param y [Fixnum] Crop y offset
21
+ def crop(width:, height:, x:, y:)
22
+ dimensions = "#{width}x#{height}+#{x}+#{y}"
23
+ image.crop(dimensions)
24
+ end
25
+
17
26
  # @param ext [String] Image extension
18
27
  # @return [MiniMagick::Image] Instance
19
28
  def format(ext)
@@ -1,3 +1,3 @@
1
1
  module Gastly
2
- VERSION = '1.0.1'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gastly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Grachev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-02 00:00:00.000000000 Z
11
+ date: 2020-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '12.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '12.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '0.68'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '0.68'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +109,7 @@ files:
109
109
  - ".travis.yml"
110
110
  - CHANGELOG.md
111
111
  - Gemfile
112
+ - LICENSE
112
113
  - README.md
113
114
  - Rakefile
114
115
  - bin/console
@@ -144,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
145
  version: '0'
145
146
  requirements: []
146
147
  rubyforge_project:
147
- rubygems_version: 2.4.5.1
148
+ rubygems_version: 2.6.3
148
149
  signing_key:
149
150
  specification_version: 4
150
151
  summary: Create screenshots or previews of web pages using Gastly. Gastly, I choose