Skip to content

Instantly share code, notes, and snippets.

@burennto
Created November 19, 2013 08:06
Show Gist options
  • Select an option

  • Save burennto/7541933 to your computer and use it in GitHub Desktop.

Select an option

Save burennto/7541933 to your computer and use it in GitHub Desktop.
# encoding: utf-8
require 'awesome_print'
require 'git'
require 'grit'
require 'fileutils'
WORK_DIR = '/tmp/git_add'
FileUtils.rm_rf(WORK_DIR)
FileUtils.mkdir_p(WORK_DIR)
`cd #{WORK_DIR} && git init .`
`cd #{WORK_DIR} && touch README`
`cd #{WORK_DIR} && touch リードミー`
`cd #{WORK_DIR} && git add .`
`cd #{WORK_DIR} && git commit -m "Add files"`
Dir.chdir(WORK_DIR) do
FileUtils.touch 'abcde.html'
FileUtils.touch 'あいうえお.html'
FileUtils.mkdir_p('templates/.config')
FileUtils.touch 'templates/.config/pushto'
FileUtils.mkdir_p('.dot-dir')
FileUtils.touch '.dot-dir/file.txt'
FileUtils.touch '.dot-file'
end
ap Grit::Repo.new(WORK_DIR).status.untracked.keys
ap Git.open(WORK_DIR).status.untracked.keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment