lib/projects.rb in dev_projects-0.0.10 vs lib/projects.rb in dev_projects-0.0.11

- old
+ new

@@ -1,7 +1,8 @@ require 'dev_environment' require 'dev_git' +require 'dev_svn' require 'json' require 'rake' class Projects < Hash attr_accessor :filename @@ -34,23 +35,23 @@ "#{Environment.dev_root}/data/PROJECTS.json" end def self.current project=nil - if(File.exists?('.git')) - if(Rake.application.original_dir.include?('/wrk/') && - Git.remote_origin.length > 0) - project=Project.new(Git.remote_origin) - name=Rake.application.original_dir.gsub("#{Environment.dev_root}/wrk/",'') - project[:name] = name if(name.length>0 && !name.include?(Environment.dev_root)) - if(defined?(PROJECTS)) - PROJECTS[name]=project if(!PROJECTS.has_key?(name)) - project.each{|k,v|PROJECTS[name][k]=v} - PROJECTS.save - else - project[:name]=name - end - end - end + url=Git.remote_origin + url=Svn.url if url.length==0 + if(Rake.application.original_dir.include?('/wrk/') && + url.length > 0) + project=Project.new(url) + name=Rake.application.original_dir.gsub("#{Environment.dev_root}/wrk/",'') + project[:name] = name if(name.length>0 && !name.include?(Environment.dev_root)) + if(defined?(PROJECTS)) + PROJECTS[name]=project if(!PROJECTS.has_key?(name)) + project.each{|k,v|PROJECTS[name][k]=v} + PROJECTS.save + else + project[:name]=name + end + end project end end \ No newline at end of file