Class: Licensed::Sources::Gradle::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/licensed/sources/gradle.rb

Overview

The Gradle::Runner class is a wrapper which provides an interface to run gradle commands with the init script initialized

Instance Method Summary collapse

Constructor Details

#initialize(configurations, executable) ⇒ Runner

Returns a new instance of Runner.



137
138
139
140
# File 'lib/licensed/sources/gradle.rb', line 137

def initialize(configurations, executable)
  @executable = executable
  @init_script = create_init_script(configurations)
end

Instance Method Details

#run(command) ⇒ Object



142
143
144
145
146
147
148
# File 'lib/licensed/sources/gradle.rb', line 142

def run(command)
  args = [command]
  # The configuration cache is an incubating feature that can be activated manually.
  # The gradle plugin for licenses does not support it so we prevent it to run for gradle version supporting it.
  args << "--no-configuration-cache" if gradle_version >= Gem::Version.new("6.6")
  Licensed::Shell.execute(@executable, "-q", "--init-script", @init_script.path, *args)
end