house_floor_bills 0.1.4 → 0.2.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
- SHA1:
3
- metadata.gz: 94d99cd5e475e372bd9e0245e5cdb667910c91cc
4
- data.tar.gz: 39e999418718201edb8049fae13c1d089f2715b9
2
+ SHA256:
3
+ metadata.gz: 26c8d3a9f2c394994df84179f9e4cfd941c0dac98b692a4164cf7d8e5df53779
4
+ data.tar.gz: eb14221c0c2eae74ef300a44e4ff85515ef6c7c46669c48b0a8c7ef63c5886fc
5
5
  SHA512:
6
- metadata.gz: 22476ffc79b1e4660b35526739b53209905c52696d4d09b057859348415a2de251274715ef3fd83bf7227b1d339ef10ef5d90cd1a6f01717f94c93683ad8bb0b
7
- data.tar.gz: 1c61b16207aff2654686b3fb3f32507c2dcced8cf94ac337060d0ca10f2920bb467b10bb561e93f279c0a74543375c25cb7e2e4ec6e5bf831d251170465dbaef
6
+ metadata.gz: 24b3352d05fee6e3196b138705dfb16fdcd228630a28a447f30a06c69aab2e3101ce2909f8c6755225bca79be23a5391241fb460a3d6fa04dd8f133ccefbd71d
7
+ data.tar.gz: 5bd4ea45ecb08a72eaff897678c5d3c5a06daf7499c035b3484e8e5bd4ee7e12ff422093f17663bd14c30eba3f499b575b3890b0c860cf1ebccdb732e86fd6c6
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
- # HouseFloorBills
1
+ # House Floor Bills
2
2
 
3
- The house-floor-bills CLI gem provides a CLI interface to view the schedule of legislative bills to be debated on the House of Representatives floor this week. Further details about the scheduled bills can be viewed as well.
3
+ The House Floor Bills application provides a command-line interface for viewing the current schedule of legislative bills that are up for consideration on the U.S. House of Representatives floor this week.
4
+
5
+ ## Requirements
6
+
7
+ - [Ruby](https://www.ruby-lang.org/)
8
+ - [Ruby Gems](https://rubygems.org/)
4
9
 
5
10
  ## Installation
6
11
 
@@ -8,19 +13,19 @@ The house-floor-bills CLI gem provides a CLI interface to view the schedule of l
8
13
 
9
14
  ## Usage
10
15
 
11
- Type the following command in your computer's terminal and follow the on-screen prompts.
16
+ Once the House Floor Bills gem is installed, type the following command in your computer's terminal and follow the on-screen prompts:
12
17
 
13
18
  $ house-floor-bills
14
19
 
15
20
  ## Development
16
21
 
17
- 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.
22
+ After checking out the repo, run `bin/setup` in your terminal to install dependencies. To run the tests, enter `rake spec`. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
18
23
 
19
24
  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).
20
25
 
21
26
  ## Contributing
22
27
 
23
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/house_floor_bills. 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.
28
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dalmaboros/house_floor_bills. 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.
24
29
 
25
30
 
26
31
  ## License
@@ -30,8 +30,9 @@ Gem::Specification.new do |spec|
30
30
  spec.require_paths = ["lib"]
31
31
 
32
32
  spec.add_development_dependency "bundler", ">= 1.11"
33
- spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rake", ">= 12.3.3"
34
34
  spec.add_development_dependency "rspec", "~> 3.0"
35
35
  spec.add_development_dependency "pry"
36
36
  spec.add_dependency "nokogiri", "~> 1.0"
37
+ spec.add_dependency "colorize"
37
38
  end
@@ -3,8 +3,8 @@
3
3
  require "open-uri"
4
4
  require "nokogiri"
5
5
  require "pry"
6
+ require "colorize"
6
7
 
7
- require_relative "./house_floor_bills/version"
8
8
  require_relative "./house_floor_bills/cli"
9
9
  require_relative "./house_floor_bills/bill"
10
10
  require_relative "./house_floor_bills/scraper"
@@ -1,3 +1,5 @@
1
+ require 'colorize'
2
+
1
3
  class HouseFloorBills::CLI
2
4
 
3
5
  def call
@@ -7,20 +9,20 @@ class HouseFloorBills::CLI
7
9
  end
8
10
 
9
11
  def welcome
10
- puts "\n------ Welcome to House Floor Bills ------"
11
- puts "\nBills to be considered on the U.S. House floor:"
12
+ puts "\n🏛 " + " House Floor Bills ".blue + "🏛"
13
+ puts "A simple CLI app to display the bills up for consideration on the U.S. House floor this week."
12
14
  end
13
15
 
14
16
  def list_bills
15
17
  s = HouseFloorBills::Scraper.new
16
18
  @schedule = s.scrape
17
19
 
18
- puts "\n-------------------------------------------"
19
- puts "#{@schedule.title}"
20
- puts "-------------------------------------------\n "
20
+ puts "\n\n-------------------------------------------".green
21
+ puts "#{@schedule.title}".green
22
+ puts "-------------------------------------------\n ".green
21
23
 
22
24
  @schedule.bills.each.with_index(1) do |bill, i|
23
- puts "#{i}. #{bill.number} - #{bill.name}"
25
+ puts "#{i}." + " #{bill.number}".blue + " - #{bill.name}"
24
26
  end
25
27
  end
26
28
 
@@ -36,26 +38,25 @@ class HouseFloorBills::CLI
36
38
  end
37
39
 
38
40
  def print_commands
39
- puts "\nCOMMANDS"
40
- puts "-------------------------------------------"
41
- puts "Enter 1-#{@schedule.bills.length} for more info on corresponding bill."
42
- puts "Enter 'open 1-#{@schedule.bills.length}' to open bill page in browser."
43
- puts "Enter 'pdf 1-#{@schedule.bills.length}' to open bill PDF in browser."
44
- puts "Enter 'list' to see the list of bills again."
45
- puts "Enter 'exit' to exit program."
41
+ puts "\nEnter a number between '" + "1-#{@schedule.bills.length}".red + "' for more info on corresponding bill."
42
+ puts "Enter '" + "open 1-#{@schedule.bills.length}".red + "' to open bill page in browser."
43
+ puts "Enter '" + "pdf 1-#{@schedule.bills.length}".red + "' to open bill PDF in browser."
44
+ puts "Enter '" + "live".red + "' to watch the U.S. House of Representatives live"
45
+ puts "Enter '" + "list".red + "' to see the list of bills again."
46
+ puts "Enter '" + "exit".red + "' to exit program."
46
47
  end
47
48
 
48
49
  def menu
49
50
  input = nil
50
51
 
51
52
  while input != "exit"
52
- puts "\nEnter command (type 'commands' for list of commands):"
53
- print ">"
53
+ puts "\nEnter command (type '" + "usage".red + "' for help):"
54
+ print "> "
54
55
  input = gets.strip.downcase
55
56
 
56
57
  if input.to_i.between?(1, @schedule.bills.size)
57
58
  print_bill(@schedule.find_bill(input))
58
- elsif input == "commands"
59
+ elsif input == "usage"
59
60
  print_commands
60
61
  elsif input =~ /open \d/
61
62
  system("open #{@schedule.find_bill(input.split.last).url}")
@@ -63,8 +64,10 @@ class HouseFloorBills::CLI
63
64
  system("open #{@schedule.find_bill(input.split.last).pdf}")
64
65
  elsif input == "list"
65
66
  list_bills
67
+ elsif input == "live"
68
+ system("open https://live.house.gov/")
66
69
  elsif input == "exit"
67
- puts "Goodybye!"
70
+ puts "💨"
68
71
  else
69
72
  puts "Invalid input."
70
73
  end
@@ -18,8 +18,24 @@ class HouseFloorBills::Scraper
18
18
  @schedule.week = @doc_schedule.search("div#primaryContent h1 > text()").text.split("\n").last.strip
19
19
  end
20
20
 
21
+ def get_congress
22
+ current_DC_time = Time.now.getlocal('-04:00')
23
+
24
+ start_of_congress_116 = Time.utc(2019,"jan",3,04,00,0)
25
+ start_of_congress_117 = Time.utc(2021,"jan",3,04,00,0)
26
+ start_of_congress_118 = Time.utc(2023,"jan",3,04,00,0)
27
+
28
+ if current_DC_time < start_of_congress_117
29
+ return "116th-congress"
30
+ elsif current_DC_time < start_of_congress_118
31
+ return "117th-congress"
32
+ elsif current_DC_time >= start_of_congress_118
33
+ return "118th-congress"
34
+ end
35
+ end
36
+
21
37
  def scrape_bills
22
- print "Loading "
38
+ print "\nLoading bills "
23
39
  @doc_schedule.search("table.floorItems > tr.floorItem").collect do |floor_item|
24
40
  # Instantiate the bill
25
41
  b = HouseFloorBills::Bill.new
@@ -32,11 +48,11 @@ class HouseFloorBills::Scraper
32
48
 
33
49
  # Set URL conditionally, based on type of bill:
34
50
  if b.number.split.include? "H.R."
35
- b.url = "https://www.congress.gov/bill/115th-congress/house-bill/#{b.number.split.last}"
51
+ b.url = "https://www.congress.gov/bill/#{get_congress}/house-bill/#{b.number.split.last}"
36
52
  elsif b.number.split.include? "H.Res."
37
- b.url = "https://www.congress.gov/bill/115th-congress/house-resolution/#{b.number.split.last}"
53
+ b.url = "https://www.congress.gov/bill/#{get_congress}/house-resolution/#{b.number.split.last}"
38
54
  elsif b.number.split.include? "S."
39
- b.url = "https://www.congress.gov/bill/115th-congress/senate-bill/#{b.number.split.last}"
55
+ b.url = "https://www.congress.gov/bill/#{get_congress}/senate-bill/#{b.number.split.last}"
40
56
  else
41
57
  b.url = ""
42
58
  end
@@ -1,3 +1,3 @@
1
1
  module HouseFloorBills
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: house_floor_bills
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dalma Boros
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
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: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: colorize
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description: Legislative bills scheduled for debate this week on the United States
84
98
  House of Representatives floor.
85
99
  email:
@@ -132,8 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
146
  - !ruby/object:Gem::Version
133
147
  version: '0'
134
148
  requirements: []
135
- rubyforge_project:
136
- rubygems_version: 2.6.14
149
+ rubygems_version: 3.1.2
137
150
  signing_key:
138
151
  specification_version: 4
139
152
  summary: Bills to be considered on the house floor.