Class: Osrcry::Stale

Inherits:
Object
  • Object
show all
Defined in:
lib/osrcry/stale.rb

Class Method Summary collapse

Class Method Details

.executeObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/osrcry/stale.rb', line 3

def self.execute
  url = "https://github.com/#{Osrcry.user}/#{Osrcry.repo}/search?type=Issues&q=state:open+updated:<"
  updated = case ARGV[1]
  when 'days'
    Time.now.utc - 86400 # 60 * 60 * 24
  when 'weeks'
    Time.now.utc - 604800 # 60 * 60 * 24 * 7
  when 'months'
    Time.now.utc - 2592000 # 60 * 60 * 24 * 30
  when 'years'
    Time.now.utc - 31536000 # 60 * 60 * 24 * 365
  else
    puts "Please specify: `days`, `months` or `years`"
  end
  if updated
    url << updated.strftime("%Y-%m-%d")
    puts url
    `open "#{url}"`
  end
end