Sha256: 8c3228d5e7a02ffeb36c8c9ef5504806688f6d71905909a552540717e238acc4

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require 'fileutils'
require 'json'

require 'skippy/library'
require 'skippy/project'

class Lib < Skippy::Command

  include Thor::Actions

  desc 'list', 'List installed libraries'
  def list
    project = Skippy::Project.current_or_fail
    libraries = project.libraries
    if libraries.empty?
      say 'No libraries installed', :yellow
    else
      say 'Installed libraries:', :yellow
      libraries.each { |library|
        say
        say "#{library.title} (#{library.version})", [:bold, :yellow]
        library.modules.each { |lib_module|
          lib_info = "  #{lib_module}"
          lib_info << ' (installed)' if project.modules.installed?(lib_module)
          say lib_info, :green
        }
      }
    end
  end
  default_command(:list)

  desc 'install SOURCE', 'Install a new library'
  def install(source)
    project = Skippy::Project.current_or_fail
    library = project.libraries.install(source)
    say "Installed library: #{library.name} (#{library.version})"
  end

  desc 'use MODULE', 'Use a library module'
  def use(module_path)
    project = Skippy::Project.current_or_fail
    lib_module = project.modules.use(module_path)
    say "Using module: #{lib_module}"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skippy-0.2.0.a app/commands/lib.rb