Class: Builderator::Tasks::Version
- Includes:
- Thor::Actions
- Defined in:
- lib/builderator/tasks/version.rb
Overview
Tasks to detect and increment package versions
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Thor::Actions
#run, #run_with_input, #run_without_bundler, #template, #thor_run
Class Method Details
.exit_on_failure? ⇒ Boolean
15 16 17 |
# File 'lib/builderator/tasks/version.rb', line 15 def self.exit_on_failure? true end |
Instance Method Details
#bump(type = :auto, prerelease_name = nil) ⇒ Object
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 |
# File 'lib/builderator/tasks/version.rb', line 38 def bump(type = :auto, prerelease_name = nil) # Workaround for singleton git provider not supporting alternate path. ENV['GIT_DIR'] = [:git_dir] if [:git_dir] ## Guard: Don't try to create a new version if `create_tags` is explicitly disabled ## or `search_tags` is disabled as we won't have a valid current version to increment unless Config.autoversion. && Config.autoversion. say_status :disabled, 'Tag creation is disabled for this build. Not '\ 'creating new SCM tags!', :red ## Try to read the current version anyway, incase `search_tags == true` current return end say_status :bump, "by #{type} version" Control::Version.bump(type, prerelease_name) ## Print the new version and write out a VERSION file current ## Try to create and push a tag run "git tag #{Control::Version.current}" run 'git push --tags' end |
#current ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/builderator/tasks/version.rb', line 22 def current # Workaround for singleton git provider not supporting alternate path. ENV['GIT_DIR'] = [:git_dir] if [:git_dir] unless Config.autoversion. say_status :disabled, 'Automatically detecting version information '\ 'from SCM tags is disabled', :red return end say_status :version, "#{Control::Version.current} (#{Control::Version.current.ref})" Control::Version.write Control::Version.set_config_version end |