gastly 1.0.1 → 1.1.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 +4 -4
- data/LICENSE +21 -0
- data/README.md +10 -6
- data/gastly.gemspec +2 -2
- data/lib/gastly/image.rb +9 -0
- data/lib/gastly/version.rb +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7825b37663690656b92aeb9ff48ac57461fe1ca1
|
4
|
+
data.tar.gz: a00e6b600dbc19b77d9502d5b4f30ad70e8a3ade
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
[](http://badge.fury.io/rb/gastly)
|
4
4
|
[](https://gemnasium.com/mgrachev/gastly)
|
@@ -6,7 +6,9 @@
|
|
6
6
|
[](https://travis-ci.org/mgrachev/gastly)
|
7
7
|
[](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).
|
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
|

|
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
|
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.
|
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/
|
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`)
|
data/gastly.gemspec
CHANGED
@@ -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', '~>
|
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'
|
data/lib/gastly/image.rb
CHANGED
@@ -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)
|
data/lib/gastly/version.rb
CHANGED
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
|
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:
|
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: '
|
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: '
|
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.
|
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
|