Class: CiToolkit::BitriseEnv
- Inherits:
-
Object
- Object
- CiToolkit::BitriseEnv
- Defined in:
- lib/ci_toolkit/bitrise_env.rb
Overview
Bitrise constants noinspection RubyTooManyInstanceVariablesInspection
Instance Attribute Summary collapse
-
#app_slug ⇒ Object
readonly
Returns the value of attribute app_slug.
-
#app_url ⇒ Object
readonly
Returns the value of attribute app_url.
-
#build_number ⇒ Object
readonly
Returns the value of attribute build_number.
-
#build_url ⇒ Object
readonly
Returns the value of attribute build_url.
-
#git_branch ⇒ Object
readonly
Returns the value of attribute git_branch.
-
#git_commit ⇒ Object
readonly
Returns the value of attribute git_commit.
-
#pull_request_number ⇒ Object
readonly
Returns the value of attribute pull_request_number.
-
#repository_slug ⇒ Object
readonly
Returns the value of attribute repository_slug.
Instance Method Summary collapse
- #build_from_cron_job? ⇒ Boolean
- #build_from_pr? ⇒ Boolean
-
#initialize(options = { build_number: ENV.fetch("BITRISE_BUILD_NUMBER", nil), build_url: ENV.fetch("BITRISE_BUILD_URL", nil), pull_request_number: ENV.fetch("BITRISE_PULL_REQUEST", nil), build_from_cron_job: !ENV["BITRISE_SCHEDULED_BUILD"].nil?, repository_owner: ENV["BITRISEIO_GIT_REPOSITORY_OWNER"] || "crvshlab", repository_slug: ENV.fetch("BITRISEIO_GIT_REPOSITORY_SLUG", nil), app_url: ENV.fetch("BITRISE_APP_URL", nil), app_slug: ENV.fetch("BITRISE_APP_SLUG", nil), git_branch: ENV.fetch("BITRISE_GIT_BRANCH", nil), git_commit: ENV.fetch("BITRISE_GIT_COMMIT", nil), api_token: ENV.fetch("BITRISE_TOKEN", nil) }) ⇒ BitriseEnv
constructor
A new instance of BitriseEnv.
- #repository_path ⇒ Object
Constructor Details
#initialize(options = { build_number: ENV.fetch("BITRISE_BUILD_NUMBER", nil), build_url: ENV.fetch("BITRISE_BUILD_URL", nil), pull_request_number: ENV.fetch("BITRISE_PULL_REQUEST", nil), build_from_cron_job: !ENV["BITRISE_SCHEDULED_BUILD"].nil?, repository_owner: ENV["BITRISEIO_GIT_REPOSITORY_OWNER"] || "crvshlab", repository_slug: ENV.fetch("BITRISEIO_GIT_REPOSITORY_SLUG", nil), app_url: ENV.fetch("BITRISE_APP_URL", nil), app_slug: ENV.fetch("BITRISE_APP_SLUG", nil), git_branch: ENV.fetch("BITRISE_GIT_BRANCH", nil), git_commit: ENV.fetch("BITRISE_GIT_COMMIT", nil), api_token: ENV.fetch("BITRISE_TOKEN", nil) }) ⇒ BitriseEnv
Returns a new instance of BitriseEnv.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 15 def initialize( = { build_number: ENV.fetch("BITRISE_BUILD_NUMBER", nil), build_url: ENV.fetch("BITRISE_BUILD_URL", nil), pull_request_number: ENV.fetch("BITRISE_PULL_REQUEST", nil), build_from_cron_job: !ENV["BITRISE_SCHEDULED_BUILD"].nil?, repository_owner: ENV["BITRISEIO_GIT_REPOSITORY_OWNER"] || "crvshlab", repository_slug: ENV.fetch("BITRISEIO_GIT_REPOSITORY_SLUG", nil), app_url: ENV.fetch("BITRISE_APP_URL", nil), app_slug: ENV.fetch("BITRISE_APP_SLUG", nil), git_branch: ENV.fetch("BITRISE_GIT_BRANCH", nil), git_commit: ENV.fetch("BITRISE_GIT_COMMIT", nil), api_token: ENV.fetch("BITRISE_TOKEN", nil) }) @build_number = [:build_number] @build_url = [:build_url] @pull_request_number = [:pull_request_number] @build_from_cron_job = [:build_from_cron_job] @repository_owner = [:repository_owner] @repository_slug = [:repository_slug] @app_url = [:app_url] @app_slug = [:app_slug] @git_branch = [:git_branch] @git_commit = [:git_commit] end |
Instance Attribute Details
#app_slug ⇒ Object (readonly)
Returns the value of attribute app_slug.
7 8 9 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 7 def app_slug @app_slug end |
#app_url ⇒ Object (readonly)
Returns the value of attribute app_url.
7 8 9 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 7 def app_url @app_url end |
#build_number ⇒ Object (readonly)
Returns the value of attribute build_number.
7 8 9 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 7 def build_number @build_number end |
#build_url ⇒ Object (readonly)
Returns the value of attribute build_url.
7 8 9 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 7 def build_url @build_url end |
#git_branch ⇒ Object (readonly)
Returns the value of attribute git_branch.
7 8 9 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 7 def git_branch @git_branch end |
#git_commit ⇒ Object (readonly)
Returns the value of attribute git_commit.
7 8 9 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 7 def git_commit @git_commit end |
#pull_request_number ⇒ Object (readonly)
Returns the value of attribute pull_request_number.
7 8 9 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 7 def pull_request_number @pull_request_number end |
#repository_slug ⇒ Object (readonly)
Returns the value of attribute repository_slug.
7 8 9 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 7 def repository_slug @repository_slug end |
Instance Method Details
#build_from_cron_job? ⇒ Boolean
44 45 46 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 44 def build_from_cron_job? @build_from_cron_job end |
#build_from_pr? ⇒ Boolean
40 41 42 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 40 def build_from_pr? !pull_request_number.nil? end |
#repository_path ⇒ Object
48 49 50 |
# File 'lib/ci_toolkit/bitrise_env.rb', line 48 def repository_path "#{@repository_owner}/#{@repository_slug}" end |