Class: Shuttle::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/shuttle/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_toObject (readonly)

Returns the value of attribute deploy_to.



4
5
6
# File 'lib/shuttle/target.rb', line 4

def deploy_to
  @deploy_to
end

#hostObject (readonly)

Returns the value of attribute host.



3
4
5
# File 'lib/shuttle/target.rb', line 3

def host
  @host
end

#passwordObject (readonly)

Returns the value of attribute password.



3
4
5
# File 'lib/shuttle/target.rb', line 3

def password
  @password
end

#userObject (readonly)

Returns the value of attribute user.



3
4
5
# File 'lib/shuttle/target.rb', line 3

def user
  @user
end

Instance Method Details

#connectionObject



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