ios_android_toolbox 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/bin/abandon_topic_branch.rb +36 -0
- data/bin/find_project_info_plist.rb +17 -0
- data/bin/get_app_path_from_xcodebuild_log.rb +14 -0
- data/bin/get_version.rb +17 -0
- data/bin/inc_version.rb +52 -0
- data/bin/inc_version_rc.rb +3 -0
- data/bin/install_prov_profile.rb +75 -0
- data/bin/start_topic_branch.rb +46 -0
- data/ios_android_toolbox.gemspec +24 -0
- data/lib/ios_android_toolbox.rb +31 -0
- data/lib/ios_android_toolbox/android.rb +77 -0
- data/lib/ios_android_toolbox/base.rb +98 -0
- data/lib/ios_android_toolbox/ios.rb +67 -0
- data/lib/ios_android_toolbox/version.rb +3 -0
- metadata +86 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'git'
|
5
|
+
|
6
|
+
username = ENV['USER']
|
7
|
+
|
8
|
+
g = Git.open('.')
|
9
|
+
raise "Cannot open repo" if g.nil?
|
10
|
+
|
11
|
+
current_branch = g.current_branch
|
12
|
+
|
13
|
+
if !/^t_/.match current_branch
|
14
|
+
puts "Not in a topic branch. Nothing to do."
|
15
|
+
exit 0
|
16
|
+
end
|
17
|
+
|
18
|
+
puts current_branch
|
19
|
+
|
20
|
+
# t_master_igorsales_1_0_2_13_20111223_22h36m
|
21
|
+
if !/^t_(.+)_#{username}_(.+)_[0-9]{8}_[0-9][0-9]h[0-9][0-9]m$/.match current_branch
|
22
|
+
puts "Cannot determine parent branch"
|
23
|
+
exit 1
|
24
|
+
end
|
25
|
+
|
26
|
+
parent_branch = $1
|
27
|
+
|
28
|
+
puts "Checking out parent branch: #{parent_branch}"
|
29
|
+
|
30
|
+
raise "Cannot checkout parent branch." if g.branches[parent_branch].nil?
|
31
|
+
|
32
|
+
g.reset_hard
|
33
|
+
|
34
|
+
g.checkout(parent_branch)
|
35
|
+
g.branch(current_branch).delete
|
36
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ios_android_toolbox/ios'
|
5
|
+
require 'ios_android_toolbox/android'
|
6
|
+
|
7
|
+
include IosAndroidToolbox
|
8
|
+
|
9
|
+
file = ARGV.shift
|
10
|
+
|
11
|
+
IosVersionController.find_project_info(file).each do |filename|
|
12
|
+
puts filename
|
13
|
+
end
|
14
|
+
|
15
|
+
AndroidVersionController.find_project_info(file).each do |filename|
|
16
|
+
puts filename
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
|
4
|
+
logfile = ARGV.shift
|
5
|
+
|
6
|
+
IO.foreach(logfile) do |line|
|
7
|
+
# /usr/bin/codesign --force --sign "iPhone Developer: Igor Sales (N6726PC4QE)" --resource-rules=/Users/igorsales/Library/Developer/Xcode/DerivedData/FFSApp-bthsqocpmgfkvfcqpbhzyfofafmp/Build/Products/Adhoc-iphoneos/blacksheep.app/ResourceRules.plist --entitlements /Users/igorsales/Library/Developer/Xcode/DerivedData/FFSApp-bthsqocpmgfkvfcqpbhzyfofafmp/Build/Intermediates/FFSApp.build/Adhoc-iphoneos/___FFSApp___.build/blacksheep.xcent /Users/igorsales/Library/Developer/Xcode/DerivedData/FFSApp-bthsqocpmgfkvfcqpbhzyfofafmp/Build/Products/Adhoc-iphoneos/blacksheep.app
|
8
|
+
#if /[\s[a-z\/]+codesign.*(?<!b)\s([^\s]+\.app)/.match line
|
9
|
+
#if /^[\sa-z\/]+codesign.*\.xcent(\s|")([^\s]+\.app|".+\.app")/.match line
|
10
|
+
if /CodeSign\s+"?(.+\.app)"?/.match line
|
11
|
+
app_name = $1
|
12
|
+
puts app_name
|
13
|
+
end
|
14
|
+
end
|
data/bin/get_version.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'optparse'
|
5
|
+
require 'ios_android_toolbox'
|
6
|
+
require 'ios_android_toolbox'
|
7
|
+
|
8
|
+
include IosAndroidToolbox
|
9
|
+
|
10
|
+
version_file = VersionController.version_file
|
11
|
+
raise "Please specify the version file" if version_file.nil?
|
12
|
+
|
13
|
+
ctrl = version_controller_for_version_file version_file
|
14
|
+
|
15
|
+
puts ctrl.version
|
16
|
+
|
17
|
+
|
data/bin/inc_version.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'optparse'
|
5
|
+
require 'ios_android_toolbox'
|
6
|
+
require 'ios_android_toolbox/ios'
|
7
|
+
require 'ios_android_toolbox/android'
|
8
|
+
|
9
|
+
include IosAndroidToolbox
|
10
|
+
|
11
|
+
$inc_idx = 4
|
12
|
+
$max_comps = 4
|
13
|
+
|
14
|
+
options = {}
|
15
|
+
OptionParser.new do |opts|
|
16
|
+
opts.banner = "Usage: inc_version.rb [options] <info.plist>"
|
17
|
+
|
18
|
+
opts.on("-M", "--major", "Increments MAJOR number") do |v|
|
19
|
+
$inc_idx = 0
|
20
|
+
$max_comps = 3
|
21
|
+
end
|
22
|
+
opts.on("-m", "--minor", "Increments MINOR number") do |v|
|
23
|
+
$inc_idx = 1
|
24
|
+
$max_comps = 3
|
25
|
+
end
|
26
|
+
opts.on("-s", "--subminor", "Increments SUBMINOR number") do |v|
|
27
|
+
$inc_idx = 2
|
28
|
+
$max_comps = 3
|
29
|
+
end
|
30
|
+
opts.on("-rc", "--candidate", "Increments RELEASE CANDIDATE number (default option)") do |v|
|
31
|
+
$inc_idx = 3
|
32
|
+
$max_comps = 4
|
33
|
+
end
|
34
|
+
opts.on("-o", "--output file", "Direction output to file") do |v|
|
35
|
+
$output_file = v
|
36
|
+
end
|
37
|
+
end.parse!
|
38
|
+
|
39
|
+
version_file = VersionController.version_file
|
40
|
+
raise "Please specify the info.plist file" if version_file.nil?
|
41
|
+
|
42
|
+
ctrl = version_controller_for_version_file version_file
|
43
|
+
|
44
|
+
ctrl.inc_idx = $inc_idx
|
45
|
+
ctrl.max_comps = $max_comps
|
46
|
+
ctrl.next_version!
|
47
|
+
|
48
|
+
$output_file = version_file if $output_file == nil
|
49
|
+
|
50
|
+
ctrl.write_to_output_file($output_file)
|
51
|
+
|
52
|
+
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'parsedate'
|
5
|
+
|
6
|
+
DEBUG=false
|
7
|
+
PROV_PROFILE_DIR=ENV['HOME']+'/Library/MobileDevice/Provisioning Profiles'
|
8
|
+
UUID_REGEX='[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}'
|
9
|
+
|
10
|
+
profile_file = ARGV.shift
|
11
|
+
profile_file or raise "Please specify a provisioning profile name"
|
12
|
+
|
13
|
+
prov_profile = File.open(profile_file).read
|
14
|
+
|
15
|
+
def uuid_for_profile(contents)
|
16
|
+
# <key>UUID</key>
|
17
|
+
# <string>06AF2826-608D-4CE9-99AE-AA917FF1641E</string>
|
18
|
+
if /<key>UUID<\/key>\s*<string>(#{UUID_REGEX})<\/string>/.match(contents)
|
19
|
+
puts "Found UUID: #{$1}" if DEBUG
|
20
|
+
uuid = $1
|
21
|
+
else
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def app_id_from_profile(contents)
|
27
|
+
# <key>application-identifier</key>
|
28
|
+
# <string>NDVAA33T9J.com.favequest.FFSApp.87.ircpa</string>
|
29
|
+
if /<key>application-identifier<\/key>\s*<string>[A-Za-z0-9]+\.([^<]+)<\/string>/.match(contents)
|
30
|
+
puts "Found app Id: #{$1}" if DEBUG
|
31
|
+
app_id = $1
|
32
|
+
else
|
33
|
+
nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def creation_date_from_profile(contents)
|
38
|
+
# <key>CreationDate</key>
|
39
|
+
# <date>2011-08-30T02:11:55Z</date>
|
40
|
+
if /<key>CreationDate<\/key>\s*<date>([^<]+)<\/date>/.match(contents)
|
41
|
+
#creation_date = Date.strptime($1, '%Y-%m-%dT%h:%M:%sZ')
|
42
|
+
creation_date = Time.parse($1)
|
43
|
+
puts "Found Creation date: #{creation_date.to_s}" if DEBUG
|
44
|
+
creation_date
|
45
|
+
else
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
new_uuid = uuid_for_profile(prov_profile)
|
51
|
+
new_app_id = app_id_from_profile(prov_profile)
|
52
|
+
new_cdate = creation_date_from_profile(prov_profile)
|
53
|
+
|
54
|
+
# Look through each file in the list
|
55
|
+
Dir.foreach(PROV_PROFILE_DIR) do |item|
|
56
|
+
next if item == '.' or item == '..'
|
57
|
+
|
58
|
+
next if !/#{UUID_REGEX}\.mobileprovision/.match(item)
|
59
|
+
puts "Prov. profile: #{item}" if DEBUG
|
60
|
+
|
61
|
+
old_prov_profile = File.open(PROV_PROFILE_DIR+"/"+item).read
|
62
|
+
|
63
|
+
old_uuid = uuid_for_profile(old_prov_profile)
|
64
|
+
old_app_id = app_id_from_profile(old_prov_profile)
|
65
|
+
old_cdate = creation_date_from_profile(old_prov_profile)
|
66
|
+
|
67
|
+
if old_app_id == new_app_id and old_cdate < new_cdate
|
68
|
+
puts "Removing stale Prov Profile: #{item}"
|
69
|
+
File.unlink PROV_PROFILE_DIR+'/'+item
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
new_profile_path = PROV_PROFILE_DIR+"/#{new_uuid}.mobileprovision"
|
74
|
+
puts "Installing new prov profile into #{new_profile_path}"
|
75
|
+
`cp -f "#{profile_file}" "#{new_profile_path}"`
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'git'
|
5
|
+
require 'ios_android_toolbox'
|
6
|
+
|
7
|
+
include IosAndroidToolbox
|
8
|
+
|
9
|
+
username = ENV['USER']
|
10
|
+
date_tag = Time.now.strftime("%Y%m%d_%Hh%Mm")
|
11
|
+
topic = ARGV.shift
|
12
|
+
|
13
|
+
version_file = VersionController.version_file
|
14
|
+
raise "Please specify the version file" if version_file.nil?
|
15
|
+
|
16
|
+
ctrl = version_controller_for_version_file version_file
|
17
|
+
|
18
|
+
if topic.nil?
|
19
|
+
topic = ctrl.version
|
20
|
+
end
|
21
|
+
|
22
|
+
topic.gsub!(/[\. \t\n]/, '_') if topic
|
23
|
+
|
24
|
+
g = Git.open('.')
|
25
|
+
raise "Cannot open repo" if g.nil?
|
26
|
+
|
27
|
+
current_branch = g.current_branch
|
28
|
+
current_branch = 'master' if current_branch.nil?
|
29
|
+
|
30
|
+
topic_branch = "t_" + current_branch + "_" + username
|
31
|
+
|
32
|
+
topic_branch = topic_branch + "_" + topic if topic
|
33
|
+
|
34
|
+
topic_branch = topic_branch + "_" + date_tag
|
35
|
+
puts "Starting topic branch: #{topic_branch}"
|
36
|
+
|
37
|
+
g.checkout(current_branch)
|
38
|
+
g.branch(topic_branch).delete if g.branches[topic_branch]
|
39
|
+
g.branch(topic_branch).checkout
|
40
|
+
|
41
|
+
# Update the version number and commit
|
42
|
+
ctrl.next_version!
|
43
|
+
ctrl.write_to_output_file version_file
|
44
|
+
|
45
|
+
# Commit the result
|
46
|
+
g.commit_all("Started topic branch '#{topic_branch}'")
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "ios_android_toolbox/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "ios_android_toolbox"
|
7
|
+
s.version = IosAndroidToolbox::VERSION
|
8
|
+
s.authors = ["Igor Sales"]
|
9
|
+
s.email = ["self@igorsales.ca"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Toolbox to manipulate iOS/Android projects}
|
12
|
+
s.description = %q{}
|
13
|
+
|
14
|
+
s.rubyforge_project = "ios_android_toolbox"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'ios_android_toolbox/version'
|
2
|
+
require 'ios_android_toolbox/base'
|
3
|
+
require 'ios_android_toolbox/ios'
|
4
|
+
require 'ios_android_toolbox/android'
|
5
|
+
|
6
|
+
module IosAndroidToolbox
|
7
|
+
def is_android_project?
|
8
|
+
File.file?('AndroidManifest.xml')
|
9
|
+
end
|
10
|
+
|
11
|
+
def is_ios_filename?(filename)
|
12
|
+
/\.plist$/.match(filename)
|
13
|
+
end
|
14
|
+
|
15
|
+
def is_android_filename?(filename)
|
16
|
+
/AndroidManifest\.xml$/.match(filename)
|
17
|
+
end
|
18
|
+
|
19
|
+
def version_controller_for_version_file(version_file)
|
20
|
+
ctrl = nil
|
21
|
+
if is_ios_filename? version_file
|
22
|
+
ctrl = IosVersionController.new(version_file)
|
23
|
+
elsif is_android_filename? version_file
|
24
|
+
ctrl = AndroidVersionController.new(version_file)
|
25
|
+
else
|
26
|
+
raise "Unrecognizable project type for file #{version_file}"
|
27
|
+
end
|
28
|
+
|
29
|
+
ctrl
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'nokogiri'
|
5
|
+
require 'ios_android_toolbox'
|
6
|
+
require 'ios_android_toolbox/base'
|
7
|
+
|
8
|
+
module IosAndroidToolbox
|
9
|
+
|
10
|
+
class AndroidVersionController < VersionController
|
11
|
+
MANIFEST='/manifest'
|
12
|
+
ANDROID_NS='android:'
|
13
|
+
ANDROID_VERSION_CODE='versionCode'
|
14
|
+
ANDROID_VERSION_NAME='versionName'
|
15
|
+
|
16
|
+
def self.find_project_info_candidates_for_dir(dir)
|
17
|
+
candidates = []
|
18
|
+
|
19
|
+
manifests=`find "#{dir}" -name "AndroidManifest.xml"`
|
20
|
+
|
21
|
+
manifests.split("\n").each do |filename|
|
22
|
+
if File.exists?(filename)
|
23
|
+
begin
|
24
|
+
manifest = Nokogiri::XML(File.open(filename)).xpath(MANIFEST, 'android' => "http://schemas.android.com/apk/res/android").first
|
25
|
+
candidates.push filename if manifest and manifest[ANDROID_VERSION_NAME]
|
26
|
+
rescue
|
27
|
+
# Do nothing, just skip the file. Must be in binary format
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
candidates
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(manifest_file)
|
36
|
+
super()
|
37
|
+
raise "No manifest file specified" if manifest_file.nil?
|
38
|
+
|
39
|
+
begin
|
40
|
+
@xml = Nokogiri::XML(File.open(manifest_file))
|
41
|
+
@manifest = @xml.xpath(MANIFEST, 'android' => "http://schemas.android.com/apk/res/android").first
|
42
|
+
rescue
|
43
|
+
raise "Cannot parse file #{version_file}"
|
44
|
+
end
|
45
|
+
|
46
|
+
raise "File #{manifest_fiile} does not have a #{MANIFEST} node" if @xml.xpath(MANIFEST).nil?
|
47
|
+
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def version
|
52
|
+
@manifest[ANDROID_VERSION_NAME]
|
53
|
+
end
|
54
|
+
|
55
|
+
def version_code
|
56
|
+
@manifest[ANDROID_VERSION_CODE]
|
57
|
+
end
|
58
|
+
|
59
|
+
def next_version!(inc_idx = nil)
|
60
|
+
@manifest[ANDROID_NS+ANDROID_VERSION_NAME] = next_version
|
61
|
+
end
|
62
|
+
|
63
|
+
def write_to_xml_file(output_file)
|
64
|
+
if output_file == '-'
|
65
|
+
puts @xml.to_xml
|
66
|
+
else
|
67
|
+
File.open output_file, "w+" do |f|
|
68
|
+
f.write(@xml.to_xml)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def write_to_output_file(output_file)
|
74
|
+
write_to_xml_file(output_file)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ios_android_toolbox'
|
5
|
+
|
6
|
+
module IosAndroidToolbox
|
7
|
+
|
8
|
+
class VersionController
|
9
|
+
attr_accessor :inc_idx, :max_comps
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
@inc_idx = 3
|
13
|
+
@max_comps = 4
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.find_project_info_candidates_for_dir
|
17
|
+
raise "Abstract class method. Please override"
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.find_project_info(dir = nil)
|
21
|
+
dir ||= '.'
|
22
|
+
|
23
|
+
candidates = find_project_info_candidates_for_dir(dir)
|
24
|
+
|
25
|
+
max_components = 9999
|
26
|
+
candidates.each do |filename|
|
27
|
+
components = filename.split(File::SEPARATOR)
|
28
|
+
if components.length < max_components
|
29
|
+
max_components = components.length
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
candidates.find_all { |filename| filename.split(File::SEPARATOR).length == max_components }
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.version_file
|
37
|
+
version_file = ARGV.shift
|
38
|
+
if version_file.nil?
|
39
|
+
files = IosVersionController.find_project_info << AndroidVersionController.find_project_info
|
40
|
+
files.flatten!
|
41
|
+
|
42
|
+
version_file = files.first if files.length == 1
|
43
|
+
end
|
44
|
+
version_file
|
45
|
+
end
|
46
|
+
|
47
|
+
def version
|
48
|
+
raise "Abstract method. Please override"
|
49
|
+
end
|
50
|
+
|
51
|
+
def components
|
52
|
+
version.split('.')
|
53
|
+
end
|
54
|
+
|
55
|
+
def next_version(inc_idx = nil)
|
56
|
+
inc_idx ||= @inc_idx
|
57
|
+
max_comps ||= @max_comps
|
58
|
+
|
59
|
+
comps = components
|
60
|
+
|
61
|
+
should_inc_prev_idx = (inc_idx > 0 and comps[inc_idx].nil?)
|
62
|
+
|
63
|
+
while comps.length < inc_idx
|
64
|
+
comps.push 0
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
if comps.length > inc_idx
|
69
|
+
inc_comp = comps[inc_idx].to_i
|
70
|
+
else
|
71
|
+
inc_comp = -1
|
72
|
+
end
|
73
|
+
|
74
|
+
inc_comp += 1
|
75
|
+
comps[inc_idx] = inc_comp
|
76
|
+
comps.each_index do |i|
|
77
|
+
comps[i] = 0 if i > inc_idx
|
78
|
+
end
|
79
|
+
|
80
|
+
if should_inc_prev_idx
|
81
|
+
comps[inc_idx-1] = comps[inc_idx-1].to_i+1
|
82
|
+
end
|
83
|
+
|
84
|
+
comps = comps.slice(0,max_comps)
|
85
|
+
|
86
|
+
comps.join "."
|
87
|
+
end
|
88
|
+
|
89
|
+
def next_version!(inc_idx = nil)
|
90
|
+
raise "Abstract method. Please override"
|
91
|
+
end
|
92
|
+
|
93
|
+
def write_to_output_file(output_file)
|
94
|
+
raise "Abstract method. Please override"
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'plist'
|
5
|
+
require 'ios_android_toolbox'
|
6
|
+
require 'ios_android_toolbox/base'
|
7
|
+
|
8
|
+
module IosAndroidToolbox
|
9
|
+
|
10
|
+
class IosVersionController < VersionController
|
11
|
+
VERSION_KEY = 'CFBundleVersion'
|
12
|
+
|
13
|
+
def self.find_project_info_candidates_for_dir(dir)
|
14
|
+
candidates = []
|
15
|
+
|
16
|
+
plists=`find "#{dir}" -name "*.plist"`
|
17
|
+
|
18
|
+
plists.split("\n").each do |filename|
|
19
|
+
if File.exists?(filename)
|
20
|
+
begin
|
21
|
+
dict = Plist.parse_xml(filename)
|
22
|
+
candidates.push filename if dict and dict[VERSION_KEY]
|
23
|
+
rescue
|
24
|
+
# Do nothing, just skip the file. Must be in binary format
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
candidates
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(version_file)
|
33
|
+
super()
|
34
|
+
raise "No version file specified" if version_file.nil?
|
35
|
+
|
36
|
+
begin
|
37
|
+
@dict = Plist.parse_xml(version_file)
|
38
|
+
rescue
|
39
|
+
raise "Cannot parse file #{version_file}"
|
40
|
+
end
|
41
|
+
|
42
|
+
raise "File #{version_file} does not have a #{VERSION_KEY} key" if @dict[VERSION_KEY].nil?
|
43
|
+
|
44
|
+
self
|
45
|
+
end
|
46
|
+
|
47
|
+
def version
|
48
|
+
@dict[VERSION_KEY]
|
49
|
+
end
|
50
|
+
|
51
|
+
def next_version!(inc_idx = nil)
|
52
|
+
@dict[VERSION_KEY] = next_version
|
53
|
+
end
|
54
|
+
|
55
|
+
def write_to_plist_file(output_file)
|
56
|
+
if output_file == '-'
|
57
|
+
puts @dict.to_plist
|
58
|
+
else
|
59
|
+
@dict.save_plist output_file
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def write_to_output_file(output_file)
|
64
|
+
write_to_plist_file(output_file)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ios_android_toolbox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Igor Sales
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-12-23 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: ""
|
22
|
+
email:
|
23
|
+
- self@igorsales.ca
|
24
|
+
executables:
|
25
|
+
- abandon_topic_branch.rb
|
26
|
+
- find_project_info_plist.rb
|
27
|
+
- get_app_path_from_xcodebuild_log.rb
|
28
|
+
- get_version.rb
|
29
|
+
- inc_version.rb
|
30
|
+
- inc_version_rc.rb
|
31
|
+
- install_prov_profile.rb
|
32
|
+
- start_topic_branch.rb
|
33
|
+
extensions: []
|
34
|
+
|
35
|
+
extra_rdoc_files: []
|
36
|
+
|
37
|
+
files:
|
38
|
+
- .gitignore
|
39
|
+
- Gemfile
|
40
|
+
- Rakefile
|
41
|
+
- bin/abandon_topic_branch.rb
|
42
|
+
- bin/find_project_info_plist.rb
|
43
|
+
- bin/get_app_path_from_xcodebuild_log.rb
|
44
|
+
- bin/get_version.rb
|
45
|
+
- bin/inc_version.rb
|
46
|
+
- bin/inc_version_rc.rb
|
47
|
+
- bin/install_prov_profile.rb
|
48
|
+
- bin/start_topic_branch.rb
|
49
|
+
- ios_android_toolbox.gemspec
|
50
|
+
- lib/ios_android_toolbox.rb
|
51
|
+
- lib/ios_android_toolbox/android.rb
|
52
|
+
- lib/ios_android_toolbox/base.rb
|
53
|
+
- lib/ios_android_toolbox/ios.rb
|
54
|
+
- lib/ios_android_toolbox/version.rb
|
55
|
+
has_rdoc: true
|
56
|
+
homepage: ""
|
57
|
+
licenses: []
|
58
|
+
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
segments:
|
69
|
+
- 0
|
70
|
+
version: "0"
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project: ios_android_toolbox
|
81
|
+
rubygems_version: 1.3.6
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Toolbox to manipulate iOS/Android projects
|
85
|
+
test_files: []
|
86
|
+
|