From f309e2a0f7ccffe4b55517bb8c3bbf119258fd12 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Wed, 28 Aug 2019 19:35:19 -0700 Subject: [PATCH] [bitbar] update for current setup - use the default ruby version - remove bundler, since we only use stdlib - set the text color to white for dark mode --- bitbar/.ruby-version | 2 +- bitbar/Gemfile | 5 ----- bitbar/Gemfile.lock | 19 ------------------- bitbar/Rakefile | 5 ----- bitbar/onebusaway.30s.rb | 8 ++++---- 5 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 bitbar/Gemfile delete mode 100644 bitbar/Gemfile.lock delete mode 100644 bitbar/Rakefile diff --git a/bitbar/.ruby-version b/bitbar/.ruby-version index 227cea2..6cec934 100644 --- a/bitbar/.ruby-version +++ b/bitbar/.ruby-version @@ -1 +1 @@ -2.0.0 +ruby diff --git a/bitbar/Gemfile b/bitbar/Gemfile deleted file mode 100644 index b6bbf79..0000000 --- a/bitbar/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://rubygems.org' - -group :development do - gem 'pry' -end diff --git a/bitbar/Gemfile.lock b/bitbar/Gemfile.lock deleted file mode 100644 index b5d163e..0000000 --- a/bitbar/Gemfile.lock +++ /dev/null @@ -1,19 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - coderay (1.1.1) - method_source (0.8.2) - pry (0.10.3) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - slop (3.6.0) - -PLATFORMS - ruby - -DEPENDENCIES - pry - -BUNDLED WITH - 1.11.2 diff --git a/bitbar/Rakefile b/bitbar/Rakefile deleted file mode 100644 index 4457b61..0000000 --- a/bitbar/Rakefile +++ /dev/null @@ -1,5 +0,0 @@ -desc '' -task :bundle do - cmd = 'bundle install --standalone --path vendor/bundle --without development test' - sh "chruby-exec 2.0.0 -- #{cmd}" -end diff --git a/bitbar/onebusaway.30s.rb b/bitbar/onebusaway.30s.rb index 4edf5eb..740aef1 100755 --- a/bitbar/onebusaway.30s.rb +++ b/bitbar/onebusaway.30s.rb @@ -9,22 +9,22 @@ COLOR_MAP = { arrivalStatusEarly: :red, arrivalStatusDelayed: :blue, arrivalStatusDepartedOnTime: :green, - arrivalStatusDepartedNoInfo: :black, + arrivalStatusDepartedNoInfo: :white, arrivalStatusDepartedEarly: :red, arrivalStatusDepartedDelayed: :blue, arrivalStatusCancelled: :red, } -html = open('http://pugetsound.onebusaway.org/where/standard/stop.action?id=1_7360').read +html = open('http://pugetsound.onebusaway.org/where/standard/stop.action?id=1_17160').read doc = REXML::Document.new(html) status = doc.elements['//td[contains(@class, "arrivalsStatusEntry")]'] minutes = status.elements['.//span'].text -color = COLOR_MAP.fetch(status.attributes['class'].split(/\s+/).last.to_sym, :black) +color = COLOR_MAP.fetch(status.attributes['class'].split(/\s+/).last.to_sym, :white) times = doc.elements.to_a('//div[@class="arrivalsTimePanel"]') puts "#{minutes} | color=#{color}" puts '---' times.each do |time| - puts "#{time[0].text}#{time[1]}#{time[2].text}" + puts "#{time[0].text} - #{time[2].text}" end