fastlane-plugin-settings_bundle 1.0.0 → 1.1.0

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: 1e4de8d118519798ac033619bc8e7d97df7a53ed
4
- data.tar.gz: 7c4b5392ec299f3793407f595f4ebddd7db7a6b0
3
+ metadata.gz: 2aa666c2aa65309f87d1a08e58de02488322ce58
4
+ data.tar.gz: 1531c25fbf01ac9d8b8225ce77f4a5aecabba97a
5
5
  SHA512:
6
- metadata.gz: a8d7cee31bc2f87df9d4887c723b66d07b38eb1db2c7665343ffe1eeb2b692006eeeda7311b4389aa2949d9b9bc00e2db947438df950acc948567d803f8c3f8b
7
- data.tar.gz: 816ac7eaf9b17e5e3e8b65a6f5318260932d73289c5eb487531c968d48fe902a4339b90868ab46262349589f527929c07bf2c6781e3db6f0bd8f94237a87b317
6
+ metadata.gz: b3323b058b91c1af1574ffefd338c4357091ddc59088b6fd9a35cfd3ad2565913189a6fa595029a86eef9c39f034c3aeed75bb81d8e79359b20d44d0f3d4dd6f
7
+ data.tar.gz: 0dbeba2dde57705a7dfba30aaf549bb89ca9a27e1687d552d5176a5cdaef9f639be56b1b367b41f65678b9c259e77eaf0f55c9b7d6e829614bebd3ac6df5b6ae
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # settings_bundle plugin
2
2
 
3
3
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg?style=flat)](https://rubygems.org/gems/fastlane-plugin-settings_bundle)
4
+ [![Gem](https://img.shields.io/gem/v/fastlane-plugin-settings_bundle.svg)](https://rubygems.org/gems/fastlane-plugin-settings_bundle)
4
5
  [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/jdee/settings-bundle/blob/master/LICENSE)
5
- [![CircleCI](https://circleci.com/gh/jdee/settings-bundle.svg?style=svg)](https://circleci.com/gh/jdee/settings-bundle)
6
+ [![CircleCI](https://img.shields.io/circleci/project/github/jdee/settings-bundle.svg)](https://circleci.com/gh/jdee/settings-bundle)
6
7
 
7
8
  ## Getting Started
8
9
 
@@ -83,6 +84,20 @@ update_settings_bundle(
83
84
  key: "CurrentAppVersion",
84
85
  value: ":version (:build)",
85
86
  configuration: "Debug"
87
+ )
88
+ ```
89
+
90
+ #### Target parameter
91
+
92
+ By default, this action takes the settings from the first non-test, non-extension target in
93
+ the project. Use the optional :target parameter to specify a target by name.
94
+ ```ruby
95
+ update_settings_bundle(
96
+ xcodeproj: "MyProject.xcodeproj",
97
+ key: "CurrentAppVersion",
98
+ value: ":version (:build)",
99
+ target: "MyAppTarget"
100
+ )
86
101
  ```
87
102
 
88
103
  ## Example
@@ -90,13 +105,12 @@ update_settings_bundle(
90
105
  See the SettingsBundleExample subdirectory for a sample project that
91
106
  makes use of this action.
92
107
 
93
- First build and run the sample project on a simulator. It should show
108
+ First build and run the sample project on a simulator or device. It should show
94
109
  you the current
95
- version and build number: 1.0.0 (1). This info is taken from the main
96
- bundle.
110
+ version and build number: 1.0.0 (1). This information is taken from the app's Info.plist.
97
111
 
98
- If you visit the Settings app and look at the settings for
99
- SettingsBundleExample, you'll see the same version and build number
112
+ Tap the version number to view the settings for
113
+ SettingsBundleExample in the Settings app. You'll see the same version and build number
100
114
  as well as a blank field for the Build date.
101
115
 
102
116
  Now run Fastlane:
@@ -106,8 +120,8 @@ bundle install
106
120
  bundle exec fastlane test
107
121
  ```
108
122
 
109
- Now run the sample app again. It should display 1.0.0 (2). Visit the
110
- Settings app under the settings for the app to see the update to the
123
+ Run the sample app again. It should display 1.0.0 (2). Tap the version number again
124
+ to see the update to the
111
125
  settings bundle. The Build date field should show the current date.
112
126
 
113
127
  ## Run tests for this plugin
@@ -24,6 +24,7 @@ module Fastlane
24
24
  def self.run(params)
25
25
  key = params[:key]
26
26
  configuration = params[:configuration]
27
+ target_name = params[:target]
27
28
  file = params[:file]
28
29
  value = params[:value]
29
30
 
@@ -32,7 +33,7 @@ module Fastlane
32
33
 
33
34
  helper = Helper::SettingsBundleHelper
34
35
 
35
- settings = helper.settings_from_project project, configuration
36
+ settings = helper.settings_from_project project, configuration, target_name
36
37
 
37
38
  formatted_value = helper.formatted_value value, settings
38
39
 
@@ -89,6 +90,11 @@ module Fastlane
89
90
  description: "The plist file in the Settings.bundle to update",
90
91
  optional: true,
91
92
  default_value: "Root.plist",
93
+ type: String),
94
+ FastlaneCore::ConfigItem.new(key: :file,
95
+ env_name: "SETTINGS_BUNDLE_TARGET",
96
+ description: "An optional target name from the project",
97
+ optional: true,
92
98
  type: String)
93
99
  ]
94
100
  end
@@ -124,6 +130,14 @@ module Fastlane
124
130
  value: ":version (:build)",
125
131
  configuration: "Debug"
126
132
  )
133
+ EOF,
134
+ <<-EOF
135
+ update_settings_bundle(
136
+ xcodeproj: "MyProject.xcodeproj",
137
+ key: "CurrentAppVersion",
138
+ value: ":version (:build)",
139
+ target: "MyAppTarget"
140
+ )
127
141
  EOF
128
142
  ]
129
143
  end
@@ -45,11 +45,17 @@ module Fastlane
45
45
  #
46
46
  # :project: An open Xcodeproj::Project via Xcodeproj::Project.open, e.g.
47
47
  # :configuration: A valid build configuration in the project
48
- def settings_from_project(project, configuration)
49
- # find the first non-test, non-extension target
50
- # TODO: Make this a :target parameter
51
- target = project.targets.find { |t| !t.test_target_type? && !t.extension_target_type? }
52
- raise "No application target found" if target.nil?
48
+ # :target_name: A valid target name in the project or nil to use the first application target
49
+ def settings_from_project(project, configuration, target_name)
50
+ if target_name
51
+ target = project.targets.find { |t| t.name == target_name }
52
+ raise "Target named \"#{target_name}\" not found" if target.nil?
53
+ else
54
+ # find the first non-test, non-extension target
55
+ # TODO: Make this a :target parameter
56
+ target = project.targets.find { |t| !t.test_target_type? && !t.extension_target_type? }
57
+ raise "No application target found" if target.nil?
58
+ end
53
59
 
54
60
  # find the Info.plist paths for all configurations
55
61
  info_plist_paths = target.resolved_build_setting "INFOPLIST_FILE"
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SettingsBundle
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-settings_bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Dee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-25 00:00:00.000000000 Z
11
+ date: 2017-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plist