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 when 'weeks'
Time.now.utc - 604800 when 'months'
Time.now.utc - 2592000 when 'years'
Time.now.utc - 31536000 else
puts "Please specify: `days`, `months` or `years`"
end
if updated
url << updated.strftime("%Y-%m-%d")
puts url
`open "#{url}"`
end
end
|