Class: Project
Overview
require ‘dev_commands’
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
Instance Method Summary collapse
- #checkout ⇒ Object
- #clone ⇒ Object
- #get_latest_unique_id ⇒ Object
-
#initialize(value = '') ⇒ Project
constructor
A new instance of Project.
- #name ⇒ Object
- #pull ⇒ Object
- #rake ⇒ Object
- #wrk_dir ⇒ Object
Methods inherited from Hash
Constructor Details
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
12 13 14 |
# File 'lib/dev_projects.rb', line 12 def filename @filename end |
Instance Method Details
#checkout ⇒ Object
50 51 52 53 54 55 |
# File 'lib/dev_projects.rb', line 50 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 |
#clone ⇒ Object
43 44 45 46 47 48 |
# File 'lib/dev_projects.rb', line 43 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 |
#get_latest_unique_id ⇒ Object
26 27 28 |
# File 'lib/dev_projects.rb', line 26 def get_latest_unique_id '51ed9c9d45ba3979c808740d75ba1831c85aff5d' end |
#name ⇒ Object
22 23 24 |
# File 'lib/dev_projects.rb', line 22 def name self[:name] end |
#pull ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/dev_projects.rb', line 34 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 |
#rake ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/dev_projects.rb', line 57 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 |
#wrk_dir ⇒ Object
30 31 32 |
# File 'lib/dev_projects.rb', line 30 def wrk_dir "#{Environment.dev_root}/wrk/#{self.name}" end |