lib/kpm/tasks.rb in kpm-0.2.1 vs lib/kpm/tasks.rb in kpm-0.2.2
- old
+ new
@@ -140,10 +140,14 @@
:desc => 'The plugin artifact packaging'
method_option :classifier,
:type => :string,
:default => KillbillPluginArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER,
:desc => 'The plugin artifact classifier'
+ method_option :from_source_file,
+ :type => :string,
+ :default => nil,
+ :desc => 'Specify the plugin jar that should be used for the installation.'
method_option :destination,
:type => :string,
:default => nil,
:desc => 'A different folder other than the current working directory.'
method_option :force_download,
@@ -156,27 +160,35 @@
:desc => 'Location of the sha1 file'
method_option :verify_sha1,
:type => :boolean,
:default => true,
:desc => 'Validates sha1 sum'
- 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')
+ desc 'install_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 install_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)
+
+ installer = BaseInstaller.new(logger,
+ options[:overrides],
+ options[:ssl_verify])
+
+ if options[:from_source_file].nil?
+ response = installer.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)
+ else
+ response = installer.install_plugin_from_fs(plugin_key, options[:from_source_file], nil, options[:version], options[:destination], 'java')
+ end
+
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
end
@@ -199,10 +211,14 @@
:desc => 'The plugin artifact packaging'
method_option :classifier,
:type => :string,
:default => KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER,
:desc => 'The plugin artifact classifier'
+ method_option :from_source_file,
+ :type => :string,
+ :default => nil,
+ :desc => 'Specify the ruby plugin archive that should be used for the installation.'
method_option :destination,
:type => :string,
:default => nil,
:desc => 'A different folder other than the current working directory.'
method_option :force_download,
@@ -215,26 +231,33 @@
:desc => 'Location of the sha1 file'
method_option :verify_sha1,
:type => :boolean,
:default => true,
:desc => 'Validates sha1 sum'
- 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)
+ desc 'install_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 install_ruby_plugin(plugin_key, kb_version='LATEST')
+ installer = BaseInstaller.new(logger,
+ options[:overrides],
+ options[:ssl_verify])
+
+ if options[:from_source_file].nil?
+ response = installer.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)
+ else
+ response = installer.install_plugin_from_fs(plugin_key, options[:from_source_file], nil, nil, options[:destination], 'ruby')
+ end
+
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
end
method_option :destination,
@@ -362,9 +385,12 @@
inspector = KPM::Inspector.new
all_plugins = inspector.inspect(options[:destination])
#puts all_plugins.to_json
inspector.format(all_plugins)
end
+
+ map :pull_ruby_plugin => :install_ruby_plugin,
+ :pull_java_plugin => :install_java_plugin
private
def logger
logger = ::Logger.new(STDOUT)