Class: BranchIOCLI::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- BranchIOCLI::RakeTask
- Defined in:
- lib/branch_io_cli/rake_task.rb
Instance Attribute Summary collapse
-
#defaults ⇒ Object
readonly
Returns the value of attribute defaults.
Instance Method Summary collapse
- #add_branch_task(task_name, description) ⇒ Object
-
#initialize(name = :branch, &b) ⇒ RakeTask
constructor
A new instance of RakeTask.
Constructor Details
#initialize(name = :branch, &b) ⇒ RakeTask
Returns a new instance of RakeTask.
10 11 12 13 14 15 16 |
# File 'lib/branch_io_cli/rake_task.rb', line 10 def initialize(name = :branch, &b) namespace name do add_branch_task :report, "Generate a brief Branch report" add_branch_task :setup, "Set a project up with the Branch SDK" add_branch_task :validate, "Validate universal links in one or more projects" end end |
Instance Attribute Details
#defaults ⇒ Object (readonly)
Returns the value of attribute defaults.
8 9 10 |
# File 'lib/branch_io_cli/rake_task.rb', line 8 def defaults @defaults end |
Instance Method Details
#add_branch_task(task_name, description) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/branch_io_cli/rake_task.rb', line 18 def add_branch_task(task_name, description) command_class = Command.const_get("#{task_name.to_s.capitalize}Command") configuration_class = Configuration.const_get("#{task_name.to_s.capitalize}Configuration") desc description task task_name, i{paths } do |task, args| paths = args[:paths] paths = [paths] unless paths.respond_to?(:each) paths.each do |path| Dir.chdir(path) do begin command_class.new(configuration_class.wrapper(args[:options] || {})).run! rescue StandardError => e say "Error from #{task_name} task in #{path}: #{e.message}" end end end end end |