Class: Blazing::Target

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/blazing/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, location, config, options = {}) ⇒ Target

Returns a new instance of Target.



9
10
11
12
13
14
15
# File 'lib/blazing/target.rb', line 9

def initialize(name, location, config, options = {})
  @name = name
  @location = location
  @config = config
  @options = options
  @target = self
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



7
8
9
# File 'lib/blazing/target.rb', line 7

def config
  @config
end

#locationObject

Returns the value of attribute location.



7
8
9
# File 'lib/blazing/target.rb', line 7

def location
  @location
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/blazing/target.rb', line 7

def name
  @name
end

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/blazing/target.rb', line 7

def options
  @options
end

Instance Method Details

#hostObject



41
42
43
44
# File 'lib/blazing/target.rb', line 41

def host
  host = @location.match(/@(.*):/)
  host[1] unless host.nil?
end

#pathObject



33
34
35
36
37
38
39
# File 'lib/blazing/target.rb', line 33

def path
  if host
    @location.match(/:(.*)$/)[1]
  else
    @location
  end
end

#setupObject

Set up Repositories and Hook



20
21
22
23
# File 'lib/blazing/target.rb', line 20

def setup
  info "Setting up repository for #{name} in #{location}"
  Repository.new(self).setup
end

#updateObject

Update git remote and hook



28
29
30
31
# File 'lib/blazing/target.rb', line 28

def update
  Repository.new(self).add_git_remote
  Hook.new(self).setup
end

#userObject



46
47
48
49
# File 'lib/blazing/target.rb', line 46

def user
  user = @location.match(/(.*)@/)
  user[1] unless user.nil?
end