intelmap_checker 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: 9ed34981806cdca981ec76494a0dc68df2569e44
4
+ data.tar.gz: 78e773a39fee8fdb47abf0b0e9a3f34aaf84032b
5
+ SHA512:
6
+ metadata.gz: 7409bd3b454828acddc8d39f7b489dd0715f5a9041adcfab8bab4829efb6ee3e87fc32933f77f62b69b7ec6d4e5c285ab3d3d79f7ca5c317978d2eadbf47a4cd
7
+ data.tar.gz: 63c9f33ad303dd374fe546a070bf50ae22248728709d4b276a72b010daf7dfd2e30da10add4c5d19184993eff1b3ca84e3c381167c3b2bfe25fe7e7dc21b046c
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ before_install: gem install bundler -v 1.10.6
@@ -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, ethnicity, 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 ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in intelmap_checker.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # IntelmapChecker
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/intelmap_checker`. 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 'intelmap_checker'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install intelmap_checker
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/[USERNAME]/intelmap_checker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
36
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "intelmap_checker"
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
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'intelmap_checker/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "intelmap_checker"
8
+ spec.version = IntelmapChecker::VERSION
9
+ spec.authors = ["kkawamura"]
10
+ spec.email = ["kawamura.keisuke@gmail.com"]
11
+
12
+ spec.summary = %q{Simple tool to collect some information from intelmap in INGRESS}
13
+ spec.description = %q{Simple tool to collect some information from intelmap in INGRESS}
14
+ spec.homepage = "http://github.com/kkawamura/intelmap_checker"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "selenium-webdriver"
26
+ end
@@ -0,0 +1,3 @@
1
+ module IntelmapChecker
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,135 @@
1
+ require "intelmap_checker/version"
2
+ require 'selenium-webdriver'
3
+
4
+ module IntelmapChecker
5
+
6
+ class IntelmapChecker
7
+
8
+ def initialize(email, passwd)
9
+ @email = email
10
+ @passwd = passwd
11
+ @auth = nil
12
+ begin
13
+ @driver = Selenium::WebDriver.for :chrome
14
+ @driver.manage.window.resize_to(100,100)
15
+ rescue Exception => e
16
+ puts e.message
17
+ puts e.backtrace
18
+ end
19
+ end
20
+
21
+ def load_map(url)
22
+ if @auth == nil
23
+ @driver.navigate.to url
24
+ @driver.find_element(:link_text, "Sign in").click
25
+ sleep 3 #waiting to load a page
26
+
27
+ @driver.find_element(:name, "Email").send_keys(@email)
28
+ @driver.find_element(:name, "signIn").click
29
+ sleep 3 #waiting to load a page
30
+
31
+ e = @driver.find_element(:name, "Passwd")
32
+ e.send_keys(@passwd)
33
+ e.submit
34
+ @auth = true
35
+ else
36
+ @driver.navigate.to url
37
+ end
38
+ sleep 5
39
+ end
40
+
41
+ def all_comments
42
+ arr = Array.new
43
+ @driver.find_element(:id, "pl_tab_all").click
44
+ sleep 3
45
+
46
+ all_logs = @driver.find_elements(:class, "plext")
47
+ all_logs.each do |log|
48
+ timestamp = log.find_element(:class, "pl_timestamp_date").text
49
+ player_class = log.find_element(:class, "pl_nudge_player").attribute("class").split(" ", 2)
50
+ message = log.find_element(:class, "pl_content").text.split(/\s*[: | ]\s*/, 2)
51
+ data = Hash.new
52
+ data[:date] = timestamp
53
+ data[:faction] = player_class[0]
54
+ data[:username] = message[0]
55
+ data[:comment] = message[1]
56
+ p data
57
+ arr.push data
58
+ end
59
+ return arr
60
+ end
61
+
62
+ def faction_comments
63
+ arr = Array.new
64
+ @driver.find_element(:id, "pl_tab_fac").click
65
+ sleep 3
66
+
67
+ fac_logs = @driver.find_elements(:class, "plext")
68
+ fac_logs.each do |log|
69
+ timestamp = log.find_element(:class, "pl_timestamp_date").text
70
+ message = log.find_element(:class, "pl_content").text.split(/\s*[: | ]\s*/, 2)
71
+ data = Hash.new
72
+ data[:date] = timestamp
73
+ data[:username] = message[0]
74
+ data[:comment] = message[1]
75
+ p data
76
+ arr.push data
77
+ end
78
+ return arr
79
+ end
80
+
81
+ def portal_details
82
+ sleep 3
83
+ portal = Hash.new
84
+ container = @driver.find_element(:id, "portal_details_container")
85
+ if container
86
+ portal[:name] = container.find_element(:id, "portal_primary_title").text
87
+ portal[:level] = container.find_element(:id, "portal_level").text
88
+ portal[:owner] = container.find_element(:id, "portal_capture_details").text
89
+ resonators = container.find_elements(:class, "resonator")
90
+ reso_arr = Array.new
91
+ resonators.each do |reso|
92
+ if reso.find_elements(:class, "resonator_owner").size > 0
93
+ reso_data = Hash.new
94
+ reso_data[:owner] = reso.find_element(:class, "resonator_owner").text
95
+ reso_data[:level] = reso.find_element(:class, "resonator_level").text
96
+ reso_arr.push reso_data
97
+ end
98
+ end
99
+ portal[:resonators] = reso_arr
100
+ reso_arr = Array.new
101
+
102
+ container.find_element(:id, "pi-tab-mod").click
103
+ mods = container.find_elements(:class, "mod")
104
+ p mods.size
105
+ mod_arr = Array.new
106
+ mods.each do |mod|
107
+ if mod.find_elements(:class, "mod_installer").size > 0
108
+ mod_data = Hash.new
109
+ if mod.find_elements(:class, "mod_name_common").size > 0
110
+ p mod.find_element(:class, "mod_name_common").text
111
+ mod_data[:type] = mod.find_element(:class, "mod_name_common").text
112
+ mod_data[:class] = "common"
113
+ elsif mod.find_elements(:class, "mod_name_rare").size > 0
114
+ p mod_data[:type] = mod.find_elements(:class, "mod_name_rare").size
115
+ p mod_data[:type] = mod.find_element(:class, "mod_name_rare").text
116
+ mod_data[:type] = mod.find_element(:class, "mod_name_rare").text
117
+ mod_data[:class] = "rare"
118
+ elsif mod.find_elements(:class, "mod_name_very_rare").size > 0
119
+ mod_data[:type] = mod.find_element(:class, "mod_name_very_rare").text
120
+ mod_data[:class] = "very_rare"
121
+ end
122
+ mod_arr.push mod_data
123
+ end
124
+ end
125
+ portal[:mods] = mod_arr
126
+ end
127
+ return portal
128
+ end
129
+
130
+ def shutdown
131
+ @driver.quit
132
+ end
133
+ end
134
+
135
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: intelmap_checker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - kkawamura
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-07-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
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
+ - !ruby/object:Gem::Dependency
56
+ name: selenium-webdriver
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Simple tool to collect some information from intelmap in INGRESS
70
+ email:
71
+ - kawamura.keisuke@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - CODE_OF_CONDUCT.md
80
+ - Gemfile
81
+ - README.md
82
+ - Rakefile
83
+ - bin/console
84
+ - bin/setup
85
+ - intelmap_checker.gemspec
86
+ - lib/intelmap_checker.rb
87
+ - lib/intelmap_checker/version.rb
88
+ homepage: http://github.com/kkawamura/intelmap_checker
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.2.0
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Simple tool to collect some information from intelmap in INGRESS
112
+ test_files: []