directlink 0.0.4.6 → 0.0.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9748ad02d022f55a9216502b17717d7512d14fc
4
- data.tar.gz: a2a781a731602a6f4264f9b5dccd50a4f87357fe
3
+ metadata.gz: 3d38a321383a964dd0c6fcbf4fdf2671dffa0209
4
+ data.tar.gz: e97f410e07324784063d3799e3396f1c263832de
5
5
  SHA512:
6
- metadata.gz: 9a91c7e5aba9fa163bd12099bcbf0d19851fee292ca00f9d4c18c0e904164927bcc6774a4dc9e098a4073efd0169ba20eef8f8bcaa17d1b2156201c0bc1fb3f9
7
- data.tar.gz: afd0b1810dc8a15ebb2ec24ad55efd41e86cef0550162256671a4e796465d60307cd2b2441175a9b202c925e921955cc99dc1e562b001337a925c13c0d6b8176
6
+ metadata.gz: 53353764e4a5f7443069890a38cc0dfad7453e3d05a96ffc49cebe39328090b04920e54a95446a954370a6e11ef1df9d8373b41dce52ff5ab1d9a8f7f949c5c6
7
+ data.tar.gz: 663560a5baec205f4c4d199c187b67d4caf213c75413049bed834783f25507fd96bbff0a775cde3b2365b2bd2361ba1f70334ebed8e3f7c6bc820e59dd822585
data/bin/directlink CHANGED
@@ -1,4 +1,5 @@
1
- #!/usr/bin/env ruby -W0
1
+ #!/usr/bin/env ruby
2
+ $VERBOSE = nil
2
3
 
3
4
  # "-W0" is against Fastimage's "warning: already initialized constant URI::DEFAULT_PARSER" on Ruby 2.0 and 2.1
4
5
  # that ruins binstub tests
data/directlink.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "directlink"
3
- spec.version = "0.0.4.6"
3
+ spec.version = "0.0.4.7"
4
4
  spec.summary = "converts any kind of image hyperlink to direct link, type of image and its resolution"
5
5
 
6
6
  spec.author = "Victor Maslov aka Nakilon"
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.add_dependency "fastimage", "~>2.1.3"
13
13
  spec.add_dependency "nokogiri"
14
- spec.add_dependency "reddit_bot", "~>1.6.9"
14
+ spec.add_dependency "reddit_bot", "~>1.6.13"
15
15
  spec.add_dependency "kramdown"
16
16
  spec.add_dependency "addressable"
17
17
  spec.add_development_dependency "minitest"
data/lib/directlink.rb CHANGED
@@ -68,7 +68,8 @@ module DirectLink
68
68
  when /\Ahttps:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z0-9_-]{11}\/W[a-zA-Z0-9_-]{9}I\/AAAAAAA[ABC][a-zA-Z0-9]{3}\/[a-zA-Z0-9_-]{33}CJoC\/s0\/[^\/]+\z/,
69
69
  /\Ahttps:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z0-9]{11}\/W[a-zA-Z0-9]{9}I\/AAAAAAAA[a-zA-Z_]{3}\/[a-zA-Z0-9]{32}gCJoC\/s0\/[^\/]+\z/,
70
70
  /\Ahttps:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z0-9]{11}\/[a-zA-Z0-9]{10}I\/AAAAAAA[a-zA-Z0-9]{4}\/[a-zA-Z0-9_-]{32}wCJoC\/s0\/[^\/]+\z/,
71
- /\Ahttps:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z0-9]{11}\/[a-zA-Z0-9]{10}I\/AAAAAAA[A-Z]{4}\/[a-zA-Z0-9-]{32}gCJoC\/s0\/[^\/]+\z/
71
+ /\Ahttps:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z0-9]{11}\/[a-zA-Z0-9]{10}I\/AAAAAAA[A-Z]{4}\/[a-zA-Z0-9-]{32}gCJoC\/s0\/[^\/]+\z/,
72
+ /\Ahttps:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z0-9-]{11}\/[a-zA-Z0-9-]{10}I\/AAAAAAA[a-zA-Z]{4}\/[a-zA-Z0-9_-]{32}ACJoC\/s0\/[^\/]+\z/
72
73
  src
73
74
  # Google Plus userpic
74
75
  when /\A(https:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z0-9-]{11}\/AAAAAAAAAAI\/AAAAAAAA[a-zA-Z0-9]{3}\/[a-zA-Z0-9_-]{11}\/)s\d\d-p(?:-k)?-rw-no(\/photo\.jpg)\z/
@@ -230,7 +231,7 @@ module DirectLink
230
231
  if data["media"]["reddit_video"]
231
232
  return [true, data["media"]["reddit_video"]["fallback_url"]]
232
233
  else
233
- raise ErrorAssert.new "our knowledge about Reddit API seems to be outdated" unless data["media"].keys.sort == %w{ oembed type } && data["media"]["type"] == "youtube.com"
234
+ raise ErrorAssert.new "our knowledge about Reddit API seems to be outdated" unless data["media"].keys.sort == %w{ oembed type } && %w{ youtube.com gfycat.com }.include?(data["media"]["type"])
234
235
  return [true, data["media"]["oembed"]["thumbnail_url"]]
235
236
  end if data["media"]
236
237
  return reddit data["url"] if data["crosspost_parent"] # TODO: test that it does it
data/test.rb CHANGED
@@ -145,6 +145,7 @@ describe DirectLink do
145
145
  https://lh3.googleusercontent.com/-GP3BA3zGR5A/W0IwuVXlfmI/AAAAAAADROs/SH8rRlBDYTsHZiHpM45S3zpEipu5hJ2PwCJoC/s0/%25D1%2582%25D0%25B0%25D0%25B4%25D0%25B6%25D0%25B8%25D0%25BA%25D1%2581%25D0%25BA%25D0%25BE%25D0%25B5%2B%25D1%2580%25D0%25B0%25D0%25B7%25D0%25BD%25D0%25BE%25D1%2582%25D1%2580%25D0%25B0%25D0%25B2%25D1%258C%25D0%25B5.png
146
146
  https://lh3.googleusercontent.com/-DLODAbD9W7E/W27ob5XGCOI/AAAAAAADV8g/J_6RYR6UkKsc2RJOWRx6Q-NBVx5RbMoxwCJoC/s0/1236080.jpg
147
147
  https://lh3.googleusercontent.com/-cJajRreI87w/W4gW5uF4Q7I/AAAAAAADZKI/mw1YayYE-MY2-1OCCmjvgM3kbCK0lmIggCJoC/s0/2504855.jpg
148
+ https://lh3.googleusercontent.com/-rm-m1meCOMY/W92GhExMG-I/AAAAAAADsTw/bIAm5-1CIOYEpyPJLnxT8VmI_YNW2W5dACJoC/s0/2659806_800n.jpg
148
149
  }.each_with_index do |link, i|
149
150
  it "gpluscomm_105636351696833883213_86400 ##{i + 1}" do
150
151
  assert DirectLink.google link
@@ -647,7 +648,7 @@ describe DirectLink do
647
648
  ["DirectLink::ErrorBadLink: \"asd\"\n", "asd"],
648
649
  ].each_with_index do |(expectation, param), i|
649
650
  it "##{i + 1}" do
650
- string, status = Open3.capture2e "bin/directlink #{param}"
651
+ string, status = Open3.capture2e "RUBYOPT='-rbundler/setup' ./bin/directlink #{param}"
651
652
  if expectation.is_a? String
652
653
  assert_equal expectation, string
653
654
  else
@@ -676,7 +677,7 @@ describe DirectLink do
676
677
  # TODO: a test that it appends the `exception.cause`
677
678
  ].each_with_index do |(expected_exit_code, link, expected_output, unset), i| # TODO: unset is not used anymore or I have to go sleep?
678
679
  it "##{i + 1}" do
679
- string, status = Open3.capture2e "export #{File.read("api_tokens_for_travis.sh").gsub(/\n?export/, ?\s).strip}#{unset} && bundle exec ruby bin/directlink #{link}"
680
+ string, status = Open3.capture2e "export #{File.read("api_tokens_for_travis.sh").gsub(/\n?export/, ?\s).strip}#{unset} && RUBYOPT='-rbundler/setup' ./bin/directlink #{link}"
680
681
  assert_equal [expected_exit_code, "#{expected_output}\n"], [status.exitstatus, string], "for #{link}"
681
682
  end
682
683
  end
@@ -719,13 +720,13 @@ describe DirectLink do
719
720
  '.gsub(/^ {8}/, ""), "json"],
720
721
  ].each do |expected_output, param|
721
722
  it "#{param || "default"} output format" do
722
- string, status = Open3.capture2e "export #{File.read("api_tokens_for_travis.sh").gsub(/\n?export/, ?\s).strip} && bundle exec ruby bin/directlink#{" --#{param}" if param} #{valid_imgur_image_url1} #{valid_imgur_image_url2}"
723
+ string, status = Open3.capture2e "export #{File.read("api_tokens_for_travis.sh").gsub(/\n?export/, ?\s).strip} && RUBYOPT='-rbundler/setup' ./bin/directlink#{" --#{param}" if param} #{valid_imgur_image_url1} #{valid_imgur_image_url2}"
723
724
  assert_equal [0, expected_output], [status.exitstatus, string]
724
725
  end
725
726
  end
726
727
 
727
728
  it "reddit_bot gem logger does not flood STDOUT" do
728
- string, status = Open3.capture2e "bundle exec ruby bin/directlink http://redd.it/997he7"
729
+ string, status = Open3.capture2e "RUBYOPT='-rbundler/setup' ./bin/directlink http://redd.it/997he7"
729
730
  assert_equal "<= http://redd.it/997he7\n=> https://i.imgur.com/QpOBvRY.png\n image/png 460x460\n", string
730
731
  end
731
732
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: directlink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.6
4
+ version: 0.0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Maslov aka Nakilon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-06 00:00:00.000000000 Z
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastimage
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.6.9
47
+ version: 1.6.13
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.6.9
54
+ version: 1.6.13
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: kramdown
57
57
  requirement: !ruby/object:Gem::Requirement