screenshooter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fcc7e9ea857a9bdf5511474774e2b1ee8b5e05e7
4
+ data.tar.gz: 006f13db90613982983425a3230fdd696bba1c06
5
+ SHA512:
6
+ metadata.gz: 32832280a7e64cd71df54025850ff9996a16bf86d66602db826d7fab2b449bd7805f1261f424f295f996fa28026d419254a4948f8b968bb57f25dfb921b1b609
7
+ data.tar.gz: 73a187fe45318ccb5739aecf9caaae7f0ab1b42e7d037c0dfd28dde03303c2c1d8ae5ba0dddd402110b2374ffce27dda5274c7eda609379eab21b8786dc39ee7
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ Gemfile.lock
16
+
17
+ # YARD artifacts
18
+ .yardoc
19
+ _yardoc
20
+ doc/
21
+
22
+ .DS_Store
23
+ browsers.yaml
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Ben Lopatin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # ScreenShooter!
2
+
3
+ A tool for generating BrowserStack screenshots from the command line.
4
+
5
+ ## Installing
6
+
7
+ For now, clone the repository.
8
+
9
+ ## Configuration
10
+
11
+ Set up your credentials in the `.browserstack` file in your home
12
+ directory. It should look like this:
13
+
14
+ username:auth_token
15
+
16
+ Your authentication token is available under the
17
+ [automation section](https://www.browserstack.com/accounts/automate-keys)
18
+ of your profile.
19
+
20
+ Next you'll need a browser configuration file. This will be used to
21
+ specify which browser versions under which operating systems to take
22
+ screenshots. You can start with the sample shipped with this project.
23
+
24
+ ## Using
25
+
26
+ Use is pretty straightforward:
27
+
28
+ ruby screenshots.rb path_to/browsers.yaml
29
+
30
+ Once the request is successfully made, the program will return the URL
31
+ of the screenshot collection.
32
+
33
+ You don't need to include the URL in your configuration file. It might
34
+ be helpful if you're always taking screenshots of the same URL, but
35
+ chances are you'll probably want to specify this each time you run the
36
+ command.
37
+
38
+ ruby screenshots.rb path_to/browsers.yaml -u http://www.github.com
39
+
40
+ The command accepts an optional boolean flag, `wait`, which will check
41
+ every two seconds on the status of the request and return the URL once
42
+ the job is complete.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/screenshooter ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby -*-
3
+
4
+ require 'screenshooter'
5
+ ScreenShooter::ShotMaster.start
@@ -0,0 +1,57 @@
1
+ require 'rubygems'
2
+ require 'thor'
3
+ require 'yaml'
4
+ require 'launchy'
5
+ require 'screenshot'
6
+ require "screenshooter/version"
7
+
8
+ # Should get the values from the .browserstack file
9
+ def get_credentials
10
+ keypair = File.open("#{Dir.home}/.browserstack", &:readline)
11
+ keypair.strip.split(":")
12
+ end
13
+
14
+ module ScreenShooter
15
+
16
+ class ShotMaster < Thor
17
+ desc "list", "list systems"
18
+ def list
19
+ username, password = get_credentials
20
+ client = Screenshot::Client.new({"username" => username, "password" => password})
21
+ puts client.get_os_and_browsers
22
+ end
23
+
24
+ desc "shoot", "take a screenshot"
25
+ method_option :url, :aliases => "-u", :desc => "URL of page to screenshot"
26
+ method_option :wait, :type => :boolean, :aliases => "-w", :default => false, :desc => "Wait for screenshots to be rendered?"
27
+ method_option :open, :type => :boolean, :aliases => "-o", :default => false, :desc => "Open the URL in the browser?"
28
+ def shoot(file="browsers.yaml")
29
+ username, password = get_credentials
30
+ client = Screenshot::Client.new({"username" => username, "password" => password})
31
+ params = YAML::load( File.open( file ) )
32
+ if options.has_key? "url"
33
+ params["url"] = options["url"]
34
+ end
35
+
36
+ begin
37
+ request_id = client.generate_screenshots params
38
+ rescue Exception => e
39
+ puts e.message
40
+ end
41
+
42
+ shot_status = "pending"
43
+ begin
44
+ shot_status = client.screenshots_status request_id
45
+ print "."
46
+ sleep 2
47
+ end while options["wait"] and shot_status != "done"
48
+
49
+ screenshots_url = "http://www.browserstack.com/screenshots/#{request_id}"
50
+ if options["open"]
51
+ Launchy.open(screenshots_url)
52
+ else
53
+ puts "\n#{screenshots_url}"
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,3 @@
1
+ module MyGem
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,22 @@
1
+ url: http://www.github.com
2
+ browsers:
3
+ -
4
+ browser: firefox
5
+ browser_version: "20.0"
6
+ os: Windows
7
+ os_version: "7"
8
+ -
9
+ browser: firefox
10
+ browser_version: "19.0"
11
+ os: Windows
12
+ os_version: "7"
13
+ -
14
+ browser: ie
15
+ browser_version: "9.0"
16
+ os: Windows
17
+ os_version: "7"
18
+ -
19
+ browser: chrome
20
+ browser_version: "28.0"
21
+ os: Windows
22
+ os_version: "7"
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "screenshooter/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "screenshooter"
7
+ s.version = MyGem::VERSION
8
+ s.authors = ["Ben Lopatin"]
9
+ s.email = ["ben.lopatin@wellfireinteractive.com"]
10
+ s.homepage = "http://www.github.com/bennylope/screenshooter"
11
+ s.description = %q{A tool for generating BrowserStack screenshots from the command line.}
12
+ s.summary = s.description
13
+ s.licenses = ['MIT']
14
+
15
+ s.rubyforge_project = "screenshooter"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_runtime_dependency "thor"
23
+ s.add_runtime_dependency "browserstack-screenshot"
24
+ s.add_runtime_dependency "launchy"
25
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: screenshooter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ben Lopatin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: browserstack-screenshot
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: launchy
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A tool for generating BrowserStack screenshots from the command line.
56
+ email:
57
+ - ben.lopatin@wellfireinteractive.com
58
+ executables:
59
+ - screenshooter
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - bin/screenshooter
69
+ - lib/screenshooter.rb
70
+ - lib/screenshooter/version.rb
71
+ - sample_browsers.yaml
72
+ - screenshooter.gemspec
73
+ homepage: http://www.github.com/bennylope/screenshooter
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project: screenshooter
93
+ rubygems_version: 2.0.6
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: A tool for generating BrowserStack screenshots from the command line.
97
+ test_files: []