Class: Jets::CLI::Git::Push
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #env_vars ⇒ Object
-
#initialize(options = {}) ⇒ Push
constructor
A new instance of Push.
- #local ⇒ Object
-
#push_branch ⇒ Object
man git-push git push git push origin git push origin : git push origin master git push origin HEAD git push mothership master:satellite/master dev:satellite/dev git push origin HEAD:master git push origin master:refs/heads/experimental git push origin :experimental git push origin +dev:master.
- #run ⇒ Object
Methods inherited from Base
#paginate, #paging_params, rescue_api_error
Methods included from Util::Logging
Methods included from AwsServices
#apigateway, #aws_options, #cfn, #codebuild, #dynamodb, #lambda_client, #logs, #s3, #s3_resource, #sns, #sqs, #ssm, #sts, #wafv2
Methods included from AwsServices::StackStatus
Methods included from AwsServices::GlobalMemoist
Methods included from Api
Constructor Details
#initialize(options = {}) ⇒ Push
Returns a new instance of Push.
5 6 7 8 |
# File 'lib/jets/cli/git/push.rb', line 5 def initialize( = {}) super @args = [:args] || [] end |
Instance Method Details
#env_vars ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/jets/cli/git/push.rb', line 26 def env_vars env_vars = Jets.project.config.git.push.branch[push_branch] return unless env_vars # IE: branch_name = {JETS_ENV: "xxx", AWS_PROFILE: "xxx"} env_vars.map do |k, v| "#{k}=#{v}" end.sort.join(" ") end |
#local ⇒ Object
60 61 62 |
# File 'lib/jets/cli/git/push.rb', line 60 def local Jets::Git::Local.new end |
#push_branch ⇒ Object
man git-push git push git push origin git push origin : git push origin master git push origin HEAD git push mothership master:satellite/master dev:satellite/dev git push origin HEAD:master git push origin master:refs/heads/experimental git push origin :experimental git push origin +dev:master
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/jets/cli/git/push.rb', line 46 def push_branch args = @args.reject { |arg| arg.start_with?("-") } # remove options case args.size when 0 local.git_default_branch when 1 local.git_current_branch when 2 args.last else raise "ERROR: Too many arguments. Usage: jets git:push [REMOTE] [BRANCH]" end end |
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jets/cli/git/push.rb', line 10 def run args = ["push"] + @args puts "=> git #{args.join(" ")}" IO.popen(["git", *args]) do |io| io.each do |line| puts line end end return unless $?.success? command = [env_vars, "jets ci:logs"].compact.join(" ") Kernel.exec(command) end |