def gitcrypt(dir = Dir.pwd, options = {})
      path = normalized_path(dir)
      unless File.directory?(path)
        warning "The directory '#{path}' does not exist yet."
        warning 'Do you want to create (and git init) this directory?'
        really_continue?
        run %(mkdir -p #{path})
        FalkorLib::Git.init(path)
      end
      error "Not a git-ready directory" unless FalkorLib::Git.init?(path)
      rootdir = FalkorLib::Git.rootdir(path)
      config =  FalkorLib::Config::Bootstrap::DEFAULTS[:gitcrypt].clone
      info "about to initialize Git crypt for the repository '#{rootdir}'"
      really_continue?
      config[:owner] = (options[:owner]) ? options[:owner] :  ask("\tEmail or (better) GPG ID of the owner of the git-crypt (root) vault", config[:owner])
      [ :hooksdir ].each do |k|
        config[k] = (options[k]) ? options[k] : ask("\t#{k.capitalize}", config[k])
      end
      #puts config.to_yaml
      if File.exists?(File.join(rootdir, '.git/git-crypt/keys/default'))
        warning "git-crypt has already been initialised in '#{rootdir}'"
      else
        Dir.chdir( rootdir ) do
          run %( git crypt init )
          if config[:owner]
            info "setup owner of the git-crypt vault to '#{config[:owner]}'"
            run %( gpg --list-key  #{config[:owner]} | grep uid| head -n1)
            run %( git crypt add-gpg-user #{config[:owner]} )
          end
        end
      end
      # Bootstrap the directory
      gitattributes = File.join(rootdir, '.gitattributes')
      if File.exists?(gitattributes)
        puts "  ... '.gitattributes' file already exists"
      else
        templatedir = File.join( FalkorLib.templates, 'git-crypt')
        init_from_template(templatedir, rootdir, {},
                           :no_interaction => true,
                           :no_commit => false)
        FalkorLib::Git.add(gitattributes, 'Initialize .gitattributes for git-crypt')
      end

      git_hooksdir       = File.join(rootdir, '.git', 'hooks')
      precommit_hook     = File.join(git_hooksdir, 'pre-commit')
      src_git_hooksdir   = File.join(rootdir, config[:hooksdir])
      src_precommit_hook = File.join(src_git_hooksdir, config[:hook])
      if File.exists?(File.join(rootdir, config[:hook]))
        Dir.chdir( rootdir ) do
          run %(mkdir -p #{config[:hooksdir]} )
          unless File.exists?(src_precommit_hook)
            run %(mv #{config[:hook]} #{config[:hooksdir]}/ )
            run %(chmod +x #{config[:hooksdir]}/#{config[:hook]})
            FalkorLib::Git.add(src_precommit_hook, 'pre-commit hook for git-crypt')
          end
          run %(rm -f #{config[:hook]} ) if File.exists?(File.join(rootdir, config[:hook]))
        end
      end
      # Pre-commit hook
      unless File.exist?(precommit_hook)
        info "=> bootstrapping special Git pre-commit hook for git-crypt"
        relative_src_hooksdir = Pathname.new( File.realpath( src_git_hooksdir )).relative_path_from Pathname.new( git_hooksdir )
        Dir.chdir( git_hooksdir ) do
          run %(ln -s #{relative_src_hooksdir}/#{config[:hook]} pre-commit)
        end
      end
      gpgkeys = []
      gpgkeys = config[:ulhpc] if options[:ulhpc]
      gpgkeys = options[:keys] if options[:keys]
      unless gpgkeys.empty?
        warning "About to allow the following GPG IDs to unlock the git-crypt vault"
        puts gpgkeys.to_yaml
        really_continue?
      end
      gpgkeys.each do |k|
        Dir.chdir( rootdir ) do
          info "allow GPG ID '#{k}' to unlock the git-crypt vault"
          run %( gpg --list-key  #{k} | grep uid| head -n1)
          run %( git crypt add-gpg-user #{k} )
        end
      end




    end
def gitcrypt(dir = Dir.pwd, options = {})
      path = normalized_path(dir)
      unless File.directory?(path)
        warning "The directory '#{path}' does not exist yet."
        warning 'Do you want to create (and git init) this directory?'
        really_continue?
        run %(mkdir -p #{path})
        FalkorLib::Git.init(path)
      end
      error "Not a git-ready directory" unless FalkorLib::Git.init?(path)
      rootdir = FalkorLib::Git.rootdir(path)
      config =  FalkorLib::Config::Bootstrap::DEFAULTS[:gitcrypt].clone
      info "about to initialize Git crypt for the repository '#{rootdir}'"
      really_continue?
      config[:owner] = (options[:owner]) ? options[:owner] :  ask("\tEmail or (better) GPG ID of the owner of the git-crypt (root) vault", config[:owner])
      [ :hooksdir ].each do |k|
        config[k] = (options[k]) ? options[k] : ask("\t#{k.capitalize}", config[k])
      end
      #puts config.to_yaml
      if File.exists?(File.join(rootdir, '.git/git-crypt/keys/default'))
        warning "git-crypt has already been initialised in '#{rootdir}'"
      else
        Dir.chdir( rootdir ) do
          run %( git crypt init )
          if config[:owner]
            info "setup owner of the git-crypt vault to '#{config[:owner]}'"
            run %( gpg --list-key  #{config[:owner]} | grep uid| head -n1)
            run %( git crypt add-gpg-user #{config[:owner]} )
          end
        end
      end
      # Bootstrap the directory
      gitattributes = File.join(rootdir, '.gitattributes')
      if File.exists?(gitattributes)
        puts "  ... '.gitattributes' file already exists"
      else
        templatedir = File.join( FalkorLib.templates, 'git-crypt')
        init_from_template(templatedir, rootdir, {},
                           :no_interaction => true,
                           :no_commit => false)
        FalkorLib::Git.add(gitattributes, 'Initialize .gitattributes for git-crypt')
      end

      git_hooksdir       = File.join(rootdir, '.git', 'hooks')
      precommit_hook     = File.join(git_hooksdir, 'pre-commit')
      src_git_hooksdir   = File.join(rootdir, config[:hooksdir])
      src_precommit_hook = File.join(src_git_hooksdir, config[:hook])
      if File.exists?(File.join(rootdir, config[:hook]))
        Dir.chdir( rootdir ) do
          run %(mkdir -p #{config[:hooksdir]} )
          unless File.exists?(src_precommit_hook)
            run %(mv #{config[:hook]} #{config[:hooksdir]}/ )
            run %(chmod +x #{config[:hooksdir]}/#{config[:hook]})
            FalkorLib::Git.add(src_precommit_hook, 'pre-commit hook for git-crypt')
          end
          run %(rm -f #{config[:hook]} ) if File.exists?(File.join(rootdir, config[:hook]))
        end
      end
      # Pre-commit hook
      unless File.exist?(precommit_hook)
        info "=> bootstrapping special Git pre-commit hook for git-crypt"
        relative_src_hooksdir = Pathname.new( File.realpath( src_git_hooksdir )).relative_path_from Pathname.new( git_hooksdir )
        Dir.chdir( git_hooksdir ) do
          run %(ln -s #{relative_src_hooksdir}/#{config[:hook]} pre-commit)
        end
      end
      gpgkeys = []
      gpgkeys = config[:ulhpc] if options[:ulhpc]
      gpgkeys = options[:keys] if options[:keys]
      unless gpgkeys.empty?
        warning "About to allow the following GPG IDs to unlock the git-crypt vault"
        puts gpgkeys.to_yaml
        really_continue?
      end
      gpgkeys.each do |k|
        Dir.chdir( rootdir ) do
          info "allow GPG ID '#{k}' to unlock the git-crypt vault"
          run %( gpg --list-key  #{k} | grep uid| head -n1)
          run %( git crypt add-gpg-user #{k} )
        end
      end




    end
repo
 gitcrypt 
 Initialize git-crypt in the current directory
 Supported options:
  * :force       [boolean] force overwritting
  * :owner       [string]  owner (GPG ID or email)
  * :keys        [array]   List of GPG IDs allowed to unlock the repository
  * :ulhpc       [boolean] setup the repository for the ULHPC team