Class: Hellgrid::CLI
- Inherits:
-
Object
- Object
- Hellgrid::CLI
- Defined in:
- lib/hellgrid/cli.rb
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv = ARGV) ⇒ CLI
constructor
A new instance of CLI.
- #start ⇒ Object
Constructor Details
#initialize(argv = ARGV) ⇒ CLI
Returns a new instance of CLI.
7 8 9 |
# File 'lib/hellgrid/cli.rb', line 7 def initialize(argv = ARGV) @argv = argv end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
11 12 13 |
# File 'lib/hellgrid/cli.rb', line 11 def argv @argv end |
Class Method Details
.start(argv = ARGV) ⇒ Object
3 4 5 |
# File 'lib/hellgrid/cli.rb', line 3 def self.start(argv = ARGV) new(argv).start end |
Instance Method Details
#start ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/hellgrid/cli.rb', line 13 def start recursive_search = !!(argv.delete('-r')) folders = argv.empty? ? [Dir.pwd] : argv folders.each do |folder| matrix = Hellgrid::Matrix.new Find.find(folder) do |path| if File.directory?(path) && File.exists?(File.join(path, 'Gemfile.lock')) matrix.add_project(Hellgrid::Project.new(folder, path)) Find.prune unless recursive_search end end view = Hellgrid::Views::Console.new(matrix.sorted_by_most_used) view.render end end |