Class: Pull
- Inherits:
-
Array
- Object
- Array
- Pull
- Defined in:
- lib/pull.rb
Instance Method Summary collapse
- #add(command) ⇒ Object
-
#initialize ⇒ Pull
constructor
A new instance of Pull.
- #update ⇒ Object
Constructor Details
#initialize ⇒ Pull
Returns a new instance of Pull.
6 7 8 |
# File 'lib/pull.rb', line 6 def initialize update end |
Instance Method Details
#add(command) ⇒ Object
26 27 28 |
# File 'lib/pull.rb', line 26 def add command self << command if(!include?(command)) end |
#update ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pull.rb', line 10 def update if(Environment.scm=='git') if(Timer.get_elapsed("last_pull").nil? || Timer.get_elapsed("last_pull") > 60*60*2) self.add "<%`git pull 2>&1`%>" self.add "<%Timer.set_timestamp('last_pull')%>" end # last_pull_time=nil # last_pull_time = Time.parse(File.read('log/last_pull').strip) if(File.exist?('log/last_pull')) # if(last_pull_time.nil? || (last_pull_time-Time.now) > 60*60*2) # self.add "<%`git pull 2>&1`%>" # self.add "<%Dir.mkdir('log') if(!File.exists?('log'))%>" # self.add "<%File.open('log/last_pull','w'){|f|f.puts(Time.now.to_s)}%>" # end end end |