Class: P4Util::Tasks
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- P4Util::Tasks
- Defined in:
- lib/p4util/tasks.rb
Overview
Instance Attribute Summary collapse
-
#basename ⇒ Object
The task base name, defaults to ‘:p4’.
-
#p4_init_dir ⇒ Object
The directory containing p4 init scripts, defaults to ‘p4init’.
-
#version ⇒ Object
P4 Version to use, defaults to ‘r14.2’.
Instance Method Summary collapse
-
#define_tasks ⇒ Object
Create the tasks defined by this task library.
- #init_task_description ⇒ Object
- #init_task_name ⇒ Object
-
#initialize(basename = :p4) {|_self| ... } ⇒ Tasks
constructor
A new instance of Tasks.
- #kill_task_description ⇒ Object
- #kill_task_name ⇒ Object
- #reset_task_description ⇒ Object
- #reset_task_name ⇒ Object
Constructor Details
#initialize(basename = :p4) {|_self| ... } ⇒ Tasks
Returns a new instance of Tasks.
35 36 37 38 39 40 41 42 43 |
# File 'lib/p4util/tasks.rb', line 35 def initialize basename = :p4 @basename = basename @version = 'r14.2' @p4_init_dir = 'p4init' yield self if block_given? define_tasks end |
Instance Attribute Details
#basename ⇒ Object
The task base name, defaults to ‘:p4’
27 28 29 |
# File 'lib/p4util/tasks.rb', line 27 def basename @basename end |
#p4_init_dir ⇒ Object
The directory containing p4 init scripts, defaults to ‘p4init’
33 34 35 |
# File 'lib/p4util/tasks.rb', line 33 def p4_init_dir @p4_init_dir end |
#version ⇒ Object
P4 Version to use, defaults to ‘r14.2’
30 31 32 |
# File 'lib/p4util/tasks.rb', line 30 def version @version end |
Instance Method Details
#define_tasks ⇒ Object
Create the tasks defined by this task library
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/p4util/tasks.rb', line 46 def define_tasks desc init_task_description task init_task_name do = OpenStruct.new .params = [p4_init_dir, '--version', version] Commands.init() end desc kill_task_description task kill_task_name do = OpenStruct.new .params = ['--version', version] Commands.kill() end desc reset_task_description task reset_task_name => kill_task_name do FileUtils.rmtree(Conventions.p4droot_dir) end self end |
#init_task_description ⇒ Object
69 70 71 |
# File 'lib/p4util/tasks.rb', line 69 def init_task_description "Initializes a p4d instance, and ensures it's downloaded and running" end |
#init_task_name ⇒ Object
73 74 75 |
# File 'lib/p4util/tasks.rb', line 73 def init_task_name "#{basename}init" end |
#kill_task_description ⇒ Object
77 78 79 |
# File 'lib/p4util/tasks.rb', line 77 def kill_task_description 'Halt any locally running p4d instance' end |
#kill_task_name ⇒ Object
81 82 83 |
# File 'lib/p4util/tasks.rb', line 81 def kill_task_name "#{basename}kill" end |
#reset_task_description ⇒ Object
85 86 87 |
# File 'lib/p4util/tasks.rb', line 85 def reset_task_description 'Cleans out the current p4droot working directory (after killing p4d)' end |
#reset_task_name ⇒ Object
89 90 91 |
# File 'lib/p4util/tasks.rb', line 89 def reset_task_name "#{basename}reset" end |