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.



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

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.



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

def config
  @config
end

#locationObject

Returns the value of attribute location.



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

def location
  @location
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#hostObject



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

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

#pathObject



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

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

#setupObject

Set up Repositories and Hook



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

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

#updateObject

Update git remote and hook



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

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

#userObject



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

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