Module: Dapp::Dapp::OptionTags
- Included in:
- Dapp::Dapp
- Defined in:
- lib/dapp/dapp/option_tags.rb
Instance Method Summary collapse
- #branch_tags ⇒ Object
- #build_tags ⇒ Object
- #ci_tags ⇒ Object
- #commit_tags ⇒ Object
- #git_local_repo ⇒ Object
- #option_tags ⇒ Object
- #simple_tags ⇒ Object
Instance Method Details
#branch_tags ⇒ Object
20 21 22 23 24 |
# File 'lib/dapp/dapp/option_tags.rb', line 20 def return [] unless [:tag_branch] raise Error::Dapp, code: :git_branch_without_name if (branch = git_local_repo.branch) == 'HEAD' [branch] end |
#build_tags ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/dapp/dapp/option_tags.rb', line 32 def return [] unless [:tag_build_id] if ENV['GITLAB_CI'] build_id = ENV['CI_BUILD_ID'] elsif ENV['TRAVIS'] build_id = ENV['TRAVIS_BUILD_NUMBER'] else raise Error::Dapp, code: :ci_environment_required end [build_id] end |
#ci_tags ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/dapp/dapp/option_tags.rb', line 46 def return [] unless [:tag_ci] if ENV['GITLAB_CI'] branch = ENV['CI_BUILD_REF_NAME'] tag = ENV['CI_BUILD_TAG'] elsif ENV['TRAVIS'] branch = ENV['TRAVIS_BRANCH'] tag = ENV['TRAVIS_TAG'] else raise Error::Dapp, code: :ci_environment_required end [branch, tag].compact end |
#commit_tags ⇒ Object
26 27 28 29 30 |
# File 'lib/dapp/dapp/option_tags.rb', line 26 def return [] unless [:tag_commit] commit = git_local_repo.latest_commit [commit] end |
#git_local_repo ⇒ Object
4 5 6 |
# File 'lib/dapp/dapp/option_tags.rb', line 4 def git_local_repo @git_repo ||= ::Dapp::Dimg::GitRepo::Own.new(self) end |
#option_tags ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/dapp/dapp/option_tags.rb', line 8 def @tags ||= begin = + + + + << :latest if .empty? end end |
#simple_tags ⇒ Object
16 17 18 |
# File 'lib/dapp/dapp/option_tags.rb', line 16 def [:tag] end |