From 651124d64ff858632627b731a026c07a06a3f918 Mon Sep 17 00:00:00 2001 From: Tatsuya Koishi Date: Mon, 19 Aug 2019 09:38:00 +0900 Subject: [PATCH 1/4] bundle update --- Gemfile.lock | 12 +++++++----- lib/tomato_toot/package.rb | 14 +++++--------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 446c7247..62991c63 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ GIT remote: https://github.com/pooza/ginseng-core.git - revision: da6a24fd19633c2b6dbf9f1ef85f44949816afeb + revision: bca4d2c45bb900838a8cb087ba3b9d40328bc9f9 specs: - ginseng-core (1.4.4) + ginseng-core (1.4.5) activesupport addressable bundler @@ -18,11 +18,12 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (5.2.3) + activesupport (6.0.0) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.1, >= 2.1.8) addressable (2.6.0) public_suffix (>= 2.0.2, < 4.0) ast (2.4.0) @@ -66,7 +67,7 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) netrc (0.11.0) - nokogiri (1.10.3) + nokogiri (1.10.4) mini_portile2 (~> 2.4.0) oauth2 (1.4.1) faraday (>= 0.8, < 0.16.0) @@ -77,7 +78,7 @@ GEM parallel (1.17.0) parser (2.6.3.0) ast (~> 2.4.0) - power_assert (1.1.4) + power_assert (1.1.5) public_suffix (3.1.1) rack (2.0.7) rainbow (3.0.0) @@ -105,6 +106,7 @@ GEM unf_ext unf_ext (0.0.7.6) unicode-display_width (1.6.0) + zeitwerk (2.1.9) PLATFORMS ruby diff --git a/lib/tomato_toot/package.rb b/lib/tomato_toot/package.rb index 17575740..a622a689 100644 --- a/lib/tomato_toot/package.rb +++ b/lib/tomato_toot/package.rb @@ -1,27 +1,23 @@ module TomatoToot module Package - def module_name - return 'TomatoToot' - end - def environment_class - return "#{module_name}::Environment".constantize + return Environment end def package_class - return "#{module_name}::Package".constantize + return Package end def config_class - return "#{module_name}::Config".constantize + return Config end def logger_class - return "#{module_name}::Logger".constantize + return Logger end def http_class - return "#{module_name}::HTTP".constantize + return HTTP end def self.name From b2f91f504acae156f5b28bf1afa0c99fa5e9344d Mon Sep 17 00:00:00 2001 From: Tatsuya Koishi Date: Wed, 28 Aug 2019 06:41:11 +0900 Subject: [PATCH 2/4] bundle update --- Gemfile.lock | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 62991c63..eb0b75a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ GIT remote: https://github.com/pooza/ginseng-core.git - revision: bca4d2c45bb900838a8cb087ba3b9d40328bc9f9 + revision: d68e5450bc2e527ee923fb3a0008485c7f55f80a specs: - ginseng-core (1.4.5) + ginseng-core (1.4.7) activesupport addressable bundler @@ -14,6 +14,7 @@ GIT rubocop syslog-logger test-unit + yajl-ruby GEM remote: https://rubygems.org/ @@ -46,6 +47,7 @@ GEM faraday_middleware (>= 0.9) loofah (>= 2.0) sax-machine (>= 1.0) + http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) httparty (0.17.0) @@ -83,7 +85,8 @@ GEM rack (2.0.7) rainbow (3.0.0) rake (12.3.3) - rest-client (2.0.2) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) @@ -106,6 +109,7 @@ GEM unf_ext unf_ext (0.0.7.6) unicode-display_width (1.6.0) + yajl-ruby (1.4.1) zeitwerk (2.1.9) PLATFORMS From d50c04079641493caf2814e5b1d9a755704e1b3f Mon Sep 17 00:00:00 2001 From: Tatsuya Koishi Date: Wed, 28 Aug 2019 06:42:23 +0900 Subject: [PATCH 3/4] ginseng-core 1.4.7 --- lib/tomato_toot/feed.rb | 1 - lib/tomato_toot/feed_entry.rb | 6 +++--- test/package.rb | 7 ------- test/slack.rb | 15 --------------- 4 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 test/package.rb delete mode 100644 test/slack.rb diff --git a/lib/tomato_toot/feed.rb b/lib/tomato_toot/feed.rb index b9fd16e1..cd82eae8 100644 --- a/lib/tomato_toot/feed.rb +++ b/lib/tomato_toot/feed.rb @@ -1,6 +1,5 @@ require 'feedjira' require 'digest/sha1' -require 'json' require 'optparse' module TomatoToot diff --git a/lib/tomato_toot/feed_entry.rb b/lib/tomato_toot/feed_entry.rb index 8d2f9a68..517053eb 100644 --- a/lib/tomato_toot/feed_entry.rb +++ b/lib/tomato_toot/feed_entry.rb @@ -30,7 +30,7 @@ def post @logger.error(e) end touch - @logger.info({entry: {date: date, body: body}}) + @logger.info(entry: {date: date, body: body}) end def toot @@ -40,11 +40,11 @@ def toot rescue Ginseng::GatewayError => e @logger.error(e) end - return @feed.mastodon.toot({ + return @feed.mastodon.toot( status: body, visibility: @feed.visibility, media_ids: ids, - }) + ) end def touch diff --git a/test/package.rb b/test/package.rb deleted file mode 100644 index e7bc74d6..00000000 --- a/test/package.rb +++ /dev/null @@ -1,7 +0,0 @@ -module TomatoToot - class PackageTest < Test::Unit::TestCase - def test_name - assert_equal(Package.name, 'tomato-toot') - end - end -end diff --git a/test/slack.rb b/test/slack.rb deleted file mode 100644 index 90de4b72..00000000 --- a/test/slack.rb +++ /dev/null @@ -1,15 +0,0 @@ -module TomatoToot - class SlackTest < Test::Unit::TestCase - def test_all - Slack.all do |slack| - assert(slack.is_a?(Slack)) - end - end - - def test_say - Slack.all do |slack| - assert_equal(slack.say({text: Package.full_name}).code, 200) - end - end - end -end From dac3e397b294d6ba4b571b48e53d28ae4fcd032f Mon Sep 17 00:00:00 2001 From: Tatsuya Koishi Date: Wed, 28 Aug 2019 06:44:47 +0900 Subject: [PATCH 4/4] #170 --- config/application.yaml | 2 +- lib/tomato_toot/feed.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/application.yaml b/config/application.yaml index 3720fdc6..0cdb8782 100644 --- a/config/application.yaml +++ b/config/application.yaml @@ -1,5 +1,5 @@ package: - version: 2.3.10 + version: 2.3.11 url: https://github.com/pooza/tomato-toot authors: - Tatsuya Koishi diff --git a/lib/tomato_toot/feed.rb b/lib/tomato_toot/feed.rb index cd82eae8..38e42aaf 100644 --- a/lib/tomato_toot/feed.rb +++ b/lib/tomato_toot/feed.rb @@ -198,8 +198,9 @@ def self.crawl_all rescue => e e = Ginseng::Error.create(e) e.package = Package.full_name - Slack.broadcast(e) - logger.error(e) + message = e.to_h.merge(feed: feed.params) + Slack.broadcast(message) + logger.error(message) next end end