ios_android_toolbox 0.0.41 → 0.0.42

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 516fadb8d12fefef4ab86cb254db207ac36f1c3e
4
- data.tar.gz: a9d581c026006355b3a74598521d6aef75e58ce2
3
+ metadata.gz: 387576a63198d50d341779c11bee0e42d586a3e3
4
+ data.tar.gz: ef990d697317c14c36602c4929b1025206f41683
5
5
  SHA512:
6
- metadata.gz: bc05b0f5fab4ec01f6f220cb60d02f22dad91a4b2635d6daca566101e1f8b08b9705b88cc7f2acc62314cfb63ae937856d59de5363cee50fc56b0eaefce67e57
7
- data.tar.gz: 0e5a498ad5c170cb6457e4edcf1e32e51e51e94c3fb39c4c3302e371dfcb68421a46ae515f4a27b5914521351b3e0c6060716be8b4f7d65d2fbe52257ea5b271
6
+ metadata.gz: 75dc0fbda087b5920e7e852e602edf30dff6fd297c11beec6b0a8fbd47697ceb703d9ec4dc0a50960d0b55411bdd5b22f89375f973c686007b2a456eee3f39f3
7
+ data.tar.gz: b4464bf999d73a06844ecfac28ffe2a2b88347e11ad2aa59b1bdafd7caaa529d2adc30db57f2ec89b2068c2f284c01b8e73da50d3d8daf94aa0ff53742d973e8
data/.gitignore CHANGED
@@ -2,3 +2,5 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .rspec
6
+ vendor
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in ios_toolbox.gemspec
4
4
  #gemspec
@@ -6,3 +6,5 @@ source "http://rubygems.org"
6
6
  gem 'git'
7
7
  gem 'plist', :git => 'git://github.com/igorsales/plist.git', :require => 'plist'
8
8
  gem 'nokogiri'
9
+ gem 'rspec', :group => :development
10
+ gem 'rspec-expectations', :group => :development
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
22
+ s.add_development_dependency "rspec"
23
23
  # s.add_runtime_dependency "rest-client"
24
24
  s.add_runtime_dependency 'git'
25
25
  #s.add_runtime_dependency 'plist', :git => 'git://github.com/igorsales/plist.git', :require => 'plist'
@@ -63,7 +63,7 @@ module IosAndroidToolbox
63
63
  v = $1
64
64
  suffix = $2
65
65
  end
66
- v.split('.')
66
+ v.split(/[\.]/)
67
67
  end
68
68
 
69
69
  def suffix
@@ -112,6 +112,10 @@ module IosAndroidToolbox
112
112
  raise "Abstract method. Please override"
113
113
  end
114
114
 
115
+ def next_build_number!
116
+ raise "Abstract method. Please override"
117
+ end
118
+
115
119
  def write_to_output_file(output_file)
116
120
  raise "Abstract method. Please override"
117
121
  end
@@ -8,8 +8,8 @@ require 'ios_android_toolbox/base'
8
8
  module IosAndroidToolbox
9
9
 
10
10
  class IosVersionController < VersionController
11
- VERSION_KEY = 'CFBundleVersion'
12
- SHORT_VERSION_KEY = 'CFBundleShortVersionString'
11
+ BUILD_VERSION_KEY = 'CFBundleVersion' # User as Build or release candidate
12
+ BUNDLE_VERSION_KEY = 'CFBundleShortVersionString' # Use as Version
13
13
  URL_TYPES_KEY = "CFBundleURLTypes"
14
14
  URL_SCHEMES_KEY = "CFBundleURLSchemes"
15
15
  BUNDLE_IDENTIFIER_KEY = "CFBundleIdentifier"
@@ -26,7 +26,7 @@ module IosAndroidToolbox
26
26
  if File.exists?(filename)
27
27
  begin
28
28
  dict = Plist.parse_xml(filename)
29
- candidates.push filename if dict and dict[SHORT_VERSION_KEY]
29
+ candidates.push filename if dict and dict[BUNDLE_VERSION_KEY]
30
30
  rescue
31
31
  # Do nothing, just skip the file. Must be in binary format
32
32
  end
@@ -46,13 +46,13 @@ module IosAndroidToolbox
46
46
  raise "Cannot parse file #{version_file}"
47
47
  end
48
48
 
49
- raise "File #{version_file} does not have a #{SHORT_VERSION_KEY} key" if @dict[SHORT_VERSION_KEY].nil?
49
+ raise "File #{version_file} does not have a #{BUNDLE_VERSION_KEY} key" if @dict[BUNDLE_VERSION_KEY].nil?
50
50
 
51
51
  self
52
52
  end
53
53
 
54
54
  def version
55
- @dict[SHORT_VERSION_KEY]
55
+ "#{@dict[BUNDLE_VERSION_KEY]}-#{@dict[BUILD_VERSION_KEY]}"
56
56
  end
57
57
 
58
58
  def bundle_id
@@ -75,8 +75,42 @@ module IosAndroidToolbox
75
75
  bundle_id
76
76
  end
77
77
 
78
- def next_version!(inc_idx = nil)
79
- @dict[SHORT_VERSION_KEY] = @dict[VERSION_KEY] = next_version
78
+ def bundle_version
79
+ @dict[BUNDLE_VERSION_KEY]
80
+ end
81
+
82
+ def build_number
83
+ @dict[BUILD_VERSION_KEY]
84
+ end
85
+
86
+ def next_version(inc_idx = @inc_idx)
87
+ if inc_idx == @inc_idx # trying to increment build number
88
+ v = bundle_version
89
+ s = (build_number.to_i + 1).to_s
90
+ else
91
+ v = super.next_version(inc_idx)
92
+ s = build_number
93
+ end
94
+
95
+ "#{v}-#{s}"
96
+ end
97
+
98
+ def next_version!(inc_idx = @inc_idx)
99
+ if inc_idx < @inc_idx
100
+ @dict[BUNDLE_VERSION_KEY] = next_version(inc_idx)
101
+ else
102
+ @dict[BUILD_VERSION_KEY] = (build_number.to_i + 1).to_s
103
+ end
104
+
105
+ version
106
+ end
107
+
108
+ def next_build_number
109
+ next_version(@inc_idx)
110
+ end
111
+
112
+ def next_build_number!
113
+ next_version!(@inc_idx)
80
114
  end
81
115
 
82
116
  def url_types
@@ -1,3 +1,3 @@
1
1
  module IosAndroidToolbox
2
- VERSION = "0.0.41"
2
+ VERSION = "0.0.42"
3
3
  end
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>English</string>
7
+ <key>CFBundleDisplayName</key>
8
+ <string>${PRODUCT_NAME}</string>
9
+ <key>CFBundleExecutable</key>
10
+ <string>${EXECUTABLE_NAME}</string>
11
+ <key>CFBundleIconFile</key>
12
+ <string>icon_app.png</string>
13
+ <key>CFBundleIconFiles</key>
14
+ <array>
15
+ <string>icon_app.png</string>
16
+ <string>icon_app@2x.png</string>
17
+ </array>
18
+ <key>CFBundleIdentifier</key>
19
+ <string>com.example.app</string>
20
+ <key>CFBundleInfoDictionaryVersion</key>
21
+ <string>6.0</string>
22
+ <key>CFBundleName</key>
23
+ <string>${PRODUCT_NAME}</string>
24
+ <key>CFBundlePackageType</key>
25
+ <string>APPL</string>
26
+ <key>CFBundleShortVersionString</key>
27
+ <string>1.2.3</string>
28
+ <key>CFBundleSignature</key>
29
+ <string>????</string>
30
+ <key>CFBundleURLTypes</key>
31
+ <array/>
32
+ <key>CFBundleVersion</key>
33
+ <string>4</string>
34
+ <key>LSRequiresIPhoneOS</key>
35
+ <true/>
36
+ <key>NSLocationAlwaysUsageDescription</key>
37
+ <string></string>
38
+ <key>NSLocationWhenInUseUsageDescription</key>
39
+ <string></string>
40
+ <key>NSMainNibFile</key>
41
+ <string>MainWindow</string>
42
+ <key>UIBackgroundModes</key>
43
+ <array/>
44
+ </dict>
45
+ </plist>
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ include IosAndroidToolbox
4
+
5
+ describe 'iOS versioning', :type => :model do
6
+ before :all do
7
+
8
+ end
9
+
10
+ before :each do
11
+ @controller = IosVersionController.new(File.join(File.dirname(__FILE__),'fixtures','info1.plist'))
12
+ end
13
+
14
+ it 'should read the right version number' do
15
+ expect(@controller.version).to eq '1.2.3-4'
16
+ end
17
+
18
+ it 'increments the build number on next version' do
19
+ expect(@controller.next_build_number!).to eq '1.2.3-5'
20
+ expect(@controller.version).to eq '1.2.3-5'
21
+ end
22
+ end
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+ Bundler.setup
3
+
4
+ require 'ios_android_toolbox'
5
+
6
+ RSpec.configure do |config|
7
+
8
+ end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ios_android_toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.41
4
+ version: 0.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Sales
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: git
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -82,6 +96,9 @@ files:
82
96
  - lib/ios_android_toolbox/ios.rb
83
97
  - lib/ios_android_toolbox/ios_prov_profile.rb
84
98
  - lib/ios_android_toolbox/version.rb
99
+ - spec/fixtures/info1.plist
100
+ - spec/ios_version_spec.rb
101
+ - spec/spec_helper.rb
85
102
  homepage: ''
86
103
  licenses: []
87
104
  metadata: {}
@@ -105,4 +122,7 @@ rubygems_version: 2.0.14
105
122
  signing_key:
106
123
  specification_version: 4
107
124
  summary: Toolbox to manipulate iOS/Android projects
108
- test_files: []
125
+ test_files:
126
+ - spec/fixtures/info1.plist
127
+ - spec/ios_version_spec.rb
128
+ - spec/spec_helper.rb