Class: Vapey::Uploader

Inherits:
Object
  • Object
show all
Defined in:
lib/vapey/uploader.rb

Defined Under Namespace

Classes: Partay

Class Method Summary collapse

Class Method Details

.invoke(directory = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/vapey/uploader.rb', line 14

def invoke(directory = nil)
  # TODO: add command line args / OptionParser
  directory ||= ENV.fetch("DOCS_DIRECTORY") { "/Users/david/development/docs/examples" }
  sections = Vapey::MarkdownParser.process(directory)
  sections.each do |section|
    puts "uploading: #{section[:file]} section: #{section[:section_title]}"
    Uploader::Partay.post('/upsert', { headers: {"Content-Type": "application/json"}, body: section.to_json })
  end
end