Sha256: 00034049c04609f19d9f7e9a6d7bd2453158e0b4055b48510f44f4c750f942db

Contents?: true

Size: 885 Bytes

Versions: 3

Compression:

Stored size: 885 Bytes

Contents

# https://stackoverflow.com/questions/8781263/access-rake-task-description-from-within-task
# enable get task description
# you aslo can see it in Rake source code: lib/rake/application.rb#select_tasks_to_show
Rake::TaskManager.record_task_metadata = true

# load rake files from lib
rake_files_pattern = File.dirname(__FILE__) + "/tasks/*.rake"
# => gems/git-hook-0.1.1/lib/githook/tasks/*.rake
Dir.glob(rake_files_pattern).each { |r| load r }

# we must be very careful to load outside ruby code
# because they are out of our control
# only load outside "*.rake" when there are ".git" and ".githook" folder, and target task isn't "install"
if Dir.exist?(".git") && Dir.exist?(".githook") && ARGV[0] != "install"
  Dir.glob(".githook/tasks/**/*.rake").each do |rake|
    begin
      load rake
    rescue => e
      puts "Error: #{e.message} in #{rake}"
      exit 1
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
git-hook-0.1.8 lib/githook/tasks.rb
git-hook-0.1.7 lib/githook/tasks.rb
git-hook-0.1.6 lib/githook/tasks.rb