Class: Blazing::Target
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #host ⇒ Object
-
#initialize(name, location, config, options = {}) ⇒ Target
constructor
A new instance of Target.
- #path ⇒ Object
-
#setup ⇒ Object
Set up Repositories and Hook.
-
#update ⇒ Object
Update git remote and hook.
- #user ⇒ Object
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, = {}) @name = name @location = location @config = config @options = @target = self end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
7 8 9 |
# File 'lib/blazing/target.rb', line 7 def config @config end |
#location ⇒ Object
Returns the value of attribute location.
7 8 9 |
# File 'lib/blazing/target.rb', line 7 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/blazing/target.rb', line 7 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/blazing/target.rb', line 7 def @options end |
Instance Method Details
#host ⇒ Object
41 42 43 44 |
# File 'lib/blazing/target.rb', line 41 def host host = @location.match(/@(.*):/) host[1] unless host.nil? end |
#path ⇒ Object
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 |
#setup ⇒ Object
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 |
#update ⇒ Object
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 |
#user ⇒ Object
46 47 48 49 |
# File 'lib/blazing/target.rb', line 46 def user user = @location.match(/(.*)@/) user[1] unless user.nil? end |