dullahan 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 +83 -0
- data/.rspec +2 -0
- data/.rspec_status +4 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +69 -0
- data/README.md +36 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dullahan.gemspec +40 -0
- data/lib/dullahan.rb +29 -0
- data/lib/dullahan/agent.rb +28 -0
- data/lib/dullahan/version.rb +3 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ea4143e1d1ffb5654e194833d51262e709703d84
|
4
|
+
data.tar.gz: 9929094b03e37c3e844be8e0f465663b0d8bedc1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e29f5a0547dcc5dbf7577b6b082cc6bef3d14d57e8341735482f15c420c59db7a5b3ffab2d885414e8e2327051c2f4e1516853b5b44a6ab829db1151524ad93
|
7
|
+
data.tar.gz: 57a3ed100a636571c496c6855b7d7096547729751afd0c5e4c58be0a2005a950b99a56f4d89d62c87293a2bc3d619c2037aeeb9c620cf5774d044558bfa608e3
|
data/.gitignore
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
### https://raw.github.com/github/gitignore/c0c1a480a906df0e023f3250cf2ad82f1612be67/ruby.gitignore
|
2
|
+
|
3
|
+
*.gem
|
4
|
+
*.rbc
|
5
|
+
/.config
|
6
|
+
/coverage/
|
7
|
+
/InstalledFiles
|
8
|
+
/pkg/
|
9
|
+
/spec/reports/
|
10
|
+
/spec/examples.txt
|
11
|
+
/test/tmp/
|
12
|
+
/test/version_tmp/
|
13
|
+
/tmp/
|
14
|
+
|
15
|
+
# Used by dotenv library to load environment variables.
|
16
|
+
# .env
|
17
|
+
|
18
|
+
## Specific to RubyMotion:
|
19
|
+
.dat*
|
20
|
+
.repl_history
|
21
|
+
build/
|
22
|
+
*.bridgesupport
|
23
|
+
build-iPhoneOS/
|
24
|
+
build-iPhoneSimulator/
|
25
|
+
|
26
|
+
## Specific to RubyMotion (use of CocoaPods):
|
27
|
+
#
|
28
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
29
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
30
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
31
|
+
#
|
32
|
+
# vendor/Pods/
|
33
|
+
|
34
|
+
## Documentation cache and generated files:
|
35
|
+
/.yardoc/
|
36
|
+
/_yardoc/
|
37
|
+
/doc/
|
38
|
+
/rdoc/
|
39
|
+
|
40
|
+
## Environment normalization:
|
41
|
+
/.bundle/
|
42
|
+
/vendor/bundle
|
43
|
+
/lib/bundler/man/
|
44
|
+
|
45
|
+
# for a library or gem, you might want to ignore these files since the code is
|
46
|
+
# intended to run in multiple environments; otherwise, check them in:
|
47
|
+
# Gemfile.lock
|
48
|
+
# .ruby-version
|
49
|
+
# .ruby-gemset
|
50
|
+
|
51
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
52
|
+
.rvmrc
|
53
|
+
|
54
|
+
|
55
|
+
### https://raw.github.com/github/gitignore/c0c1a480a906df0e023f3250cf2ad82f1612be67/Global/macos.gitignore
|
56
|
+
|
57
|
+
*.DS_Store
|
58
|
+
.AppleDouble
|
59
|
+
.LSOverride
|
60
|
+
|
61
|
+
# Icon must end with two \r
|
62
|
+
Icon
|
63
|
+
|
64
|
+
# Thumbnails
|
65
|
+
._*
|
66
|
+
|
67
|
+
# Files that might appear in the root of a volume
|
68
|
+
.DocumentRevisions-V100
|
69
|
+
.fseventsd
|
70
|
+
.Spotlight-V100
|
71
|
+
.TemporaryItems
|
72
|
+
.Trashes
|
73
|
+
.VolumeIcon.icns
|
74
|
+
.com.apple.timemachine.donotpresent
|
75
|
+
|
76
|
+
# Directories potentially created on remote AFP share
|
77
|
+
.AppleDB
|
78
|
+
.AppleDesktop
|
79
|
+
Network Trash Folder
|
80
|
+
Temporary Items
|
81
|
+
.apdisk
|
82
|
+
|
83
|
+
|
data/.rspec
ADDED
data/.rspec_status
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dullahan (0.1.0)
|
5
|
+
capybara
|
6
|
+
imgkit
|
7
|
+
selenium-webdriver
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
addressable (2.5.1)
|
13
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
14
|
+
capybara (2.13.0)
|
15
|
+
addressable
|
16
|
+
mime-types (>= 1.16)
|
17
|
+
nokogiri (>= 1.3.3)
|
18
|
+
rack (>= 1.0.0)
|
19
|
+
rack-test (>= 0.5.4)
|
20
|
+
xpath (~> 2.0)
|
21
|
+
childprocess (0.6.3)
|
22
|
+
ffi (~> 1.0, >= 1.0.11)
|
23
|
+
diff-lcs (1.3)
|
24
|
+
ffi (1.9.18)
|
25
|
+
imgkit (1.6.1)
|
26
|
+
mime-types (3.1)
|
27
|
+
mime-types-data (~> 3.2015)
|
28
|
+
mime-types-data (3.2016.0521)
|
29
|
+
mini_portile2 (2.1.0)
|
30
|
+
nokogiri (1.7.1)
|
31
|
+
mini_portile2 (~> 2.1.0)
|
32
|
+
public_suffix (2.0.5)
|
33
|
+
rack (2.0.1)
|
34
|
+
rack-test (0.6.3)
|
35
|
+
rack (>= 1.0)
|
36
|
+
rake (10.5.0)
|
37
|
+
rspec (3.5.0)
|
38
|
+
rspec-core (~> 3.5.0)
|
39
|
+
rspec-expectations (~> 3.5.0)
|
40
|
+
rspec-mocks (~> 3.5.0)
|
41
|
+
rspec-core (3.5.4)
|
42
|
+
rspec-support (~> 3.5.0)
|
43
|
+
rspec-expectations (3.5.0)
|
44
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
+
rspec-support (~> 3.5.0)
|
46
|
+
rspec-mocks (3.5.0)
|
47
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
+
rspec-support (~> 3.5.0)
|
49
|
+
rspec-support (3.5.0)
|
50
|
+
rubyzip (1.2.1)
|
51
|
+
selenium-webdriver (3.4.0)
|
52
|
+
childprocess (~> 0.5)
|
53
|
+
rubyzip (~> 1.0)
|
54
|
+
websocket (~> 1.0)
|
55
|
+
websocket (1.2.4)
|
56
|
+
xpath (2.0.0)
|
57
|
+
nokogiri (~> 1.3)
|
58
|
+
|
59
|
+
PLATFORMS
|
60
|
+
ruby
|
61
|
+
|
62
|
+
DEPENDENCIES
|
63
|
+
bundler (~> 1.14)
|
64
|
+
dullahan!
|
65
|
+
rake (~> 10.0)
|
66
|
+
rspec (~> 3.0)
|
67
|
+
|
68
|
+
BUNDLED WITH
|
69
|
+
1.14.6
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Dullahan
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/dullahan`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'dullahan'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install dullahan
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
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.
|
30
|
+
|
31
|
+
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).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rentalname/dullahan.
|
36
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dullahan"
|
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__)
|
data/bin/setup
ADDED
data/dullahan.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'dullahan/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dullahan"
|
8
|
+
spec.version = Dullahan::VERSION
|
9
|
+
spec.authors = ["rentalname"]
|
10
|
+
spec.email = ["agenda21st@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Headless chrome with capybara}
|
13
|
+
spec.description = %q{Headless chrome with capybara}
|
14
|
+
spec.homepage = "https://github.com/rentalname/dullahan"
|
15
|
+
spec.licenses = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_runtime_dependency 'capybara', "~> 2.0"
|
34
|
+
spec.add_runtime_dependency 'selenium-webdriver', "~> 3.4"
|
35
|
+
spec.add_runtime_dependency 'imgkit', '~> 1.6'
|
36
|
+
|
37
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
38
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
39
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
40
|
+
end
|
data/lib/dullahan.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "dullahan/version"
|
2
|
+
require "dullahan/agent"
|
3
|
+
require "capybara"
|
4
|
+
require 'selenium-webdriver'
|
5
|
+
require 'imgkit'
|
6
|
+
module Dullahan
|
7
|
+
extend self
|
8
|
+
|
9
|
+
def setup(bin:, args: %w{--headless --disable-gpu})
|
10
|
+
Capybara.register_driver :dullahan do |app|
|
11
|
+
caps = Selenium::WebDriver::Remote::Capabilities.chrome(
|
12
|
+
"chromeOptions": {
|
13
|
+
'binary': bin,
|
14
|
+
'args': args
|
15
|
+
}
|
16
|
+
)
|
17
|
+
|
18
|
+
Capybara::Selenium::Driver.new(
|
19
|
+
app,
|
20
|
+
browser: :chrome,
|
21
|
+
desired_capabilities: caps
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def gem_root
|
27
|
+
"#{File.dirname(__FILE__)}/../"
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Dullahan::Agent
|
2
|
+
attr_reader :session
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@session = Capybara::Session.new(:dullahan)
|
6
|
+
end
|
7
|
+
|
8
|
+
def ss(file_name, save_dir: '.', ext: :png, imgkit_options: {})
|
9
|
+
FileUtils.mkdir_p save_dir
|
10
|
+
|
11
|
+
options = {quality: 70, "disable-smart-width": true, "width": 1280}.merge(imgkit_options)
|
12
|
+
File.open("#{save_dir}/#{file_name}.#{ext}", "wb") do |f|
|
13
|
+
f.write IMGKit.new(session.body, options).to_img(ext.to_sym)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def finish!
|
18
|
+
session.driver.quit
|
19
|
+
end
|
20
|
+
|
21
|
+
def method_missing(sym, *args)
|
22
|
+
if session.respond_to?(sym)
|
23
|
+
session.public_send(sym, *args)
|
24
|
+
else
|
25
|
+
super
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dullahan
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- rentalname
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capybara
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: selenium-webdriver
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: imgkit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.14'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.14'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
description: Headless chrome with capybara
|
98
|
+
email:
|
99
|
+
- agenda21st@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".rspec_status"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- Gemfile.lock
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- dullahan.gemspec
|
115
|
+
- lib/dullahan.rb
|
116
|
+
- lib/dullahan/agent.rb
|
117
|
+
- lib/dullahan/version.rb
|
118
|
+
homepage: https://github.com/rentalname/dullahan
|
119
|
+
licenses:
|
120
|
+
- MIT
|
121
|
+
metadata:
|
122
|
+
allowed_push_host: https://rubygems.org
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.6.11
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: Headless chrome with capybara
|
143
|
+
test_files: []
|