Skip to content

Instantly share code, notes, and snippets.

@0xAhmed
Created March 7, 2012 13:18
Show Gist options
  • Save 0xAhmed/1993054 to your computer and use it in GitHub Desktop.
Save 0xAhmed/1993054 to your computer and use it in GitHub Desktop.
deployinator
module Deployinator
module Stacks
module Webtier
### Production environment methods
## current version deployed in production
def webtier_prod_version
# %x{curl http://my-app.com/version.txt}
"1.1"
end
## current build deployed in production, inferred from the version
def webtier_current_prod_build
"build-153"
end
## next build that is about to be deployed in production
def webtier_next_prod_build
"build-154"
end
# What the "deploy production" button actually does
def webtier_production(options={})
log_and_stream "Fill in the webtier_production method in stacks/webtier.rb!<br>"
# log the deploy
log_and_shout :old_build => environments[0][:current_build].call, :build => environments[0][:next_build].call
end
### Staging environment methods
## current version deployed on staging
def webtier_staging_version
"1.4"
end
## current build deployed in staging, inferred from the version
def webtier_current_staging_build
"build-160"
end
## next build that is about to be deployed in staging
def webtier_next_staging_build
"build-161"
end
def webtier_environments
[
{
:title => "Push to staging",
:name => "staging",
:method => "qa_rsync",
:current_version => webtier_staging_version,
:current_build => webtier_current_staging_build,
:next_build => webtier_next_staging_build
},
{
:title => "Push to production",
:name => "production",
:method => "prod_rsync",
:current_version => webtier_prod_version,
:current_build => webtier_current_prod_build,
:next_build => webtier_next_prod_build
}
]
end
end
end
end
@tomvachon
Copy link

module Deployinator
module Stacks
module Webtier

  ### Production environment methods

  ## current version deployed in production
  def webtier_production_version
    # %x{curl http://my-app.com/version.txt}
    "1.1"
  end

  ## current build deployed in production, inferred from the version
  def webtier_production_build
    "build-153"
  end

  ## next build that is about to be deployed in production
  def next_production_build
    "build-154"
  end

  # What the "deploy production" button actually does
  def webtier_production_rsync(options={})
    log_and_stream "Fill in the webtier_production method in stacks/webtier.rb!<br>"

    # log the deploy
    log_and_shout :old_build => environments[0][:current_build].call, :build => environments[0][:next_build].call
  end


  ### Staging environment methods

  ## current version deployed on staging
  def webtier_staging_version
    "1.4"
  end

 ## current build deployed in staging, inferred from the version
 def webtier_staging_build
   "build-160"
 end

 ## next build that is about to be deployed in staging
 def next_staging_build
   "build-161"
 end


  def webtier_environments
    [
      {
        :title           => "Push to staging",
        :name            => "staging",
        :method          => "webtier_staging_rsync",
        :current_version => webtier_staging_version,
        :current_build   => webtier_staging_build,
        :next_build      => next_staging_build
      },
      {
        :title           => "Push to production",
        :name            => "production",
        :method          => "webtier_production_rsync",
        :current_version => webtier_production_version,
        :current_build   => webtier_production_build,
        :next_build      => next_production_build
      }
    ]
  end
end

end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment