Class: CommitLeaderboardSync

Inherits:
Object
  • Object
show all
Defined in:
lib/renuo/cli/app/commit_leaderboard_sync.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_secretObject

Returns the value of attribute api_secret.



8
9
10
# File 'lib/renuo/cli/app/commit_leaderboard_sync.rb', line 8

def api_secret
  @api_secret
end

#leaderboard_api_urlObject

Returns the value of attribute leaderboard_api_url.



8
9
10
# File 'lib/renuo/cli/app/commit_leaderboard_sync.rb', line 8

def leaderboard_api_url
  @leaderboard_api_url
end

#queue_file_pathObject

Returns the value of attribute queue_file_path.



8
9
10
# File 'lib/renuo/cli/app/commit_leaderboard_sync.rb', line 8

def queue_file_path
  @queue_file_path
end

Instance Method Details

#run(args, options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/renuo/cli/app/commit_leaderboard_sync.rb', line 10

def run(args, options)
  process_args(args)
  print_configuration if options.verbose

  unless File.exist?(@queue_file_path)
    abort(">> Commit queue file does not exist.")
  end

  unless @leaderboard_api_url.match?(URI::DEFAULT_PARSER.make_regexp)
    abort(">> Invalid API URL.")
  end

  commits = JSON.parse(File.read(@queue_file_path))
  send_commits(commits)
end