Class: Toothpick::Git
- Inherits:
-
Object
- Object
- Toothpick::Git
- Defined in:
- lib/toothpick/git.rb
Instance Attribute Summary collapse
-
#git_dir ⇒ Object
readonly
Returns the value of attribute git_dir.
Class Method Summary collapse
Instance Method Summary collapse
- #commit ⇒ Object
-
#initialize(git_dir) ⇒ Git
constructor
A new instance of Git.
- #make_commit_message ⇒ Object
- #push ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(git_dir) ⇒ Git
Returns a new instance of Git.
14 15 16 |
# File 'lib/toothpick/git.rb', line 14 def initialize(git_dir) @git_dir = git_dir end |
Instance Attribute Details
#git_dir ⇒ Object (readonly)
Returns the value of attribute git_dir.
4 5 6 |
# File 'lib/toothpick/git.rb', line 4 def git_dir @git_dir end |
Class Method Details
.clone_repo(repo, target_dir) ⇒ Object
6 7 8 |
# File 'lib/toothpick/git.rb', line 6 def self.clone_repo(repo, target_dir) system("git clone #{repo} #{target_dir}") end |
.on_git?(dir) ⇒ Boolean
10 11 12 |
# File 'lib/toothpick/git.rb', line 10 def self.on_git?(dir) return system("cd #{dir} && git rev-parse --git-dir") end |
Instance Method Details
#commit ⇒ Object
22 23 24 25 26 |
# File 'lib/toothpick/git.rb', line 22 def commit system("cd #{git_dir} "\ "&& git add --all "\ "&& git commit -m '#{}'") end |
#make_commit_message ⇒ Object
28 29 30 |
# File 'lib/toothpick/git.rb', line 28 def "Added pick by #{ENV['USER']} on #{Time.now}" end |
#push ⇒ Object
32 33 34 |
# File 'lib/toothpick/git.rb', line 32 def push system("cd #{git_dir} && git push origin master") end |
#update ⇒ Object
18 19 20 |
# File 'lib/toothpick/git.rb', line 18 def update system("cd #{git_dir} && git pull --rebase") end |