Skip to content

Commit

Permalink
Allow Airbrussh to be used without rake installed (#127)
Browse files Browse the repository at this point in the history
We only actually need rake if the `monkey_patch_rake` setting is true.
By default it is false, so airbrussh should be usable without rake.

However we were running `require "rake"` regardless of this config,
which meant that in practice you would get a `LoadError` if rake is
unavailable.

Fix by running `require "rake"` only if `monkey_patch_rake` is true.

Fixes #126
  • Loading branch information
mattbrictson authored Aug 17, 2019
1 parent 915bed8 commit 1a638a8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/airbrussh/rake/context.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require "rake"

module Airbrussh
module Rake
# Maintains information about what Rake task is currently being invoked,
Expand Down Expand Up @@ -53,6 +51,7 @@ class << self
attr_accessor :current_task_name

def install_monkey_patch
require "rake"
return if ::Rake::Task.instance_methods.include?(:_airbrussh_execute)

::Rake::Task.class_exec do
Expand Down

0 comments on commit 1a638a8

Please sign in to comment.