lib/kpm/installer.rb in kpm-0.0.10 vs lib/kpm/installer.rb in kpm-0.0.11

- old
+ new

@@ -2,10 +2,11 @@ require 'yaml' module KPM class Installer LATEST_VERSION = 'LATEST' + SHA1_FILENAME = 'sha1.yml' def self.from_file(config_path, logger=nil) Installer.new(YAML::load_file(config_path), logger) end @@ -23,19 +24,20 @@ @nexus_config = !@config.nil? ? @config['nexus'] : @kaui_config['nexus'] @nexus_ssl_verify = !@nexus_config.nil? ? @nexus_config['ssl_verify'] : true end - def install + def install(force_download=false) unless @config.nil? install_killbill_server install_plugins install_default_bundles end unless @kaui_config.nil? install_kaui end + @force_download = force_download end private def install_killbill_server @@ -44,16 +46,15 @@ packaging = @config['packaging'] || KPM::BaseArtifact::KILLBILL_PACKAGING classifier = @config['classifier'] || KPM::BaseArtifact::KILLBILL_CLASSIFIER version = @config['version'] || LATEST_VERSION webapp_path = @config['webapp_path'] || KPM::root - KPM::KillbillServerArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, webapp_path, @nexus_config, @nexus_ssl_verify) + KPM::KillbillServerArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, webapp_path, nil, @force_download, @nexus_config, @nexus_ssl_verify) end def install_plugins bundles_dir = @config['plugins_dir'] - install_java_plugins(bundles_dir) install_ruby_plugins(bundles_dir) end def install_java_plugins(bundles_dir) @@ -65,12 +66,13 @@ artifact_id = plugin['artifact_id'] || plugin['name'] packaging = plugin['packaging'] || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING classifier = plugin['classifier'] || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER version = plugin['version'] || LATEST_VERSION destination = "#{bundles_dir}/plugins/java/#{artifact_id}/#{version}" + sha1_file = "#{bundles_dir}/#{SHA1_FILENAME}" - infos << KPM::KillbillPluginArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @nexus_config, @nexus_ssl_verify) + infos << KPM::KillbillPluginArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, sha1_file, @force_download, @nexus_config, @nexus_ssl_verify) end infos end @@ -83,12 +85,13 @@ artifact_id = plugin['artifact_id'] || plugin['name'] packaging = plugin['packaging'] || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING classifier = plugin['classifier'] || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER version = plugin['version'] || LATEST_VERSION destination = "#{bundles_dir}/plugins/ruby" + sha1_file = "#{bundles_dir}/#{SHA1_FILENAME}" - infos << KPM::KillbillPluginArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @nexus_config, @nexus_ssl_verify) + infos << KPM::KillbillPluginArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, sha1_file, @force_download, @nexus_config, @nexus_ssl_verify) end infos end @@ -100,11 +103,11 @@ packaging = 'tar.gz' classifier = nil version = @config['default_bundles_version'] || LATEST_VERSION destination = "#{@config['plugins_dir']}/platform" - info = KPM::BaseArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @nexus_config, @nexus_ssl_verify) + info = KPM::BaseArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, nil, @force_download, @nexus_config, @nexus_ssl_verify) # The special JRuby bundle needs to be called jruby.jar # TODO .first - code smell File.rename Dir.glob("#{destination}/killbill-platform-osgi-bundles-jruby-*.jar").first, "#{destination}/jruby.jar" @@ -117,9 +120,9 @@ packaging = @kaui_config['packaging'] || KPM::BaseArtifact::KAUI_PACKAGING classifier = @kaui_config['classifier'] || KPM::BaseArtifact::KAUI_CLASSIFIER version = @kaui_config['version'] || LATEST_VERSION webapp_path = @kaui_config['webapp_path'] || KPM::root - KPM::KauiArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, webapp_path, @nexus_config, @nexus_ssl_verify) + KPM::KauiArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, webapp_path, nil, @force_download, @nexus_config, @nexus_ssl_verify) end end end