Sha256: 388d8d3f8a2a9748ce5bd2bda5ea5967158aaef9d9d456f031ce74ed9dfd798a

Contents?: true

Size: 563 Bytes

Versions: 21

Compression:

Stored size: 563 Bytes

Contents

class Terraspace::CLI
  class List
    def initialize(options={})
      @options = options
      @type_dir = normalized_type
    end

    def run
      dirs = Dir.glob("{app,vendor}/{modules,stacks}/*").select { |p| File.directory?(p) }
      dirs.sort.each do |path|
        if @type_dir
          puts path if path.include?("/#{@type_dir}/")
        else
          puts path
        end
      end
    end

  private
    def normalized_type
      type = @options[:type]
      if %w[stack module].include?(type)
        type.pluralize
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
terraspace-0.6.3 lib/terraspace/cli/list.rb
terraspace-0.6.2 lib/terraspace/cli/list.rb
terraspace-0.6.1 lib/terraspace/cli/list.rb
terraspace-0.6.0 lib/terraspace/cli/list.rb
terraspace-0.5.12 lib/terraspace/cli/list.rb
terraspace-0.5.11 lib/terraspace/cli/list.rb
terraspace-0.5.10 lib/terraspace/cli/list.rb
terraspace-0.5.9 lib/terraspace/cli/list.rb
terraspace-0.5.8 lib/terraspace/cli/list.rb
terraspace-0.5.7 lib/terraspace/cli/list.rb
terraspace-0.5.6 lib/terraspace/cli/list.rb
terraspace-0.5.5 lib/terraspace/cli/list.rb
terraspace-0.5.4 lib/terraspace/cli/list.rb
terraspace-0.5.3 lib/terraspace/cli/list.rb
terraspace-0.5.2 lib/terraspace/cli/list.rb
terraspace-0.5.1 lib/terraspace/cli/list.rb
terraspace-0.5.0 lib/terraspace/cli/list.rb
terraspace-0.4.4 lib/terraspace/cli/list.rb
terraspace-0.4.3 lib/terraspace/cli/list.rb
terraspace-0.4.2 lib/terraspace/cli/list.rb