command-line program with --export flag to dump microsoft exchange release build numbers
This commit is contained in:
parent
f9cff52fb2
commit
b11dea84ef
2 changed files with 42 additions and 0 deletions
|
@ -27,6 +27,7 @@ class MicrosoftExchangeReleaseInfo
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def parse_html(html)
|
||||
Nokogiri::HTML(html)
|
||||
end
|
||||
|
|
41
tools/microsoft/bin/get_microsoft_exchange_release_builds.rb
Executable file
41
tools/microsoft/bin/get_microsoft_exchange_release_builds.rb
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require '../app_build_number_cpe_mapper/exchange.rb'
|
||||
require 'optparse'
|
||||
require 'json'
|
||||
|
||||
def pretty_json(data_hash)
|
||||
json = JSON.parse(data_hash.to_json)
|
||||
JSON.pretty_generate(json)
|
||||
end
|
||||
|
||||
def export_to_json(data, filename)
|
||||
File.write(filename, data)
|
||||
end
|
||||
|
||||
def do_export(data_hash)
|
||||
filename = './data/microsoft_exchange_release_info.json'
|
||||
json = pretty_json(data_hash)
|
||||
export_to_json(json, filename)
|
||||
puts "----" * 12
|
||||
puts "Succesfully Exported to #{filename}:"
|
||||
puts "----" * 12
|
||||
puts json
|
||||
puts "----" * 12
|
||||
end
|
||||
|
||||
@options = {}
|
||||
|
||||
OptionParser.new do |opts|
|
||||
opts.on("-e", "--export", "Export Microsoft Exchange Server release data to json file in ./data") do |export|
|
||||
@options[:export] = export
|
||||
end
|
||||
end.parse!
|
||||
|
||||
scraper = MicrosoftExchangeReleaseInfo.new
|
||||
RestClient.log = 'stdout'
|
||||
|
||||
if @options[:export]
|
||||
data_hash = scraper.main
|
||||
do_export(data_hash)
|
||||
end
|
Loading…
Add table
Reference in a new issue