Sha256: 3188cd812d8ed933fe0f2fa5527a2b1e9aa5afa93cee990b7252f4fcb61731ba

Contents?: true

Size: 700 Bytes

Versions: 12

Compression:

Stored size: 700 Bytes

Contents

# encoding: utf-8

# === Helpers === #
def submodules(&block)
  File.foreach(File.join(File.dirname(__FILE__), "..", ".gitmodules")) do |line|
    if line.match(%r{submodule "(.+)"})
      block.call($1)
    end
  end
end

# === Tasks === #
namespace :submodules do
  desc "Init submodules"
  task :init do
    sh "git submodule init"
  end

  desc "Update submodules"
  task :update do
    submodules do |path|
      if File.directory?(path) && File.directory?(File.join(path, ".git"))
        Dir.chdir(path) do
          puts "=> #{path}"
          sh "git reset --hard"
          sh "git fetch"
          sh "git reset origin/master --hard"
          puts
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
simple-templater-0.0.1.4 tasks/submodules.rake
media-path-0.1.2 tasks/submodules.rake
media-path-0.2.pre tasks/submodules.rake
simple-templater-0.0.1.3 tasks/submodules.rake
pupu-0.0.2.pre tasks/submodules.rake
media-path-0.1.1.pre tasks/submodules.rake
rubyexts-0.3.pre tasks/submodules.rake
simple-templater-0.2.pre tasks/submodules.rake
simple-templater-0.0.1.2 tasks/submodules.rake
rubyexts-0.1.pre tasks/submodules.rake
simple-templater-0.1.pre tasks/submodules.rake
pupu-0.1.pre tasks/submodules.rake