Class: Licensed::Command::List
- Inherits:
-
Object
- Object
- Licensed::Command::List
- Defined in:
- lib/licensed/command/list.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#dependencies(app, source) ⇒ Object
Returns an apps non-ignored dependencies, sorted by name.
-
#initialize(config) ⇒ List
constructor
A new instance of List.
- #run ⇒ Object
- #success? ⇒ Boolean
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
#config ⇒ Object (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 |
#run ⇒ Object
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
36 37 38 |
# File 'lib/licensed/command/list.rb', line 36 def success? true end |