Class: Teamistrano::Settings
- Inherits:
-
Object
- Object
- Teamistrano::Settings
- Defined in:
- lib/teamistrano/settings.rb
Instance Method Summary collapse
-
#application ⇒ Object
Get the name of the application being deployed.
-
#branch ⇒ Object
Get the branch being deployed.
-
#deployer ⇒ Object
Get the name of the deployer.
-
#get_local_user ⇒ Object
Get the local user name.
-
#initialize(env) ⇒ Settings
constructor
A new instance of Settings.
-
#show ⇒ Object
Show the settings.
-
#stage ⇒ Object
Get the stage of deployment (TEST, PROD).
-
#use_curl? ⇒ Boolean
Should we use curl to post the message to teams?.
-
#webhook_url ⇒ Object
Get the URL for the webhook call.
Constructor Details
#initialize(env) ⇒ Settings
Returns a new instance of Settings.
7 8 9 10 |
# File 'lib/teamistrano/settings.rb', line 7 def initialize( env ) @env = env @config = @env.fetch( :teamistrano, {} ) end |
Instance Method Details
#application ⇒ Object
Get the name of the application being deployed.
43 44 45 |
# File 'lib/teamistrano/settings.rb', line 43 def application @env.fetch( :application, "N/A" ) end |
#branch ⇒ Object
Get the branch being deployed.
38 39 40 |
# File 'lib/teamistrano/settings.rb', line 38 def branch @env.fetch( :branch, "N/A" ) end |
#deployer ⇒ Object
Get the name of the deployer.
33 34 35 |
# File 'lib/teamistrano/settings.rb', line 33 def deployer return @env.fetch( :local_user, get_local_user) end |
#get_local_user ⇒ Object
Get the local user name.
28 29 30 |
# File 'lib/teamistrano/settings.rb', line 28 def get_local_user return ENV['USER'] || ENV['USERNAME'] end |
#show ⇒ Object
Show the settings. This is a debugging function only.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/teamistrano/settings.rb', line 54 def show puts "------------------- settings -------------------" puts "Application: #{application}" puts "Branch: #{branch}" puts "Stage: #{stage}" puts "Deployer: #{deployer}" puts "Local User: #{get_local_user}" puts "URL: #{webhook_url}" puts "------------------------------------------------" end |
#stage ⇒ Object
Get the stage of deployment (TEST, PROD).
48 49 50 |
# File 'lib/teamistrano/settings.rb', line 48 def stage @env.fetch( :stage, "N/A" ) end |
#use_curl? ⇒ Boolean
Should we use curl to post the message to teams?
18 19 20 21 22 23 24 25 |
# File 'lib/teamistrano/settings.rb', line 18 def use_curl? o = @config[ :curl ] if o return true else return false end end |
#webhook_url ⇒ Object
Get the URL for the webhook call.
13 14 15 |
# File 'lib/teamistrano/settings.rb', line 13 def webhook_url return @config[ :webhook ] end |