Class: LicenseFinder::CLI::Main

Inherits:
Base
  • Object
show all
Defined in:
lib/license_finder/cli.rb

Instance Method Summary collapse

Methods inherited from Base

subcommand

Instance Method Details

#action_itemsObject



192
193
194
195
196
197
198
199
200
201
202
# File 'lib/license_finder/cli.rb', line 192

def action_items
  unapproved = Dependency.unapproved

  if unapproved.empty?
    say "All dependencies are approved for use", :green
  else
    say "Dependencies that need approval:", :red
    say TextReport.new(unapproved)
    exit 1
  end
end

#approve(*names) ⇒ Object



164
165
166
167
168
169
170
171
172
173
174
# File 'lib/license_finder/cli.rb', line 164

def approve(*names)
  if(names.count < 1)
    say "Warning: Must specify dependencies to approve.", :red
  else
    die_on_error {
      names.each { |name| DependencyManager.approve!(name) }
    }

    say "The #{names.join(", ")} dependency has been approved!", :green
  end
end

#license(license, name) ⇒ Object



177
178
179
180
181
182
183
# File 'lib/license_finder/cli.rb', line 177

def license(license, name)
  die_on_error {
    DependencyManager.license!(name, license)
  }

  say "The #{name} dependency has been marked as using #{license} license!", :green
end

#moveObject



186
187
188
189
# File 'lib/license_finder/cli.rb', line 186

def move
  Configuration.move!
  say "Congratulations, you have cleaned up your root directory!'", :green
end

#rescanObject



152
153
154
155
156
157
158
159
160
# File 'lib/license_finder/cli.rb', line 152

def rescan
  die_on_error {
    spinner {
      DependencyManager.sync_with_package_managers
    }
  }

  action_items
end