Sha256: 2fb2b2be9f99e85dde3b7ece1cf936b1219a96e6895215c46116229cb74babb8
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
# encoding: utf-8 require 'fedux_org_stdlib/rake/task' require 'fedux_org_stdlib/require_files' require_library %w{ erubis } module FeduxOrgStdlib module Rake # Shell Task # # @see Rakefile class ShellTask < Task # @!attribute [r] command # The command to be executed attr_reader :command # @!attribute [r] use_bundler # Use bundler to run command attr_reader :use_bundler def initialize(command:, use_bundler: false, **args) super(**args) @use_bundler = use_bundler @command = command end # @private def run_task(verbose) logger.warn 'Gemfile does not exist. Running bundler will fail. I am going to run the command without `bundle exec`.' unless gemfile_exists? cmd = [] cmd << 'bundle exec' if use_bundler and gemfile_exists? cmd << command sh Erubis::Eruby.new(cmd.join(' ')).result(get_binding) end private def gemfile_exists? !Dir.glob('Gemfile').blank? end end end end
Version data entries
3 entries across 3 versions & 1 rubygems