Class: Licensed::Command::List

Inherits:
Object
  • Object
show all
Defined in:
lib/licensed/command/list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ List

Returns a new instance of List.



7
8
9
# File 'lib/licensed/command/list.rb', line 7

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/licensed/command/list.rb', line 5

def config
  @config
end

Instance Method Details

#dependencies(app, source) ⇒ Object

Returns an apps non-ignored dependencies, sorted by name



30
31
32
33
34
# File 'lib/licensed/command/list.rb', line 30

def dependencies(app, source)
  source.dependencies
        .select { |d| !app.ignored?(d) }
        .sort_by { |d| d["name"] }
end

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/licensed/command/list.rb', line 11

def run
  @config.apps.each do |app|
    @config.ui.info "Displaying dependencies for #{app['name']}"
    Dir.chdir app.source_path do
      app.sources.each do |source|
        @config.ui.info "  #{source.type} dependencies:"

        source_dependencies = dependencies(app, source)
        source_dependencies.each do |dependency|
          @config.ui.info "    Found #{dependency['name']} (#{dependency['version']})"
        end

        @config.ui.confirm "  * #{source.type} dependencies: #{source_dependencies.size}"
      end
    end
  end
end

#success?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/licensed/command/list.rb', line 36

def success?
  true
end