Class: Crackin::Scm::Git
Direct Known Subclasses
Instance Attribute Summary collapse
-
#git ⇒ Object
readonly
Returns the value of attribute git.
Instance Method Summary collapse
- #add(options = {}) ⇒ Object
- #between(from, to) ⇒ Object
- #change_branch(to) ⇒ Object
- #commit(message) ⇒ Object
- #create_branch(name) ⇒ Object
- #current_branch ⇒ Object
- #delete_branch(name) ⇒ Object
-
#initialize(config = {}) ⇒ Git
constructor
A new instance of Git.
- #log ⇒ Object
- #merge_from(from) ⇒ Object
- #pending ⇒ Object
- #pending? ⇒ Boolean
- #push ⇒ Object
- #push_tags(remote = @git.remote, branch = current_branch) ⇒ Object
- #reset ⇒ Object
- #tags ⇒ Object
- #uncommit ⇒ Object
Methods inherited from Base
Constructor Details
Instance Attribute Details
#git ⇒ Object (readonly)
Returns the value of attribute git.
7 8 9 |
# File 'lib/crackin/scm/git.rb', line 7 def git @git end |
Instance Method Details
#add(options = {}) ⇒ Object
14 15 16 |
# File 'lib/crackin/scm/git.rb', line 14 def add(={}) @git.add() end |
#between(from, to) ⇒ Object
22 23 24 |
# File 'lib/crackin/scm/git.rb', line 22 def between(from, to) @git.log.between(from, to) end |
#change_branch(to) ⇒ Object
55 56 57 |
# File 'lib/crackin/scm/git.rb', line 55 def change_branch(to) @git.checkout(to) end |
#commit(message) ⇒ Object
30 31 32 |
# File 'lib/crackin/scm/git.rb', line 30 def commit() @git.commit_all() end |
#create_branch(name) ⇒ Object
59 60 61 62 63 |
# File 'lib/crackin/scm/git.rb', line 59 def create_branch(name) branch = @git.branch(Shellwords.escape(name)) branch.create branch.checkout end |
#current_branch ⇒ Object
51 52 53 |
# File 'lib/crackin/scm/git.rb', line 51 def current_branch @git.branch_current end |
#delete_branch(name) ⇒ Object
65 66 67 68 |
# File 'lib/crackin/scm/git.rb', line 65 def delete_branch(name) @git.checkout @git.branch(Shellwords.escape(name)).delete end |
#log ⇒ Object
18 19 20 |
# File 'lib/crackin/scm/git.rb', line 18 def log @git.log end |
#merge_from(from) ⇒ Object
47 48 49 |
# File 'lib/crackin/scm/git.rb', line 47 def merge_from(from) @git.branch(from).merge end |
#pending ⇒ Object
78 79 80 81 82 83 84 85 86 |
# File 'lib/crackin/scm/git.rb', line 78 def pending s = @git.status d = {} d.merge! s.changed d.merge! s.added d.merge! s.deleted d.merge! s.untracked d end |
#pending? ⇒ Boolean
88 89 90 |
# File 'lib/crackin/scm/git.rb', line 88 def pending? pending.count > 0 end |
#push ⇒ Object
70 71 72 |
# File 'lib/crackin/scm/git.rb', line 70 def push @git.push end |
#push_tags(remote = @git.remote, branch = current_branch) ⇒ Object
74 75 76 |
# File 'lib/crackin/scm/git.rb', line 74 def (remote=@git.remote, branch=current_branch) @git.push(remote, branch, true) end |
#reset ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/crackin/scm/git.rb', line 38 def reset @git.checkout_file('--', '.') @git.clean(d: true, force: true) #pending.keys.each do |p| # puts "pending: #{p}" # @git.checkout_file('--', p) #end end |
#uncommit ⇒ Object
34 35 36 |
# File 'lib/crackin/scm/git.rb', line 34 def uncommit @git.reset_hard('HEAD^') end |