Class: CfHarvestRepoMetrics::CLI

Inherits:
Object
  • Object
show all
Includes:
CodeFumesHarvester
Defined in:
lib/cf_harvest_repo_metrics/cli.rb

Overview

Class by the harvest_metric script for command line parsing and delegation to the Harvester class.

Constant Summary

Constants included from CodeFumesHarvester

CodeFumesHarvester::LIB_ROOT, CodeFumesHarvester::VERSION

Class Method Summary collapse

Class Method Details

.execute(stdout, arguments = []) ⇒ Object

Parses command-line options passed into harvest_repo_metrics and sends data collected to CodeFumes website.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cf_harvest_repo_metrics/cli.rb', line 11

def self.execute(stdout, arguments=[])
  parse_command_line_options!(stdout, arguments)
  harvester = Harvester.new(@options)

  if (results = harvester.publish_data!) == false
    stdout.puts "Error saving project...please try again or file a bug report."
    exit(1)
  else
    if results.empty?
      stdout.puts "Local repository is in sync with server. No updates posted."
    else
      puts "Successfully saved #{results[:successful_count]} of #{results[:total_count]} payloads."
      stdout.puts "Project saved to CodeFumes.com. Visit #{harvester.short_uri}"
    end
    puts "Exiting."
    puts
  end
end