fastlane-plugin-ionic 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8d179eb835417527f3cc1322e07b8ed8ff4d90d3
4
+ data.tar.gz: 84c7810e7f7a295f64dd3ea752904cd6f4f1da38
5
+ SHA512:
6
+ metadata.gz: fa39f9ffff6e6897bfc10eb1842a4f8ef95479c8089c4475824bb858287761c4c9e88fd126e90c410aff44c5af418924ea5188e4f13b095a7f6f3b3cfbb58342
7
+ data.tar.gz: 73778a6dda9e2e4477d4c02e49d7de8ece739ec52881bd56a9f11e7ac344853cf6b365fd7e3b3083d21736d550661676a89aa0b6bc1a87ffe959f833f2f9e281
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Jan Piotrowski <piotrowski@gmail.com>
4
+ Copyright (c) 2016 Almouro <contact@almouro.com>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # Ionic Plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-ionic)
4
+
5
+ > Work in Progress: This is a simple fork of the fastlane cordova plugin with "cordova" replaced with "ionic". It is not tested yet at all. Soon it will support all options of `ionic cordova build`.
6
+
7
+ ## Features
8
+
9
+ - Build your Ionic project inside a lane
10
+
11
+ ## Getting Started
12
+
13
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-ionic`, add it to your project by running:
14
+
15
+ ```bash
16
+ fastlane add_plugin ionic
17
+ ```
18
+
19
+ Then you can integrate it into your Fastlane setup:
20
+
21
+ ```ruby
22
+ platform :ios do
23
+ desc "Deploy ios app on the appstore"
24
+
25
+ lane :deploy do
26
+ match(type: "appstore")
27
+ ionic(platform: 'ios')
28
+ appstore(ipa: ENV['CORDOVA_IOS_RELEASE_BUILD_PATH'])
29
+ end
30
+ end
31
+
32
+ platform :android do
33
+ desc "Deploy android app on play store"
34
+
35
+ lane :deploy do
36
+ ionic(
37
+ platform: 'android',
38
+ keystore_path: './prod.keystore',
39
+ keystore_alias: 'prod',
40
+ keystore_password: 'password'
41
+ )
42
+ supply(apk: ENV['CORDOVA_ANDROID_RELEASE_BUILD_PATH'])
43
+ end
44
+ end
45
+ ```
46
+
47
+ with an `Appfile` such as
48
+
49
+ ```ruby
50
+ app_identifier "com.awesome.app"
51
+ apple_id "apple@id.com"
52
+ team_id "28323HT"
53
+ ```
54
+
55
+ If using **Crosswalk**, replace `supply(apk: ENV['CORDOVA_ANDROID_RELEASE_BUILD_PATH'])` by:
56
+ ```
57
+ supply(
58
+ apk_paths: [
59
+ 'platforms/android/build/outputs/apk/android-armv7-release.apk',
60
+ 'platforms/android/build/outputs/apk/android-x86-release.apk'
61
+ ],
62
+ )
63
+ ```
64
+
65
+ ## Plugin API
66
+
67
+ To check what's available in the plugin, install it in a project and run at the root of the project:
68
+ ```
69
+ fastlane actions ionic
70
+ ```
71
+
72
+ Which will produce:
73
+
74
+ | Key | Description | Env Var | Default |
75
+ |-----|-------------|---------|---------|
76
+ | **platform** | Platform to build on. <br>Should be either android or ios | CORDOVA_PLATFORM | |
77
+ | **release** | Build for release if true,<br>or for debug if false | CORDOVA_RELEASE | *true* |
78
+ | **device** | Build for device | CORDOVA_DEVICE | *true* |
79
+ | **type** | This will determine what type of build is generated by Xcode. <br>Valid options are development, enterprise, adhoc, and appstore| CORDOVA_IOS_PACKAGE_TYPE | appstore |
80
+ | **team_id** | The development team (Team ID) to use for code signing | CORDOVA_IOS_TEAM_ID | *28323HT* |
81
+ | **provisioning_profile** | GUID of the provisioning profile to be used for signing | CORDOVA_IOS_PROVISIONING_PROFILE | |
82
+ | **keystore_path** | Path to the Keystore for Android | CORDOVA_ANDROID_KEYSTORE_PATH | |
83
+ | **keystore_password** | Android Keystore password | CORDOVA_ANDROID_KEYSTORE_PASSWORD | |
84
+ | **key_password** | Android Key password (default is keystore password) | CORDOVA_ANDROID_KEY_PASSWORD | |
85
+ | **keystore_alias** | Android Keystore alias | CORDOVA_ANDROID_KEYSTORE_ALIAS | |
86
+ | **build_number** | Build Number for iOS and Android | CORDOVA_BUILD_NUMBER | |
87
+ | **browserify** | Specifies whether to browserify build or not | CORDOVA_BROWSERIFY | *false* |
88
+ | **cordova_prepare** | Specifies whether to run `cordova prepare` before building | CORDOVA_PREPARE | *true* |
89
+
90
+ ## Run tests for this plugin
91
+
92
+ To run both the tests, and code style validation, run
93
+
94
+ ```
95
+ rake
96
+ ```
97
+
98
+ To automatically fix many of the styling issues, use
99
+ ```
100
+ rubocop -a
101
+ ```
102
+
103
+ ## Issues and Feedback
104
+
105
+ For any other issues and feedback about this plugin, please submit it to this repository.
106
+
107
+ ## Troubleshooting
108
+
109
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/PluginsTroubleshooting.md) doc in the main `fastlane` repo.
110
+
111
+ ## Using `fastlane` Plugins
112
+
113
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Plugins.md).
114
+
115
+ ## About `fastlane`
116
+
117
+ `fastlane` is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/ionic/version'
2
+
3
+ module Fastlane
4
+ module Ionic
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::Ionic.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,264 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ CORDOVA_IOS_RELEASE_BUILD_PATH = :CORDOVA_IOS_RELEASE_BUILD_PATH
5
+ CORDOVA_ANDROID_RELEASE_BUILD_PATH = :CORDOVA_ANDROID_RELEASE_BUILD_PATH
6
+ end
7
+
8
+ class IonicAction < Action
9
+ ANDROID_ARGS_MAP = {
10
+ keystore_path: 'keystore',
11
+ keystore_password: 'storePassword',
12
+ key_password: 'password',
13
+ keystore_alias: 'alias',
14
+ build_number: 'versionCode'
15
+ }
16
+
17
+ IOS_ARGS_MAP = {
18
+ type: 'packageType',
19
+ team_id: 'developmentTeam',
20
+ provisioning_profile: 'provisioningProfile',
21
+ }
22
+
23
+ def self.get_platform_args(params, args_map)
24
+ platform_args = []
25
+ args_map.each do |action_key, cli_param|
26
+ param_value = params[action_key]
27
+ unless param_value.to_s.empty?
28
+ platform_args << "--#{cli_param}=#{Shellwords.escape(param_value)}"
29
+ end
30
+ end
31
+
32
+ return platform_args.join(' ')
33
+ end
34
+
35
+ def self.get_android_args(params)
36
+ if params[:key_password].empty?
37
+ params[:key_password] = params[:keystore_password]
38
+ end
39
+
40
+ return self.get_platform_args(params, ANDROID_ARGS_MAP)
41
+ end
42
+
43
+ def self.get_ios_args(params)
44
+ app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
45
+
46
+ if params[:provisioning_profile].empty?
47
+ params[:provisioning_profile] = ENV['SIGH_UUID'] || ENV["sigh_#{app_identifier}_#{params[:type].sub("-","")}"]
48
+ end
49
+
50
+ if params[:type] == 'adhoc'
51
+ params[:type] = 'ad-hoc'
52
+ end
53
+ if params[:type] == 'appstore'
54
+ params[:type] = 'app-store'
55
+ end
56
+
57
+ return self.get_platform_args(params, IOS_ARGS_MAP)
58
+ end
59
+
60
+ def self.check_platform(platform)
61
+ if platform && !File.directory?("./platforms/#{platform}")
62
+ sh "ionic cordova platform add #{platform}"
63
+ end
64
+ end
65
+
66
+ def self.get_app_name()
67
+ config = REXML::Document.new(File.open('config.xml'))
68
+ return config.elements['widget'].elements['name'].first.value
69
+ end
70
+
71
+ def self.build(params)
72
+ args = [params[:release] ? '--release' : '--debug']
73
+ args << '--device' if params[:device]
74
+ args << '--browserify' if params[:browserify]
75
+ android_args = self.get_android_args(params) if params[:platform].to_s == 'android'
76
+ ios_args = self.get_ios_args(params) if params[:platform].to_s == 'ios'
77
+
78
+ if params[:cordova_prepare]
79
+ sh "ionic cordova prepare #{params[:platform]} #{args.join(' ')} #{ios_args} -- #{android_args}"
80
+ end
81
+
82
+ if params[:platform].to_s == 'ios' && !params[:build_number].to_s.empty?
83
+ cf_bundle_version = params[:build_number].to_s
84
+ Actions::UpdateInfoPlistAction.run(
85
+ xcodeproj: "./platforms/ios/#{self.get_app_name}.xcodeproj",
86
+ plist_path: "#{self.get_app_name}/#{self.get_app_name}-Info.plist",
87
+ block: lambda { |plist|
88
+ plist['CFBundleVersion'] = cf_bundle_version
89
+ }
90
+ )
91
+ end
92
+
93
+ sh "ionic cordova compile #{params[:platform]} #{args.join(' ')} #{ios_args} -- #{android_args}"
94
+ end
95
+
96
+ def self.set_build_paths(is_release)
97
+ app_name = self.get_app_name()
98
+ build_type = is_release ? 'release' : 'debug'
99
+
100
+ ENV['CORDOVA_ANDROID_RELEASE_BUILD_PATH'] = "./platforms/android/build/outputs/apk/android-#{build_type}.apk"
101
+ ENV['CORDOVA_IOS_RELEASE_BUILD_PATH'] = "./platforms/ios/build/device/#{app_name}.ipa"
102
+ end
103
+
104
+ def self.run(params)
105
+ self.check_platform(params[:platform])
106
+ self.build(params)
107
+ self.set_build_paths(params[:release])
108
+ end
109
+
110
+ #####################################################
111
+ # @!group Documentation
112
+ #####################################################
113
+
114
+ def self.description
115
+ "Build your Ionic app"
116
+ end
117
+
118
+ def self.details
119
+ "Easily integrate your Ionic build into a Fastlane setup"
120
+ end
121
+
122
+ def self.available_options
123
+ [
124
+ FastlaneCore::ConfigItem.new(
125
+ key: :platform,
126
+ env_name: "CORDOVA_PLATFORM",
127
+ description: "Platform to build on. Should be either android or ios",
128
+ is_string: true,
129
+ default_value: '',
130
+ verify_block: proc do |value|
131
+ UI.user_error!("Platform should be either android or ios") unless ['', 'android', 'ios'].include? value
132
+ end
133
+ ),
134
+ FastlaneCore::ConfigItem.new(
135
+ key: :release,
136
+ env_name: "CORDOVA_RELEASE",
137
+ description: "Build for release if true, or for debug if false",
138
+ is_string: false,
139
+ default_value: true,
140
+ verify_block: proc do |value|
141
+ UI.user_error!("Release should be boolean") unless [false, true].include? value
142
+ end
143
+ ),
144
+ FastlaneCore::ConfigItem.new(
145
+ key: :device,
146
+ env_name: "CORDOVA_DEVICE",
147
+ description: "Build for device",
148
+ is_string: false,
149
+ default_value: true,
150
+ verify_block: proc do |value|
151
+ UI.user_error!("Device should be boolean") unless [false, true].include? value
152
+ end
153
+ ),
154
+ FastlaneCore::ConfigItem.new(
155
+ key: :type,
156
+ env_name: "CORDOVA_IOS_PACKAGE_TYPE",
157
+ description: "This will determine what type of build is generated by Xcode. Valid options are development, enterprise, adhoc, and appstore",
158
+ is_string: true,
159
+ default_value: 'appstore',
160
+ verify_block: proc do |value|
161
+ UI.user_error!("Valid options are development, enterprise, adhoc, and appstore.") unless ['development', 'enterprise', 'adhoc', 'appstore', 'ad-hoc', 'app-store'].include? value
162
+ end
163
+ ),
164
+ FastlaneCore::ConfigItem.new(
165
+ key: :team_id,
166
+ env_name: "CORDOVA_IOS_TEAM_ID",
167
+ description: "The development team (Team ID) to use for code signing",
168
+ is_string: true,
169
+ default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
170
+ ),
171
+ FastlaneCore::ConfigItem.new(
172
+ key: :provisioning_profile,
173
+ env_name: "CORDOVA_IOS_PROVISIONING_PROFILE",
174
+ description: "GUID of the provisioning profile to be used for signing",
175
+ is_string: true,
176
+ default_value: ''
177
+ ),
178
+ FastlaneCore::ConfigItem.new(
179
+ key: :keystore_path,
180
+ env_name: "CORDOVA_ANDROID_KEYSTORE_PATH",
181
+ description: "Path to the Keystore for Android",
182
+ is_string: true,
183
+ default_value: ''
184
+ ),
185
+ FastlaneCore::ConfigItem.new(
186
+ key: :keystore_password,
187
+ env_name: "CORDOVA_ANDROID_KEYSTORE_PASSWORD",
188
+ description: "Android Keystore password",
189
+ is_string: true,
190
+ default_value: ''
191
+ ),
192
+ FastlaneCore::ConfigItem.new(
193
+ key: :key_password,
194
+ env_name: "CORDOVA_ANDROID_KEY_PASSWORD",
195
+ description: "Android Key password (default is keystore password)",
196
+ is_string: true,
197
+ default_value: ''
198
+ ),
199
+ FastlaneCore::ConfigItem.new(
200
+ key: :keystore_alias,
201
+ env_name: "CORDOVA_ANDROID_KEYSTORE_ALIAS",
202
+ description: "Android Keystore alias",
203
+ is_string: true,
204
+ default_value: ''
205
+ ),
206
+ FastlaneCore::ConfigItem.new(
207
+ key: :build_number,
208
+ env_name: "CORDOVA_BUILD_NUMBER",
209
+ description: "Build Number for iOS",
210
+ optional: true,
211
+ is_string: false,
212
+ ),
213
+ FastlaneCore::ConfigItem.new(
214
+ key: :browserify,
215
+ env_name: "CORDOVA_BROWSERIFY",
216
+ description: "Specifies whether to browserify build or not",
217
+ default_value: false,
218
+ is_string: false
219
+ ),
220
+ FastlaneCore::ConfigItem.new(
221
+ key: :cordova_prepare,
222
+ env_name: "CORDOVA_PREPARE",
223
+ description: "Specifies whether to run `ionic cordova prepare` before building",
224
+ default_value: true,
225
+ is_string: false
226
+ )
227
+ ]
228
+ end
229
+
230
+ def self.output
231
+ [
232
+ ['CORDOVA_ANDROID_RELEASE_BUILD_PATH', 'Path to the signed release APK if it was generated'],
233
+ ['CORDOVA_IOS_RELEASE_BUILD_PATH', 'Path to the signed release IPA if it was generated']
234
+ ]
235
+ end
236
+
237
+ def self.authors
238
+ ['almouro']
239
+ end
240
+
241
+ def self.is_supported?(platform)
242
+ true
243
+ end
244
+
245
+ def self.example_code
246
+ [
247
+ "ionic(
248
+ platform: 'ios'
249
+ )",
250
+ "ionic(
251
+ platform: 'android',
252
+ keystore_path: './staging.keystore',
253
+ keystore_alias: 'alias_name',
254
+ keystore_password: 'store_password'
255
+ )"
256
+ ]
257
+ end
258
+
259
+ def self.category
260
+ :building
261
+ end
262
+ end
263
+ end
264
+ end
@@ -0,0 +1,12 @@
1
+ module Fastlane
2
+ module Helper
3
+ class IonicHelper
4
+ # class methods that you define here become available in your action
5
+ # as `Helper::IonicHelper.your_method`
6
+ #
7
+ def self.show_message
8
+ UI.message("Hello from the ionic plugin helper!")
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module Ionic
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-ionic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jan Piotrowski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-10-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
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'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: fastlane
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 1.111.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 1.111.0
97
+ description:
98
+ email: piotrowski+rubygems@gmail.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - LICENSE
104
+ - README.md
105
+ - lib/fastlane/plugin/ionic.rb
106
+ - lib/fastlane/plugin/ionic/actions/ionic_action.rb
107
+ - lib/fastlane/plugin/ionic/helper/ionic_helper.rb
108
+ - lib/fastlane/plugin/ionic/version.rb
109
+ homepage: https://github.com/janpio/fastlane-plugin-ionic
110
+ licenses:
111
+ - MIT
112
+ metadata: {}
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.6.13
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: Build your Ionic app
133
+ test_files: []