tweet_sanitizer 0.2.0 → 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
- SHA1:
3
- metadata.gz: f81ed3decd1defa109db3cb5dcd3ff146b9d2377
4
- data.tar.gz: f788cc11a47f4ccbc626846f3977ca6170ea99f0
2
+ SHA256:
3
+ metadata.gz: 94cfea42a30a369a8c748983c64e14ddd60091ed44a2bc00b4e4692683b9ecca
4
+ data.tar.gz: 17c8ad189cc23b0b3f779ffab3f39ddf9e8ab106c1cd4881128df28251142a89
5
5
  SHA512:
6
- metadata.gz: d76f6708fdb977de53aa3f00155d4292203ffaa730a9828ec5af244b5539b4fef23e39e195f945f911383fbe10d0a0825662179be6d71b51dae129e3d6aa4551
7
- data.tar.gz: 365728cef1fe75877b00cff14e0a0ebbd0d088fecb1a0b51a3fa5654989ee5ce49867d3454b2c05f5a612754a63f8c2f3c972d85d5dac9e7356f20b9d4322aa1
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 }}
@@ -0,0 +1,91 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ types:
9
+ - opened
10
+ - synchronize
11
+ - reopened
12
+ schedule:
13
+ - cron: "0 10 * * 5" # JST 19:00 (Fri)
14
+
15
+ jobs:
16
+ test:
17
+ # runs-on: ubuntu-latest
18
+ runs-on: ${{ (matrix.runner != '' && matrix.runner) || 'ubuntu-latest' }}
19
+
20
+ strategy:
21
+ fail-fast: false
22
+
23
+ matrix:
24
+ ruby:
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
+ include:
38
+ # ref. https://github.com/ruby/setup-ruby/issues/496#issuecomment-1520662740
39
+ - ruby: "2.2"
40
+ runner: ubuntu-20.04
41
+
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+
45
+ - uses: ruby/setup-ruby@v1
46
+ with:
47
+ ruby-version: ${{ matrix.ruby }}
48
+ bundler-cache: true
49
+
50
+ - run: bundle update --jobs $(nproc) --retry 3
51
+
52
+ - name: Setup Code Climate Test Reporter
53
+ uses: aktions/codeclimate-test-reporter@v1
54
+ with:
55
+ codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
56
+ command: before-build
57
+ continue-on-error: true
58
+
59
+ - run: bundle exec rspec
60
+
61
+ - name: Teardown Code Climate Test Reporter
62
+ uses: aktions/codeclimate-test-reporter@v1
63
+ with:
64
+ codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
65
+ command: after-build
66
+ if: always()
67
+ continue-on-error: true
68
+
69
+ - name: Slack Notification (not success)
70
+ uses: act10ns/slack@v2
71
+ if: "! success()"
72
+ continue-on-error: true
73
+ with:
74
+ status: ${{ job.status }}
75
+ webhook-url: ${{ secrets.SLACK_WEBHOOK }}
76
+ matrix: ${{ toJson(matrix) }}
77
+
78
+ notify:
79
+ needs:
80
+ - test
81
+
82
+ runs-on: ubuntu-latest
83
+
84
+ steps:
85
+ - name: Slack Notification (success)
86
+ uses: act10ns/slack@v2
87
+ if: always()
88
+ continue-on-error: true
89
+ with:
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,17 @@
1
1
  ## Unreleased
2
- [full changelog](https://github.com/sue445/tweet_sanitizer/compare/v0.2.0...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
9
+
10
+ ## v0.2.1
11
+ [full changelog](https://github.com/sue445/tweet_sanitizer/compare/v0.2.0...v0.2.1)
12
+
13
+ * Enable MFA requirement for gem releasing
14
+ * https://github.com/sue445/tweet_sanitizer/pull/32
3
15
 
4
16
  ## v0.2.0
5
17
  [full changelog](https://github.com/sue445/tweet_sanitizer/compare/v0.1.1...v0.2.0)
data/Gemfile CHANGED
@@ -4,3 +4,15 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in tweet_sanitizer.gemspec
6
6
  gemspec
7
+
8
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.5.0")
9
+ group :test do
10
+ # NOTE: unparser v0.3.0+ requires Ruby 2.5+
11
+ gem "unparser", "< 0.3.0"
12
+ end
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,9 +1,8 @@
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://travis-ci.org/sue445/tweet_sanitizer.svg?branch=master)](https://travis-ci.org/sue445/tweet_sanitizer)
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
- [![Dependency Status](https://gemnasium.com/badges/github.com/sue445/tweet_sanitizer.svg)](https://gemnasium.com/github.com/sue445/tweet_sanitizer)
7
6
 
8
7
  This is extension of [twitter](https://github.com/sferik/twitter). Sanitize `Twitter::Tweet#text`
9
8
 
@@ -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.0"
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
 
@@ -14,6 +14,12 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/sue445/tweet_sanitizer"
15
15
  spec.license = "MIT"
16
16
 
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
20
+ spec.metadata["documentation_uri"] = "https://sue445.github.io/tweet_sanitizer/"
21
+ spec.metadata["rubygems_mfa_required"] = "true"
22
+
17
23
  spec.required_ruby_version = ">= 2.1.0"
18
24
 
19
25
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -25,13 +31,15 @@ Gem::Specification.new do |spec|
25
31
 
26
32
  spec.add_dependency "twitter"
27
33
 
28
- spec.add_development_dependency "bundler", "~> 1.15"
29
- spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
30
- spec.add_development_dependency "coveralls"
34
+ spec.add_development_dependency "bundler", ">= 1.15"
35
+ spec.add_development_dependency "coveralls_reborn"
31
36
  spec.add_development_dependency "dotenv"
32
37
  spec.add_development_dependency "pry-byebug"
33
- spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "rake", ">= 10.0"
34
39
  spec.add_development_dependency "rspec", "~> 3.0"
35
40
  spec.add_development_dependency "rspec-parameterized"
36
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
43
+ spec.add_development_dependency "unparser", ">= 0.4.5"
44
+ spec.add_development_dependency "yard"
37
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.0
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: 2017-09-03 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
@@ -28,32 +27,18 @@ dependencies:
28
27
  name: bundler
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - "~>"
30
+ - - ">="
32
31
  - !ruby/object:Gem::Version
33
32
  version: '1.15'
34
33
  type: :development
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
- - - "~>"
37
+ - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '1.15'
41
40
  - !ruby/object:Gem::Dependency
42
- name: codeclimate-test-reporter
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 1.0.0
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 1.0.0
55
- - !ruby/object:Gem::Dependency
56
- name: coveralls
41
+ name: coveralls_reborn
57
42
  requirement: !ruby/object:Gem::Requirement
58
43
  requirements:
59
44
  - - ">="
@@ -98,14 +83,14 @@ dependencies:
98
83
  name: rake
99
84
  requirement: !ruby/object:Gem::Requirement
100
85
  requirements:
101
- - - "~>"
86
+ - - ">="
102
87
  - !ruby/object:Gem::Version
103
88
  version: '10.0'
104
89
  type: :development
105
90
  prerelease: false
106
91
  version_requirements: !ruby/object:Gem::Requirement
107
92
  requirements:
108
- - - "~>"
93
+ - - ">="
109
94
  - !ruby/object:Gem::Version
110
95
  version: '10.0'
111
96
  - !ruby/object:Gem::Dependency
@@ -150,6 +135,48 @@ dependencies:
150
135
  - - ">="
151
136
  - !ruby/object:Gem::Version
152
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
152
+ - !ruby/object:Gem::Dependency
153
+ name: unparser
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: 0.4.5
159
+ type: :development
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
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"
191
+ - ".github/workflows/test.yml"
162
192
  - ".gitignore"
163
193
  - ".rspec"
164
- - ".travis.yml"
194
+ - ".yardopts"
165
195
  - CHANGELOG.md
166
196
  - Gemfile
167
197
  - LICENSE.txt
@@ -176,8 +206,12 @@ files:
176
206
  homepage: https://github.com/sue445/tweet_sanitizer
177
207
  licenses:
178
208
  - MIT
179
- metadata: {}
180
- post_install_message:
209
+ metadata:
210
+ homepage_uri: https://github.com/sue445/tweet_sanitizer
211
+ source_code_uri: https://github.com/sue445/tweet_sanitizer
212
+ changelog_uri: https://github.com/sue445/tweet_sanitizer/blob/master/CHANGELOG.md
213
+ documentation_uri: https://sue445.github.io/tweet_sanitizer/
214
+ rubygems_mfa_required: 'true'
181
215
  rdoc_options: []
182
216
  require_paths:
183
217
  - lib
@@ -192,9 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
226
  - !ruby/object:Gem::Version
193
227
  version: '0'
194
228
  requirements: []
195
- rubyforge_project:
196
- rubygems_version: 2.6.11
197
- signing_key:
229
+ rubygems_version: 3.6.2
198
230
  specification_version: 4
199
231
  summary: sanitize tweet
200
232
  test_files: []
data/.travis.yml DELETED
@@ -1,27 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.1
5
- - 2.2
6
- - 2.3
7
- - 2.4.1
8
- - ruby-head
9
- bundler_args: "--jobs=2"
10
- cache: bundler
11
- before_install: gem install bundler -v 1.15.3
12
- before_script:
13
- - export CODECLIMATE_REPO_TOKEN=b275edefb84b9adf2e55846adb2c2649072895873f85eacafff3cb9a31aec846
14
- - export CI=true
15
- script:
16
- - bundle exec rspec
17
- - bundle exec codeclimate-test-reporter
18
- branches:
19
- only:
20
- - master
21
- notifications:
22
- email: false
23
- slack:
24
- secure: Sv+kslA+VVRafEOYfWVM7f+9Tryw+OKFdyqLOodduDexNoLedeqCqYSASJsw33vxgSGhRnWgcCHLzpLdK211bn6H6q3JgKKJQdO9Zxci7iftqn2lXiltL8EdIIHreW7qKYUJhWeM0CCpdLD7R8IGvPv7HbWko2g3JRYqmAmPMBZBU99uX0Sa0pWirEGAY7asqbz4yU2ugCEIRiD5/Ao9y8AltTn4r7m3puIKgm/3WhjJJtasWZFohFf3d/QEybefYoTcEOmRK3WI1yeRC2t0fK55yOLRgndUggSz1DSIad+f+PeyaTG24ErmkaxfGg086OIT8fB/39UNqrxC9xIMWGKLF0g2Xb09JrnvZbl9QVhdTqre/jbaflsQLanSd/nGA3f1uXk/QESL7zYz1qxgXkcREmrQxrZ0yC11L7Xz6nqigkAt/V5/zRM2LOuYBEO+d4hPHAO7IJMyLfppPd8P07QAW9jSmYoDIRqmZfKz/hQ2aUlubc5D64VcLECgbtMUbj6mOEVl4H8ygAJvBOkrx4gJGEU5YxMDDRJt3yAb8VD7Ek2fw5ovLFqkNTp+a8TjksGTA2s2vpNE1dnDhJb6OrCgQNC8hkFkkVhV1V5a0bNuJE+lybErzWzaT/y8YSCCcY8FCytOZOs63zfIWqCDLjJq9/juThUx3hKndYXtc70=
25
- matrix:
26
- allow_failures:
27
- - rvm: ruby-head