Module: Gears::Binaries
- Defined in:
- lib/robot_sweatshop/gears/binaries.rb
Overview
Installs binary Gears packages
Class Method Summary collapse
- .contains_binary?(package_path) ⇒ Boolean
- .expose(from_path:) ⇒ Object
- .link(package_path) ⇒ Object
- .scripts_path ⇒ Object
Class Method Details
.contains_binary?(package_path) ⇒ Boolean
13 14 15 16 |
# File 'lib/robot_sweatshop/gears/binaries.rb', line 13 def self.contains_binary?(package_path) = Gears. package_path ['type'] == 'binary' end |
.expose(from_path:) ⇒ Object
7 8 9 10 11 |
# File 'lib/robot_sweatshop/gears/binaries.rb', line 7 def self.expose(from_path:) Gears.packages(from_path).each do |package| link package if contains_binary? package end end |
.link(package_path) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/robot_sweatshop/gears/binaries.rb', line 18 def self.link(package_path) binary_name = File.basename package_path original_binary = "#{package_path}/#{binary_name}" binary_link = "#{scripts_path}/#{binary_name}" begin FileUtils.symlink original_binary, binary_link Announce.success "Symlinked #{binary_name}" rescue Announce.warning "#{binary_name} already exists" end end |
.scripts_path ⇒ Object
30 31 32 33 34 35 |
# File 'lib/robot_sweatshop/gears/binaries.rb', line 30 def self.scripts_path config = File. '~/.robot_sweatshop/compiled_config.yaml' Announce.failure 'Please run `sweatshop start` again' unless File.exist? config config = YAML.load File.read(config) config[:scripts_path] end |