Top Level Namespace

Defined Under Namespace

Modules: Hiptest Classes: FileConfigParser, LanguageConfigParser, Option, OptionsParser, String

Instance Method Summary collapse

Instance Method Details

#fetch_project_export(options) ⇒ Object



19
20
21
22
23
24
# File 'lib/hiptest-publisher/utils.rb', line 19

def fetch_project_export(options)
  url = "#{options.site}/publication/#{options.token}/#{options.leafless_export ? 'leafless_tests' : 'project'}?future=1#{make_filter(options)}"

  puts "URL: #{url}".white if options.verbose
  open(url, :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE)
end

#hiptest_publisher_pathObject



5
6
7
8
9
# File 'lib/hiptest-publisher/utils.rb', line 5

def hiptest_publisher_path
  Gem.loaded_specs['hiptest-publisher'].full_gem_path
rescue
  '.'
end

#make_filter(options) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/hiptest-publisher/utils.rb', line 11

def make_filter(options)
  ids = options.filter_ids.split(',').map {|id| "filter[]=id:#{id}"}
  tags = options.filter_tags.split(',').map {|tag| "filter[]=tag:#{tag}"}

  filter = (ids + tags).join("&")
  filter.empty? ? '' : "&#{filter}"
end

#show_status_message(message, status = nil) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/hiptest-publisher/utils.rb', line 34

def show_status_message(message, status=nil)
  status_icon = " "
  line_end = status.nil? ? "" : "\n"
  output = STDOUT

  if status == :success
    status_icon = "v".green
  elsif status == :failure
    status_icon = "x".red
    output = STDERR
  end

  output.print "[#{status_icon}] #{message}\r#{line_end}"
end

#trace_exception(exception) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/hiptest-publisher/utils.rb', line 26

def trace_exception(exception)
  line = "-" * 80
  puts line.yellow
  puts "#{exception.class.name}: #{exception.message}".red
  puts "#{exception.backtrace.map {|l| "  #{l}\n"}.join}".yellow
  puts line.yellow
end