Improves plugin/theme version detection by looking at the "Version: "- Fixes #732
This commit is contained in:
@@ -13,7 +13,7 @@ class WpItem
|
|||||||
# This check is needed because readme_url can return nil
|
# This check is needed because readme_url can return nil
|
||||||
if has_readme?
|
if has_readme?
|
||||||
response = Browser.get(readme_url)
|
response = Browser.get(readme_url)
|
||||||
@version = response.body[%r{stable tag: #{WpVersion.version_pattern}}i, 1]
|
@version = response.body[%r{(?:stable tag|version): #{WpVersion.version_pattern}}i, 1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@version
|
@version
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
=== WP Photo Album Plus ===
|
||||||
|
Contributors: opajaap
|
||||||
|
Tags: photo, album, photoalbum, gallery, slideshow, sidebar widget, photowidget, photoblog, widget, qtranslate, cubepoints, multisite, network, lightbox, comment, watermark, iptc, exif, responsive, mobile
|
||||||
|
Stable tag: trunk
|
||||||
|
Version: 5.1.15
|
||||||
|
Author: J.N. Breetvelt
|
||||||
|
Author URI: http://www.opajaap.nl/
|
||||||
|
Requires at least: 3.1
|
||||||
|
Tested up to: 3.7.1
|
||||||
@@ -27,9 +27,18 @@ shared_examples 'WpItem::Versionable' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'when the version is valid' do
|
context 'when the version is valid' do
|
||||||
it 'returns it' do
|
context 'when leaked from the stable tag' do
|
||||||
@file = '/simple-login-lockdown-0.4.txt'
|
it 'returns it' do
|
||||||
@expected = '0.4'
|
@file = '/simple-login-lockdown-0.4.txt'
|
||||||
|
@expected = '0.4'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when leaked from the version' do
|
||||||
|
it 'returns it' do
|
||||||
|
@file = '/wp-photo-plus-5.1.15.txt'
|
||||||
|
@expected = '5.1.15'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user