Class: Httpotemkin::Client
- Inherits:
-
Object
- Object
- Httpotemkin::Client
- Defined in:
- lib/client.rb
Instance Attribute Summary collapse
-
#err ⇒ Object
readonly
Returns the value of attribute err.
-
#exit_code ⇒ Object
readonly
Returns the value of attribute exit_code.
-
#out ⇒ Object
readonly
Returns the value of attribute out.
Instance Method Summary collapse
- #execute(cmd, working_directory: nil) ⇒ Object
-
#initialize(containers) ⇒ Client
constructor
A new instance of Client.
- #inject_tarball(filename) ⇒ Object
- #install_gem_from_spec(specfile) ⇒ Object
Constructor Details
#initialize(containers) ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/client.rb', line 5 def initialize(containers) @containers = containers end |
Instance Attribute Details
#err ⇒ Object (readonly)
Returns the value of attribute err.
3 4 5 |
# File 'lib/client.rb', line 3 def err @err end |
#exit_code ⇒ Object (readonly)
Returns the value of attribute exit_code.
3 4 5 |
# File 'lib/client.rb', line 3 def exit_code @exit_code end |
#out ⇒ Object (readonly)
Returns the value of attribute out.
3 4 5 |
# File 'lib/client.rb', line 3 def out @out end |
Instance Method Details
#execute(cmd, working_directory: nil) ⇒ Object
9 10 11 |
# File 'lib/client.rb', line 9 def execute(cmd, working_directory: nil) @out, @err, @exit_code = @containers.exec_client(cmd, working_directory: working_directory) end |
#inject_tarball(filename) ⇒ Object
13 14 15 |
# File 'lib/client.rb', line 13 def inject_tarball(filename) Cheetah.run(["cat", filename], ["docker", "cp", "-", "client:/"]) end |
#install_gem_from_spec(specfile) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/client.rb', line 17 def install_gem_from_spec(specfile) Dir.chdir(File.dirname(specfile)) do out = Cheetah.run(["gem", "build", File.basename(specfile)], stdout: :capture) gemfile = out[/File: (.*)\n/, 1] @containers.run_docker(["cp", gemfile, "client:/tmp"]) @containers.run_docker(["exec", "client", "gem", "install", "--local", File.join("/tmp", gemfile)]) end end |