Module: Gears::Scripts

Defined in:
lib/robot_sweatshop/gears/scripts.rb

Overview

Installs Gears script packages

Class Method Summary collapse

Class Method Details

.expose(from_path:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/robot_sweatshop/gears/scripts.rb', line 7

def self.expose(from_path:)
  script_name = File.basename from_path
  original_script = File.expand_path "#{from_path}/#{script_name}"
  script_link = File.expand_path "#{scripts_path}/#{script_name}"
  begin
    FileUtils.symlink original_script, script_link
    Announce.success "Symlinked #{script_name}"
  rescue
    Announce.warning "#{script_name} already exists"
  end
end

.scripts_pathObject



19
20
21
22
23
24
# File 'lib/robot_sweatshop/gears/scripts.rb', line 19

def self.scripts_path
  config = File.expand_path '~/.robot_sweatshop/compiled_config.yaml'
  fail 'Please run `sweatshop start` again' unless File.exist? config
  config = YAML.load File.read(config)
  config[:scripts_path]
end