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.
10 11 12 13 14 15 16 |
# File 'lib/blazing/target.rb', line 10 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.
8 9 10 |
# File 'lib/blazing/target.rb', line 8 def config @config end |
#location ⇒ Object
Returns the value of attribute location.
8 9 10 |
# File 'lib/blazing/target.rb', line 8 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/blazing/target.rb', line 8 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/blazing/target.rb', line 8 def @options end |
Instance Method Details
#host ⇒ Object
42 43 44 45 |
# File 'lib/blazing/target.rb', line 42 def host host = @location.match(/@(.*):/) host[1] unless host.nil? end |
#path ⇒ Object
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 |
#setup ⇒ Object
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 |
#update ⇒ Object
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 |
#user ⇒ Object
47 48 49 50 |
# File 'lib/blazing/target.rb', line 47 def user user = @location.match(/(.*)@/) user[1] unless user.nil? end |