Skip to content

Commit

Permalink
fixing rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
rshade committed Jan 6, 2017
1 parent d66ffb4 commit 48c24ba
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ end

desc 'verifies version and changelog'
task :verify_version do
def get_old_version
def old_version?
f = `git show master:metadata.rb`
f.each_line do |line|
if line =~ /^version/
Expand All @@ -29,7 +29,7 @@ task :verify_version do
@old_version
end

def get_new_version
def new_version?
f = File.read('metadata.rb')
f.each_line do |line|
if line =~ /^version/
Expand All @@ -40,11 +40,11 @@ task :verify_version do
@new_version
end

if `git rev-parse --abbrev-ref HEAD`.strip != 'master'
old_version = get_old_version.tr('\'', '')
new_version = get_new_version.tr('\'', '')
if `git rev-parse --abbrev-ref HEAD`.strip != ('master' && 'HEAD')
old_version = old_version?.tr('\'', '')
new_version = new_version?.tr('\'', '')
puts "Verifying Metdata Version - Old:#{old_version}, New:#{new_version}"
if get_old_version == get_new_version
if old_version == new_version
raise 'You need to increment version before test will pass'
end

Expand Down Expand Up @@ -95,6 +95,13 @@ task :kitchen do
sh(cmd)
end

desc 'clean up test files'
task :clean do
cmd = 'rm -fr berks-cookbooks knife.rb'
puts cmd
sh(cmd)
end

desc 'runs all tests except kitchen'
task except_kitchen: [:verify_version, :cookstyle, :foodcritic, :rspec] do
puts 'running all tests except kitchen'
Expand Down

0 comments on commit 48c24ba

Please sign in to comment.