Class: Raykit::SourceImport
- Inherits:
-
Hash
- Object
- Hash
- Raykit::SourceImport
- Defined in:
- lib/raykit/sourceImport.rb
Instance Method Summary collapse
-
#initialize(url) ⇒ SourceImport
constructor
attr_accessor :remote attr_accessor :glob attr_accessor :target attr_accessor :commit.
- #remote ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(url) ⇒ SourceImport
attr_accessor :remote attr_accessor :glob attr_accessor :target attr_accessor :commit
9 10 11 12 13 14 |
# File 'lib/raykit/sourceImport.rb', line 9 def initialize(url) self['remote'] = url self['glob'] = '**/*.cs' self['target'] = 'src' self['commit']='' end |
Instance Method Details
#remote ⇒ Object
16 17 18 |
# File 'lib/raykit/sourceImport.rb', line 16 def remote self['remote'] end |
#update ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/raykit/sourceImport.rb', line 20 def update work=self['remote'].work_dir work_parent=File.dirname(work) FileUtils.mkdir_p(work_parent) if(!Dir.exist?(work_parent)) if(Dir.exist?(work)) Dir.chdir(work) do PROJECT.run("git pull") end else PROJECT.run("git clone #{remote} #{work}") end Dir.chdir(work) do text=`git log -n 1` scan=text.scan(/commit ([\w]+)\s/) self['commit'] = scan[0][0].to_s end end |