Sha256: 5e9eaefe8e81821f567ef3c159e3fc6e457f8b9eae75d5f64880a6bb9721ee80
Contents?: true
Size: 1.89 KB
Versions: 3
Compression:
Stored size: 1.89 KB
Contents
require 'json' class Project < Hash attr_accessor :filename def self.get_url return `git config --get remote.origin.url` if(File.exists?('.git')) return Svn.url if(File.exists?('.svn')) '' end def self.get_fullname Rake.application.original_dir.gsub(Environment.dev_root,'').gsub('/trunk','') end def initialize value='' @filename='' self[:url]=Project.get_url self[:fullname]=Project.get_fullname if value.is_a?(String) self[:url] = value if value.is_a?(String) elsif(value.is_a?(Hash)) value.each{|k,v|self[k]=v} else self[:fullname]=Project.get_fullname end end def fullname self[:fullname] end def name parts=fullname.split('/') parts[parts.length-1] #self[:name] end #def get_latest_unique_id # '51ed9c9d45ba3979c808740d75ba1831c85aff5d' #end def wrk_dir "#{Environment.dev_root}/wrk/#{self.fullname}" end def pull if(File.exists?(wrk_dir) && File.exists?("#{wrk_dir}/.git")) Dir.chdir(wrk_dir) do puts "git pull (#{wrk_dir})" puts `git pull` end end end def clone if(!File.exists?(wrk_dir) && self[:url].include?('.git')) puts "cloning #{self[:url]} to #{self.wrk_dir}" puts `git clone #{self[:url]} #{self.wrk_dir}` end end def checkout if(!File.exists?(wrk_dir) && self[:url].include?('svn')) puts "checkout #{self.url} to #{self.wrk_dir}" puts `svn checkout #{self.url} #{self.wrk_dir}` end end def rake if(!File.exists?(self.wrk_dir)) clone checkout end if(File.exists?(self.wrk_dir)) Dir.chdir(self.wrk_dir) do rake = Command.new({ :input => 'rake', :timeout => 300, :ignore_failure => true }) rake.execute puts rake.summary end end end def info puts "Project #{name}" puts " fullname: #{self.fullname}" puts " url: #{self[:url]}" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dev-2.0.146 | lib/base/project.rb |
dev-2.0.145 | lib/base/project.rb |
dev-2.0.143 | lib/base/project.rb |