Class: Git::Er::Done::App
- Inherits:
-
Thor
- Object
- Thor
- Git::Er::Done::App
- Includes:
- Actions, Thor::Actions
- Defined in:
- lib/git_er_done/app.rb
Constant Summary collapse
- FEATURES_PATH =
"features/"
Instance Method Summary collapse
- #done(name = nil) ⇒ Object
- #feature(name) ⇒ Object
- #info ⇒ Object
- #squash ⇒ Object
- #sync ⇒ Object
- #version ⇒ Object
Methods included from Actions
Instance Method Details
#done(name = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/git_er_done/app.rb', line 23 def done(name=nil) unless name name = current_feature end puts "Completing a feature called #{feature_branch(name)}" git :add=>"." git :commit squash # Should we also sync with master first? git :checkout => 'master' git :merge => feature_branch(name) git :branch => "-d #{feature_branch(name)}" end |
#feature(name) ⇒ Object
16 17 18 19 |
# File 'lib/git_er_done/app.rb', line 16 def feature(name) puts "Creating a new feature called #{feature_branch(name)}." git :checkout => "-b #{feature_branch(name)}" end |
#info ⇒ Object
49 50 51 52 |
# File 'lib/git_er_done/app.rb', line 49 def info commits = commits_in_feature_branch puts "There are #{commits.size} new commits for #{current_branch_name}" end |
#squash ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/git_er_done/app.rb', line 38 def squash new_commits = commits_in_feature_branch.size if new_commits < 2 puts "Only '#{new_commits}' new commits in this branch, so no squashing necessary." return end # Squash all changes since we branched away from master git :rebase => "-i master" end |
#sync ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/git_er_done/app.rb', line 55 def sync return_to_branch = current_branch_name git :checkout => :master git :pull git :checkout => return_to_branch git :rebase => :master end |