Class: Origen::CodeGenerators::Semver

Inherits:
Base
  • Object
show all
Defined in:
lib/origen/code_generators/semver.rb

Instance Method Summary collapse

Methods inherited from Base

banner, inherited, name, namespace

Methods included from Actions

#add_config, #add_source, #comment_config, #config, #environment, #gem, #gem_group, #generate, #git, #initialize, #lib, #rake, #rakefile, #readme

Instance Method Details

#create_version_fileObject


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/origen/code_generators/semver.rb', line 8

def create_version_file
  if config[:change]
    @version = config[:change]
  else
    @version = Origen.app.version
    # Ensure > 0.0.0 due to Bundler issues resolving 0.0.0.preX versions
    until @version.semantic? && @version.greater_than_or_equal_to?(VersionString.new('0.0.1'))
      ver = ask 'What version do you want to start from (this must be > 0.0.0) ? [0.1.0]'
      if !ver || ver.empty?
        @version = VersionString.new('0.1.0')
      else
        @version = VersionString.new(ver)
      end
    end
  end
  template 'templates/code_generators/version.rb', File.join(Origen.root, 'config', 'version.rb'), force: true
end

33
34
35
36
# File 'lib/origen/code_generators/semver.rb', line 33

def print_version
  puts
  puts "You're new app version is: #{Origen.app.version(refresh: true)}"
end

#set_configurationObject


26
27
28
29
30
31
# File 'lib/origen/code_generators/semver.rb', line 26

def set_configuration
  unless Origen.app.config.semantically_version
    comment_config :semantically_version
    add_config :semantically_version, true
  end
end