Sha256: 202d2d89154d1d1eb7d255c0c6c54e8a8d883c300df20cf23c56d3c861f17e89

Contents?: true

Size: 870 Bytes

Versions: 55

Compression:

Stored size: 870 Bytes

Contents

require_relative('./environment.rb')
require 'time'

class Pull < Array

  def initialize
    update
  end

  def update
    if(Environment.scm=='git')
	  if(Timer.elapsed_exceeds?("last_pull",60*60*2))
	  #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

  def add command
    self << command if(!include?(command))
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
dev_tasks-0.0.155 lib/pull.rb
dev_tasks-0.0.154 lib/pull.rb
dev_tasks-0.0.153 lib/pull.rb
dev_tasks-0.0.152 lib/pull.rb
dev_tasks-0.0.151 lib/pull.rb
dev_tasks-0.0.150 lib/pull.rb
dev_tasks-0.0.149 lib/pull.rb
dev_tasks-0.0.148 lib/pull.rb
dev_tasks-0.0.147 lib/pull.rb
dev_tasks-0.0.146 lib/pull.rb
dev_tasks-0.0.145 lib/pull.rb
dev_tasks-0.0.144 lib/pull.rb
dev_tasks-0.0.143 lib/pull.rb
dev_tasks-0.0.142 lib/pull.rb
dev_tasks-0.0.141 lib/pull.rb
dev_tasks-0.0.140 lib/pull.rb
dev_tasks-0.0.139 lib/pull.rb
dev_tasks-0.0.138 lib/pull.rb
dev_tasks-0.0.137 lib/pull.rb
dev_tasks-0.0.136 lib/pull.rb