Skip to content

Commit

Permalink
Merge pull request #201 from SUSE/makefile_version_from_ruby
Browse files Browse the repository at this point in the history
Use RMT::VERSION in Makefile
  • Loading branch information
ikapelyukhin committed Jul 6, 2018
2 parents 7e758f5 + c636b91 commit bca4800
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
14 changes: 2 additions & 12 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,14 @@ rubocop.lint(report_danger: true, inline_comment: true, force_exclusion: true)

# Check that the versions in all files are the same
def check_all_versions_equal
if makefile_version != spec_version || makefile_version != rmt_version || spec_version != rmt_version
if spec_version != rmt_version
error_msg = "The version of RMT is not consistent. These files must specify the same version:\n"
error_msg << "- `lib/rmt.rb` specifies `#{rmt_version}`\n"
error_msg << "- `Makefile` specifies `#{makefile_version}`\n"
error_msg << "- `package/rmt-server.spec` specifies `#{spec_version}`"
error_msg << "- `package/rmt-server.spec` specifies `#{spec_version}`\n"
fail(error_msg)
end
end

def makefile_version
return @_makefile_version if defined?(@_makefile_version)
@_makefile_version = File.open('Makefile', 'r') do |f|
f.each_line do |line|
break line.split('=').last.strip if line =~ /^VERSION/
end
end
end

def spec_version
return @_spec_version if defined?(@_spec_version)
@_spec_version = File.open('package/rmt-server.spec', 'r') do |f|
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = rmt-server
VERSION = 1.0.4
VERSION = $(shell ruby -e 'require "./lib/rmt.rb"; print RMT::VERSION')

all:
@:
Expand Down

0 comments on commit bca4800

Please sign in to comment.