browserly 0.1.0 → 0.1.1
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/README.md +17 -4
- data/lib/browserly/pool.rb +2 -6
- data/lib/browserly/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f53fa92854c720723ff9cffdbb2e082b0119319b0e1be774d7c1fb8935c48d5c
|
4
|
+
data.tar.gz: 5b7e46847076cde7def8f31aebd8088e9d1eb372d855b0e40876fe3d947e35b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 312c8944b2adaf49f4e957c19037a088d664a6d57fce281447bf9be861e781940a0d88d01c8958616bb11c7d3a468107fcb843874dd3748f5d000c3b42172498
|
7
|
+
data.tar.gz: ba7099286f393e71685fd43112c8df6a9508a6ace23098d84fa254cc2750a288c062c3407c00f73027f238d924318e2ac0179a088a7193578a6b81fc0e9f52b8
|
data/README.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# Browserly
|
2
|
-
|
3
|
-
|
4
|
-
## Usage
|
5
|
-
How to use my plugin.
|
2
|
+
Is a simple tool that helps to create website screenshots using selenium + chrome driver. This gem creates pool of browsers thus increases speed of taking webpage screenshot.
|
6
3
|
|
7
4
|
## Installation
|
8
5
|
Add this line to your application's Gemfile:
|
@@ -21,6 +18,22 @@ Or install it yourself as:
|
|
21
18
|
$ gem install browserly
|
22
19
|
```
|
23
20
|
|
21
|
+
## Configuration
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
Browserly.configure do |config|
|
25
|
+
config.tmp_path = 'path/to/store/screenshots'
|
26
|
+
config.pool_size = 1 # count of browsers instance to start
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
screenshot = Browserly::Screenshot.new('http://example.com').perform
|
34
|
+
screenshot.file #=> screenshot image file
|
35
|
+
```
|
36
|
+
|
24
37
|
## Contributing
|
25
38
|
Contribution directions go here.
|
26
39
|
|
data/lib/browserly/pool.rb
CHANGED
@@ -6,8 +6,8 @@ module Browserly
|
|
6
6
|
attr_reader :browsers
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
@browsers = SizedQueue.new(pool_size)
|
10
|
-
pool_size.times { @browsers.push(new_browser) }
|
9
|
+
@browsers = SizedQueue.new(Browserly.configuration.pool_size)
|
10
|
+
Browserly.configuration.pool_size.times { @browsers.push(new_browser) }
|
11
11
|
end
|
12
12
|
|
13
13
|
def take_browser
|
@@ -24,10 +24,6 @@ module Browserly
|
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
-
def pool_size
|
28
|
-
ENV.fetch('BROWSER_POOL_SIZE') { 1 }.to_i
|
29
|
-
end
|
30
|
-
|
31
27
|
def new_browser
|
32
28
|
options = Selenium::WebDriver::Chrome::Options.new(
|
33
29
|
args: [
|
data/lib/browserly/version.rb
CHANGED