fastlane-plugin-get_last_circleci_build_number_bitbucket 0.3.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
+ SHA256:
3
+ metadata.gz: a3864694fb912ce84df57317f75788e37c702b086ff55bfe24227de4b3b0b5e8
4
+ data.tar.gz: b57727a28d6e2107344c9ce715225b59c805571ae5489358340c3dd5e9eebef4
5
+ SHA512:
6
+ metadata.gz: 5e34e3cb1003caaf6d0d5b14433881e0ab33628459cb04d4d5efac7c22acad0c86ae5d10f816743c426f2388ab55efba2668853353412c53d736d3b2617b0f04
7
+ data.tar.gz: c9877d58856b5bbc9d79aa18c14a0d96cecf64ab633d7685ce48eac73a56d9e7ba341df27872a1e56f2c72f0bb2bc6eda9b1e2d2c697be25e05a97788e6b16fa
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Dawid van der Hoven <dawidvdh@gmail.com>
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,54 @@
1
+ # get_last_circleci_build_number_bitbucket plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-get_last_circleci_build_number)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-get_last_circleci_build_number_bitbucket`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin get_last_circleci_build_number_bitbucket
11
+ ```
12
+
13
+ Ensure you have the following enviroment variables set:
14
+
15
+ * `CIRCLECI_TOKEN` - your circleci token you can create one by getting a token from circle ci `Profile > Personal Api Tokens`
16
+ * `CIRCLECI_USER_NAME` - the username which owns the project
17
+ * `CIRCLECI_REPOSITORY` - the name of the repository
18
+
19
+ You should be able to find your repository name and user name on circleci when you enter into a project the url will be `https://app.circleci.com/projects/project-setup/github/dawidvdh/some-project` so in this case `dawidvdh` is my username and `some-project` is my project.
20
+
21
+ ## Usage
22
+
23
+ I typical use it in a project like so:
24
+
25
+ ```
26
+ before_all do |options, params|
27
+ Dotenv.overload '.env'
28
+ build_number = params[:build_number] || ENV["CIRCLE_BUILD_NUM"] || get_last_circleci_build_number
29
+ end
30
+ ```
31
+
32
+ where my `.env` contains `CIRCLECI_TOKEN`, `CIRCLECI_USER_NAME` and `CIRCLECI_REPOSITORY`.
33
+
34
+ ## About get_last_circleci_build_number_bitbucket
35
+
36
+ Makes user of [circleci gem] to fetch the last build number from circleci.
37
+
38
+ ## Issues and Feedback
39
+
40
+ For any other issues and feedback about this plugin, please submit it to this repository.
41
+
42
+ ## Troubleshooting
43
+
44
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
+
46
+ ## Using _fastlane_ Plugins
47
+
48
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
+
50
+ ## About _fastlane_
51
+
52
+ _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).
53
+
54
+ [circleci gem]: https://github.com/mtchavez/circleci
@@ -0,0 +1,93 @@
1
+ require 'fastlane/action'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ module SharedValues
6
+ GET_LAST_CIRCLECI_BUILD_NUMBER_BITBUCKET = :GET_LAST_CIRCLECI_BUILD_NUMBER_BITBUCKET
7
+ end
8
+
9
+ class GetLastCircleciBuildNumberBitbucketAction < Action
10
+ def self.run(params)
11
+ Actions.verify_gem!('circleci')
12
+ require 'circleci'
13
+ configure(params)
14
+ get
15
+ end
16
+
17
+ def self.token(params)
18
+ token = params[:api_token].nil? ? ENV['CIRCLECI_TOKEN'] : params[:api_token]
19
+ CircleCi.configure do |config|
20
+ config.token = token
21
+ end
22
+ token
23
+ end
24
+
25
+ def self.configure(params)
26
+ @token = params[:api_token].nil? ? ENV['CIRCLECI_TOKEN'] : params[:api_token]
27
+ @user = params[:user_name].nil? ? ENV['CIRCLECI_USER_NAME'] : params[:user_name]
28
+ @repository = params[:repository].nil? ? ENV['CIRCLECI_REPOSITORY'] : params[:repository]
29
+
30
+ CircleCi.configure do |config|
31
+ config.token = @token
32
+ end
33
+
34
+ UI.user_error! "Set CIRCLECI_TOKEN" if @token.nil? || @token.empty?
35
+ UI.user_error! "Set CIRCLECI_USER_NAME" if @user.nil? || @user.empty?
36
+ UI.user_error! "Set CIRCLECI_REPOSITORY" if @repository.nil? || @repository.empty?
37
+ UI.message "Access to #{@user}/#{@repository}"
38
+ end
39
+
40
+ def self.get
41
+ project = CircleCi::Project.new @user, @repository, 'bitbucket'
42
+ res = project.recent_builds limit: 1
43
+ build_num = res.body.map do |e|
44
+ e['build_num']
45
+ end
46
+
47
+ Actions.lane_context[SharedValues::GET_LAST_CIRCLECI_BUILD_NUMBER_BITBUCKET] = build_num[0]
48
+ end
49
+
50
+ def self.description
51
+ "fetches the last build number from circleci."
52
+ end
53
+
54
+ def self.authors
55
+ ["Dawid van der Hoven"]
56
+ end
57
+
58
+ def self.output
59
+ [
60
+ ['LAST_CIRCLE_CI_BUILD_NUMBER', 'Last Build Number']
61
+ ]
62
+ end
63
+
64
+ def self.details
65
+ "Fetches that last build number from circleci using the circleci gem, useful for local builds when the project uses the circleci build number as the version build number."
66
+ end
67
+
68
+ def self.available_options
69
+ [
70
+ FastlaneCore::ConfigItem.new(key: :api_token,
71
+ env_name: "CIRCLECI_TOKEN",
72
+ description: "API Token for Circle CI",
73
+ type: String,
74
+ optional: true),
75
+ FastlaneCore::ConfigItem.new(key: :user_name,
76
+ env_name: "CIRCLECI_USER_NAME",
77
+ description: "user name for Circle CI",
78
+ type: String,
79
+ optional: true),
80
+ FastlaneCore::ConfigItem.new(key: :repository,
81
+ env_name: "CIRCLECI_REPOSITORY",
82
+ description: "repository for Circle CI",
83
+ type: String,
84
+ optional: true)
85
+ ]
86
+ end
87
+
88
+ def self.is_supported?(platform)
89
+ [:ios, :mac, :android].include?(platform)
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module GetLastCircleciBuildNumberBitbucket
3
+ VERSION = "0.3.1"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/get_last_circleci_build_number_bitbucket/version'
2
+
3
+ module Fastlane
4
+ module GetLastCircleciBuildNumberBitbucket
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions}/*.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::GetLastCircleciBuildNumberBitbucket.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-get_last_circleci_build_number_bitbucket
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
5
+ platform: ruby
6
+ authors:
7
+ - Dawid van der Hoven
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-07-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: circleci
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
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: bundler
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: rspec
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: rspec_junit_formatter
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: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.49.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.49.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-require_tools
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: fastlane
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 2.142.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 2.142.0
153
+ description:
154
+ email: dawidvdh@gmail.com
155
+ executables: []
156
+ extensions: []
157
+ extra_rdoc_files: []
158
+ files:
159
+ - LICENSE
160
+ - README.md
161
+ - lib/fastlane/plugin/get_last_circleci_build_number_bitbucket.rb
162
+ - lib/fastlane/plugin/get_last_circleci_build_number_bitbucket/actions/get_last_circleci_build_number_bitbucket_action.rb
163
+ - lib/fastlane/plugin/get_last_circleci_build_number_bitbucket/version.rb
164
+ homepage: https://github.com/tgreco/get_last_circleci_build_number_bitbucket
165
+ licenses:
166
+ - MIT
167
+ metadata: {}
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ requirements: []
183
+ rubygems_version: 3.3.3
184
+ signing_key:
185
+ specification_version: 4
186
+ summary: fetches the last build number from circleci for a bitbucket project.
187
+ test_files: []