Class: Maestro::Plugin::RakeTasks::BundleTask

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/maestro/plugin/rake_tasks/bundle_task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &task_block) ⇒ BundleTask

Returns a new instance of BundleTask.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/maestro/plugin/rake_tasks/bundle_task.rb', line 18

def initialize(*args, &task_block)
  setup_ivars(args)

  desc 'Update the dependencies' unless ::Rake.application.last_comment

  task name, *args do |_, task_args|
    RakeFileUtils.send(:verbose, verbose) do
      task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
      run_task verbose
    end
  end
end

Instance Attribute Details

#nameObject

Name of task.

default:

:bundle


16
17
18
# File 'lib/maestro/plugin/rake_tasks/bundle_task.rb', line 16

def name
  @name
end

#without_groupsObject

Depedency groups to omit default:

[ 'development', 'test' ]


10
11
12
# File 'lib/maestro/plugin/rake_tasks/bundle_task.rb', line 10

def without_groups
  @without_groups
end

Instance Method Details

#run_task(verbose) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/maestro/plugin/rake_tasks/bundle_task.rb', line 36

def run_task(verbose)
  sh "bundle install --without #{@without_groups.join(' ')}" do |ok, res|
    raise 'Error bundling' if ! ok
  end
  sh 'bundle package' do |ok, res|
    raise 'Error bundling' if ! ok
  end
end

#setup_ivars(args) ⇒ Object



31
32
33
34
# File 'lib/maestro/plugin/rake_tasks/bundle_task.rb', line 31

def setup_ivars(args)
  @name = args.shift || :bundle
  @without_groups = [ 'development', 'test' ]
end