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(root_path, configurations, executable) ⇒ Runner

Returns a new instance of Runner.



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

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

Instance Method Details

#run(command, source_path) ⇒ Object



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

def run(command, source_path)
  args = [format_command(command, source_path)]
  # 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 >= "6.6"
  Licensed::Shell.execute(@executable, "-q", "--init-script", @init_script.path, *args)
end