dashing-screenshots 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +26 -0
- data/Rakefile +2 -0
- data/dashing-screenshots.gemspec +25 -0
- data/lib/dashing-screenshots.rb +2 -0
- data/lib/dashing_screenshots/screenshot.rb +37 -0
- data/lib/dashing_screenshots/version.rb +5 -0
- data/sampletv.png +0 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f9e3a4fc1a80ac739be2561a7f09b693b7b2abc8
|
4
|
+
data.tar.gz: a4b367ae472ed7d1a4827b9d688a2802a284fba6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 83a280fdf5d9131f3427db3fa2c93d0eed8d3175d3650f00cf2dcd39b709d91a803165715bccd9c3cb1a278b6a5167059bcee07b83d425ef666a8c35571c73cc
|
7
|
+
data.tar.gz: d3c364642180ce246472e61c723f51119c7d1c15afbdc8ad046f271e3e52f8cf859474e1eec8a839b76840c5daaabecc143b0bdf4f32db2aff85e9bfdf2fbffd
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 TODO: Write your name
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Dashing::Screenshots
|
2
|
+
|
3
|
+
So you have a bunch of [Dashing](http://dashing.io/) dashboards and want a screenshot of all of them? You've come to right place.
|
4
|
+
|
5
|
+
## Setup
|
6
|
+
|
7
|
+
* Add this gem to your gem file.
|
8
|
+
* Make a Rakefile if you don't have more
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
namespace :dashing do
|
12
|
+
desc "takes screenshots"
|
13
|
+
task :screenshots do
|
14
|
+
require 'dashing-screenshots'
|
15
|
+
Dashing::Screenshot.new("screenshots", log: true).capture!
|
16
|
+
end
|
17
|
+
end
|
18
|
+
```
|
19
|
+
|
20
|
+
## Run it
|
21
|
+
|
22
|
+
Run `bundle exec rake dashing:screenshots`
|
23
|
+
|
24
|
+
It will pop up Firefox and take some pictures. It will save them in the directory you specified. The given code would save them within your project. You can also give an absolute path to put them anywhere on the system.
|
25
|
+
|
26
|
+
![Example](sampletv.png)
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'dashing_screenshots/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dashing-screenshots"
|
8
|
+
spec.version = Dashing::Screenshots::VERSION
|
9
|
+
spec.authors = ["Brian Leonard"]
|
10
|
+
spec.email = ["brian@bleonard.com"]
|
11
|
+
spec.summary = %q{Take screenshots of your Dashing dashboards.}
|
12
|
+
spec.description = %q{}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
|
22
|
+
spec.add_dependency 'selenium-webdriver'
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Dashing
|
4
|
+
class Screenshot
|
5
|
+
def initialize(directory, options=nil)
|
6
|
+
@directory = directory
|
7
|
+
@options = options || {}
|
8
|
+
end
|
9
|
+
|
10
|
+
def capture!
|
11
|
+
require 'selenium-webdriver'
|
12
|
+
::FileUtils.mkdir_p(@directory)
|
13
|
+
|
14
|
+
@driver = Selenium::WebDriver.for :firefox
|
15
|
+
Dir["dashboards/**/*.erb"].each do |file|
|
16
|
+
file.gsub!(/^dashboards\//, "")
|
17
|
+
file.gsub!(/\.erb$/, "")
|
18
|
+
next if ["layout"].include?(file)
|
19
|
+
snap(file)
|
20
|
+
end
|
21
|
+
@driver.quit
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def snap(path)
|
27
|
+
puts "Fetching #{path}" if @options[:log]
|
28
|
+
@driver.navigate.to "http://localhost:3030/#{path}"
|
29
|
+
filename = File.join(@directory, "#{path.gsub("/", "__")}.png")
|
30
|
+
puts " saving: #{filename}" if @options[:log]
|
31
|
+
sleep 2
|
32
|
+
@driver.save_screenshot(filename)
|
33
|
+
rescue Exception => e
|
34
|
+
puts " SCREENSHOT ERROR: #{e.message}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/sampletv.png
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dashing-screenshots
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Leonard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: selenium-webdriver
|
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: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: ''
|
56
|
+
email:
|
57
|
+
- brian@bleonard.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- dashing-screenshots.gemspec
|
68
|
+
- lib/dashing-screenshots.rb
|
69
|
+
- lib/dashing_screenshots/screenshot.rb
|
70
|
+
- lib/dashing_screenshots/version.rb
|
71
|
+
- sampletv.png
|
72
|
+
homepage: ''
|
73
|
+
licenses:
|
74
|
+
- MIT
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.0.3
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: Take screenshots of your Dashing dashboards.
|
96
|
+
test_files: []
|
97
|
+
has_rdoc:
|