Class: Shuttle::Target
- Inherits:
-
Object
- Object
- Shuttle::Target
- Defined in:
- lib/shuttle/target.rb
Instance Attribute Summary collapse
-
#deploy_to ⇒ Object
readonly
Returns the value of attribute deploy_to.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(hash) ⇒ Target
constructor
A new instance of Target.
- #validate! ⇒ Object
Constructor Details
#initialize(hash) ⇒ Target
Returns a new instance of Target.
6 7 8 9 10 11 |
# File 'lib/shuttle/target.rb', line 6 def initialize(hash) @host = hash[:host] @user = hash[:user] @password = hash[:password] @deploy_to = hash[:deploy_to] end |
Instance Attribute Details
#deploy_to ⇒ Object (readonly)
Returns the value of attribute deploy_to.
4 5 6 |
# File 'lib/shuttle/target.rb', line 4 def deploy_to @deploy_to end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/shuttle/target.rb', line 3 def host @host end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
3 4 5 |
# File 'lib/shuttle/target.rb', line 3 def password @password end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
3 4 5 |
# File 'lib/shuttle/target.rb', line 3 def user @user end |
Instance Method Details
#connection ⇒ Object
13 14 15 |
# File 'lib/shuttle/target.rb', line 13 def connection @connection ||= Net::SSH::Session.new(host, user, password) end |
#validate! ⇒ Object
17 18 19 20 21 |
# File 'lib/shuttle/target.rb', line 17 def validate! raise Shuttle::ConfigError, "Host required" if host.nil? raise Shuttle::ConfigError, "User required" if user.nil? raise Shuttle::ConfigError, "Deploy path required" if deploy_to.nil? end |