class Pushnote::Note

Attributes

body[RW]
df_report[R]
git_diff_report[R]
git_log_report[R]
git_status_report[R]
title[RW]
top_report[R]

Public Class Methods

new() click to toggle source
# File lib/pushnote/note.rb, line 12
def initialize
  set_server_host(configuration.server)
end

Public Instance Methods

collect_system_info() click to toggle source
# File lib/pushnote/note.rb, line 24
def collect_system_info
  [
    Thread.new { create_top_report },
    Thread.new { create_df_report },
    Thread.new { create_git_status_report },
    Thread.new { create_git_log_report },
    Thread.new { create_git_diff_report }
  ].each(&:join)
end
save() click to toggle source
# File lib/pushnote/note.rb, line 16
def save
  self.class.post('/', { body: serialize.to_json })
end
set_server_host(host) click to toggle source
# File lib/pushnote/note.rb, line 20
def set_server_host(host)
  self.class.base_uri(host)
end

Private Instance Methods

configuration() click to toggle source
# File lib/pushnote/note.rb, line 50
def configuration
  @configuration ||= Configuration.new
end
create_df_report() click to toggle source
# File lib/pushnote/note.rb, line 58
def create_df_report
  @df_report ||= `df -h`
end
create_git_diff_report() click to toggle source
# File lib/pushnote/note.rb, line 70
def create_git_diff_report
  @git_diff_report ||= `git diff`
end
create_git_log_report() click to toggle source
# File lib/pushnote/note.rb, line 66
def create_git_log_report
  @git_log_report ||= `git log origin/master --pretty=oneline --abbrev-commit --decorate`
end
create_git_status_report() click to toggle source
# File lib/pushnote/note.rb, line 62
def create_git_status_report
  @git_status_report ||= `git status`
end
create_top_report() click to toggle source
# File lib/pushnote/note.rb, line 54
def create_top_report
  @top_report ||= `top -l 1 -o +command -O pid`
end
serialize() click to toggle source
# File lib/pushnote/note.rb, line 36
def serialize
  {
    title: title,
    body: body,
    snapshot: {
      top: top_report,
      df: df_report,
      git_status: git_status_report,
      git_log: git_log_report,
      git_diff: git_diff_report
    }
  }
end