ios_android_toolbox 0.0.6 → 0.0.7
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/bin/ios_replace_url_scheme.rb +45 -0
- data/lib/ios_android_toolbox/ios.rb +22 -0
- data/lib/ios_android_toolbox/version.rb +1 -1
- metadata +6 -4
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ios_android_toolbox/ios'
|
5
|
+
|
6
|
+
include IosAndroidToolbox
|
7
|
+
|
8
|
+
prev = ARGV.shift
|
9
|
+
replace = ARGV.shift
|
10
|
+
|
11
|
+
if prev.nil? and replace.nil?
|
12
|
+
puts "Usage: ios_replace_url_scheme [prev] replace"
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
|
16
|
+
if replace.nil?
|
17
|
+
replace = prev
|
18
|
+
prev = nil
|
19
|
+
end
|
20
|
+
|
21
|
+
version_file = VersionController.version_file
|
22
|
+
|
23
|
+
ctrl = version_controller_for_version_file version_file
|
24
|
+
|
25
|
+
schemes = ctrl.url_schemes
|
26
|
+
|
27
|
+
exit if schemes.empty?
|
28
|
+
|
29
|
+
if prev.nil?
|
30
|
+
prev = schemes[0]
|
31
|
+
else
|
32
|
+
regex = Regexp.new(prev)
|
33
|
+
prevs = schemes.select do |scheme|
|
34
|
+
regex.match(scheme)
|
35
|
+
end
|
36
|
+
|
37
|
+
if prevs.length > 0
|
38
|
+
prev = prevs[0]
|
39
|
+
else
|
40
|
+
prev = nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
ctrl.replace_url_scheme(prev, replace)
|
45
|
+
ctrl.write_to_plist_file('-')
|
@@ -10,6 +10,8 @@ module IosAndroidToolbox
|
|
10
10
|
class IosVersionController < VersionController
|
11
11
|
VERSION_KEY = 'CFBundleVersion'
|
12
12
|
SHORT_VERSION_KEY = 'CFBundleShortVersionString'
|
13
|
+
URL_TYPES_KEY = "CFBundleURLTypes"
|
14
|
+
URL_SCHEMES_KEY = "CFBundleURLSchemes"
|
13
15
|
|
14
16
|
def self.find_project_info_candidates_for_dir(dir)
|
15
17
|
candidates = []
|
@@ -53,6 +55,26 @@ module IosAndroidToolbox
|
|
53
55
|
@dict[SHORT_VERSION_KEY] = @dict[VERSION_KEY] = next_version
|
54
56
|
end
|
55
57
|
|
58
|
+
def url_types
|
59
|
+
@dict[URL_TYPES_KEY]
|
60
|
+
end
|
61
|
+
|
62
|
+
def url_schemes
|
63
|
+
schemes = url_types.collect do |ary|
|
64
|
+
ary[URL_SCHEMES_KEY]
|
65
|
+
end
|
66
|
+
schemes.flatten
|
67
|
+
end
|
68
|
+
|
69
|
+
def replace_url_scheme(prev, replace)
|
70
|
+
url_types.each do |url_type_dict|
|
71
|
+
schemes = url_type_dict[URL_SCHEMES_KEY]
|
72
|
+
schemes.each_index do |i|
|
73
|
+
schemes[i] = replace if prev == schemes[i]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
56
78
|
def write_to_plist_file(output_file)
|
57
79
|
if output_file == '-'
|
58
80
|
puts @dict.to_plist
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ios_android_toolbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Igor Sales
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-03-26 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: ""
|
@@ -30,6 +30,7 @@ executables:
|
|
30
30
|
- inc_version.rb
|
31
31
|
- inc_version_rc.rb
|
32
32
|
- install_prov_profile.rb
|
33
|
+
- ios_replace_url_scheme.rb
|
33
34
|
- start_topic_branch.rb
|
34
35
|
extensions: []
|
35
36
|
|
@@ -47,6 +48,7 @@ files:
|
|
47
48
|
- bin/inc_version.rb
|
48
49
|
- bin/inc_version_rc.rb
|
49
50
|
- bin/install_prov_profile.rb
|
51
|
+
- bin/ios_replace_url_scheme.rb
|
50
52
|
- bin/start_topic_branch.rb
|
51
53
|
- ios_android_toolbox.gemspec
|
52
54
|
- lib/ios_android_toolbox.rb
|