Sha256: 195bbf5a126b5a16d77f83e6bb2841385adef2bd583f862ece5831b18fd7ee56

Contents?: true

Size: 1.65 KB

Versions: 64

Compression:

Stored size: 1.65 KB

Contents

require_relative('./environment.rb')

class Upgrade < Array

  def initialize
    update
  end

  def update
    if(Environment.scm=='git' && Environment.branch=='develop')
	  Dir.glob('dep/**/*.dll').each {|f|
	    src=Environment.dev_root + "/" + f
		if(File.exist?(src) && File.mtime(src) > File.mtime(f))
		  self.add "<%FileUtils.cp('#{src}','#{f}')%>"
		end
	  }
      if(defined?(DEV_TASKS))
	    if(DEV_TASKS[:dependencies].has_key?(:rake))
		  DEV_TASKS[:dependencies][:rake].each{|rake_dir|
		    
			if(Dir.exists?(rake_dir))
			  #newest_file_here=Dir.glob("**/*").max_by {|f| File.mtime(f)}
			  newest_file_rake_dir=nil
			  Dir.chdir(rake_dir) do
			    newest_file_rake_dir=rake_dir + '/' + Dir.glob("**/*").max_by {|f| File.mtime(f)}
			  end

			  if(newest_file_rake_dir.nil? || DEV_TASKS[:newest_artifact].nil?)
			    self.add "<%Environment.rake('#{rake_dir}','default',false)%>"
			  else
			    self.add "<%Environment.rake('#{rake_dir}','default',false)%>" if(File.mtime(newest_file_rake_dir) > File.mtime(DEV_TASKS[:newest_artifact]))
			  end
			end
		  }
		end
        if(DEV_TASKS[:dependencies].has_key?(:source))
          DEV_TASKS[:dependencies][:source].each{|source_dep|

		    
	        dest = "./dep/#{File.basename(source_dep)}"

			if(!File.exists?(dest))
			  self.add "<%FileUtils.cp('#{source_dep}','#{dest}')%>"
			else
			  if(File.exists?(source_dep))
			    self.add "<%FileUtils.cp('#{source_dep}','#{dest}')%>" if(File.mtime(source_dep) > File.mtime(dest))
			  end
			end
		  }
	    end	  
	  end
	end
  end

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

Version data entries

64 entries across 64 versions & 1 rubygems

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