Module: Gears::Metadata

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

Class Method Summary collapse

Class Method Details

.clone(path) ⇒ Object



9
10
11
# File 'lib/robot_sweatshop/gears/metadata.rb', line 9

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

.create_runtime_pathsObject



27
28
29
30
31
32
# File 'lib/robot_sweatshop/gears/metadata.rb', line 27

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



17
18
19
20
21
# File 'lib/robot_sweatshop/gears/metadata.rb', line 17

def self.download(to_path:)
  puts "Downloading metadata from '#{git_repo}'"
  clone to_path
  Announce.success 'Metadata downloaded'
end

.download_and_install(package_name, from_path:) ⇒ Object



34
35
36
37
38
39
# File 'lib/robot_sweatshop/gears/metadata.rb', line 34

def self.download_and_install(package_name, from_path:)
   = "#{from_path}/#{package_name}.yaml"
  fail "#{package_name} not found" unless File.exist? 
   = YAML.load_file 
  Gears::Package.install_from 
end

.git_repoObject



13
14
15
# File 'lib/robot_sweatshop/gears/metadata.rb', line 13

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

.metadata(package_path) ⇒ Object



23
24
25
# File 'lib/robot_sweatshop/gears/metadata.rb', line 23

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