Module: Dev::Executables::Commands::Hotfix
- Included in:
- Dev::Executable
- Defined in:
- lib/dev/executables/commands/hotfix.rb
Instance Method Summary collapse
-
#hotfix(command = nil, version = nil) ⇒ nil
Comandi per gestire l’apertura e la chiusura di un nuovo rilascio.
-
#hotfix_close(version) ⇒ nil
Chiude una hotfix esistente.
-
#hotfix_open(version) ⇒ nil
Apre una nuova hotfix.
Instance Method Details
#hotfix(command = nil, version = nil) ⇒ nil
Comandi per gestire l’apertura e la chiusura di un nuovo rilascio.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dev/executables/commands/hotfix.rb', line 13 def hotfix(command = nil, version = nil) raise Dev::Executable::ExecutionError.new "Wrong command syntax: "\ "specify whether to open or close a hotfix. "\ "Example: dev hotfix open 1.0.0" unless command.in? [ 'open', 'close' ] version = version.to_s.squish if @project.valid_app? case command when 'open' then hotfix_open(version) when 'close' then hotfix_close(version) end end end |
#hotfix_close(version) ⇒ nil
Chiude una hotfix esistente.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/dev/executables/commands/hotfix.rb', line 65 def hotfix_close(version) print "Preparing to close the hotfix for app " print @project.current_app.teal print " with version " puts version.teal puts status = `git status` if status.include? "Changes not staged for commit:" raise Dev::Executable::ExecutionError.new "Your current branch has unstaged changes. Please "\ "commit or stash them before closing the hotfix." end branches = `git branch -a` unless branches.include? ("hotfix/#{version}\n") raise Dev::Executable::ExecutionError.new "No hotfix for version '#{version}' could be found "\ "for this app's repository." end print "\tClosing.. " exec "git checkout master" exec "git merge --no-ff hotfix/#{version}" exec "git tag -a #{version} -m \"hotfix #{version}\"" git_output = exec "git push origin master" if git_output.include?('fatal') or git_output.include?('rejected') or git_output.include?('error') print "X\n".red puts "\t\tSomething went wrong, take a look at the output from git:".indianred puts "\t\t#{git_output.split("\n").map(&:squish).join("\n\t\t")}".indianred puts else print "√\n".green puts "\t\tDone. Output from git:".cadetblue puts "\t\t#{git_output.split("\n").map(&:squish).join("\n\t\t")}".cadetblue print "\tMerging hotfix on develop.." exec "git checkout develop" exec "git merge --no-ff hotfix/#{version}" git_output = exec "git push origin develop" if git_output.include?('fatal') or git_output.include?('rejected') or git_output.include?('error') print "X\n".red puts "\t\tSomething went wrong, take a look at the output from git:".indianred puts "\t\t#{git_output.split("\n").map(&:squish).join("\n\t\t")}".indianred puts else print "√\n".green puts "\t\tDone. Output from git:".cadetblue puts "\t\t#{git_output.split("\n").map(&:squish).join("\n\t\t")}".cadetblue puts end exec "git checkout master" end end |
#hotfix_open(version) ⇒ nil
Apre una nuova hotfix.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/dev/executables/commands/hotfix.rb', line 33 def hotfix_open(version) print "Preparing to open a new hotfix for app " print @project.current_app.teal print " with version " puts version.teal puts print "\tOpening.. " git_output = exec "git checkout -b hotfix/#{version} master" if git_output.include?('fatal') or git_output.include?('rejected') or git_output.include?('error') print "X\n".red puts "\t\tSomething went wrong, take a look at the output from git:".indianred puts "\t\t#{git_output.split("\n").map(&:squish).join("\n\t\t")}".indianred puts else print "√\n".green puts "\t\tDone. Output from git:".cadetblue puts "\t\t#{git_output.split("\n").map(&:squish).join("\n\t\t")}".cadetblue puts end print "\tBumping version to #{version}.. " @project.bump_app_version_to(version) print "√\n".green puts end |