Module: Dev::Executables::Commands::Push
- Included in:
- Dev::Executable
- Defined in:
- lib/dev/executables/commands/push.rb
Instance Method Summary collapse
-
#push(app = nil, commit_message = nil) ⇒ nil
Esegue il commit e il push del repository dell’app specificata.
Instance Method Details
#push(app = nil, commit_message = nil) ⇒ nil
Esegue il commit e il push del repository dell’app specificata.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/dev/executables/commands/push.rb', line 13 def push(app = nil, = nil) if app.present? and .present? @project.current_app = app if @project.valid_app? Dir.chdir @project.app_folder current_branch = `git rev-parse --abbrev-ref HEAD` print "Preparing to push app " print @project.current_app.teal print " on branch " print current_branch.teal puts print "\tRunning bundler.. " exec 'bundle install' print "√\n".green print "\tCommitting.. " exec 'git add .' exec "git commit -m \"#{}\"" print "√\n".green print "\tPushing.. " = exec "git push origin #{current_branch}" if .include?('fatal') or .include?('rejected') print "X\n".red puts "\t\tSomething went wrong, take a look at the output from git remote:".indianred puts "\t\t#{.split("\n").map(&:squish).join("\n\t\t")}".indianred puts else print "√\n".green puts "\t\tDone. Output from git remote:".cadetblue puts "\t\t#{.split("\n").map(&:squish).join("\n\t\t")}".cadetblue puts end end else raise Dev::Executable::ExecutionError.new "Wrong command syntax: "\ "specify an app and a commit message. "\ "Example: dev push app \"commit message\"." end end |