seeit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +82 -0
- data/LICENSE.txt +21 -0
- data/README.md +72 -0
- data/Rakefile +6 -0
- data/bin/build_version +36 -0
- data/bin/console +14 -0
- data/bin/seeit_build_baseline +29 -0
- data/bin/seeit_build_version +32 -0
- data/bin/setup +8 -0
- data/lib/seeit.rb +3 -0
- data/lib/seeit/builder.rb +70 -0
- data/lib/seeit/screen.rb +52 -0
- data/lib/seeit/version.rb +3 -0
- data/seeit.gemspec +32 -0
- metadata +167 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e0ddcca140d8a25791bd29b706c6e1aa56c0085c
|
4
|
+
data.tar.gz: ca7d4549fe8bb179113829997bf1e78eea912c6d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 50e665897311ffb3afea88338b790a956559875340ceb3eacbf303960bd849ce942e378b426093663056e24a5b218d308a9a222729c91260966aff6b2eea81d3
|
7
|
+
data.tar.gz: f2ca0590e5f6f015358cc99b1fa8393213444fc48d95e5436d573cce683a009cbb34a219d5074b80e28ddbb1866f4ed6be91df8d586513fbf9941b7746bb1e52
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at rsmacapinlac@boogienet.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
seeit (0.1.0)
|
5
|
+
activesupport
|
6
|
+
faye-websocket (~> 0.7.3)
|
7
|
+
mini_magick (~> 4.3.3)
|
8
|
+
poltergeist (~> 1.12.0)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activesupport (5.1.4)
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
+
i18n (~> 0.7)
|
16
|
+
minitest (~> 5.1)
|
17
|
+
tzinfo (~> 1.1)
|
18
|
+
addressable (2.5.2)
|
19
|
+
public_suffix (>= 2.0.2, < 4.0)
|
20
|
+
capybara (2.15.2)
|
21
|
+
addressable
|
22
|
+
mini_mime (>= 0.1.3)
|
23
|
+
nokogiri (>= 1.3.3)
|
24
|
+
rack (>= 1.0.0)
|
25
|
+
rack-test (>= 0.5.4)
|
26
|
+
xpath (~> 2.0)
|
27
|
+
cliver (0.3.2)
|
28
|
+
concurrent-ruby (1.0.5)
|
29
|
+
diff-lcs (1.3)
|
30
|
+
eventmachine (1.2.5)
|
31
|
+
faye-websocket (0.7.5)
|
32
|
+
eventmachine (>= 0.12.0)
|
33
|
+
websocket-driver (>= 0.3.5)
|
34
|
+
i18n (0.8.6)
|
35
|
+
mini_magick (4.3.6)
|
36
|
+
mini_mime (0.1.4)
|
37
|
+
mini_portile2 (2.3.0)
|
38
|
+
minitest (5.10.3)
|
39
|
+
nokogiri (1.8.1)
|
40
|
+
mini_portile2 (~> 2.3.0)
|
41
|
+
poltergeist (1.12.0)
|
42
|
+
capybara (~> 2.1)
|
43
|
+
cliver (~> 0.3.1)
|
44
|
+
websocket-driver (>= 0.2.0)
|
45
|
+
public_suffix (3.0.0)
|
46
|
+
rack (2.0.3)
|
47
|
+
rack-test (0.7.0)
|
48
|
+
rack (>= 1.0, < 3)
|
49
|
+
rake (10.5.0)
|
50
|
+
rspec (3.6.0)
|
51
|
+
rspec-core (~> 3.6.0)
|
52
|
+
rspec-expectations (~> 3.6.0)
|
53
|
+
rspec-mocks (~> 3.6.0)
|
54
|
+
rspec-core (3.6.0)
|
55
|
+
rspec-support (~> 3.6.0)
|
56
|
+
rspec-expectations (3.6.0)
|
57
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
58
|
+
rspec-support (~> 3.6.0)
|
59
|
+
rspec-mocks (3.6.0)
|
60
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
61
|
+
rspec-support (~> 3.6.0)
|
62
|
+
rspec-support (3.6.0)
|
63
|
+
thread_safe (0.3.6)
|
64
|
+
tzinfo (1.2.3)
|
65
|
+
thread_safe (~> 0.1)
|
66
|
+
websocket-driver (0.7.0)
|
67
|
+
websocket-extensions (>= 0.1.0)
|
68
|
+
websocket-extensions (0.1.2)
|
69
|
+
xpath (2.1.0)
|
70
|
+
nokogiri (~> 1.3)
|
71
|
+
|
72
|
+
PLATFORMS
|
73
|
+
ruby
|
74
|
+
|
75
|
+
DEPENDENCIES
|
76
|
+
bundler (~> 1.16.a)
|
77
|
+
rake (~> 10.0)
|
78
|
+
rspec (~> 3.0)
|
79
|
+
seeit!
|
80
|
+
|
81
|
+
BUNDLED WITH
|
82
|
+
1.16.0.pre.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Ritchie Macapinlac
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# Seeit
|
2
|
+
|
3
|
+
A command line utility that creates screenshots of websites.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
The utilities assume that you've set up a PROJECT_DIRECTORY. The project
|
8
|
+
directory should contain a settings.json file.
|
9
|
+
|
10
|
+
### settings.json
|
11
|
+
|
12
|
+
```
|
13
|
+
{
|
14
|
+
"name":"Macapinlac.com",
|
15
|
+
"widths": [
|
16
|
+
{ "large": 2048 },
|
17
|
+
{ "medium": 1024 }
|
18
|
+
],
|
19
|
+
"structure": [
|
20
|
+
{ "home": "http://macapinlac.com" },
|
21
|
+
{ "now": "http://macapinlac.com/now" },
|
22
|
+
{ "notes": "http://macapinlac.com/blog" },
|
23
|
+
{ "blog-post": "http://macapinlac.com/blog/keyboard-shortcuts-arduino-learning" },
|
24
|
+
{ "blog-category": "http://macapinlac.com/blog/tag:Projects" }
|
25
|
+
]
|
26
|
+
}
|
27
|
+
```
|
28
|
+
|
29
|
+
### Commands
|
30
|
+
|
31
|
+
The following command will create a 'baseline' directory in the project
|
32
|
+
directory where the screenshots will be saved.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
seeit_build_baseline --project_dir=PROJECT_DIR
|
36
|
+
```
|
37
|
+
|
38
|
+
You can create a 'version' of screenshots. This will use the current date as the
|
39
|
+
version name.
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
seeit_build_version --project-dir=PROJECT_DIR
|
43
|
+
```
|
44
|
+
|
45
|
+
or specify a version name.
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
seeit_build_version --project-dir=PROJECT_DIR --version-name=SOMENAME
|
49
|
+
```
|
50
|
+
|
51
|
+
## Development
|
52
|
+
|
53
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
54
|
+
|
55
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
56
|
+
|
57
|
+
### Todo
|
58
|
+
|
59
|
+
* [ ] Ability to compare versions of websites
|
60
|
+
* [ ] Ability to compare versions according to the baseline
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rsmacapinlac/seeit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
65
|
+
|
66
|
+
## License
|
67
|
+
|
68
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
69
|
+
|
70
|
+
## Code of Conduct
|
71
|
+
|
72
|
+
Everyone interacting in the Seeit project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rsmacapinlac/seeit/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/build_version
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require 'seeit'
|
5
|
+
require "json"
|
6
|
+
require 'optparse'
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = "Usage: build_version"
|
11
|
+
|
12
|
+
opts.on("-pPROJECT_DIR", "--project-dir=PROJECT_DIR", "Project directory with settings.json") do |project_dir|
|
13
|
+
options[:project_dir] = project_dir
|
14
|
+
end
|
15
|
+
opts.on("-bVERSION_NAME", "--build-version=VERSION_NAME", "Mark the version of your screenshots (defaults to today's date)") do |build_version|
|
16
|
+
options[:build_version] = build_version
|
17
|
+
end
|
18
|
+
opts.on("-h", "--help", "Prints this help") do
|
19
|
+
puts opts
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
|
23
|
+
end.parse!
|
24
|
+
|
25
|
+
# raise required items
|
26
|
+
raise OptionParser::MissingArgument if options[:project_dir].nil?
|
27
|
+
|
28
|
+
build_version = options[:build_version]
|
29
|
+
build_version = Date.today.strftime("%Y-%m-%d") if options[:build_version].nil?
|
30
|
+
|
31
|
+
# read and parse config file
|
32
|
+
file = File.read "#{options[:project_dir]}/settings.json"
|
33
|
+
site_config = JSON.parse(file)
|
34
|
+
|
35
|
+
b = Seeit::Builder.new(site_config, options[:build_version])
|
36
|
+
b.build
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "seeit"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require 'seeit'
|
5
|
+
require "json"
|
6
|
+
require 'optparse'
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = "Usage: seeit_build_version"
|
11
|
+
|
12
|
+
opts.on("-pPROJECT_DIR", "--project-dir=PROJECT_DIR", "Project directory with settings.json") do |project_dir|
|
13
|
+
options[:project_dir] = project_dir
|
14
|
+
end
|
15
|
+
opts.on("-h", "--help", "Prints this help") do
|
16
|
+
puts opts
|
17
|
+
exit
|
18
|
+
end
|
19
|
+
|
20
|
+
end.parse!
|
21
|
+
|
22
|
+
# raise required items
|
23
|
+
raise OptionParser::MissingArgument if options[:project_dir].nil?
|
24
|
+
|
25
|
+
build_version = options[:build_version]
|
26
|
+
build_version = Date.today.strftime("%Y-%m-%d") if options[:build_version].nil?
|
27
|
+
|
28
|
+
b = Seeit::Builder.new(options[:project_dir], 'baseline')
|
29
|
+
b.build
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require 'seeit'
|
5
|
+
require "json"
|
6
|
+
require 'optparse'
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = "Usage: seeit_build_version"
|
11
|
+
|
12
|
+
opts.on("-pPROJECT_DIR", "--project-dir=PROJECT_DIR", "Project directory with settings.json") do |project_dir|
|
13
|
+
options[:project_dir] = project_dir
|
14
|
+
end
|
15
|
+
opts.on("-nVERSION_NAME", "--version-name=VERSION_NAME", "Mark the version of your screenshots (defaults to today's date)") do |build_version|
|
16
|
+
options[:build_version] = build_version
|
17
|
+
end
|
18
|
+
opts.on("-h", "--help", "Prints this help") do
|
19
|
+
puts opts
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
|
23
|
+
end.parse!
|
24
|
+
|
25
|
+
# raise required items
|
26
|
+
raise OptionParser::MissingArgument if options[:project_dir].nil?
|
27
|
+
|
28
|
+
build_version = options[:build_version]
|
29
|
+
build_version = Date.today.strftime("%Y-%m-%d") if options[:build_version].nil?
|
30
|
+
|
31
|
+
b = Seeit::Builder.new(options[:project_dir], options[:build_version])
|
32
|
+
b.build
|
data/bin/setup
ADDED
data/lib/seeit.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Seeit
|
5
|
+
class ConfigFileNotFound < StandardError
|
6
|
+
def initialize(msg = "settings.json File not found")
|
7
|
+
super(msg)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Builder
|
12
|
+
def initialize(project_folder, build_version_marker = nil)
|
13
|
+
@project_folder = File.expand_path project_folder
|
14
|
+
@screenshot = Seeit::Screenshot.new(project_folder)
|
15
|
+
|
16
|
+
@site_configuration_file = "#{@project_folder}/settings.json"
|
17
|
+
read_settings(@site_configuration_file)
|
18
|
+
|
19
|
+
@build_version_marker = build_version_marker
|
20
|
+
@build_version_marker = Date.today.strftime("%Y-%m-%d") if build_version_marker.nil?
|
21
|
+
end
|
22
|
+
|
23
|
+
def build
|
24
|
+
create_build_version_directory
|
25
|
+
pages = @site_config['structure']
|
26
|
+
widths = @site_config['widths']
|
27
|
+
widths = [] if @site_config['widths'].nil?
|
28
|
+
|
29
|
+
for page in pages
|
30
|
+
page_name = page.keys[0]
|
31
|
+
page_url = page[page_name]
|
32
|
+
|
33
|
+
@screenshot.open_url page_url
|
34
|
+
|
35
|
+
if widths.empty?
|
36
|
+
file_path = File.join @build_version_marker, page_name
|
37
|
+
@screenshot.snap file_path
|
38
|
+
else
|
39
|
+
for width in widths
|
40
|
+
profile_name = width.keys[0]
|
41
|
+
profile_size = width[profile_name]
|
42
|
+
@screenshot.resize_width profile_size
|
43
|
+
file_path = File.join @build_version_marker, "#{page_name} - #{profile_name}"
|
44
|
+
@screenshot.snap file_path
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def build_version_directory
|
53
|
+
File.join @project_folder, @build_version_marker
|
54
|
+
end
|
55
|
+
|
56
|
+
def read_settings(config_file)
|
57
|
+
unless File.exists? config_file
|
58
|
+
raise ConfigFileNotFound.new
|
59
|
+
end
|
60
|
+
_file = File.read config_file
|
61
|
+
@site_config = JSON.parse _file
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_build_version_directory
|
65
|
+
unless File.exists? build_version_directory
|
66
|
+
FileUtils::mkdir_p build_version_directory
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/seeit/screen.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require "capybara/dsl"
|
3
|
+
require "capybara/poltergeist"
|
4
|
+
|
5
|
+
module Seeit
|
6
|
+
class Screenshot
|
7
|
+
include Capybara::DSL
|
8
|
+
def initialize(save_path)
|
9
|
+
|
10
|
+
@browser_width = 1024
|
11
|
+
@browser_height = 768
|
12
|
+
|
13
|
+
Capybara.run_server = false
|
14
|
+
Capybara.register_driver :poltergeist do |app|
|
15
|
+
Capybara::Poltergeist::Driver.new(app, {
|
16
|
+
# Raise JavaScript errors to Ruby
|
17
|
+
js_errors: false,
|
18
|
+
# Additional command line options for PhantomJS
|
19
|
+
phantomjs_options: ['--ignore-ssl-errors=yes', '--ssl-protocol=any']
|
20
|
+
})
|
21
|
+
end
|
22
|
+
Capybara.current_driver = :poltergeist
|
23
|
+
|
24
|
+
#@_url = url
|
25
|
+
#@_name = name
|
26
|
+
@_path = save_path
|
27
|
+
end
|
28
|
+
|
29
|
+
def resize_width(width = nil)
|
30
|
+
_width = @browser_width
|
31
|
+
_width = width unless width.nil?
|
32
|
+
page.driver.resize(_width, @browser_height)
|
33
|
+
end
|
34
|
+
|
35
|
+
def open_url(url = nil)
|
36
|
+
@_url = url unless url.nil?
|
37
|
+
visit @_url
|
38
|
+
end
|
39
|
+
|
40
|
+
def snap(name = nil)
|
41
|
+
@_name = name unless name.nil?
|
42
|
+
take_screenshot
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def take_screenshot()
|
48
|
+
output_path = File.join @_path, "#{@_name}.png"
|
49
|
+
save_screenshot(output_path, {full: true, gravity: 'north'})
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/seeit.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "seeit/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "seeit"
|
8
|
+
spec.version = Seeit::VERSION
|
9
|
+
spec.authors = ["Ritchie Macapinlac"]
|
10
|
+
spec.email = ["ritchie@macapinlac.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Write a short summary, because RubyGems requires one.}
|
13
|
+
spec.homepage = "http://github.com/rsmacapinlac/seeit"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "bin"
|
20
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
# spec.add_dependency 'webshot'
|
24
|
+
spec.add_dependency "activesupport"
|
25
|
+
spec.add_dependency "poltergeist", "~> 1.12.0"
|
26
|
+
spec.add_dependency "faye-websocket", "~> 0.7.3"
|
27
|
+
spec.add_dependency "mini_magick", "~> 4.3.3"
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.16.a"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: seeit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ritchie Macapinlac
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
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: poltergeist
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.12.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.12.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faye-websocket
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.7.3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.7.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mini_magick
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.3.3
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.3.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.16.a
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.16.a
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- ritchie@macapinlac.com
|
114
|
+
executables:
|
115
|
+
- build_version
|
116
|
+
- console
|
117
|
+
- seeit_build_baseline
|
118
|
+
- seeit_build_version
|
119
|
+
- setup
|
120
|
+
extensions: []
|
121
|
+
extra_rdoc_files: []
|
122
|
+
files:
|
123
|
+
- ".gitignore"
|
124
|
+
- ".rspec"
|
125
|
+
- ".ruby-version"
|
126
|
+
- ".travis.yml"
|
127
|
+
- CODE_OF_CONDUCT.md
|
128
|
+
- Gemfile
|
129
|
+
- Gemfile.lock
|
130
|
+
- LICENSE.txt
|
131
|
+
- README.md
|
132
|
+
- Rakefile
|
133
|
+
- bin/build_version
|
134
|
+
- bin/console
|
135
|
+
- bin/seeit_build_baseline
|
136
|
+
- bin/seeit_build_version
|
137
|
+
- bin/setup
|
138
|
+
- lib/seeit.rb
|
139
|
+
- lib/seeit/builder.rb
|
140
|
+
- lib/seeit/screen.rb
|
141
|
+
- lib/seeit/version.rb
|
142
|
+
- seeit.gemspec
|
143
|
+
homepage: http://github.com/rsmacapinlac/seeit
|
144
|
+
licenses:
|
145
|
+
- MIT
|
146
|
+
metadata: {}
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 2.5.1
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: Write a short summary, because RubyGems requires one.
|
167
|
+
test_files: []
|