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

- old
+ new

@@ -42,11 +42,11 @@ :desc => 'Force download of the artifact even if it exists' method_option :verify_sha1, :type => :boolean, :default => true, :desc => 'Validate sha1 sum' - desc 'pull_kb_server_war version', 'Pulls Kill Bill server war from Sonatype and places it on your machine.' + desc 'pull_kb_server_war <version>', 'Pulls Kill Bill server war from Sonatype and places it on your machine. If version was not specified it uses the latest released version.' def pull_kb_server_war(version='LATEST') response = KillbillServerArtifact.pull(logger, KillbillServerArtifact::KILLBILL_GROUP_ID, KillbillServerArtifact::KILLBILL_ARTIFACT_ID, KillbillServerArtifact::KILLBILL_PACKAGING, @@ -80,11 +80,11 @@ :desc => 'Force download of the artifact even if it exists' method_option :verify_sha1, :type => :boolean, :default => true, :desc => 'Validates sha1 sum' - desc 'pull_kp_server_war version', 'Pulls Kill Pay server war from Sonatype and places it on your machine.' + desc 'pull_kp_server_war <version>', 'Pulls Kill Pay server war from Sonatype and places it on your machine. If version was not specified it uses the latest released version.' def pull_kp_server_war(version='LATEST') response = KillbillServerArtifact.pull(logger, KillbillServerArtifact::KILLBILL_GROUP_ID, KillbillServerArtifact::KILLPAY_ARTIFACT_ID, KillbillServerArtifact::KILLPAY_PACKAGING, @@ -106,10 +106,30 @@ KillbillServerArtifact::KILLPAY_CLASSIFIER, options[:overrides], options[:ssl_verify]).to_a.join(', ')}", :green end + method_option :group_id, + :type => :string, + :default => KillbillPluginArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID, + :desc => 'The plugin artifact group-id' + method_option :artifact_id, + :type => :string, + :default => nil, + :desc => 'The plugin artifact id' + method_option :version, + :type => :string, + :default => nil, + :desc => 'The plugin artifact version' + method_option :packaging, + :type => :string, + :default => KillbillPluginArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING, + :desc => 'The plugin artifact packaging' + method_option :classifier, + :type => :string, + :default => KillbillPluginArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER, + :desc => 'The plugin artifact classifier' method_option :destination, :type => :string, :default => nil, :desc => 'A different folder other than the current working directory.' method_option :force_download, @@ -122,27 +142,53 @@ :desc => 'Location of the sha1 file' method_option :verify_sha1, :type => :boolean, :default => true, :desc => 'Validates sha1 sum' - desc 'pull_java_plugin artifact_id', 'Pulls a java plugin from Sonatype and places it on your machine.' - def pull_java_plugin(artifact_id, version='LATEST') - response = KillbillPluginArtifact.pull(logger, - KillbillPluginArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID, - artifact_id, - KillbillPluginArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING, - KillbillPluginArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER, - version, - options[:destination], - options[:sha1_file], - options[:force_download], - options[:verify_sha1], - options[:overrides], - options[:ssl_verify]) + desc 'pull_java_plugin plugin-key <kb-version>', 'Pulls a java plugin from Sonatype and installs it under the specified destination. If the kb-version has been specified, it is used to download the matching plugin artifact version; if not, it uses the specified plugin version or if null, the LATEST one.' + def pull_java_plugin(plugin_key, kb_version='LATEST') + + response = BaseInstaller.new(logger, + options[:overrides], + options[:ssl_verify]).install_plugin(plugin_key, + kb_version, + options[:group_id], + options[:artifact_id], + options[:packaging], + options[:classifier], + options[:version], + options[:destination], + 'java', + options[:force_download], + options[:verify_sha1], + false) say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green end + + + + method_option :group_id, + :type => :string, + :default => KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID, + :desc => 'The plugin artifact group-id' + method_option :artifact_id, + :type => :string, + :default => nil, + :desc => 'The plugin artifact id' + method_option :version, + :type => :string, + :default => nil, + :desc => 'The plugin artifact version' + method_option :packaging, + :type => :string, + :default => KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING, + :desc => 'The plugin artifact packaging' + method_option :classifier, + :type => :string, + :default => KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER, + :desc => 'The plugin artifact classifier' method_option :destination, :type => :string, :default => nil, :desc => 'A different folder other than the current working directory.' method_option :force_download, @@ -155,25 +201,28 @@ :desc => 'Location of the sha1 file' method_option :verify_sha1, :type => :boolean, :default => true, :desc => 'Validates sha1 sum' - desc 'pull_ruby_plugin artifact_id', 'Pulls a ruby plugin from Sonatype and places it on your machine.' - def pull_ruby_plugin(artifact_id, version='LATEST') - response = KillbillPluginArtifact.pull(logger, - KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID, - artifact_id, - KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING, - KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER, - version, - options[:destination], - options[:sha1_file], - options[:force_download], - options[:verify_sha1], - options[:overrides], - options[:ssl_verify]) + desc 'pull_ruby_plugin plugin-key <kb-version>', 'Pulls a ruby plugin from Sonatype and installs it under the specified destination. If the kb-version has been specified, it is used to download the matching plugin artifact version; if not, it uses the specified plugin version or if null, the LATEST one.' + def pull_ruby_plugin(plugin_key, kb_version='LATEST') + response = BaseInstaller.new(logger, + options[:overrides], + options[:ssl_verify]).install_plugin(plugin_key, + kb_version, + options[:group_id], + options[:artifact_id], + options[:packaging], + options[:classifier], + options[:version], + options[:destination], + 'ruby', + options[:force_download], + options[:verify_sha1], + true) say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green + end method_option :destination, :type => :string, :default => nil, @@ -184,11 +233,11 @@ :desc => 'Force download of the artifact even if it exists' method_option :verify_sha1, :type => :boolean, :default => true, :desc => 'Validates sha1 sum' - desc 'pull_defaultbundles', 'Pulls the default OSGI bundles from Sonatype and places it on your machine.' + desc 'pull_defaultbundles <kb-version>', 'Pulls the default OSGI bundles from Sonatype and places it on your machine. If the kb-version has been specified, it is used to download the matching platform artifact; if not, it uses the latest released version.' def pull_defaultbundles(kb_version='LATEST') response = BaseInstaller.new(logger, options[:overrides], options[:ssl_verify]) .install_default_bundles(options[:destination], @@ -228,11 +277,11 @@ :desc => 'Location of the sha1 file' method_option :verify_sha1, :type => :boolean, :default => true, :desc => 'Validates sha1 sum' - desc 'pull_kaui_war version', 'Pulls Kaui war from Sonatype and places it on your machine.' + desc 'pull_kaui_war <version>', 'Pulls Kaui war from Sonatype and places it on your machine. If version was not specified it uses the latest released version.' def pull_kaui_war(version='LATEST') response = KauiArtifact.pull(logger, KauiArtifact::KAUI_GROUP_ID, KauiArtifact::KAUI_ARTIFACT_ID, KauiArtifact::KAUI_PACKAGING, @@ -256,14 +305,24 @@ :type => :string, :default => 'LATEST', :desc => 'Kill Bill version' desc 'info', 'Describe information about a Kill Bill version' def info - info = KillbillServerArtifact.info(options[:version], + + say "Fetching info for version #{options[:version]}...\n" + + versions_info = KillbillServerArtifact.info(options[:version], options[:overrides], options[:ssl_verify]) + say "Dependencies for version #{options[:version]}\n " + (versions_info.map {|k,v| "#{k} #{v}"}).join("\n "), :green + say "\n\n" - say "Dependencies for version #{options[:version]}\n " + (info.map {|k,v| "#{k} #{v}"}).join("\n "), :green + resolved_kb_version = versions_info['killbill'] + 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 private def logger