Alright Clinton,

Sounds like those don't have a sane default, that is, if they're not set
you're deploying in the wind, and that's not a solution.

In this case environmental variables are probably the way to go, or to make
a *very* simple wrapper script that loads capistrano, parses your special
options with `OptParser` or something, and then defers to the Capistrano
application, it would be exactly like
https://github.com/capistrano/capistrano/blob/master/bin/cap except you'd
be able to drop it into your own app.

In this case, especially as they are required, I'd be tempted to do
something like this:

#!/usr/bin/env ruby

require 'optparse'
require 'capistrano/all'

OptionParser.new do |opts|
  opts.banner = "Usage: clintcap [options] [commands as accepted by cap
itself]"
  opts.on("-r", "--ref", "Git Reference") do |r|
    $git_reference = r
  end
  opts.on("-e", "--es-index", "ElasticSearch Index Name") do |esi|
    $elasticsearch_index = esi
  end
end.parse!

Capistrano::Application.new.run


Lee Hambley
--
http://lee.hambley.name/
+49 (0) 170 298 5667


On 17 October 2013 14:46, Clinton Blackburn <[email protected]>wrote:

> I have three use cases:
>
>    - Git revision: When my build server finishes running tests, it
>    deploys code. Since commits can occur during testing, HEAD may not
>    necessarily be the revision that was tested and needs to be deployed.
>    Previously I passed -S revision=<git-sha> to ensure only tested code was
>    deployed. We used -S tag when deploying to production.
>    - API Versioning: My API versions live on different branches of the
>    same repository and are deployed to different locations. For example, v1
>    lives in the api/v1 branch and is deployed to /var/www/api-v1. In Capv2, I
>    passed -S version=1 to set the version.
>    - Elasticsearch Index Naming: My deployment of ES indices relies on
>    knowing the index name. Since we have indices named based on our customers'
>    names as well as a build number (e.g. acme_186), I need to be able to pass
>    in -S customer=acme -S build_number=186.
>
>
> Thanks,
> Clinton
>
> --
> --
> * You received this message because you are subscribed to the Google
> Groups "Capistrano" group.
> * To post to this group, send email to [email protected]
> * To unsubscribe from this group, send email to
> [email protected] For more options, visit this
> group at http://groups.google.com/group/capistrano?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Capistrano" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to 
[email protected] For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to