class GitPunch::Plugin
Public Class Methods
source_root()
click to toggle source
# File lib/git_punch/plugin.rb, line 6 def self.source_root GitPunch.template_path end
Public Instance Methods
init()
click to toggle source
# File lib/git_punch/plugin.rb, line 11 def init install_configuration! say %{ We strongly urge you to `gem install guard-live-set && guard init live-set` so you can automatically keep your Live set changes in Git. } if project.live? && !project.has_guard_installed? end
Private Instance Methods
configured_user_name()
click to toggle source
# File lib/git_punch/plugin.rb, line 46 def configured_user_name @user_name_from_gitconfig ||= `git config punch.username`.strip end
install_configuration!()
click to toggle source
# File lib/git_punch/plugin.rb, line 29 def install_configuration! run "git config punch.username '#{note_punch_username}'" copy_file 'post-commit.sh', '.git/hooks/post-commit' template 'gitattributes.erb', '.gitattributes' template 'gitignore.erb', '.gitignore' system 'cp .git/config .git/config.backup' # silently back up gitconfig insert_into_file '.git/config', git_media_config, before: '[punch]' end
note_punch_username()
click to toggle source
# File lib/git_punch/plugin.rb, line 38 def note_punch_username @user_name ||= if configured_user_name.empty? ask 'What is your NotePunch username?' else configured_user_name end end
project()
click to toggle source
# File lib/git_punch/plugin.rb, line 25 def project @project ||= Project.detect! end
repo()
click to toggle source
# File lib/git_punch/plugin.rb, line 21 def repo @current_repository ||= Repository.current! end