lib/cli.rb in inqlude-0.0.5 vs lib/cli.rb in inqlude-0.0.6
- old
+ new
@@ -50,16 +50,18 @@
desc "list", "List libraries"
method_option :remote, :type => :boolean, :aliases => "-r",
:desc => "List remote libraries"
def list
+ process_global_options options
+
handler = ManifestHandler.new @@settings
handler.read_remote
if options[:remote]
- handler.manifests.each do |manifest|
- puts manifest["name"] + "-" + manifest["version"]
+ handler.libraries.each do |library|
+ puts library.name + " (" + library.versions.join(", ") + ")"
end
else
manifests = @@distro.installed handler
manifests.each do |manifest|
puts manifest["name"]
@@ -69,27 +71,49 @@
desc "view", "Create view"
method_option :output_dir, :type => :string, :aliases => "-o",
:desc => "Output directory", :required => true
method_option :enable_disqus, :type => :boolean,
- :desc => "Enable Disqus based comments on generate web pages. Works only on actual domain."
+ :desc => "Enable Disqus based comments on generate web pages. Works only on
+actual domain."
+ method_option :disable_search, :type => :boolean,
+ :desc => "Disable Google based search."
def view
process_global_options options
view = View.new ManifestHandler.new @@settings
view.enable_disqus = options[:enable_disqus]
+ view.enable_search = !options[:disable_search]
view.create options[:output_dir]
end
desc "show <library_name>", "Show library details"
def show name
Upstream.get_involved "Add command for showing library details", 1
end
desc "verify", "Verify manifests"
def verify
- Upstream.get_involved "Add command for verifying manifests", 2
+ process_global_options options
+
+ v = Verifier.new @@settings
+
+ handler = ManifestHandler.new @@settings
+ handler.read_remote
+ count_ok = 0
+ count_error = 0
+ handler.libraries.each do |library|
+ library.manifests.each do |manifest|
+ if v.verify manifest
+ count_ok += 1
+ else
+ count_error += 1
+ end
+ end
+ end
+ puts "#{handler.manifests.count} manifests checked. #{count_ok} ok, " +
+ "#{count_error} with error."
end
desc "create", "Create manifest"
method_option :dry_run, :type => :boolean,
:desc => "Dry run. Don't write files."
@@ -127,16 +151,18 @@
@@distro.uninstall manifest
end
end
desc "install", "Install library"
+ method_option :dry_run, :type => :boolean,
+ :desc => "Only show what would happen, don't install anything."
def install name
handler = ManifestHandler.new @@settings
manifest = handler.manifest name
if !manifest
STDERR.puts "Manifest for '#{name}' not found"
else
- @@distro.install manifest
+ @@distro.install manifest, :dry_run => options[:dry_run]
end
end
private