screenshooter 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -8
- data/lib/screenshooter.rb +11 -5
- data/lib/screenshooter/version.rb +1 -1
- data/screenshooter.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 425ac2d8befaa4dbe6e00593ac2bd70d07b17fdc
|
4
|
+
data.tar.gz: cc2f14417c715de3c82b341de17d226746d1d2c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d3317ac9ee43ab2b81e9ec10a0ab78a01f34bb01dfe8866ece815513a2b229e5e60b0e62dbe939bb528a3dabf6c471d6eaf338fc76636e476116f242dcb50b
|
7
|
+
data.tar.gz: 8cd94b3167e39ad114be2cc1e658807ae1ce879971ac1f32325fb1b177577d9156549548868bf6b2c4b29850ed6d1838376055f49a7a15cc4dd3c213fccad0ce
|
data/README.md
CHANGED
@@ -4,12 +4,24 @@ A tool for generating BrowserStack screenshots from the command line.
|
|
4
4
|
|
5
5
|
## Installing
|
6
6
|
|
7
|
-
|
7
|
+
> gem install screenshooter
|
8
|
+
|
9
|
+
Or clone the repository and run
|
10
|
+
|
11
|
+
> rake install
|
8
12
|
|
9
13
|
## Configuration
|
10
14
|
|
11
|
-
|
12
|
-
|
15
|
+
You will need to provide username and authentication token credentials
|
16
|
+
to use the service. You can do so with environment variables or using a
|
17
|
+
file.
|
18
|
+
|
19
|
+
To use environment variables (suitable for a CI environment) set
|
20
|
+
`BROWSERSTACK_USERNAME` and `BROWSERSTACK_TOKEN`, respectively. If these
|
21
|
+
are missing then ScreenShooter will look for a credentials file.
|
22
|
+
|
23
|
+
You should set up your credentials in the `.browserstack` file in your
|
24
|
+
home directory. It should look like this:
|
13
25
|
|
14
26
|
username:auth_token
|
15
27
|
|
@@ -19,24 +31,41 @@ of your profile.
|
|
19
31
|
|
20
32
|
Next you'll need a browser configuration file. This will be used to
|
21
33
|
specify which browser versions under which operating systems to take
|
22
|
-
screenshots. You can start with the sample
|
34
|
+
screenshots. You can start with the sample included in this project,
|
35
|
+
`sample_browsers.yaml`.
|
23
36
|
|
24
37
|
## Using
|
25
38
|
|
26
39
|
Use is pretty straightforward:
|
27
40
|
|
28
|
-
|
41
|
+
screenshooter path_to/browsers.yaml
|
29
42
|
|
30
43
|
Once the request is successfully made, the program will return the URL
|
31
|
-
of the screenshot collection.
|
44
|
+
of the screenshot collection. The URL output can be piped to another
|
45
|
+
service.
|
46
|
+
|
47
|
+
### Setting the URL
|
32
48
|
|
33
49
|
You don't need to include the URL in your configuration file. It might
|
34
50
|
be helpful if you're always taking screenshots of the same URL, but
|
35
51
|
chances are you'll probably want to specify this each time you run the
|
36
52
|
command.
|
37
53
|
|
38
|
-
|
54
|
+
screenshooter path_to/browsers.yaml -u http://www.github.com
|
55
|
+
|
56
|
+
### Waiting for completion
|
39
57
|
|
40
58
|
The command accepts an optional boolean flag, `wait`, which will check
|
41
|
-
every
|
59
|
+
every 2.5 seconds on the status of the request and return the URL once
|
42
60
|
the job is complete.
|
61
|
+
|
62
|
+
screenshooter path_to/browsers.yaml -u http://www.github.com -w
|
63
|
+
screenshooter path_to/browsers.yaml -u http://www.github.com --wait
|
64
|
+
|
65
|
+
### Open the screenshots URL
|
66
|
+
|
67
|
+
The command accepts an optional boolean flag, `open`, which will open
|
68
|
+
the screenshots URL in your default browser.
|
69
|
+
|
70
|
+
screenshooter path_to/browsers.yaml -u http://www.github.com -o
|
71
|
+
screenshooter path_to/browsers.yaml -u http://www.github.com --open
|
data/lib/screenshooter.rb
CHANGED
@@ -2,13 +2,18 @@ require 'rubygems'
|
|
2
2
|
require 'thor'
|
3
3
|
require 'yaml'
|
4
4
|
require 'launchy'
|
5
|
+
require 'progress_bar'
|
5
6
|
require 'screenshot'
|
6
7
|
require "screenshooter/version"
|
7
8
|
|
8
9
|
# Should get the values from the .browserstack file
|
9
10
|
def get_credentials
|
10
|
-
|
11
|
-
|
11
|
+
if ENV['BROWSERSTACK_USERNAME'] and ENV['BROWSERSTACK_TOKEN']
|
12
|
+
[ENV['BROWSERSTACK_USERNAME'], ENV['BROWSERSTACK_TOKEN']]
|
13
|
+
else
|
14
|
+
keypair = File.open("#{Dir.home}/.browserstack", &:readline)
|
15
|
+
keypair.strip.split(":")
|
16
|
+
end
|
12
17
|
end
|
13
18
|
|
14
19
|
module ScreenShooter
|
@@ -40,17 +45,18 @@ module ScreenShooter
|
|
40
45
|
end
|
41
46
|
|
42
47
|
shot_status = "pending"
|
48
|
+
bar = ProgressBar.new(:elapsed)
|
43
49
|
begin
|
44
50
|
shot_status = client.screenshots_status request_id
|
45
|
-
|
46
|
-
|
51
|
+
sleep 2.5
|
52
|
+
bar.increment!
|
47
53
|
end while options["wait"] and shot_status != "done"
|
48
54
|
|
49
55
|
screenshots_url = "http://www.browserstack.com/screenshots/#{request_id}"
|
50
56
|
if options["open"]
|
51
57
|
Launchy.open(screenshots_url)
|
52
58
|
else
|
53
|
-
puts
|
59
|
+
puts screenshots_url
|
54
60
|
end
|
55
61
|
end
|
56
62
|
end
|
data/screenshooter.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: screenshooter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Lopatin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: progress_bar
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: A tool for generating BrowserStack screenshots from the command line.
|
56
70
|
email:
|
57
71
|
- ben.lopatin@wellfireinteractive.com
|