Class: GitFlower::GitRepository
- Inherits:
-
Object
- Object
- GitFlower::GitRepository
- Defined in:
- lib/git_flower/git_repository.rb
Instance Method Summary collapse
-
#initialize(path_to_repo) ⇒ GitRepository
constructor
A new instance of GitRepository.
- #validate_for_feature! ⇒ Object
- #validate_for_hotfix! ⇒ Object
Constructor Details
#initialize(path_to_repo) ⇒ GitRepository
Returns a new instance of GitRepository.
8 9 10 |
# File 'lib/git_flower/git_repository.rb', line 8 def initialize(path_to_repo) @repo = find_git_repo(path_to_repo) end |
Instance Method Details
#validate_for_feature! ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/git_flower/git_repository.rb', line 29 def validate_for_feature! puts "Checking for commited files" if has_added_files? raise GitError, "Please commit or stash all added files." end puts "Checking if develop is up to date" if !develop_up_to_date? raise GitError, "Please pull --rebase develop" end end |
#validate_for_hotfix! ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/git_flower/git_repository.rb', line 12 def validate_for_hotfix! puts "Checking for commited files" if has_added_files? raise GitError, "Please commit or stash all added files." end puts "Checking if master and develop are up to date" if !master_up_to_date? || !develop_up_to_date? raise GitError, "Please pull --rebase master and develop" end puts "Checking for existing hotfix branch" if has_existing_branch_name?("hotfix") raise GitFlowError, "You already have an existing hotfix branch" end end |