parent
e8f91aadce
commit
de51c827f6
@ -1,13 +0,0 @@
|
||||
FROM arm32v7/ruby:2.7
|
||||
|
||||
# throw errors if Gemfile has been modified since Gemfile.lock
|
||||
RUN bundle config --global frozen 1
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY Gemfile Gemfile.lock ./
|
||||
RUN bundle install
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD ["rackup", "--host", "0.0.0.0"]
|
@ -1,14 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
||||
|
||||
gem "nokogiri"
|
||||
gem "roda"
|
||||
|
||||
group :development do
|
||||
gem "pry"
|
||||
gem "rake"
|
||||
gem "rerun"
|
||||
end
|
@ -1,39 +0,0 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
coderay (1.1.2)
|
||||
ffi (1.12.1)
|
||||
listen (3.2.1)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
method_source (0.9.2)
|
||||
mini_portile2 (2.8.0)
|
||||
nokogiri (1.13.6)
|
||||
mini_portile2 (~> 2.8.0)
|
||||
racc (~> 1.4)
|
||||
pry (0.12.2)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.9.0)
|
||||
racc (1.6.0)
|
||||
rack (2.2.3.1)
|
||||
rake (13.0.1)
|
||||
rb-fsevent (0.10.3)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rerun (0.13.0)
|
||||
listen (~> 3.0)
|
||||
roda (3.28.0)
|
||||
rack
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
nokogiri
|
||||
pry
|
||||
rake
|
||||
rerun
|
||||
roda
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.2
|
@ -1,17 +0,0 @@
|
||||
desc "Run RZZ in development mode"
|
||||
task :dev do
|
||||
sh "rerun -- rackup"
|
||||
end
|
||||
|
||||
namespace :docker do
|
||||
TAG = "kejadlen/rzz"
|
||||
|
||||
task :build do
|
||||
sh "docker build --tag #{TAG} ."
|
||||
end
|
||||
|
||||
task push: :build do
|
||||
sh "docker push #{TAG}"
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +0,0 @@
|
||||
require_relative "rzz"
|
||||
|
||||
run Rzz::App.freeze.app
|
@ -1,51 +0,0 @@
|
||||
require "digest/sha1"
|
||||
require "open-uri"
|
||||
|
||||
require "nokogiri"
|
||||
require "roda"
|
||||
|
||||
module Rzz
|
||||
|
||||
class App < Roda
|
||||
plugin :caching
|
||||
plugin :json
|
||||
|
||||
route do |r|
|
||||
r.get do
|
||||
r.is "test-gym" do
|
||||
url = "https://elemental.medium.com/test-gym/home"
|
||||
html = URI.open(url).read
|
||||
|
||||
doc = Nokogiri::HTML(html)
|
||||
items = doc.xpath("//a[@data-post-id]").map {|a|
|
||||
attrs = a.attributes
|
||||
id = attrs.fetch("data-post-id").value
|
||||
title = a.xpath("./h3").text
|
||||
content = a.xpath("./div").text
|
||||
href = URI(attrs.fetch("href"))
|
||||
url = "#{href.scheme}://#{href.host}#{href.path}"
|
||||
{ id: id, title: title, content_text: content, url: url }
|
||||
}
|
||||
|
||||
{
|
||||
version: "https://jsonfeed.org/version/1",
|
||||
title: "Test Gym",
|
||||
home_page_url: url,
|
||||
feed_url: "#{r.base_url}#{r.path}",
|
||||
items: items,
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
url = "https://elemental.medium.com/feed"
|
||||
xml = URI.open(url).read
|
||||
doc = Nokogiri::XML(xml)
|
||||
|
||||
require "pry"
|
||||
binding.pry
|
||||
end
|
Loading…
Reference in new issue