Module: Dapp::Dapp::Deps::Base
- Included in:
- Dapp::Dapp
- Defined in:
- lib/dapp/dapp/deps/base.rb
Constant Summary collapse
- BASE_VERSION =
"0.2.1"
Instance Method Summary collapse
- #base_container ⇒ Object
-
#base_container_name ⇒ Object
FIXME: hashsum(image) or dockersafe().
- #sudo_command(owner: nil, group: nil) ⇒ Object
- #sudo_format_user(user) ⇒ Object
Instance Method Details
#base_container ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dapp/dapp/deps/base.rb', line 11 def base_container @base_container ||= begin is_container_exist = proc{shellout("#{host_docker} inspect #{base_container_name}").exitstatus.zero?} if !is_container_exist.call lock("dappdeps.container.#{base_container_name}", default_timeout: 600) do if !is_container_exist.call log_secondary_process(t(code: 'process.base_container_creating', data: {name: base_container_name}), short: true) do shellout!( ["#{host_docker} create", "--name #{base_container_name}", "--volume /.dapp/deps/base/#{BASE_VERSION} dappdeps/base:#{BASE_VERSION}"].join(' ') ) end end end end base_container_name end end |
#base_container_name ⇒ Object
FIXME: hashsum(image) or dockersafe()
7 8 9 |
# File 'lib/dapp/dapp/deps/base.rb', line 7 def base_container_name # FIXME: hashsum(image) or dockersafe() "dappdeps_base_#{BASE_VERSION}" end |
#sudo_command(owner: nil, group: nil) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/dapp/dapp/deps/base.rb', line 38 def sudo_command(owner: nil, group: nil) sudo = '' if owner || group sudo = "#{sudo_bin} -E " sudo += "-u #{sudo_format_user(owner)} " if owner sudo += "-g #{sudo_format_user(group)} " if group end sudo end |
#sudo_format_user(user) ⇒ Object
48 49 50 |
# File 'lib/dapp/dapp/deps/base.rb', line 48 def sudo_format_user(user) user.to_s.to_i.to_s == user.to_s ? "\\\##{user}" : user end |