Added option to generate a full plugin list

This commit is contained in:
Christian Mehlmauer
2012-09-10 22:59:03 +02:00
parent 91cfa5a060
commit f273290887
3 changed files with 33 additions and 4 deletions

View File

@@ -36,7 +36,7 @@ class Generate_Plugin_List
# Send a HTTP request to the WordPress most popular plugins webpage
# parse the response for the plugin names.
def parse_plugins
def parse_popular_plugins
found_plugins = []
page_count = 1
@@ -69,6 +69,16 @@ class Generate_Plugin_List
found_plugins.uniq
end
def parse_full_plugins
found_plugins = []
queue_count = 0
index = @browser.get('http://plugins.svn.wordpress.org/').body
index.scan(%r{<li><a href=".*">(.*)/</a></li>}i).each do |plugin|
found_plugins << plugin[0]
end
found_plugins.uniq
end
# Use the WordPress plugin SVN repo to find a
# valid plugin file. This will cut down on
@@ -113,9 +123,13 @@ class Generate_Plugin_List
# Save the file
def save_file
def save_file(full=false)
begin
plugins = parse_plugins
if (full)
plugins = parse_full_plugins
else
plugins = parse_popular_plugins
end
puts "[*] We have parsed " + plugins.size.to_s
plugins_with_paths = parse_plugin_files(plugins)
File.open(DATA_DIR + '/plugins.txt', 'w') { |f| f.write(plugins_with_paths) }