Class: ManifestsPlugin

Inherits:
VMC::App::Base
  • Object
show all
Includes:
VMC::App::Sync, VMCManifests
Defined in:
lib/manifests-vmc-plugin/plugin.rb

Constant Summary

Constants included from VMCManifests

VMCManifests::MANIFEST_FILE, VMCManifests::VERSION

Instance Method Summary collapse

Methods included from VMCManifests

#all_apps, #apps_in_manifest, #create_manifest_for, #current_apps, #find_apps, #load_manifest, #manifest, #manifest_file, #resolve_symbol, #save_manifest

Instance Method Details

#wrap_push(cmd, input) ⇒ Object



87
88
89
# File 'lib/manifests-vmc-plugin/plugin.rb', line 87

def wrap_push(cmd, input)

end

#wrap_with_optional_name(name_made_optional, cmd, input) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/manifests-vmc-plugin/plugin.rb', line 15

def wrap_with_optional_name(name_made_optional, cmd, input)
  return cmd.call if input[:all]

  unless manifest
    # if the command knows how to handle this
    if input.has?(:app) || !name_made_optional
      return cmd.call
    else
      return no_apps
    end
  end

  internal, external = apps_in_manifest(input)

  return cmd.call if internal.empty? && !external.empty?

  show_manifest_usage

  apps = internal + external

  if apps.empty?
    apps = current_apps if apps.empty?
    apps = all_apps if apps.empty?
    apps = apps.collect { |app| app[:name] }
  end

  return no_apps if apps.empty?

  apps.each.with_index do |app, num|
    line unless quiet? || num == 0
    cmd.call(input.without(:apps).merge_given(:app => app))
  end
end