Class: Fastlane::Actions::DockerClient
- Inherits:
-
Object
- Object
- Fastlane::Actions::DockerClient
- Defined in:
- lib/fastlane/plugin/docker/actions/docker_client.rb
Instance Method Summary collapse
- #build(repository, path, tag: "latest") ⇒ Object
- #login(username, password, email: nil) ⇒ Object
- #push(repository, tag: nil) ⇒ Object
Instance Method Details
#build(repository, path, tag: "latest") ⇒ Object
4 5 6 7 8 9 |
# File 'lib/fastlane/plugin/docker/actions/docker_client.rb', line 4 def build(repository, path, tag: "latest") result = Actions.sh "docker build --pull -t #{repository.shellescape}:#{tag.shellescape} #{path.shellescape}" # Image ID is the last word of the last line return result.lines.last.split(" ").last end |
#login(username, password, email: nil) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/fastlane/plugin/docker/actions/docker_client.rb', line 11 def login(username, password, email: nil) require 'open3' require 'shellwords' cmd = %W[docker login --username #{username} --password-stdin] cmd << "--email=\"#{email}\"" unless email.nil? Open3.capture2("cat - | " + cmd.shelljoin, stdin_data: password) end |
#push(repository, tag: nil) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/fastlane/plugin/docker/actions/docker_client.rb', line 21 def push(repository, tag: nil) cmd = "docker push #{repository}" cmd << ":#{tag}" unless tag.nil? Actions.sh cmd end |