Sha256: 600aab1d6ab8114ba11f8fe6d96c29118cc04a2d0eaa8fb214690387514b3f31

Contents?: true

Size: 1.21 KB

Versions: 12

Compression:

Stored size: 1.21 KB

Contents

module Maestro
  module Plugin
    module RakeTasks
      class BundleTask < ::Rake::TaskLib
        include ::Rake::DSL if defined?(::Rake::DSL)

        # Depedency groups to omit
        # default:
        #   [ 'development', 'test' ]
        attr_accessor :without_groups

        # Name of task.
        #
        # default:
        #   :bundle
        attr_accessor :name

        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

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

        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
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
maestro-plugin-rake-tasks-1.0.11 lib/maestro/plugin/rake_tasks/bundle_task.rb
maestro-plugin-rake-tasks-1.0.10 lib/maestro/plugin/rake_tasks/bundle_task.rb
maestro-plugin-rake-tasks-1.0.9 lib/maestro/plugin/rake_tasks/bundle_task.rb
maestro-plugin-rake-tasks-1.0.8 lib/maestro/plugin/rake_tasks/bundle_task.rb
maestro-plugin-rake-tasks-1.0.7 lib/maestro/plugin/rake_tasks/bundle_task.rb
maestro-plugin-rake-tasks-1.0.6 lib/maestro/plugin/rake_tasks/bundle_task.rb
maestro-plugin-rake-tasks-1.0.5 lib/maestro/plugin/rake_tasks/bundle_task.rb
maestro-plugin-rake-tasks-1.0.4 lib/maestro/plugin/rake_tasks/bundle_task.rb
maestro-plugin-rake-tasks-1.0.3 lib/maestro/plugin/rake_tasks/bundle_task.rb
maestro-plugin-rake-tasks-1.0.2 lib/maestro/plugin/rake_tasks/bundle_task.rb
maestro-plugin-rake-tasks-1.0.1 lib/maestro/plugin/rake_tasks/bundle_task.rb
maestro-plugin-rake-tasks-1.0.0 lib/maestro/plugin/rake_tasks/bundle_task.rb