Class: Garlic::Target
- Inherits:
-
Object
- Object
- Garlic::Target
- Defined in:
- lib/garlic/target.rb
Defined Under Namespace
Classes: Runner
Instance Attribute Summary collapse
-
#garlic ⇒ Object
readonly
Returns the value of attribute garlic.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#rails_repo_name ⇒ Object
readonly
Returns the value of attribute rails_repo_name.
-
#tree_ish ⇒ Object
readonly
Returns the value of attribute tree_ish.
Instance Method Summary collapse
-
#initialize(garlic, options = {}) ⇒ Target
constructor
A new instance of Target.
- #prepare ⇒ Object
- #rails_sha ⇒ Object
- #run ⇒ Object
- #shell ⇒ Object
Constructor Details
#initialize(garlic, options = {}) ⇒ Target
Returns a new instance of Target.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/garlic/target.rb', line 7 def initialize(garlic, = {}) @garlic = garlic @tree_ish = Repo.tree_ish() || 'origin/master' @rails_repo_name = [:rails] || 'rails' @path = [:path] or raise ArgumentError, "Target requires a :path" @path = File.(@path) @name = [:name] || File.basename(@path) @prepare = [:prepare] @run = [:run] end |
Instance Attribute Details
#garlic ⇒ Object (readonly)
Returns the value of attribute garlic.
5 6 7 |
# File 'lib/garlic/target.rb', line 5 def garlic @garlic end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/garlic/target.rb', line 5 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/garlic/target.rb', line 5 def path @path end |
#rails_repo_name ⇒ Object (readonly)
Returns the value of attribute rails_repo_name.
5 6 7 |
# File 'lib/garlic/target.rb', line 5 def rails_repo_name @rails_repo_name end |
#tree_ish ⇒ Object (readonly)
Returns the value of attribute tree_ish.
5 6 7 |
# File 'lib/garlic/target.rb', line 5 def tree_ish @tree_ish end |
Instance Method Details
#prepare ⇒ Object
18 19 20 21 22 |
# File 'lib/garlic/target.rb', line 18 def prepare puts "\nPreparing target #{name} (#{tree_ish})" install_rails runner.run(&@prepare) if @prepare end |
#rails_sha ⇒ Object
28 29 30 |
# File 'lib/garlic/target.rb', line 28 def rails_sha read_sha('vendor/rails') end |
#run ⇒ Object
24 25 26 |
# File 'lib/garlic/target.rb', line 24 def run runner.run(&@run) if @run end |
#shell ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/garlic/target.rb', line 32 def shell unless @shell @shell = Shell.new @shell.verbose = false @shell.cd path end @shell end |