fastlane-plugin-code_push 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 16e7189e66b0299b46ac2865451cb8f1d2938102
4
+ data.tar.gz: a80936080ebf39c69526b70c028eda05ea3c8350
5
+ SHA512:
6
+ metadata.gz: 1dff86bd5e4feaa0b81d5d8d3d9cf856aa7ccdaa16348569c0ca6a062748b8736e60fcf7955007dfa14e4c72eb5069888634aacbd6b41e28b336aca85c3ccf51
7
+ data.tar.gz: a7446b9ae21623fc2e853f09d762039ddacd64456b72c9fec378a5a9c559fbbdf9619d434872be31fd5699b403a38b0a134af1dec1e75d4ac6c43746e554f554
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Manuel Koch <manuel.koch@ymc.ch>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # CodePush Fastlane Plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-code_push)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-code_push`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin code_push
11
+ ```
12
+
13
+ ## Dependencies
14
+ CodePush CLI :
15
+ http://microsoft.github.io/code-push/
16
+
17
+ ## About plugin
18
+
19
+ Includes "some" CodePush functionalities for local use and build server:
20
+ The functionallity is currently limited to the options described below. The plugin got created out of a specific business need. So if you'd like to have more freedom to specify things like parameters by your needs, create a pull request or ask for it....
21
+
22
+ ### Login action
23
+ https://github.com/Microsoft/code-push/blob/master/cli/README.md#access-keys
24
+
25
+ ```
26
+ code_push_login(access_key: YOURSECRETACCESSKEY)
27
+ ```
28
+ Options:
29
+
30
+ Key | Description | Env Var | Default
31
+ ------------- | ------------- | ------------- | -------------
32
+ access_key | Access Key for CodePush Login | CODE_PUSH_ACCESS_KEY |
33
+ enforce | Enforce logout before login | | false
34
+
35
+ "enforce" is usefull if you want to be assure that actions are done by a specfic "user" and not by the may current logged in user. Like in the context of a automatic build process
36
+
37
+ ### Promote action
38
+ https://github.com/Microsoft/code-push/blob/master/cli/README.md#promoting-updates
39
+
40
+ ```
41
+ code_push_promote(app_name: YOURCODEPUSHAPPNAME)
42
+ ```
43
+ Options:
44
+
45
+ Key | Description | Env Var | Default
46
+ ------------- | ------------- | ------------- | -------------
47
+ app_name | CodePush app name for promoting to | FASTLANE_CODE_PUSH_APP_NAME |
48
+ from | sourceDeploymentName | | Staging
49
+ to | destDeploymentName | | Production
50
+ dry_run | Print the command that would be run, and don't run it | | false
51
+
52
+
53
+ ### Release React action
54
+
55
+ https://github.com/Microsoft/code-push/blob/master/cli/README.md#releasing-updates-react-native
56
+
57
+ ```
58
+ code_push_release_react(
59
+ app_name: "YOURAPPNAME",
60
+ target_binary_version: "1.0.5"
61
+ )
62
+ ```
63
+
64
+ Key | Description | Env Var | Default
65
+ ------------- | ------------- | ------------- | -------------
66
+ app_name | CodePush app name for releasing | FASTLANE_CODE_PUSH_APP_NAME |
67
+ platform | Platform for releasing to | | android
68
+ deployment | Deployment name for releasing to | | Staging
69
+ target_binary_version | Target binary version for example 1.0.1 | |
70
+ mandatory | manadtory update or not | | true
71
+ description | Release description for CodePush | | no description for release
72
+ dry_run | Print the command that would be run, and don't run it | | false
73
+ ## Example
74
+
75
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
76
+
77
+ ## Run tests for this plugin
78
+
79
+ To run both the tests, and code style validation, run
80
+
81
+ ```
82
+ rake
83
+ ```
84
+
85
+ To automatically fix many of the styling issues, use
86
+ ```
87
+ rubocop -a
88
+ ```
89
+
90
+ ## Issues and Feedback
91
+
92
+ For any other issues and feedback about this plugin, please submit it to this repository.
93
+
94
+ ## Troubleshooting
95
+
96
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
97
+
98
+ ## Using `fastlane` Plugins
99
+
100
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
101
+
102
+ ## About `fastlane`
103
+
104
+ `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/code_push/version'
2
+
3
+ module Fastlane
4
+ module CodePush
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::CodePush.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,56 @@
1
+ module Fastlane
2
+ module Actions
3
+ class CodePushLoginAction < Action
4
+ def self.run(params)
5
+ if params[:enforce] == true
6
+ Helper::CodePushLoginHelper.log_out
7
+ end
8
+ if Helper::CodePushLoginHelper.is_logged_in == false
9
+ if params[:access_key].instance_of?(String)
10
+ Helper::CodePushLoginHelper.log_in(params[:access_key])
11
+ else
12
+ UI.user_error!("Provide parameter :access_key String")
13
+ end
14
+ else
15
+ UI.important "Login skipped !!! You were allready logged in. Logout first "
16
+ end
17
+ end
18
+
19
+ def self.description
20
+ "CodePush login with accessKey"
21
+ end
22
+
23
+ def self.authors
24
+ ["Manuel Koch"]
25
+ end
26
+
27
+ def self.return_value
28
+ # If your method provides a return value, you can describe here what it does
29
+ end
30
+
31
+ def self.details
32
+ # Optional:
33
+ "Generall CodePush login functionality for fastlane with optional enforced relogin"
34
+ end
35
+
36
+ def self.available_options
37
+ [
38
+ FastlaneCore::ConfigItem.new(key: :access_key,
39
+ env_name: "CODE_PUSH_ACCESS_KEY",
40
+ type: String,
41
+ optional: false,
42
+ description: "Access Key for CodePush Login"),
43
+ FastlaneCore::ConfigItem.new(key: :enforce,
44
+ type: TrueClass,
45
+ optional: true,
46
+ default_value: false,
47
+ description: "Enforce logout before login")
48
+ ]
49
+ end
50
+
51
+ def self.is_supported?(platform)
52
+ true
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,57 @@
1
+ module Fastlane
2
+ module Actions
3
+ class CodePushPromoteAction < Action
4
+ def self.run(params)
5
+ command = "code-push promote #{params[:app_name]} #{params[:from]} #{params[:to]}"
6
+ if params[:dry_run]
7
+ UI.message("Dry run!".red + " Would have run: " + command + "\n")
8
+ else
9
+ sh(command.to_s)
10
+ end
11
+ end
12
+
13
+ def self.description
14
+ "CodePush promote"
15
+ end
16
+
17
+ def self.authors
18
+ ["Manuel Koch"]
19
+ end
20
+
21
+ def self.return_value
22
+ end
23
+
24
+ def self.details
25
+ "CodePush promote functionality"
26
+ end
27
+
28
+ def self.available_options
29
+ [
30
+ FastlaneCore::ConfigItem.new(key: :app_name,
31
+ env_name: "FASTLANE_CODE_PUSH_APP_NAME",
32
+ type: String,
33
+ optional: false,
34
+ description: "CodePush app name for promoting to"),
35
+ FastlaneCore::ConfigItem.new(key: :from,
36
+ type: String,
37
+ optional: true,
38
+ default_value: "Staging",
39
+ description: "sourceDeploymentName"),
40
+ FastlaneCore::ConfigItem.new(key: :to,
41
+ type: String,
42
+ optional: true,
43
+ default_value: "Production",
44
+ description: "destDeploymentName"),
45
+ FastlaneCore::ConfigItem.new(key: :dry_run,
46
+ description: "Print the command that would be run, and don't run it",
47
+ is_string: false,
48
+ default_value: false)
49
+ ]
50
+ end
51
+
52
+ def self.is_supported?(platform)
53
+ true
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,80 @@
1
+ module Fastlane
2
+ module Actions
3
+ class CodePushReleaseReactAction < Action
4
+ def self.run(params)
5
+ command = "code-push release-react #{params[:app_name]} #{params[:platform]} -d #{params[:deployment]} "\
6
+ "--des \"#{params[:description]}\" "
7
+ if params[:mandatory]
8
+ command += "-m "
9
+ end
10
+ if params[:target_binary_version]
11
+ command += "-t #{params[:target_binary_version]} "
12
+ end
13
+ if params[:dry_run]
14
+ UI.message("Dry run!".red + " Would have run: " + command + "\n")
15
+ else
16
+ sh(command.to_s)
17
+ end
18
+ end
19
+
20
+ def self.description
21
+ "CodePush release-react functionality for fastlane"
22
+ end
23
+
24
+ def self.authors
25
+ ["Manuel Koch"]
26
+ end
27
+
28
+ def self.return_value
29
+ # If your method provides a return value, you can describe here what it does
30
+ end
31
+
32
+ def self.details
33
+ # Optional:
34
+ "Fastlane Cli Wrapper for CodePush's release-react command"
35
+ end
36
+
37
+ def self.available_options
38
+ [
39
+ FastlaneCore::ConfigItem.new(key: :app_name,
40
+ env_name: "FASTLANE_CODE_PUSH_APP_NAME",
41
+ type: String,
42
+ optional: false,
43
+ description: "CodePush app name for releasing"),
44
+ FastlaneCore::ConfigItem.new(key: :platform,
45
+ type: String,
46
+ optional: true,
47
+ default_value: "android",
48
+ description: "Platform for releasing to"),
49
+ FastlaneCore::ConfigItem.new(key: :deployment,
50
+ type: String,
51
+ optional: true,
52
+ default_value: "Staging",
53
+ description: "Deployment name for releasing to"),
54
+ FastlaneCore::ConfigItem.new(key: :target_binary_version,
55
+ is_string: false,
56
+ optional: true,
57
+ description: "Target binary version for example 1.0.1"),
58
+ FastlaneCore::ConfigItem.new(key: :mandatory,
59
+ is_string: false,
60
+ default_value: true,
61
+ optional: true,
62
+ description: "mandatory update or not"),
63
+ FastlaneCore::ConfigItem.new(key: :description,
64
+ type: String,
65
+ optional: true,
66
+ default_value: "no description for release",
67
+ description: "Release description for CodePush"),
68
+ FastlaneCore::ConfigItem.new(key: :dry_run,
69
+ description: "Print the command that would be run, and don't run it",
70
+ is_string: false,
71
+ default_value: false)
72
+ ]
73
+ end
74
+
75
+ def self.is_supported?(platform)
76
+ true
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,26 @@
1
+ module Fastlane
2
+ module Helper
3
+ class CodePushLoginHelper
4
+ def self.log_in(access_key)
5
+ Action.sh("code-push login --accessKey #{access_key}", false)
6
+ rescue
7
+ UI.user_error!("something went wrong during login with access key #{access_key}")
8
+ end
9
+
10
+ def self.log_out
11
+ Action.sh("code-push logout")
12
+ rescue
13
+ end
14
+
15
+ def self.is_logged_in
16
+ value = true
17
+ begin
18
+ Action.sh("code-push whoami")
19
+ rescue
20
+ value = false
21
+ end
22
+ value
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module CodePush
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-code_push
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Manuel Koch
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-03-16 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: 2.18.3
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 2.18.3
97
+ description:
98
+ email: manuel.koch@ymc.ch
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - LICENSE
104
+ - README.md
105
+ - lib/fastlane/plugin/code_push.rb
106
+ - lib/fastlane/plugin/code_push/actions/code_push_login_action.rb
107
+ - lib/fastlane/plugin/code_push/actions/code_push_promote_action.rb
108
+ - lib/fastlane/plugin/code_push/actions/code_push_release_react_action.rb
109
+ - lib/fastlane/plugin/code_push/helper/code_push_login_helper.rb
110
+ - lib/fastlane/plugin/code_push/version.rb
111
+ homepage: https://github.com/manuelkch/fastlane-plugin-code_push
112
+ licenses:
113
+ - MIT
114
+ metadata: {}
115
+ post_install_message:
116
+ rdoc_options: []
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ requirements: []
130
+ rubyforge_project:
131
+ rubygems_version: 2.6.6
132
+ signing_key:
133
+ specification_version: 4
134
+ summary: CodePush functionality for fastlane
135
+ test_files: []