tweet_sanitizer 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c5714c30ff280753252d5c0a6bfe3365b329199edb2d670190d069e9ff7820b
4
- data.tar.gz: 0157a784bc6b12391389d14a34a27f41b61805cefbbc272b2e3d1a1066e0fbe3
3
+ metadata.gz: 94cfea42a30a369a8c748983c64e14ddd60091ed44a2bc00b4e4692683b9ecca
4
+ data.tar.gz: 17c8ad189cc23b0b3f779ffab3f39ddf9e8ab106c1cd4881128df28251142a89
5
5
  SHA512:
6
- metadata.gz: 18982482212aa7c854803a6770bb14b9d8990e9581fe7f3d27bc6896fd9645c6c408512d1b4e859d3c2c654095f7ce2ea7acb7e85686e542f49cdbdfb751f4d6
7
- data.tar.gz: 6f82ab38dfdc1bcd8046d2cd1f4c8b28f239d5e5d4dd7f6d4a4af8c943d06a5a41e02d0ec2ab4129347dd610bb5cd203a60f9b9ef1c72bf851c022ea8757df48
6
+ metadata.gz: '08eab640591ec2695394310a3b0bbae65cb28c1059eaec9adedba32bd8935405163b6965c1cba2b952157040de4ea5bd1ce48640fbf6e5cfca96cddfe695ea50'
7
+ data.tar.gz: f369fcd38037e8fc9fadbc49e2669255dfaa79c20234c6727c2506d46ef87b47e693f7fad52ba03b38e8714bb40ec65f609cd93a5f1e18c24b57f32d5052f6c7
@@ -0,0 +1,10 @@
1
+ # c.f. https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2
+ version: 2
3
+
4
+ updates:
5
+ - package-ecosystem: github-actions
6
+ directory: /
7
+ schedule:
8
+ interval: weekly
9
+ assignees:
10
+ - sue445
@@ -0,0 +1,59 @@
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy static content to Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches:
8
+ - master
9
+
10
+ # Allows you to run this workflow manually from the Actions tab
11
+ workflow_dispatch:
12
+
13
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14
+ permissions:
15
+ contents: read
16
+ pages: write
17
+ id-token: write
18
+
19
+ # Allow one concurrent deployment
20
+ concurrency:
21
+ group: "pages"
22
+ cancel-in-progress: true
23
+
24
+ jobs:
25
+ # Single deploy job since we're just deploying
26
+ deploy:
27
+ environment:
28
+ name: github-pages
29
+ url: ${{ steps.deployment.outputs.page_url }}
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v4
34
+
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ruby
38
+ bundler-cache: true
39
+
40
+ - run: bundle exec yard
41
+
42
+ - name: Setup Pages
43
+ uses: actions/configure-pages@v5
44
+ - name: Upload artifact
45
+ uses: actions/upload-pages-artifact@v3
46
+ with:
47
+ # Upload entire repository
48
+ path: './doc'
49
+ - name: Deploy to GitHub Pages
50
+ id: deployment
51
+ uses: actions/deploy-pages@main
52
+
53
+ - name: Slack Notification (not success)
54
+ uses: act10ns/slack@v2
55
+ if: "! success()"
56
+ continue-on-error: true
57
+ with:
58
+ status: ${{ job.status }}
59
+ webhook-url: ${{ secrets.SLACK_WEBHOOK }}
@@ -12,85 +12,68 @@ on:
12
12
  schedule:
13
13
  - cron: "0 10 * * 5" # JST 19:00 (Fri)
14
14
 
15
- env:
16
- CI: "true"
17
-
18
15
  jobs:
19
16
  test:
20
- runs-on: ubuntu-latest
21
-
22
- container: ${{ matrix.ruby }}
17
+ # runs-on: ubuntu-latest
18
+ runs-on: ${{ (matrix.runner != '' && matrix.runner) || 'ubuntu-latest' }}
23
19
 
24
20
  strategy:
25
21
  fail-fast: false
26
22
 
27
23
  matrix:
28
24
  ruby:
29
- - ruby:2.2
30
- - ruby:2.3
31
- - ruby:2.4
32
- - ruby:2.5
33
- - ruby:2.6
34
- - ruby:2.7
35
- - ruby:3.0
36
- - rubylang/ruby:master-nightly-bionic
25
+ - "2.2"
26
+ - "2.3"
27
+ - "2.4"
28
+ - "2.5"
29
+ - "2.6"
30
+ - "2.7"
31
+ - "3.0"
32
+ - "3.1"
33
+ - "3.2"
34
+ - "3.3"
35
+ - "3.4"
36
+
37
37
  include:
38
- - ruby: rubylang/ruby:master-nightly-bionic
39
- allow_failures: "true"
38
+ # ref. https://github.com/ruby/setup-ruby/issues/496#issuecomment-1520662740
39
+ - ruby: "2.2"
40
+ runner: ubuntu-20.04
40
41
 
41
42
  steps:
42
- - uses: actions/checkout@v2
43
-
43
+ - uses: actions/checkout@v4
44
44
 
45
- - name: Cache vendor/bundle
46
- uses: actions/cache@v1
47
- id: cache_gem
45
+ - uses: ruby/setup-ruby@v1
48
46
  with:
49
- path: vendor/bundle
50
- key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
51
- restore-keys: |
52
- v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
53
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
47
+ ruby-version: ${{ matrix.ruby }}
48
+ bundler-cache: true
54
49
 
55
- - name: bundle update
56
- run: |
57
- set -xe
58
- bundle config path vendor/bundle
59
- bundle update --jobs $(nproc) --retry 3
60
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
50
+ - run: bundle update --jobs $(nproc) --retry 3
61
51
 
62
52
  - name: Setup Code Climate Test Reporter
63
53
  uses: aktions/codeclimate-test-reporter@v1
64
54
  with:
65
55
  codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
66
56
  command: before-build
67
- if: matrix.ruby >= 'ruby:2.4'
68
57
  continue-on-error: true
69
58
 
70
- - name: Run test
71
- run: |
72
- set -xe
73
- bundle exec rspec
74
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
59
+ - run: bundle exec rspec
75
60
 
76
61
  - name: Teardown Code Climate Test Reporter
77
62
  uses: aktions/codeclimate-test-reporter@v1
78
63
  with:
79
64
  codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
80
65
  command: after-build
81
- if: matrix.ruby >= 'ruby:2.4' && always()
66
+ if: always()
82
67
  continue-on-error: true
83
68
 
84
69
  - name: Slack Notification (not success)
85
- uses: lazy-actions/slatify@master
70
+ uses: act10ns/slack@v2
86
71
  if: "! success()"
87
72
  continue-on-error: true
88
73
  with:
89
- job_name: ${{ format('*build* ({0})', matrix.ruby) }}
90
- type: ${{ job.status }}
91
- icon_emoji: ":octocat:"
92
- url: ${{ secrets.SLACK_WEBHOOK }}
93
- token: ${{ secrets.GITHUB_TOKEN }}
74
+ status: ${{ job.status }}
75
+ webhook-url: ${{ secrets.SLACK_WEBHOOK }}
76
+ matrix: ${{ toJson(matrix) }}
94
77
 
95
78
  notify:
96
79
  needs:
@@ -100,12 +83,9 @@ jobs:
100
83
 
101
84
  steps:
102
85
  - name: Slack Notification (success)
103
- uses: lazy-actions/slatify@master
86
+ uses: act10ns/slack@v2
104
87
  if: always()
105
88
  continue-on-error: true
106
89
  with:
107
- job_name: '*build*'
108
- type: ${{ job.status }}
109
- icon_emoji: ":octocat:"
110
- url: ${{ secrets.SLACK_WEBHOOK }}
111
- token: ${{ secrets.GITHUB_TOKEN }}
90
+ status: ${{ job.status }}
91
+ webhook-url: ${{ secrets.SLACK_WEBHOOK }}
data/.yardopts ADDED
@@ -0,0 +1,2 @@
1
+ --markup markdown
2
+ --no-private
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Unreleased
2
- [full changelog](https://github.com/sue445/tweet_sanitizer/compare/v0.2.1...master)
2
+ [full changelog](https://github.com/sue445/tweet_sanitizer/compare/v0.2.2...master)
3
+
4
+ ## v0.2.2
5
+ [full changelog](https://github.com/sue445/tweet_sanitizer/compare/v0.2.1...v0.2.2)
6
+
7
+ * Fix TypeError no implicit conversion of nil into String (TypeError)
8
+ * https://github.com/sue445/tweet_sanitizer/pull/56
3
9
 
4
10
  ## v0.2.1
5
11
  [full changelog](https://github.com/sue445/tweet_sanitizer/compare/v0.2.0...v0.2.1)
data/Gemfile CHANGED
@@ -11,3 +11,8 @@ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.5.0")
11
11
  gem "unparser", "< 0.3.0"
12
12
  end
13
13
  end
14
+
15
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.7.0")
16
+ # term-ansicolor 1.9.0+ doesn't work on Ruby < 2.7
17
+ gem "term-ansicolor", "< 1.9.0"
18
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TweetSanitizer
2
2
  [![Gem Version](https://badge.fury.io/rb/tweet_sanitizer.svg)](https://badge.fury.io/rb/tweet_sanitizer)
3
- [![Build Status](https://github.com/sue445/tweet_sanitizer/workflows/test/badge.svg?branch=master)](https://github.com/sue445/tweet_sanitizer/actions?query=workflow%3Atest)
3
+ [![test](https://github.com/sue445/tweet_sanitizer/actions/workflows/test.yml/badge.svg)](https://github.com/sue445/tweet_sanitizer/actions/workflows/test.yml)
4
4
  [![Code Climate](https://codeclimate.com/github/sue445/tweet_sanitizer.png)](https://codeclimate.com/github/sue445/tweet_sanitizer)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/sue445/tweet_sanitizer/badge.svg?branch=master)](https://coveralls.io/github/sue445/tweet_sanitizer?branch=master)
6
6
 
@@ -1,12 +1,17 @@
1
1
  module TweetSanitizer
2
2
  module TwitterExtension
3
+ # Sanitize tweet
4
+ #
5
+ # @!method sanitized_text(use_retweeted_tweet: true, expand_url: true, remove_media_url: true, unescape: true)
6
+ #
7
+ # @param use_retweeted_tweet [Boolean] Whether use original retweeted tweet if exists
8
+ # @param expand_url [Boolean] Whether expand url in tweet (e.g. `t.co` url -> original url)
9
+ # @param remove_media_url [Boolean] Whether remove media url in tweet
10
+ # @param unescape [Boolean] Whether unescape in tweet (e.g. `(&gt; &lt;)` -> `(> <)`)
11
+ #
12
+ # @return [String]
13
+
3
14
  refine(Twitter::Tweet) do
4
- # Sanitize tweet
5
- # @param use_retweeted_tweet [Boolean] Whether use original retweeted tweet if exists
6
- # @param expand_url [Boolean] Whether expand url in tweet (e.g. `t.co` url -> original url)
7
- # @param remove_media_url [Boolean] Whether remove media url in tweet
8
- # @param unescape [Boolean] Whether unescape in tweet (e.g. `(&gt; &lt;)` -> `(> <)`)
9
- # @return [String]
10
15
  def sanitized_text(use_retweeted_tweet: true, expand_url: true, remove_media_url: true, unescape: true)
11
16
  TweetSanitizer.sanitize(
12
17
  self,
@@ -1,3 +1,3 @@
1
1
  module TweetSanitizer
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -32,7 +32,7 @@ module TweetSanitizer
32
32
  tweet.uris.reverse.each_with_object(text.dup) do |uri, expanded|
33
33
  pos1 = uri.indices[0]
34
34
  pos2 = uri.indices[1]
35
- expanded[pos1, pos2-pos1] = uri.expanded_url
35
+ expanded[pos1, pos2-pos1] = uri.expanded_url if uri.expanded_url
36
36
  end
37
37
  end
38
38
 
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
19
19
  spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
20
+ spec.metadata["documentation_uri"] = "https://sue445.github.io/tweet_sanitizer/"
20
21
  spec.metadata["rubygems_mfa_required"] = "true"
21
22
 
22
23
  spec.required_ruby_version = ">= 2.1.0"
@@ -31,12 +32,14 @@ Gem::Specification.new do |spec|
31
32
  spec.add_dependency "twitter"
32
33
 
33
34
  spec.add_development_dependency "bundler", ">= 1.15"
34
- spec.add_development_dependency "coveralls"
35
+ spec.add_development_dependency "coveralls_reborn"
35
36
  spec.add_development_dependency "dotenv"
36
37
  spec.add_development_dependency "pry-byebug"
37
38
  spec.add_development_dependency "rake", ">= 10.0"
38
39
  spec.add_development_dependency "rspec", "~> 3.0"
39
40
  spec.add_development_dependency "rspec-parameterized"
40
41
  spec.add_development_dependency "simplecov"
42
+ spec.add_development_dependency "term-ansicolor", "!= 1.11.1" # ref. https://github.com/flori/term-ansicolor/issues/41
41
43
  spec.add_development_dependency "unparser", ">= 0.4.5"
44
+ spec.add_development_dependency "yard"
42
45
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tweet_sanitizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2021-11-20 00:00:00.000000000 Z
10
+ date: 2025-03-31 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: twitter
@@ -39,7 +38,7 @@ dependencies:
39
38
  - !ruby/object:Gem::Version
40
39
  version: '1.15'
41
40
  - !ruby/object:Gem::Dependency
42
- name: coveralls
41
+ name: coveralls_reborn
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - ">="
@@ -136,6 +135,20 @@ dependencies:
136
135
  - - ">="
137
136
  - !ruby/object:Gem::Version
138
137
  version: '0'
138
+ - !ruby/object:Gem::Dependency
139
+ name: term-ansicolor
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "!="
143
+ - !ruby/object:Gem::Version
144
+ version: 1.11.1
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "!="
150
+ - !ruby/object:Gem::Version
151
+ version: 1.11.1
139
152
  - !ruby/object:Gem::Dependency
140
153
  name: unparser
141
154
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +163,20 @@ dependencies:
150
163
  - - ">="
151
164
  - !ruby/object:Gem::Version
152
165
  version: 0.4.5
166
+ - !ruby/object:Gem::Dependency
167
+ name: yard
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ type: :development
174
+ prerelease: false
175
+ version_requirements: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
153
180
  description: sanitize tweet
154
181
  email:
155
182
  - sue445@sue445.net
@@ -159,9 +186,12 @@ extra_rdoc_files: []
159
186
  files:
160
187
  - ".coveralls.yml"
161
188
  - ".env.example"
189
+ - ".github/dependabot.yml"
190
+ - ".github/workflows/pages.yml"
162
191
  - ".github/workflows/test.yml"
163
192
  - ".gitignore"
164
193
  - ".rspec"
194
+ - ".yardopts"
165
195
  - CHANGELOG.md
166
196
  - Gemfile
167
197
  - LICENSE.txt
@@ -180,8 +210,8 @@ metadata:
180
210
  homepage_uri: https://github.com/sue445/tweet_sanitizer
181
211
  source_code_uri: https://github.com/sue445/tweet_sanitizer
182
212
  changelog_uri: https://github.com/sue445/tweet_sanitizer/blob/master/CHANGELOG.md
213
+ documentation_uri: https://sue445.github.io/tweet_sanitizer/
183
214
  rubygems_mfa_required: 'true'
184
- post_install_message:
185
215
  rdoc_options: []
186
216
  require_paths:
187
217
  - lib
@@ -196,8 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
226
  - !ruby/object:Gem::Version
197
227
  version: '0'
198
228
  requirements: []
199
- rubygems_version: 3.2.22
200
- signing_key:
229
+ rubygems_version: 3.6.2
201
230
  specification_version: 4
202
231
  summary: sanitize tweet
203
232
  test_files: []