gogo_driver 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 439927baf453888c00569b9507569cf27c765d03
4
- data.tar.gz: 9deb1d97f1239723972713d03bcfd99b797c1126
3
+ metadata.gz: 49f77e06484158676215a3d8d2ee049402b67769
4
+ data.tar.gz: 588c2beebc576c6d272d1406215a0fbbcac6d1b0
5
5
  SHA512:
6
- metadata.gz: 9be2c24bf7876f54c328958982060acc0b749949e9a07bf18bf64127f090ace13596f0d3de24e6bb6b2065b3c8dc3af1695d74e3ea758af1c971e1f152a71bff
7
- data.tar.gz: cb5756fa853883de1a5ba6b37f07ac4d92d29ef7b5f117293a1ef62c7ee4b2ce4bd4f85cca5d595b165d8594500c567ebd402f7bf0860a4e64665ecaef9a1673
6
+ metadata.gz: 71f8d94a67aeca61eef82e4e934ce34f0f43ffdfff4a82feb78c31eb618ec1f28c6dd1b1f35603a8f00f10959ee3deba4b5bdd1795af2644f322d591ca3cca28
7
+ data.tar.gz: be551eb77e567a1dcd32d88419f3b87640efadd6400189c5ea275adeebafaa44a0c99d7e406df60a401836a8c113908acfa8f403c5f63f7d8cbc70b8ef24ebe4
data/.gitignore CHANGED
@@ -7,8 +7,3 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
data/.travis.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.2
3
+ - 2.2.0
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in gogo_driver.gemspec
2
+ gem 'pry'
4
3
  gemspec
data/LICENSE.txt CHANGED
@@ -1,22 +1,21 @@
1
- Copyright (c) 2014 gogotanaka
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2015 gogotanaka
4
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:
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:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
15
14
 
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.
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 CHANGED
@@ -6,10 +6,10 @@ Super simple web driver.
6
6
 
7
7
  ## Installation
8
8
 
9
- [1] Install gem as you like.
9
+ [1] Install gem as you like.
10
10
 
11
11
  $ gem install gogo_driver
12
-
12
+
13
13
  [2] Install chromedriver. Below is the MacOS example.
14
14
 
15
15
  $ brew install chromedriver
@@ -33,4 +33,3 @@ else
33
33
  # ログイン成功時の処理
34
34
  end
35
35
  ```
36
-
data/Rakefile CHANGED
@@ -1,7 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
2
+ require "rake/testtask"
3
3
 
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ end
7
7
 
8
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gogo_driver"
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
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/exe/gogo_driver ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "gogo_driver"
data/gogo_driver.gemspec CHANGED
@@ -1,11 +1,10 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'gogo_driver/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "gogo_driver"
8
- spec.version = GogoDriver::VERSION
7
+ spec.version = "0.1.0"
9
8
  spec.authors = ["gogotanaka"]
10
9
  spec.email = ["mail@tanakakazuki.com"]
11
10
  spec.summary = %q{Super simple web driver.}
@@ -13,14 +12,18 @@ Gem::Specification.new do |spec|
13
12
  spec.homepage = ""
14
13
  spec.license = "MIT"
15
14
 
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)/})
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
17
+ spec.bindir = "exe"
19
18
  spec.require_paths = ["lib"]
20
19
 
20
+ # if spec.respond_to?(:metadata)
21
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
22
+ # end
23
+
21
24
  spec.add_dependency "selenium-webdriver"
22
25
 
23
- spec.add_development_dependency "bundler", "~> 1.6"
26
+ spec.add_development_dependency "bundler", "~> 1.9"
24
27
  spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "rspec"
28
+ spec.add_development_dependency "minitest"
26
29
  end
data/lib/gogo_driver.rb CHANGED
@@ -1,19 +1,45 @@
1
- require "gogo_driver/version"
2
- require "gogo_driver/entity"
1
+ require 'selenium-webdriver'
3
2
 
4
3
  class GogoDriver
5
- attr_accessor :entity
4
+ attr_accessor :driver
6
5
 
7
- def initialize(url='https://www.google.com')
8
- @entity = Entity.new
9
- @entity.go(url)
10
- @last_url = url
6
+ def initialize
7
+ @driver = Selenium::WebDriver.for(:chrome)
8
+ end
9
+
10
+ def go(url)
11
+ @driver.navigate.to(url)
12
+ end
13
+
14
+ def reload
15
+ @driver.navigate.refresh
16
+ end
17
+
18
+ def find(selector)
19
+ @driver.find_element(css: selector)
20
+ end
21
+
22
+ def has?(selector)
23
+ !!find(selector)
24
+ rescue Selenium::WebDriver::Error::NoSuchElementError
25
+ false
26
+ end
27
+
28
+ def has_text?(text)
29
+ !!@driver.find_element({xpath: "//*[text()[contains(.,\"#{text}\")]]"})
30
+ rescue Selenium::WebDriver::Error::NoSuchElementError
31
+ false
32
+ end
33
+
34
+ def click(selector)
35
+ has?(selector) ? find(selector).click : false
36
+ end
37
+
38
+ def submit
39
+ $focus.submit if $focus
11
40
  end
12
41
 
13
42
  def method_missing(method, *args, &block)
14
- @entity.respond_to?(method) ? @entity.send(method, *args, &block) : super
15
- rescue Errno::ECONNREFUSED
16
- initialize(@last_url)
17
- @entity.send(method, *args, &block)
43
+ @driver.respond_to?(method) ? @driver.send(method, *args, &block) : super
18
44
  end
19
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gogo_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - gogotanaka
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2015-01-06 00:00:00.000000000 Z
11
+ date: 2015-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.6'
33
+ version: '1.9'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.6'
40
+ version: '1.9'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -69,23 +69,23 @@ dependencies:
69
69
  description: Super simple web driver.
70
70
  email:
71
71
  - mail@tanakakazuki.com
72
- executables: []
72
+ executables:
73
+ - gogo_driver
73
74
  extensions: []
74
75
  extra_rdoc_files: []
75
76
  files:
76
77
  - ".gitignore"
77
- - ".rspec"
78
78
  - ".travis.yml"
79
+ - CODE_OF_CONDUCT.md
79
80
  - Gemfile
80
81
  - LICENSE.txt
81
82
  - README.md
82
83
  - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - exe/gogo_driver
83
87
  - gogo_driver.gemspec
84
88
  - lib/gogo_driver.rb
85
- - lib/gogo_driver/entity.rb
86
- - lib/gogo_driver/version.rb
87
- - spec/gogo_driver_spec.rb
88
- - spec/spec_helper.rb
89
89
  homepage: ''
90
90
  licenses:
91
91
  - MIT
@@ -106,10 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.2.2
109
+ rubygems_version: 2.4.5
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Super simple web driver.
113
- test_files:
114
- - spec/gogo_driver_spec.rb
115
- - spec/spec_helper.rb
113
+ test_files: []
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
@@ -1,54 +0,0 @@
1
- require 'selenium-webdriver'
2
-
3
- class GogoDriver
4
- class Entity
5
- attr_accessor :driver
6
-
7
- def initialize
8
- @driver = Selenium::WebDriver.for(:chrome)
9
- end
10
-
11
- def go(url)
12
- @driver.navigate.to(url)
13
- end
14
-
15
- def reload
16
- @driver.navigate.refresh
17
- end
18
-
19
- def find(selector)
20
- @driver.find_element(css: selector)
21
- end
22
-
23
- def finds(selector)
24
- @driver.find_elements(css: selector)
25
- end
26
-
27
- def has?(selector)
28
- !!find(selector)
29
- rescue Selenium::WebDriver::Error::NoSuchElementError
30
- false
31
- end
32
-
33
- def has_text?(text)
34
- !!@driver.find_element({xpath: "//*[text()[contains(.,\"#{text}\")]]"})
35
- rescue Selenium::WebDriver::Error::NoSuchElementError
36
- false
37
- end
38
-
39
- def click(selector)
40
- has?(selector) ? find(selector).click : false
41
- end
42
-
43
- def submit
44
- $focus.submit if $focus
45
- end
46
- end
47
- end
48
-
49
- class Selenium::WebDriver::Element
50
- def fill(text)
51
- $focus = self
52
- send_key(text)
53
- end
54
- end
@@ -1,3 +0,0 @@
1
- class GogoDriver
2
- VERSION = "0.0.5"
3
- end
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe GogoDriver do
4
- it 'has a version number' do
5
- expect(GogoDriver::VERSION).not_to be nil
6
- end
7
-
8
- it 'does something useful' do
9
- expect(false).to eq(true)
10
- end
11
- end
data/spec/spec_helper.rb DELETED
@@ -1,2 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'gogo_driver'