Module: WinterRakeUtils
- Extended by:
- FileUtils
- Defined in:
- lib/winter_rakeutils.rb
Class Method Summary collapse
- .ensure_dir(d) ⇒ Object
- .load_common_tasks ⇒ Object
- .load_gem_tasks ⇒ Object
- .load_git_tasks ⇒ Object
- .within_dir(dir, &block) ⇒ Object
Class Method Details
.ensure_dir(d) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/winter_rakeutils.rb', line 25 def ensure_dir d unless File.exists? d mkdir_p d unless File.exists? d sleep 0.01 ensure_dir d end end end |
.load_common_tasks ⇒ Object
20 21 22 23 |
# File 'lib/winter_rakeutils.rb', line 20 def load_common_tasks spec = Gem::Specification.find_by_name 'winter_rakeutils' load "#{spec.gem_dir}/lib/winter_commontasks.rake" end |
.load_gem_tasks ⇒ Object
10 11 12 13 |
# File 'lib/winter_rakeutils.rb', line 10 def load_gem_tasks spec = Gem::Specification.find_by_name 'winter_rakeutils' load "#{spec.gem_dir}/lib/winter_gemtasks.rake" end |
.load_git_tasks ⇒ Object
15 16 17 18 |
# File 'lib/winter_rakeutils.rb', line 15 def load_git_tasks spec = Gem::Specification.find_by_name 'winter_rakeutils' load "#{spec.gem_dir}/lib/winter_gittasks.rake" end |
.within_dir(dir, &block) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/winter_rakeutils.rb', line 35 def within_dir dir, &block pwd = Dir.pwd Dir.chdir dir begin block.call ensure Dir.chdir pwd end end |