boxing-schedules 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 +8 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +32 -0
- data/LICENSE.txt +21 -0
- data/Project_Notes.md +41 -0
- data/README.md +42 -0
- data/Rakefile +2 -0
- data/bin/boxing-schedules +6 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/boxing-schedules.gemspec +43 -0
- data/lib/boxing-schedules/cli.rb +137 -0
- data/lib/boxing-schedules/fight.rb +16 -0
- data/lib/boxing-schedules/scraper.rb +29 -0
- data/lib/boxing-schedules/version.rb +3 -0
- data/lib/boxing_schedules.rb +16 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f81c190ba87288262e0cf2dee48e21eb55a38758bc7099ff8b4db3000b20e5a0
|
4
|
+
data.tar.gz: 4f930d42eb3ec6b6cc9d5e80f05861768bd38cba844cb2e6a95304150d94d085
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: abf540065dd8c40caf9257e0fb80b37808ef5d67a52e546d13ae03e3f75a8eb2842a030163ec2ff60c3f73337c8b2f61581ea874f802a9002827dd707cbe42cd
|
7
|
+
data.tar.gz: 7bc305d291669ac126d758df468ff6eee044ec48430b0943e5898c317d691a7dffc5ab9a32662032f1010660a5044fe2ac0d29e0ccca1782be613d2fc8948305
|
data/.gitignore
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 'jaycru06@yahoo.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,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
boxing-schedules (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coderay (1.1.2)
|
10
|
+
colorize (0.8.1)
|
11
|
+
method_source (0.9.2)
|
12
|
+
mini_portile2 (2.4.0)
|
13
|
+
nokogiri (1.10.7)
|
14
|
+
mini_portile2 (~> 2.4.0)
|
15
|
+
pry (0.12.2)
|
16
|
+
coderay (~> 1.1.0)
|
17
|
+
method_source (~> 0.9.0)
|
18
|
+
rake (10.5.0)
|
19
|
+
|
20
|
+
PLATFORMS
|
21
|
+
ruby
|
22
|
+
|
23
|
+
DEPENDENCIES
|
24
|
+
boxing-schedules!
|
25
|
+
bundler (~> 2.0)
|
26
|
+
colorize
|
27
|
+
nokogiri
|
28
|
+
pry
|
29
|
+
rake (~> 10.0)
|
30
|
+
|
31
|
+
BUNDLED WITH
|
32
|
+
2.0.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 'Jason J Cruz'
|
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/Project_Notes.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
CLI Data Gem Project Notes:
|
2
|
+
|
3
|
+
**Create A CLI Data gem that scrapes scheduled boxing fights**
|
4
|
+
|
5
|
+
1. Imagine your user interface for this Project
|
6
|
+
2. Start with the structure
|
7
|
+
3. Create the entry point - bin/run
|
8
|
+
4. force that to build the CLI interface
|
9
|
+
5. Stub out the interface
|
10
|
+
6. Start making things real
|
11
|
+
7. discover objects
|
12
|
+
8. Program
|
13
|
+
|
14
|
+
Clases:
|
15
|
+
|
16
|
+
User Interface(CLI):
|
17
|
+
|
18
|
+
- user types boxing-schedules
|
19
|
+
|
20
|
+
- a list of options/selections appear
|
21
|
+
- show list of boxing fights scheduled
|
22
|
+
_ a fight has:
|
23
|
+
*fight details*
|
24
|
+
1. fighter names
|
25
|
+
2. fight location
|
26
|
+
3. fight channel
|
27
|
+
4. fight time
|
28
|
+
5. fight url
|
29
|
+
|
30
|
+
CLI:
|
31
|
+
- controller for the boxing schedules cli app
|
32
|
+
- calls on Scraper class method
|
33
|
+
- iterates over fights to display fight details for UI
|
34
|
+
|
35
|
+
Fight:
|
36
|
+
- makes fight objects from scraped data
|
37
|
+
- stores and saves all fight objects
|
38
|
+
|
39
|
+
Scraper:
|
40
|
+
- opens webpage for all upcoming fight data
|
41
|
+
- scrapes all content for fight details
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
CLI Data Gem Project
|
2
|
+
|
3
|
+
# Boxing Schedules
|
4
|
+
|
5
|
+
This Ruby Gem scrapes data on upcoming boxing matches and displays the informartion to the user. The user can see all details for all upcoming fights at once or select from a list of options to focus in on specific details such as, fighter names, fight location & channel, fight times etc. . All fights are numbered for easy viewing and selection if the user wants to select a specific fight.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'boxing-schedules'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install boxing-schedules
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
$ ruby bin/boxing-schedules
|
25
|
+
|
26
|
+
## Development
|
27
|
+
|
28
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
29
|
+
|
30
|
+
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).
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/'glorious-compressor-1583'/boxing-schedules. 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.
|
35
|
+
|
36
|
+
## License
|
37
|
+
|
38
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
39
|
+
|
40
|
+
## Code of Conduct
|
41
|
+
|
42
|
+
Everyone interacting in the Boxing::Schedules project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/'glorious-compressor-1583'/boxing-schedules/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require_relative "../lib/boxing_schedules"
|
5
|
+
# require "boxing-schedules"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "boxing-schedules/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "boxing-schedules"
|
8
|
+
spec.version = BoxingSchedules::VERSION
|
9
|
+
spec.authors = ["'Jason J Cruz'"]
|
10
|
+
spec.email = ["'jjcru06@gmail.com'"]
|
11
|
+
|
12
|
+
spec.summary = "A Gem that scrapes boxing fight schedules."
|
13
|
+
spec.description = "A Gem that scrapes boxing fight schedules."
|
14
|
+
spec.homepage = "https://github.com/CoderJay06/boxing-schedules"
|
15
|
+
spec.license = "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"] = "'http://mygemserver.com'"
|
21
|
+
|
22
|
+
# spec.metadata["homepage_uri"] = spec.homepage
|
23
|
+
# spec.metadata["source_code_uri"] = "https://github.com/CoderJay06/boxing-schedules"
|
24
|
+
# spec.metadata["changelog_uri"] = "https://github.com/CoderJay06/boxing-schedules"
|
25
|
+
# else
|
26
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
27
|
+
# "public gem pushes."
|
28
|
+
# end
|
29
|
+
|
30
|
+
# Specify which files should be added to the gem when it is released.
|
31
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
32
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
|
+
end
|
35
|
+
spec.bindir = "exe"
|
36
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
|
+
spec.require_paths = ["lib"]
|
38
|
+
|
39
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
40
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
41
|
+
spec.add_development_dependency "nokogiri"
|
42
|
+
spec.add_development_dependency "pry"
|
43
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
class BoxingSchedules::CLI
|
2
|
+
|
3
|
+
# displays main menu for fight options
|
4
|
+
def main_menu
|
5
|
+
puts "\t\t -----------------------------".red
|
6
|
+
puts "Hello, Welcome to #{"The Boxing Schedules CLI App".blue}"
|
7
|
+
puts "\t\t -----------------------------".red
|
8
|
+
puts "Which displayed option would you like to select(Type the number to select):"
|
9
|
+
puts "1. All Fight Details"
|
10
|
+
puts "2. Fight Channels & Locations"
|
11
|
+
puts "3. Fight Times"
|
12
|
+
puts "4. Fighter Names"
|
13
|
+
puts "5. Fight Links"
|
14
|
+
puts "Type 'exit' to quit."
|
15
|
+
puts "Type 'list' to see options again."
|
16
|
+
end
|
17
|
+
|
18
|
+
# calls on Scraper class method
|
19
|
+
def scheduled_fights_scraper
|
20
|
+
BoxingSchedules::Scraper.scrape_scheduled_fights
|
21
|
+
end
|
22
|
+
|
23
|
+
# calls on all fight objects from Fight class
|
24
|
+
def number_of_fights
|
25
|
+
BoxingSchedules::Fight.all
|
26
|
+
end
|
27
|
+
|
28
|
+
# iterates through all fight instances of Fight.all and grabs the attributes
|
29
|
+
# to display each fight details to the user.
|
30
|
+
def scheduled_fight_details
|
31
|
+
number_of_fights.each_with_index do|fight, index|
|
32
|
+
puts "----------------------------".red + "#{"BOXING SCHEDULES".blue}" + "------------------------------------------------".red
|
33
|
+
puts "Fight ##{index+1}".red
|
34
|
+
puts "Fight Channel & Location: #{fight.channel_location}"
|
35
|
+
puts "Fight Time: #{fight.fight_time}"
|
36
|
+
puts "Fighter Names: #{fight.fighter_names}"
|
37
|
+
puts "All Fight Details: #{fight.fight_details.gsub("More Details", "")}"
|
38
|
+
puts "Fight Link:" + "#{fight.fight_url}".yellow
|
39
|
+
puts "--------------------------------------------------------------------------------------------".red
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# passes in fight number selected by the user and
|
44
|
+
# fight detail for selected fight.
|
45
|
+
# iterates through scheduled fight details method
|
46
|
+
# and selects index of fight matching number passed in.
|
47
|
+
def fight_number(number, fight_detail)
|
48
|
+
number_of_fights.select.with_index(1) do |fight, index|
|
49
|
+
if index == number
|
50
|
+
puts ""
|
51
|
+
puts "Selected fight:"
|
52
|
+
puts "--------------------------------------------------------------------------------------------".red
|
53
|
+
puts "Fight ##{index}:".red
|
54
|
+
puts "Selected details:" + " #{fight.send(fight_detail)}".gsub("More Details", "")
|
55
|
+
puts "Fight Link:" +" #{fight.fight_url}".yellow
|
56
|
+
puts "---------------------------------------------------------------------------------------------".red
|
57
|
+
puts ""
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# gets user input for viewing specific fight.
|
63
|
+
def view_fight_input
|
64
|
+
puts "Would you like to view a specific fight? (y/n)"
|
65
|
+
input = gets.strip.downcase
|
66
|
+
end
|
67
|
+
|
68
|
+
# gets user input for fight number selected.
|
69
|
+
def view_fight(fight_detail)
|
70
|
+
puts "Enter fight number to view specific fight: "
|
71
|
+
fight_num_input = gets.strip.to_i
|
72
|
+
fight_number(fight_num_input, fight_detail)
|
73
|
+
end
|
74
|
+
|
75
|
+
# determines if user chooses to
|
76
|
+
# view specific fight number.
|
77
|
+
def select_fight_number(selected_fight)
|
78
|
+
if view_fight_input == 'y'
|
79
|
+
view_fight(selected_fight)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# prints out details for fights option
|
84
|
+
# chosen by user using metaprograming.
|
85
|
+
def print_fight_details(fight_detail)
|
86
|
+
number_of_fights.each_with_index do|fight, index|
|
87
|
+
if index < number_of_fights.size
|
88
|
+
puts "Fight".blue + "##{index+1} ".red + "#{fight.send(fight_detail)}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# calls Scraper scrape scheduled fights method.
|
94
|
+
# gets user input and determines which option
|
95
|
+
# to display based on number input by the user.
|
96
|
+
def start
|
97
|
+
scheduled_fights_scraper
|
98
|
+
user_input = nil
|
99
|
+
while user_input != 'exit'
|
100
|
+
main_menu
|
101
|
+
user_input = gets.strip.downcase
|
102
|
+
case user_input
|
103
|
+
when '1'
|
104
|
+
scheduled_fight_details
|
105
|
+
select_fight_number('fight_details')
|
106
|
+
when '2'
|
107
|
+
print_fight_details('channel_location')
|
108
|
+
select_fight_number('channel_location')
|
109
|
+
when '3'
|
110
|
+
print_fight_details('fight_time')
|
111
|
+
select_fight_number('fight_time')
|
112
|
+
when '4'
|
113
|
+
print_fight_details('fighter_names')
|
114
|
+
select_fight_number('fighter_names')
|
115
|
+
when '5'
|
116
|
+
print_fight_details('fight_url')
|
117
|
+
select_fight_number('fight_url')
|
118
|
+
when 'exit'
|
119
|
+
goodbye
|
120
|
+
when 'list'
|
121
|
+
main_menu
|
122
|
+
else
|
123
|
+
invalid_input
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def invalid_input
|
129
|
+
puts "Invalid input, that is not an option.".red
|
130
|
+
end
|
131
|
+
|
132
|
+
def goodbye
|
133
|
+
puts "Goodbye from The Boxing Schedules CLI App!".blue
|
134
|
+
puts "------------------------------------------".red
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class BoxingSchedules::Fight
|
2
|
+
attr_accessor :fight_details, :fighter_names, :channel_location, :fight_time, :fight_url
|
3
|
+
|
4
|
+
@@all = []
|
5
|
+
|
6
|
+
# saves all fight objects
|
7
|
+
def save
|
8
|
+
@@all << self
|
9
|
+
end
|
10
|
+
|
11
|
+
# displays all fight objects
|
12
|
+
def self.all
|
13
|
+
@@all
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class BoxingSchedules::Scraper
|
2
|
+
|
3
|
+
# sets url for boxing schedules webpage, opens the page with Nokogiri.
|
4
|
+
def self.open_scheduled_fights
|
5
|
+
url = "https://schedule.boxingscene.com/"
|
6
|
+
Nokogiri::HTML(open(url))
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
# loops through all upcoming fights on boxingscene.
|
11
|
+
# scrapes all the fight details and sets fight attributes.
|
12
|
+
# saves them to the Fight class variable all.
|
13
|
+
def self.scrape_scheduled_fights
|
14
|
+
content = self.open_scheduled_fights.css("div.schedules")
|
15
|
+
number_of_fights = open_scheduled_fights.css(".vs").size
|
16
|
+
i = 0
|
17
|
+
while i < number_of_fights
|
18
|
+
fight = BoxingSchedules::Fight.new
|
19
|
+
fight.channel_location = content.css("p.fight-channels")[i].text.split.join(" ")
|
20
|
+
fight.fighter_names = content.css(".schedule-details-block div div")[i].text.split.join(" ").strip
|
21
|
+
fight.fight_time = content.css(".schedule-time-block")[i].text.split.join(" ")
|
22
|
+
fight.fight_details = content.css(".schedule-details-block")[i].text.split.join(" ")
|
23
|
+
fight.fight_url = "https://schedule.boxingscene.com/" + content.css("a")[i].attr("href")
|
24
|
+
fight.save
|
25
|
+
i += 1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#enviornment file
|
2
|
+
require "nokogiri"
|
3
|
+
require "open-uri"
|
4
|
+
require 'pry'
|
5
|
+
require 'colorize'
|
6
|
+
require 'colorized_string'
|
7
|
+
|
8
|
+
require_relative "boxing-schedules/version"
|
9
|
+
require_relative "boxing-schedules/cli"
|
10
|
+
require_relative "boxing-schedules/scraper"
|
11
|
+
require_relative "boxing-schedules/fight"
|
12
|
+
|
13
|
+
module BoxingSchedules
|
14
|
+
class Error < StandardError; end
|
15
|
+
# Your code goes here...
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: boxing-schedules
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "'Jason J Cruz'"
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-02-21 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: '2.0'
|
20
|
+
type: :development
|
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: 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: nokogiri
|
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: pry
|
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: A Gem that scrapes boxing fight schedules.
|
70
|
+
email:
|
71
|
+
- "'jjcru06@gmail.com'"
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- CODE_OF_CONDUCT.md
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- LICENSE.txt
|
81
|
+
- Project_Notes.md
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/boxing-schedules
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- boxing-schedules.gemspec
|
88
|
+
- lib/boxing-schedules/cli.rb
|
89
|
+
- lib/boxing-schedules/fight.rb
|
90
|
+
- lib/boxing-schedules/scraper.rb
|
91
|
+
- lib/boxing-schedules/version.rb
|
92
|
+
- lib/boxing_schedules.rb
|
93
|
+
homepage: https://github.com/CoderJay06/boxing-schedules
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubygems_version: 3.1.2
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: A Gem that scrapes boxing fight schedules.
|
116
|
+
test_files: []
|