Module: Gears

Defined in:
lib/robot_sweatshop/gears/base.rb,
lib/robot_sweatshop/gears/binaries.rb,
lib/robot_sweatshop/gears/services.rb,
lib/robot_sweatshop/gears/dependencies.rb

Overview

Provides information and downloading of Gears packages

Defined Under Namespace

Modules: Binaries, Dependencies, Services

Class Method Summary collapse

Class Method Details

.clone_packages(path) ⇒ Object



6
7
8
# File 'lib/robot_sweatshop/gears/base.rb', line 6

def self.clone_packages(path)
  Git.clone git_repo, File.basename(path), path: File.dirname(path)
end

.create_runtime_pathsObject



29
30
31
32
33
34
# File 'lib/robot_sweatshop/gears/base.rb', line 29

def self.create_runtime_paths
  config_path = File.expand_path '~/.robot_sweatshop/compiled_config.yaml'
  config = YAML.load_file config_path
  FileUtils.mkpath config[:logfile_path]
  FileUtils.mkpath config[:pidfile_path]
end

.download(to_path:) ⇒ Object



14
15
16
17
18
# File 'lib/robot_sweatshop/gears/base.rb', line 14

def self.download(to_path:)
  puts "Downloading packages from '#{git_repo}'"
  clone_packages to_path
  Announce.success 'Packages downloaded'
end

.git_repoObject



10
11
12
# File 'lib/robot_sweatshop/gears/base.rb', line 10

def self.git_repo
  'https://github.com/JScott/sweatshop-gears-packages.git'
end

.metadata(package_path) ⇒ Object



25
26
27
# File 'lib/robot_sweatshop/gears/base.rb', line 25

def self.(package_path)
  YAML.load File.read("#{package_path}/metadata.yaml")
end

.packages(gears_path) ⇒ Object



20
21
22
23
# File 'lib/robot_sweatshop/gears/base.rb', line 20

def self.packages(gears_path)
  paths = Dir["#{gears_path}/*"].select { |path| File.directory? path }
  paths.map { |path| File.expand_path path }
end