<commit_before>#!/usr/bin/env ruby

require 'xcoder'

class ChangelogUtils

	attr_accessor :branch_name

	def self.getProjectName
		projectFiles = Dir["*.xcodeproj"]
		if (projectFiles.size()>0)
			return projectFiles[0].scan(/[^.]*/)[0]
		else 
			return nil
		end
	end
  

	def self.showVersion
		projectName = self.getProjectName
		project="#{projectName}.xcodeproj"
		config="Debug"

		config = Xcode.project(project).target(projectName).config(config)
		version = config.info_plist.version
		`git checkout .` #reset all modified files by xcoder but I don't like this solution
		version
	end
	
	def self.printCurrentChange
		" * #{ChangelogUtils.getLastMessageFromGit.strip} (#{ChangelogUtils.getPullRequestHash.strip})"
	end
	
	def self.goBack
		@branch_name = self.currentBranchName if !@branch_name
		`git checkout HEAD^ >/dev/null 2>/dev/null`
	end
	
	def self.goForward
		`git checkout #{@branch_name} >/dev/null 2>/dev/null`
	end

	def self.getLastMessageFromGit
		`git log -1 --format="%b"`
	end

	def self.isPullRequestMerge
		`git log -1 --format="%s" | cut -c -18`.strip == "Merge pull request"<commit_msg>Revert "Improved the way of getting the version from the plist file"<commit_after>#!/usr/bin/env ruby

class ChangelogUtils

	attr_accessor :branch_name

	def self.getProjectName
		projectFiles = Dir["*.xcodeproj"]
		if (projectFiles.size()>0)
			return projectFiles[0].scan(/[^.]*/)[0]
		else 
			return nil
		end
	end
  

	def self.plistFile
		projectName = ChangelogUtils.getProjectName
	   plistFile = Dir["#{Dir.pwd}/*/#{projectName}-Info.plist"]
  		if (plistFile.size() > 0)
   	   return plistFile[0]
	  	else 
   	   return nil
	  	end
	end

	def self.showVersion
		`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" #{ChangelogUtils.plistFile}`.strip
	end
	
	def self.printCurrentChange
		" * #{ChangelogUtils.getLastMessageFromGit.strip} (#{ChangelogUtils.getPullRequestHash.strip})"
	end
	
	def self.goBack
		@branch_name = self.currentBranchName if !@branch_name
		`git checkout HEAD^ >/dev/null 2>/dev/null`
	end
	
	def self.goForward
		`git checkout #{@branch_name} >/dev/null 2>/dev/null`
	end

	def self.getLastMessageFromGit
		`git log -1 --format="%b"`
	end

	def self.isPullRequestMerge
		`git log -1 --format="%s" | cut -c -18`.strip == "Merge pull request"
{'fraction_non_alphanumeric': 0.1277056277056277, 'fraction_numerical': 0.008658008658008658, 'mean_word_length': 3.9065817409766455, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1042575', 'n_tokens_mistral': 915, 'n_tokens_neox': 819, 'n_words': 188}