Class: Container::Templates::RakeTask
- Inherits:
-
Object
- Object
- Container::Templates::RakeTask
- Includes:
- Rake::DSL
- Defined in:
- lib/docker_rack/container_template.rb
Overview
< ::Rake::TaskLib
Constant Summary collapse
- DEFAULT_PATTERN =
Default pattern for template files. DEFAULT_PATTERN = ‘container_templates/**,/<strong>/*</strong>/*.yml,yaml’
'**/*.{yml,yaml}'- DEFAULT_PATH =
'container_templates'
Instance Attribute Summary collapse
-
#name ⇒ Object
Name of task.
-
#pattern ⇒ Object
Files matching this pattern will be loaded.
-
#templates_path ⇒ Object
Path to Container templates.
Instance Method Summary collapse
- #contains?(task_name) ⇒ Boolean
-
#initialize ⇒ RakeTask
constructor
A new instance of RakeTask.
- #invoke(name) ⇒ Object
- #options ⇒ Object
- #process(params) ⇒ Object
- #tasks ⇒ Object
Constructor Details
#initialize ⇒ RakeTask
Returns a new instance of RakeTask.
36 37 38 39 40 41 42 |
# File 'lib/docker_rack/container_template.rb', line 36 def initialize = Rake.application. .trace = false .dryrun = false Rake::TaskManager. = true end |
Instance Attribute Details
#name ⇒ Object
Name of task. Defaults to :container_templates.
26 27 28 |
# File 'lib/docker_rack/container_template.rb', line 26 def name @name end |
#pattern ⇒ Object
Files matching this pattern will be loaded. Defaults to ‘’*/.yml,yaml‘`.
34 35 36 |
# File 'lib/docker_rack/container_template.rb', line 34 def pattern @pattern end |
#templates_path ⇒ Object
Path to Container templates. Defaults to the absolute path to the relative location of container templates.
30 31 32 |
# File 'lib/docker_rack/container_template.rb', line 30 def templates_path @templates_path end |
Instance Method Details
#contains?(task_name) ⇒ Boolean
69 70 71 |
# File 'lib/docker_rack/container_template.rb', line 69 def contains?(task_name) tasks.any? { |task| task.name == task_name } end |
#invoke(name) ⇒ Object
73 74 75 |
# File 'lib/docker_rack/container_template.rb', line 73 def invoke(name) Rake.application[name].invoke end |
#options ⇒ Object
58 59 60 61 62 63 |
# File 'lib/docker_rack/container_template.rb', line 58 def = OpenStruct.new .trace = false .dryrun = false end |
#process(params) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/docker_rack/container_template.rb', line 44 def process(params) @templates_path = params[:path] || DEFAULT_PATH @pattern = params[:pattern] || DEFAULT_PATTERN load_templates @templates_path, @pattern scripts_path = File.join(@templates_path, 'scripts/*.rake') puts "Loading scripts from '#{scripts_path}'" if LOG_LEVEL == 'DEBUG' Dir.glob(scripts_path).each do |r| load r end end |
#tasks ⇒ Object
65 66 67 |
# File 'lib/docker_rack/container_template.rb', line 65 def tasks Rake.application.tasks() end |