Class: MxxRu::Externals::Git
Instance Attribute Summary collapse
#name, #paths, #url
Instance Method Summary
collapse
#option
#map, #map_dir, #map_file
Constructor Details
#initialize(name) {|_self| ... } ⇒ Git
Returns a new instance of Git.
511
512
513
514
515
516
517
518
519
520
521
|
# File 'lib/mxx_ru/externals.rb', line 511
def initialize(name)
defaults(name)
@unlimited_depth = false
@recursive = false
yield self if block_given?
raise "#{name}: tag and commit cannot be specified together" if @tag and @commit
Registry::handle_external(@name, self)
end
|
Instance Attribute Details
#commit(v) ⇒ Object
Also known as:
commit=
Returns the value of attribute commit.
535
536
537
|
# File 'lib/mxx_ru/externals.rb', line 535
def commit
@commit
end
|
#tag(v) ⇒ Object
Also known as:
tag=
Returns the value of attribute tag.
523
524
525
|
# File 'lib/mxx_ru/externals.rb', line 523
def tag
@tag
end
|
Instance Method Details
#define_rules(old_or_new) ⇒ Object
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
|
# File 'lib/mxx_ru/externals.rb', line 548
def define_rules(old_or_new)
define(old_or_new) do |tmp_dir|
if @commit.nil?
sh_args = ['git', 'clone']
sh_args << '--branch' << @tag.to_s if @tag
sh_args << '--depth' << '1' unless @unlimited_depth
sh_args << '--recursive' if @recursive
push_options_to(sh_args)
sh_args << @url << tmp_dir
sh *sh_args
else
sh *(push_options_to(['git', 'clone']).push(@url).push(tmp_dir))
cd tmp_dir do
sh 'git', 'checkout', @commit
end
end
end
end
|
#make_hash ⇒ Object
539
540
541
542
543
544
545
546
|
# File 'lib/mxx_ru/externals.rb', line 539
def make_hash
options_to_map.merge!( basics_to_map ).merge!(
{ :recursive => @recursive,
:unlimited_depth => @unlimited_depth,
:tag => @tag,
:commit => @commit
} )
end
|
#recursive ⇒ Object
531
532
533
|
# File 'lib/mxx_ru/externals.rb', line 531
def recursive
@recursive = true
end
|
#unlimited_depth ⇒ Object
527
528
529
|
# File 'lib/mxx_ru/externals.rb', line 527
def unlimited_depth
@unlimited_depth = true
end
|