Module: RakeHelper

Defined in:
lib/ipt/rake_helper.rb

Instance Method Summary collapse

Instance Method Details

#find_binary(name) ⇒ Object

Tries to determine the absolute path to the given binary.



5
6
7
8
9
10
11
12
13
14
# File 'lib/ipt/rake_helper.rb', line 5

def find_binary(name)
  ENV["PATH"].split(":").each do |dir| # we are on a mac anyway
    path = File.join(dir, name)
    if File.executable?(path)
      puts "Found '#{name}' in #{dir}" if $DEBUG
      return File.expand_path(path)
    end
  end
  raise "Unable to find #{name} in the system PATH. Add /path/to/#{name} to your $PATH"
end

#find_current_project_nameObject



16
17
18
19
20
21
22
23
# File 'lib/ipt/rake_helper.rb', line 16

def find_current_project_name
  # Run xcodebuile in the current directory
  info = `xcodebuild -list`
  if info =~ /Targets:(.*?)Build Configurations/m
    return $1.dup.gsub(/\(Active\)/, '').strip
  end
  nil
end

#get_previous_version(current_version) ⇒ Object



31
32
33
34
# File 'lib/ipt/rake_helper.rb', line 31

def get_previous_version(current_version)
  tags = `#{GIT} tag -l`.split("\n")
  resolve_previous_version(tags, current_version)
end

#resolve_tagObject



25
26
27
28
29
# File 'lib/ipt/rake_helper.rb', line 25

def resolve_tag
  last_tag = `#{GIT} describe --tags --always`
  last_tag = last_tag.split('-').first if last_tag =~ /-/  
  IPT::Version.parse(last_tag)
end