Module: Dev::Executables::Commands::Release
- Included in:
- Dev::Executable
- Defined in:
- lib/dev/executables/commands/release.rb
Instance Method Summary collapse
-
#release(command = nil, version = nil) ⇒ nil
Comandi per gestire l’apertura e la chiusura di un nuovo rilascio.
-
#release_close(version) ⇒ nil
Chiude una release esistente.
-
#release_open(version) ⇒ nil
Apre una nuova release.
Instance Method Details
#release(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/release.rb', line 13 def release(command = nil, version = nil) raise Dev::Executable::ExecutionError.new "Wrong command syntax: "\ "specify whether to open or close a release. "\ "Example: dev release open 1.0.0" unless command.in? [ 'open', 'close' ] version = version.to_s.squish if @project.valid_app? case command when 'open' then release_open(version) when 'close' then release_close(version) end end end |
#release_close(version) ⇒ nil
Chiude una release esistente.
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 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/dev/executables/commands/release.rb', line 76 def release_close(version) print "Preparing to close the release 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 release." end branches = `git branch -a` unless branches.include? ("release/#{version}\n") raise Dev::Executable::ExecutionError.new "No release for version '#{version}' could be found "\ "for this app's repository." end print "\tClosing.. " exec "git checkout master" exec "git merge --no-ff release/#{version}" exec "git tag -a #{version} -m \"release #{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 release on develop.." exec "git checkout develop" exec "git merge --no-ff release/#{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 |
#release_open(version) ⇒ nil
Apre una nuova release.
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 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/dev/executables/commands/release.rb', line 33 def release_open(version) print "Preparing to open a new release for app " print @project.current_app.teal print " with version " puts version.teal puts branches = `git branch -a` unless branches.include? ("develop\n") print "\tCreating develop branch.." exec "git checkout -b develop" exec "git add ." exec "git commit -m \"Dev: automatically created 'develop' branch\"" exec "git push -u origin develop" print "√\n".green puts end print "\tOpening.. " git_output = exec "git checkout -b release/#{version} 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 print "\tBumping version to #{version}.. " @project.bump_app_version_to(version) print "√\n".green puts end |