fastlane-plugin-versioning 0.2.6 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a4a70cac9311a1ce1955c8e720defe4ce9432aa
4
- data.tar.gz: 9c1710bbea9fb591490039f317a437246d42e395
3
+ metadata.gz: 749bf9d3c7aab89d0b8c8a0f273daabd859891c3
4
+ data.tar.gz: 62f2d4ceeb98b3de90f3fd607b8d159471960a07
5
5
  SHA512:
6
- metadata.gz: fb80d0659cce57c7d012d56f9cebeaf928a238ef686e639ab73b308eec56cfe79025ba10b23ba5e31f726b273265575eb1fac0a8a84995c35e21ec354701bbf1
7
- data.tar.gz: a20f660514e5a9bece2da98a364ae1ddea1cd9c7ffd4fd60061d0d2ed6f72e27f508ea7cef712c45664ef2081bf0c72fba506b2f0aa30a59cf47ed21964c49ad
6
+ metadata.gz: 29505ea2cccf47cdb47616d915bd2cca64a762e7173a5b898b87969c9dc651921aceaa0bc299d4ac5758ecb2025d7a96dd07ccede859427d1d0e0b22a77b9a51
7
+ data.tar.gz: 6c8c51b9672abffa69d158024581c17d5026d69ee6738e43d5a61195f7527420ba48915362e616ed8fc865485ea61a29d74b7c7bbafe73ba1855e9ba7a1e7e72
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Versioning `fastlane` Plugin
2
2
 
3
- [![CI Status](http://img.shields.io/travis/SiarheiFedartsou/fastlane-plugin-versioning.svg?style=flat)](https://travis-ci.org/SiarheiFedartsou/fastlane-plugin-versioning)
3
+ ![CI Status](https://travis-ci.org/SiarheiFedartsou/fastlane-plugin-versioning.svg?branch=master)
4
4
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-versioning)
5
5
 
6
6
 
@@ -15,6 +15,8 @@ fastlane add_plugin versioning
15
15
  ## About versioning
16
16
 
17
17
  Extends fastlane versioning actions. Allows to set/get versions without using agvtool and do some other small tricks.
18
+ Note that all schemes that you pass to actions like `increment_version_number_in_plist` or `get_info_plist_path` in `scheme` parameter must be shared.
19
+ To make your scheme shared go to "Manage schemes" in Xcode and tich "Shared" checkbox near your scheme.
18
20
 
19
21
  ## Actions
20
22
 
@@ -48,7 +50,7 @@ increment_version_number_in_plist(
48
50
  # or if you have multiple xcodeproj's in the root directory)
49
51
  xcodeproj: './path/to/MyApp.xcodeproj'
50
52
  # (optional)
51
- target: 'TestTarget'
53
+ target: 'TestTarget' # or `scheme`
52
54
  )
53
55
  ```
54
56
 
@@ -58,7 +60,7 @@ Get version number from Info.plist of specific target. Doesn't use agvtool (unli
58
60
 
59
61
  ```ruby
60
62
  version = get_version_number_from_plist(xcodeproj: 'Project.xcodeproj', # optional
61
- target: 'TestTarget', # optional
63
+ target: 'TestTarget', # optional, or `scheme`
62
64
  # optional, must be specified if you have different Info.plist build settings
63
65
  # for different build configurations
64
66
  build_configuration_name: 'Release')
@@ -69,7 +71,7 @@ version = get_version_number_from_plist(xcodeproj: 'Project.xcodeproj', # option
69
71
 
70
72
  ```ruby
71
73
  version = get_app_store_version_number(xcodeproj: 'Project.xcodeproj', # optional
72
- target: 'TestTarget', # optional
74
+ target: 'TestTarget', # optional, or `scheme`
73
75
  # optional, must be specified if you have different Info.plist build settings
74
76
  # for different build configurations
75
77
  build_configuration_name: 'Release')
@@ -105,7 +107,7 @@ Get build number from Info.plist of specific target. Doesn't use agvtool (unlike
105
107
 
106
108
  ```ruby
107
109
  version = get_build_number_from_plist(xcodeproj: "Project.xcodeproj", # optional
108
- target: 'TestTarget', # optional
110
+ target: 'TestTarget', # optional, or `scheme`
109
111
  build_configuration_name: 'Release') # optional, must be specified if you have different Info.plist build settings for different build configurations
110
112
  ```
111
113
 
@@ -115,7 +117,7 @@ version = get_build_number_from_plist(xcodeproj: "Project.xcodeproj", # optional
115
117
  Get a path to target's Info.plist
116
118
  ```ruby
117
119
  get_info_plist_path(xcodeproj: 'Test.xcodeproj', # optional
118
- target: 'TestTarget', # optional
120
+ target: 'TestTarget', # optional, or `scheme`
119
121
  # optional, must be specified if you have different Info.plist build settings
120
122
  # for different build configurations
121
123
  build_configuration_name: 'Release')
@@ -42,9 +42,8 @@ module Fastlane
42
42
  env_name: "FL_APPSTORE_VERSION_NUMBER_BUNDLE_ID",
43
43
  description: "Bundle ID of the application",
44
44
  optional: true,
45
- conflicting_options: [:xcodeproj, :target, :build_configuration_name],
45
+ conflicting_options: [:xcodeproj, :target, :scheme, :build_configuration_name],
46
46
  is_string: true),
47
-
48
47
  FastlaneCore::ConfigItem.new(key: :xcodeproj,
49
48
  env_name: "FL_VERSION_NUMBER_PROJECT",
50
49
  description: "optional, you must specify the path to your main Xcode project if it is not in the project root directory",
@@ -57,8 +56,13 @@ module Fastlane
57
56
  FastlaneCore::ConfigItem.new(key: :target,
58
57
  env_name: "FL_VERSION_NUMBER_TARGET",
59
58
  optional: true,
60
- conflicting_options: [:bundle_id],
59
+ conflicting_options: [:bundle_id, :scheme],
61
60
  description: "Specify a specific target if you have multiple per project, optional"),
61
+ FastlaneCore::ConfigItem.new(key: :scheme,
62
+ env_name: "FL_VERSION_NUMBER_SCHEME",
63
+ optional: true,
64
+ conflicting_options: [:bundle_id, :target],
65
+ description: "Specify a specific scheme if you have multiple per project, optional"),
62
66
  FastlaneCore::ConfigItem.new(key: :build_configuration_name,
63
67
  optional: true,
64
68
  conflicting_options: [:bundle_id],
@@ -5,9 +5,7 @@ module Fastlane
5
5
  if Helper.test?
6
6
  plist = "/tmp/fastlane/tests/fastlane/Info.plist"
7
7
  else
8
- plist = GetInfoPlistPathAction.run(xcodeproj: params[:xcodeproj],
9
- target: params[:target],
10
- build_configuration_name: params[:build_configuration_name])
8
+ plist = GetInfoPlistPathAction.run(params)
11
9
  end
12
10
 
13
11
  version_number = GetInfoPlistValueAction.run(path: plist, key: 'CFBundleVersion')
@@ -42,7 +40,13 @@ module Fastlane
42
40
  FastlaneCore::ConfigItem.new(key: :target,
43
41
  env_name: "FL_BUILD_NUMBER_TARGET",
44
42
  optional: true,
43
+ conflicting_options: [:scheme],
45
44
  description: "Specify a specific target if you have multiple per project, optional"),
45
+ FastlaneCore::ConfigItem.new(key: :scheme,
46
+ env_name: "FL_BUILD_NUMBER_SCHEME",
47
+ optional: true,
48
+ conflicting_options: [:target],
49
+ description: "Specify a specific scheme if you have multiple per project, optional"),
46
50
  FastlaneCore::ConfigItem.new(key: :build_configuration_name,
47
51
  optional: true,
48
52
  description: "Specify a specific build configuration if you have different Info.plist build settings for each configuration")
@@ -13,18 +13,58 @@ module Fastlane
13
13
  end
14
14
  end
15
15
 
16
- config = {project: params[:xcodeproj], scheme: params[:target], configuration: params[:build_configuration_name]}
17
- project = FastlaneCore::Project.new(config)
18
- project.select_scheme
19
16
 
20
- path = project.build_settings(key: 'INFOPLIST_FILE')
21
- unless (Pathname.new path).absolute?
22
- path = File.join(Pathname.new(project.path).parent.to_path, path)
17
+ if params[:target] then
18
+ path = find_path_using_target(params)
19
+ else
20
+ path = find_path_using_scheme(params)
21
+ end
22
+ path
23
+ end
24
+
25
+ def self.find_path_using_target(params)
26
+ project = Xcodeproj::Project.open(params[:xcodeproj])
27
+ if params[:target]
28
+ target = project.targets.detect { |t| t.name == params[:target]}
29
+ else
30
+ # firstly we are trying to find modern application target
31
+ target = project.targets.detect do |t|
32
+ t.kind_of?(Xcodeproj::Project::Object::PBXNativeTarget) &&
33
+ t.product_type == 'com.apple.product-type.application'
34
+ end
35
+ target = project.targets[0] if target.nil?
36
+ end
37
+
38
+ if params[:build_configuration_name]
39
+ build_settings = target.build_settings(params[:build_configuration_name])
40
+ plist = build_settings['INFOPLIST_FILE']
41
+ else
42
+ begin
43
+ plist = target.common_resolved_build_setting('INFOPLIST_FILE')
44
+ rescue
45
+ UI.user_error! 'Cannot resolve Info.plist build setting. Maybe you should specify :build_configuration_name?'
46
+ end
23
47
  end
24
48
 
49
+ path = plist.gsub('$(SRCROOT)', project.path.parent.to_path)
50
+ unless (Pathname.new path).absolute?
51
+ path = File.join(project.path.parent.to_path, path)
52
+ end
25
53
  path
26
54
  end
27
55
 
56
+ def self.find_path_using_scheme(params)
57
+ config = {project: params[:xcodeproj], scheme: params[:scheme], configuration: params[:build_configuration_name]}
58
+ project = FastlaneCore::Project.new(config)
59
+ project.select_scheme
60
+
61
+ path = project.build_settings(key: 'INFOPLIST_FILE')
62
+ unless (Pathname.new path).absolute?
63
+ path = File.join(Pathname.new(project.path).parent.to_path, path)
64
+ end
65
+ path
66
+ end
67
+
28
68
  #####################################################
29
69
  # @!group Documentation
30
70
  #####################################################
@@ -52,7 +92,13 @@ module Fastlane
52
92
  FastlaneCore::ConfigItem.new(key: :target,
53
93
  env_name: "FL_INFO_PLIST_TARGET",
54
94
  optional: true,
95
+ conflicting_options: [:scheme],
55
96
  description: "Specify a specific target if you have multiple per project, optional"),
97
+ FastlaneCore::ConfigItem.new(key: :scheme,
98
+ env_name: "FL_INFO_PLIST_SCHEME",
99
+ optional: true,
100
+ conflicting_options: [:target],
101
+ description: "Specify a specific scheme if you have multiple per project, optional"),
56
102
  FastlaneCore::ConfigItem.new(key: :build_configuration_name,
57
103
  optional: true,
58
104
  description: "Specify a specific build configuration if you have different Info.plist build settings for each configuration")
@@ -39,7 +39,7 @@ module Fastlane
39
39
  end
40
40
 
41
41
  def self.is_supported?(platform)
42
- [:ios, :mac].include? platform
42
+ [:ios, :mac, :android].include? platform
43
43
  end
44
44
  end
45
45
  end
@@ -5,9 +5,7 @@ module Fastlane
5
5
  if Helper.test?
6
6
  plist = "/tmp/fastlane/tests/fastlane/Info.plist"
7
7
  else
8
- plist = GetInfoPlistPathAction.run(xcodeproj: params[:xcodeproj],
9
- target: params[:target],
10
- build_configuration_name: params[:build_configuration_name])
8
+ plist = GetInfoPlistPathAction.run(params)
11
9
  end
12
10
 
13
11
  version_number = GetInfoPlistValueAction.run(path: plist, key: 'CFBundleShortVersionString')
@@ -42,7 +40,13 @@ module Fastlane
42
40
  FastlaneCore::ConfigItem.new(key: :target,
43
41
  env_name: "FL_VERSION_NUMBER_TARGET",
44
42
  optional: true,
43
+ conflicting_options: [:scheme],
45
44
  description: "Specify a specific target if you have multiple per project, optional"),
45
+ FastlaneCore::ConfigItem.new(key: :scheme,
46
+ env_name: "FL_VERSION_NUMBER_SCHEME",
47
+ optional: true,
48
+ conflicting_options: [:target],
49
+ description: "Specify a specific scheme if you have multiple per project, optional"),
46
50
  FastlaneCore::ConfigItem.new(key: :build_configuration_name,
47
51
  optional: true,
48
52
  description: "Specify a specific build configuration if you have different Info.plist build settings for each configuration")
@@ -11,9 +11,7 @@ module Fastlane
11
11
  if Helper.test?
12
12
  plist = "/tmp/fastlane/tests/fastlane/Info.plist"
13
13
  else
14
- plist = GetInfoPlistPathAction.run(xcodeproj: params[:xcodeproj],
15
- target: params[:target],
16
- build_configuration_name: params[:build_configuration_name])
14
+ plist = GetInfoPlistPathAction.run(params)
17
15
  end
18
16
 
19
17
  SetInfoPlistValueAction.run(path: plist, key: 'CFBundleVersion', value: next_build_number)
@@ -48,7 +46,13 @@ module Fastlane
48
46
  FastlaneCore::ConfigItem.new(key: :target,
49
47
  env_name: "FL_VERSION_NUMBER_TARGET",
50
48
  optional: true,
49
+ conflicting_options: [:scheme],
51
50
  description: "Specify a specific target if you have multiple per project, optional"),
51
+ FastlaneCore::ConfigItem.new(key: :scheme,
52
+ env_name: "FL_VERSION_NUMBER_SCHEME",
53
+ optional: true,
54
+ conflicting_options: [:target],
55
+ description: "Specify a specific scheme if you have multiple per project, optional"),
52
56
  FastlaneCore::ConfigItem.new(key: :build_configuration_name,
53
57
  optional: true,
54
58
  description: "Specify a specific build configuration if you have different Info.plist build settings for each configuration")
@@ -15,14 +15,14 @@ module Fastlane
15
15
  version_array = current_version.split(".").map(&:to_i)
16
16
  case params[:bump_type]
17
17
  when "patch"
18
- version_array[2] = version_array[2] + 1
18
+ version_array[2] = (version_array[2] ? version_array[2] : 0) + 1
19
19
  next_version_number = version_array.join(".")
20
20
  when "minor"
21
- version_array[1] = version_array[1] + 1
21
+ version_array[1] = (version_array[1] ? version_array[1] : 0) + 1
22
22
  version_array[2] = version_array[2] = 0
23
23
  next_version_number = version_array.join(".")
24
24
  when "major"
25
- version_array[0] = version_array[0] + 1
25
+ version_array[0] = (version_array[0] ? version_array[0] : 0) + 1
26
26
  version_array[1] = version_array[1] = 0
27
27
  version_array[1] = version_array[2] = 0
28
28
  next_version_number = version_array.join(".")
@@ -32,9 +32,7 @@ module Fastlane
32
32
  if Helper.test?
33
33
  plist = "/tmp/fastlane/tests/fastlane/Info.plist"
34
34
  else
35
- plist = GetInfoPlistPathAction.run(xcodeproj: params[:xcodeproj],
36
- target: params[:target],
37
- build_configuration_name: params[:build_configuration_name])
35
+ plist = GetInfoPlistPathAction.run(params)
38
36
  end
39
37
 
40
38
  SetInfoPlistValueAction.run(path: plist, key: 'CFBundleShortVersionString', value: next_version_number)
@@ -69,7 +67,7 @@ module Fastlane
69
67
  env_name: "FL_APPSTORE_VERSION_NUMBER_BUNDLE_ID",
70
68
  description: "Bundle ID of the application",
71
69
  optional: true,
72
- conflicting_options: [:xcodeproj, :target, :build_configuration_name],
70
+ conflicting_options: [:xcodeproj, :target, :build_configuration_name, :scheme],
73
71
  is_string: true),
74
72
  FastlaneCore::ConfigItem.new(key: :xcodeproj,
75
73
  env_name: "FL_VERSION_NUMBER_PROJECT",
@@ -83,8 +81,13 @@ module Fastlane
83
81
  FastlaneCore::ConfigItem.new(key: :target,
84
82
  env_name: "FL_VERSION_NUMBER_TARGET",
85
83
  optional: true,
86
- conflicting_options: [:bundle_id],
84
+ conflicting_options: [:bundle_id, :scheme],
87
85
  description: "Specify a specific target if you have multiple per project, optional"),
86
+ FastlaneCore::ConfigItem.new(key: :scheme,
87
+ env_name: "FL_VERSION_NUMBER_SCHEME",
88
+ optional: true,
89
+ conflicting_options: [:bundle_id, :target],
90
+ description: "Specify a specific scheme if you have multiple per project, optional"),
88
91
  FastlaneCore::ConfigItem.new(key: :build_configuration_name,
89
92
  optional: true,
90
93
  conflicting_options: [:bundle_id],
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Versioning
3
- VERSION = "0.2.6"
3
+ VERSION = "0.2.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-versioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siarhei Fiedartsou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-08 00:00:00.000000000 Z
11
+ date: 2017-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry