Class: Origen::Application::Release
- Includes:
- Users, Utility, Utility::InputCapture, Utility::TimeAndDate
- Defined in:
- lib/origen/application/release.rb
Overview
Responsible for co-ordinating application releases
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Release
constructor
A new instance of Release.
-
#run(options) ⇒ Object
Release a new application version.
Methods included from Utility
Methods included from Utility::InputCapture
#find_space, #get_text, #split_long_line
Methods included from Utility::TimeAndDate
Methods included from Users
#admins, #app_users, #current_user
Constructor Details
Class Method Details
.valid_types ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/origen/application/release.rb', line 15 def self.valid_types if Origen.config.semantically_version if Origen.app.version.development? [:development, :production] else [:development, :tiny, :minor, :major] end else [:development, :production] end end |
Instance Method Details
#run(options) ⇒ Object
Release a new application version
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/origen/application/release.rb', line 28 def run() # Don't want plugin callbacks kicking in during the release process Origen.app.plugins.disable_current @options = if Origen.app.plugins.validate_production_status(true) fail 'No revision control configured for this application, cannot release a new version' if Origen.app.rc.nil? unless Origen.app.rc.local_modifications.empty? puts <<-EOT Your workspace has local modifications that are preventing the requested action - run 'origen rc mods' to see them. EOT exit 1 end get_release_type unless type validate_branch # For development tags always include the latest updates from everyone else, # for production tag exactly what is in the user's workspace if type == :development && ![:no_fetch] puts 'Fetching the latest version of all application files...' Origen.app.rc.checkout(force: true) end Origen.app.listeners_for(:validate_release).each(&:validate_release) lint_test get_latest_version_files base_version = Origen.app.version(refresh: true) # Read in the latest version get_release_note unless note new_version = get_or_confirm_version(type) # Don't mask this like the above! write_version(new_version) # Refresh the version in the current thread Origen.app.version(refresh: true) if Origen.app.version != new_version fail "Sorry something has gone wrong trying to update the version counter to #{new_version}!" end Origen.app.version_tracker.add_version(Origen.app.version) if Origen.app.version.production? write_history Origen.app.listeners_for(:before_release_tag).each do |listener| listener.before_release_tag(tag, note, type, selector, ) end puts "Tagging workspace, this could take a few minutes, don't interrupt..." Origen.app.rc.checkin("#{version_file} #{history_file} #{File.join(Origen.root, 'Gemfile.lock')}", force: true, comment: 'Updated app version and history') workspace_dirs.each do |wdir| Origen.app.rc.tag tag end begin Origen.client.release! rescue # Don't allow any server post errors to kill the release process end release_gem Origen.app.listeners_for(:after_release_tag).each do |listener| listener.after_release_tag(tag, note, type, selector, ) end @mailer.send_release_notice(tag, note, type, selector) unless [:silent] Origen.app.listeners_for(:after_release_email).each do |listener| listener.after_release_email(tag, note, type, selector, ) end puts "Successfully released version #{Origen.app.version}!" end end |