forked from id774/automaticruby
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheject.rb
More file actions
43 lines (38 loc) · 1.12 KB
/
eject.rb
File metadata and controls
43 lines (38 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding: utf-8 -*-
# Name:: Automatic::Plugin::Publish::Eject
# Author:: soramugi <http://soramugi.net>
# 774 <http://id774.net>
# Created:: Jun 9, 2013
# Updated:: May 16, 2014
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
module Automatic::Plugin
class PublishEject
def initialize(config, pipeline=[])
@config = config
@pipeline = pipeline
end
def run
@pipeline.each {|feeds|
unless feeds.nil?
feeds.items.each {|feed|
unless feed.link.nil?
`#{eject_cmd}`
Automatic::Log.puts('info', "Eject: #{feed.link}")
interval = @config['interval'].to_i unless @config['interval'].nil? unless @config.nil?
sleep ||= @config['interval'].to_i
end
}
end
}
@pipeline
end
def eject_cmd
if `which eject` != '' # linux
'eject ; eject -t'
elsif `which drutil` != '' # mac
'drutil tray eject ; drutil tray close'
end
end
end
end