lib/kpm/tasks.rb in kpm-0.2.0 vs lib/kpm/tasks.rb in kpm-0.2.1

- old
+ new

@@ -1,8 +1,9 @@ require 'highline' require 'logger' require 'thor' +require 'pathname' module KPM module Tasks def self.included(base) base.send :include, ::Thor::Actions @@ -33,10 +34,23 @@ end method_option :destination, :type => :string, :default => nil, + :desc => 'A different folder other than the default bundles directory.' + method_option :force, + :type => :boolean, + :default => nil, + :desc => 'Don\'t ask for confirmation while deleting multiple versions of a plugin.' + desc 'uninstall plugin', 'Uninstall the specified plugin, identified by its name or key, from current deployment' + def uninstall(plugin) + say 'Done!' if Uninstaller.new(options[:destination]).uninstall_plugin(plugin, options[:force]) + end + + method_option :destination, + :type => :string, + :default => nil, :desc => 'A different folder other than the current working directory.' method_option :force_download, :type => :boolean, :default => false, :desc => 'Force download of the artifact even if it exists' @@ -320,9 +334,36 @@ kb_version = resolved_kb_version.split('.').slice(0,2).join(".") plugins_info = KPM::PluginsDirectory.list_plugins(true, kb_version) say "Known plugin for KB version #{options[:version]}\n " + (plugins_info.map {|k,v| "#{k} #{v}"}).join("\n "), :green + end + + method_option :destination, + :type => :string, + :default => nil, + :desc => 'Folder where to download migration files.' + method_option :token, + :type => :string, + :default => nil, + :desc => 'GitHub OAuth token.' + desc 'migrations repository from to', 'Download migration files for Kill Bill or a plugin' + def migrations(repository, from, to = nil) + full_repo = repository.include?('/') ? repository : "killbill/#{repository}" + dir = KPM::Migrations.new(from, to, full_repo, options[:token], logger).save(options[:destination]) + say (dir.nil? ? 'No migration required' : "Migrations can be found at #{dir}"), :green + end + + method_option :destination, + :type => :string, + :default => nil, + :desc => 'A different folder other than the default bundles directory.' + desc 'inspect', 'Inspect current deployment' + def inspect + inspector = KPM::Inspector.new + all_plugins = inspector.inspect(options[:destination]) + #puts all_plugins.to_json + inspector.format(all_plugins) end private def logger