Sha256: 2adb08dd0cbaf8b0a2102c817e95b3fb4739698aac9765f85e7217b80975276a

Contents?: true

Size: 1.25 KB

Versions: 8

Compression:

Stored size: 1.25 KB

Contents

desc 'Deliver your changes to a staging server'
command :stage do |c|
  c.desc 'deliver your feature branch to the staging branch'
  c.action do |global_options, options, args|
    feature_branch_name = GitReflow.current_branch
    staging_branch_name = GitReflow::Config.get('reflow.staging-branch', local: true)

    if staging_branch_name.empty?
      staging_branch_name = GitReflow.ask("What's the name of your staging branch? (default: 'staging') ")
      staging_branch_name = 'staging' if staging_branch_name.strip == ''
      GitReflow::Config.set('reflow.staging-branch', staging_branch_name, local: true)
    end

    GitReflow.run_command_with_label "git checkout #{staging_branch_name}"
    GitReflow.run_command_with_label "git pull origin #{staging_branch_name}"

    if GitReflow.run_command_with_label "git merge #{feature_branch_name}", with_system: true
      GitReflow.run_command_with_label "git push origin #{staging_branch_name}"

      staged = GitReflow.deploy(:staging)

      if staged
        GitReflow.say "Deployed to Staging.", :success
      else
        GitReflow.say "There were issues deploying to staging.", :error
      end
    else
      GitReflow.say "There were issues merging your feature branch to staging.", :error
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
git_reflow-0.8.3 lib/git_reflow/commands/stage.rb
git_reflow-0.8.2 lib/git_reflow/commands/stage.rb
git_reflow-0.8.1 lib/git_reflow/commands/stage.rb
git_reflow-0.8.0 lib/git_reflow/commands/stage.rb
git_reflow-0.7.5 lib/git_reflow/commands/stage.rb
git_reflow-0.7.4 lib/git_reflow/commands/stage.rb
git_reflow-0.7.2 lib/git_reflow/commands/stage.rb
git_reflow-0.7.1 lib/git_reflow/commands/stage.rb