lib/d3/admin/add.rb in depot3-3.0.9 vs lib/d3/admin/add.rb in depot3-3.0.11

- old
+ new

@@ -52,11 +52,11 @@ pre_install post_install pre_remove post_remove expiration - expiration_path + expiration_paths source_path }.map{|i| i.to_sym} ### If we need to build the pkg, these options are needed BUILD_OPTIONS = [:workspace, :package_build_type] @@ -113,10 +113,11 @@ chosen_opt = menu_options[choice] # Here the value we're actually editing current_opt_value = options[chosen_opt] + # if we're editing version or revision, and the current pkg or filenames are # based on them then make a note to update the names when we get the new values if chosen_opt == :basename or chosen_opt == :version or chosen_opt == :revision update_edition = true update_pkg_name = options.package_name.start_with? options.edition @@ -135,10 +136,18 @@ end # prompt for a new value and put it in place options[chosen_opt] = D3::Admin::Interactive.get_value(chosen_opt, current_opt_value, nil) + # if we changed the version, reset the revision to 1 and update values as needed + if chosen_opt == :version and options[chosen_opt] != current_opt_value + options[:revision] = 1 + update_edition = true + update_pkg_name = options.package_name.start_with? options.edition + update_filename = options.filename.start_with? options.edition + end + # if we edited the version or revision, we might need to update names and edition options.edition = "#{options.basename}-#{options.version}-#{options.revision}" if update_edition options.package_name = "#{options.edition}.#{options.package_build_type}" if update_pkg_name options.filename = "#{options.edition}.#{options.package_build_type}" if update_filename @@ -269,10 +278,10 @@ errors << "Auto and Excluded group-lists can't contain groups in common." end # expiration path if expiration if options_from_user[:expiration] > 0 - errors << "expiration path cannot be empty if expiration is > 0 ." unless options_from_user[:expiration_path] + errors << "expiration path cannot be empty if expiration is > 0 ." unless options_from_user[:expiration_paths] end return [options_from_user, errors] end # validate_all_new_package_options ### Figure out the default values for all options for creating a new package