class ConvertToBootstrap3::Converter
Attributes
converter_url[RW]
Public Class Methods
new()
click to toggle source
# File lib/convert_to_bootstrap3.rb, line 18 def initialize @converter_url = 'http://code.divshot.com/bootstrap3_upgrader/' end
Public Instance Methods
convert_in_place(directory = "")
click to toggle source
# File lib/convert_to_bootstrap3.rb, line 22 def convert_in_place(directory = "") directory << '**/*.html*' visit @converter_url all_files = Dir.glob(directory).reject { |file| File.directory? file } all_files.each { |file| convert_file_contents(file) } end
Private Instance Methods
convert_file_contents(file)
click to toggle source
# File lib/convert_to_bootstrap3.rb, line 34 def convert_file_contents(file) file_contents = File.read(file) fill_in 'source', with: file_contents click_button 'Convert This Code' all(:xpath, "//textarea[@id='result']").each do |a| result = fix_embedded_language_tags a.value File.open(file, 'w+') { |f| f.write(result) } end end