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
32 33 34 35 36 |
# File 'lib/licensed/command/list.rb', line 32 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 28 29 |
# 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| type = source.class.type @config.ui.info " #{type} dependencies:" source_dependencies = dependencies(app, source) source_dependencies.each do |dependency| @config.ui.info " Found #{dependency['name']} (#{dependency['version']})" end @config.ui.confirm " * #{type} dependencies: #{source_dependencies.size}" end end end end |
#success? ⇒ Boolean
38 39 40 |
# File 'lib/licensed/command/list.rb', line 38 def success? true end |