Class: Project
- Inherits:
-
Hash
- Object
- Hash
- Project
- Defined in:
- lib/project.rb
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
Constructor Details
#initialize(value = '') ⇒ Project
Returns a new instance of Project.
5 6 7 8 9 10 11 12 |
# File 'lib/project.rb', line 5 def initialize value='' @filename='' self[:url]='' self[:url] = value if value.is_a?(String) if(value.is_a?(Hash)) value.each{|k,v|self[k]=v} end end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
4 5 6 |
# File 'lib/project.rb', line 4 def filename @filename end |
Instance Method Details
#checkout ⇒ Object
40 41 42 43 44 45 |
# File 'lib/project.rb', line 40 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
33 34 35 36 37 38 |
# File 'lib/project.rb', line 33 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
18 19 20 |
# File 'lib/project.rb', line 18 def get_latest_unique_id '51ed9c9d45ba3979c808740d75ba1831c85aff5d' end |
#name ⇒ Object
14 15 16 |
# File 'lib/project.rb', line 14 def name self[:name] end |
#pull ⇒ Object
26 27 28 29 30 31 |
# File 'lib/project.rb', line 26 def pull if(File.exists?(wrk_dir) && File.exists?("#{wrk_dir}/.git")) puts "git pull (#{wrk_dir})" puts `git pull` end end |
#rake ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/project.rb', line 47 def rake if(!File.exists?(self.wrk_dir)) clone checkout end if(File.exists?(self.wrk_dir)) Dir.chdir(self.wrk_dir) do puts "rake (#{self.wrk_dir})" puts `rake` end end end |
#wrk_dir ⇒ Object
22 23 24 |
# File 'lib/project.rb', line 22 def wrk_dir "#{Environment.dev_root}/wrk/#{self.name}" end |